mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
improved coding style, removing unused globals
This commit is contained in:
parent
0c3314ff16
commit
08b4939be9
@ -151,7 +151,7 @@ class file_browser {
|
||||
* @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;
|
||||
|
@ -53,8 +53,6 @@ class file_info_context_course extends file_info {
|
||||
* @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;
|
||||
}
|
||||
@ -396,7 +394,7 @@ class file_info_area_course_section extends file_info {
|
||||
* @return string
|
||||
*/
|
||||
public function get_visible_name() {
|
||||
$format = $this->course->format;
|
||||
//$format = $this->course->format;
|
||||
$sectionsname = get_string("coursesectionsummaries");
|
||||
|
||||
return $sectionsname;
|
||||
@ -495,10 +493,7 @@ class file_info_area_backup_section extends file_info {
|
||||
* @return string
|
||||
*/
|
||||
public function get_visible_name() {
|
||||
$format = $this->course->format;
|
||||
$sectionsname = get_string('sectionbackup', 'repository');
|
||||
|
||||
return $sectionsname;
|
||||
return get_string('sectionbackup', 'repository');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ class file_info_context_module extends file_info {
|
||||
protected $areas;
|
||||
|
||||
public function __construct($browser, $context, $course, $cm, $modname) {
|
||||
global $DB, $CFG;
|
||||
global $CFG;
|
||||
|
||||
parent::__construct($browser, $context);
|
||||
$this->course = $course;
|
||||
@ -75,8 +75,6 @@ class file_info_context_module extends file_info {
|
||||
* @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;
|
||||
|
@ -86,7 +86,7 @@ class file_info_context_user extends file_info {
|
||||
|
||||
if (is_null($itemid)) {
|
||||
// go to parent, we do not use itemids here in private area
|
||||
return $this;;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$fs = get_file_storage();
|
||||
@ -111,7 +111,7 @@ class file_info_context_user extends file_info {
|
||||
}
|
||||
|
||||
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
|
||||
@ -229,8 +229,6 @@ class file_info_context_user extends file_info {
|
||||
* @return array of file_info instances
|
||||
*/
|
||||
public function get_children() {
|
||||
global $USER, $CFG;
|
||||
|
||||
$children = array();
|
||||
|
||||
if ($child = $this->get_area_user_private(0, '/', '.')) {
|
||||
|
@ -417,7 +417,7 @@ class file_info_stored extends file_info {
|
||||
* 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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user