* @return file_info instance or null if not found or access not allowed
*/
private function get_file_info_context_coursecat($context, $component, $filearea, $itemid, $filepath, $filename) {
- global $DB, $CFG;
+ global $DB;
if (!$category = $DB->get_record('course_categories', array('id'=>$context->instanceid))) {
return null;
* @param $filename
*/
public function get_file_info($component, $filearea, $itemid, $filepath, $filename) {
- global $DB;
-
if (!$this->course->visible and !has_capability('moodle/course:viewhiddencourses', $this->context)) {
return null;
}
* @return string
*/
public function get_visible_name() {
- $format = $this->course->format;
+ //$format = $this->course->format;
$sectionsname = get_string("coursesectionsummaries");
return $sectionsname;
* @return string
*/
public function get_visible_name() {
- $format = $this->course->format;
- $sectionsname = get_string('sectionbackup', 'repository');
-
- return $sectionsname;
+ return get_string('sectionbackup', 'repository');
}
/**
protected $areas;
public function __construct($browser, $context, $course, $cm, $modname) {
- global $DB, $CFG;
+ global $CFG;
parent::__construct($browser, $context);
$this->course = $course;
* @param $filename
*/
public function get_file_info($component, $filearea, $itemid, $filepath, $filename) {
- global $USER;
-
if (!is_enrolled($this->context) and !is_viewing($this->context)) {
// no peaking here if not enrolled or inspector
return null;
if (is_null($itemid)) {
// go to parent, we do not use itemids here in private area
- return $this;;
+ return $this;
}
$fs = get_file_storage();
}
protected function get_area_user_profile($itemid, $filepath, $filename) {
- global $USER, $CFG;
+ global $CFG;
if (!has_capability('moodle/user:update', $this->context)) {
// the idea here is that only admins should be able to list/modify files in user profile, the rest has to use profile page
* @return array of file_info instances
*/
public function get_children() {
- global $USER, $CFG;
-
$children = array();
if ($child = $this->get_area_user_private(0, '/', '.')) {
* Create new file from stored file - make sure
* params are valid.
* @param string $newfilename name of new file
- * @param mixed dile id or stored_file of file
+ * @param mixed file id or stored_file of file
* @param int id of author, default $USER->id
* @return file_info new file
*/