forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-14589 implemented browsing of course section files + fixed bug wh…
…en getting parent dirs of stored files
- Loading branch information
skodak
committed
Feb 16, 2009
1 parent
23a6c9d
commit 3156b8c
Showing
7 changed files
with
159 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php //$Id$ | ||
|
||
/** | ||
* Represents a course category context in the tree navigated by @see{file_browser}. | ||
*/ | ||
class file_info_coursesection extends file_info { | ||
protected $course; | ||
|
||
public function __construct($browser, $context, $course) { | ||
parent::__construct($browser, $context); | ||
$this->course = $course; | ||
} | ||
|
||
public function get_params() { | ||
return array('contextid'=>$this->context->id, | ||
'filearea' =>'course_section', | ||
'itemid' =>null, | ||
'filepath' =>null, | ||
'filename' =>null); | ||
} | ||
|
||
public function get_visible_name() { | ||
$format = $this->course->format; | ||
$sectionsname = get_string("coursesections$format","format_$format"); // TODO: localise | ||
if ($sectionsname === "[[coursesections$format]]") { | ||
$sectionsname = get_string("coursesections$format", 'repository'); // TODO: localise | ||
} | ||
|
||
return $sectionsname; | ||
} | ||
|
||
public function is_writable() { | ||
return false; | ||
} | ||
|
||
public function is_directory() { | ||
return true; | ||
} | ||
|
||
public function get_children() { | ||
global $DB; | ||
|
||
$children = array(); | ||
|
||
$course_sections = $DB->get_records('course_sections', array('course'=>$this->course->id), 'section'); | ||
foreach ($course_sections as $section) { | ||
if ($child = $this->browser->get_file_info($this->context, 'course_section', $section->id)) { | ||
$children[] = $child; | ||
} | ||
} | ||
|
||
return $children; | ||
} | ||
|
||
public function get_parent() { | ||
return $this->browser->get_file_info($this->context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters