protected function get_area_course_legacy($itemid, $filepath, $filename) {
        if (!has_capability('moodle/course:managefiles', $this->context)) {
            return null;
        }

        if ($this->course->id != SITEID and $this->course->legacyfiles != 2) {
            // bad luck, legacy course files not used any more
        }

        if (is_null($itemid)) {
            return $this;
        }

        $fs = get_file_storage();

        $filepath = is_null($filepath) ? '/' : $filepath;
        $filename = is_null($filename) ? '.' : $filename;
        if (!$storedfile = $fs->get_file($this->context->id, 'course', 'legacy', 0, $filepath, $filename)) {
            if ($filepath === '/' and $filename === '.') {
                $storedfile = new virtual_root_file($this->context->id, 'course', 'legacy', 0);
            } else {
                // not found
                return null;
            }
        }

        return new file_info_area_course_legacy($this->browser, $this->context, $storedfile);
    }
protected function get_area_course_legacy($itemid, $filepath, $filename) {
        if (!has_capability('moodle/course:managefiles', $this->context)) {
            return null;
        }

        if ($this->course->id != SITEID and $this->course->legacyfiles != 2) {
            // bad luck, legacy course files not used any more
        }

        if (is_null($itemid)) {
            return $this;
        }

        $fs = get_file_storage();

        $filepath = is_null($filepath) ? '/' : $filepath;
        $filename = is_null($filename) ? '.' : $filename;
        if (!$storedfile = $fs->get_file($this->context->id, 'course', 'legacy', 0, $filepath, $filename)) {
            if ($filepath === '/' and $filename === '.') {
                $storedfile = new virtual_root_file($this->context->id, 'course', 'legacy', 0);
            } else {
                // not found
                return null;
            }
        }

        return new file_info_area_course_legacy($this->browser, $this->context, $storedfile);
    }
protected function get_area_course_legacy ( $ itemid , $ filepath , $ filename ) { if ( ! has_capability ( 'moodle/course:managefiles' , $ this -> context ) ) { return null ; } if ( $ this -> course -> id != SITEID and $ this -> course -> legacyfiles != 2 ) { // bad luck, legacy course files not used any more } if ( is_null ( $ itemid ) ) { return $ this ; } $ fs = get_file_storage ( ) ; $ filepath = is_null ( $ filepath ) ? '/' : $ filepath ; $ filename = is_null ( $ filename ) ? '.' : $ filename ; if ( ! $ storedfile = $ fs -> get_file ( $ this -> context -> id , 'course' , 'legacy' , 0 , $ filepath , $ filename ) ) { if ( $ filepath === '/' and $ filename === '.' ) { $ storedfile = new virtual_root_file ( $ this -> context -> id , 'course' , 'legacy' , 0 ) ; } else { // not found return null ; } } return new file_info_area_course_legacy ( $ this -> browser , $ this -> context , $ storedfile ) ; }
Gets a stored file for the course legacy filearea directory

@param int $itemid item ID
@param string $filepath file path
@param string $filename file name
@return file_info|null file_info instance or null if not found or access not allowed
Gets a stored file for the course legacy filearea directory