|
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 00018 00027 class block_private_files extends block_base { 00028 00029 function init() { 00030 $this->title = get_string('myfiles'); 00031 } 00032 00033 function specialization() { 00034 } 00035 00036 function applicable_formats() { 00037 return array('all' => true); 00038 } 00039 00040 function instance_allow_multiple() { 00041 return false; 00042 } 00043 00044 function get_content() { 00045 global $CFG, $USER, $PAGE, $OUTPUT; 00046 00047 if ($this->content !== NULL) { 00048 return $this->content; 00049 } 00050 if (empty($this->instance)) { 00051 return null; 00052 } 00053 00054 $this->content = new stdClass(); 00055 $this->content->text = ''; 00056 $this->content->footer = ''; 00057 if (isloggedin() && !isguestuser()) { // Show the block 00058 $this->content = new stdClass(); 00059 00060 //TODO: add capability check here! 00061 00062 $renderer = $this->page->get_renderer('block_private_files'); 00063 $this->content->text = $renderer->private_files_tree(); 00064 if (has_capability('moodle/user:manageownfiles', $this->context)) { 00065 $this->content->text .= $OUTPUT->single_button(new moodle_url('/user/filesedit.php', array('returnurl'=>$PAGE->url->out())), get_string('myfilesmanage'), 'get'); 00066 } 00067 $this->content->footer = ''; 00068 00069 } 00070 return $this->content; 00071 } 00072 }