|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00027 defined('MOODLE_INTERNAL') || die(); 00028 00036 class workshop_file_info_submissions_container extends file_info { 00037 protected $course; 00038 protected $cm; 00039 protected $areas; 00040 protected $filearea; 00041 00042 public function __construct($browser, $course, $cm, $context, $areas, $filearea) { 00043 parent::__construct($browser, $context); 00044 $this->course = $course; 00045 $this->cm = $cm; 00046 $this->areas = $areas; 00047 $this->filearea = $filearea; 00048 } 00049 00056 public function get_params() { 00057 return array('contextid'=>$this->context->id, 00058 'component'=>'mod_workshop', 00059 'filearea' =>$this->filearea, 00060 'itemid' =>null, 00061 'filepath' =>null, 00062 'filename' =>null); 00063 } 00064 00069 public function get_visible_name() { 00070 return $this->areas[$this->filearea]; 00071 } 00072 00077 public function is_writable() { 00078 return false; 00079 } 00080 00085 public function is_directory() { 00086 return true; 00087 } 00088 00093 public function get_children() { 00094 global $DB; 00095 00096 $children = array(); 00097 $itemids = $DB->get_records('files', array('contextid' => $this->context->id, 'component' => 'mod_workshop', 'filearea' => $this->filearea), 00098 'itemid', "DISTINCT itemid"); 00099 foreach ($itemids as $itemid => $unused) { 00100 if ($child = $this->browser->get_file_info($this->context, $this->filearea, $itemid)) { 00101 $children[] = $child; 00102 } 00103 } 00104 return $children; 00105 } 00106 00111 public function get_parent() { 00112 return $this->browser->get_file_info($this->context); 00113 } 00114 }