|
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 require_once('../config.php'); 00019 require_once(dirname(__FILE__) . '/coursefilesedit_form.php'); 00020 require_once($CFG->dirroot . '/repository/lib.php'); 00021 00022 // current context 00023 $contextid = required_param('contextid', PARAM_INT); 00024 $component = 'course'; 00025 $filearea = 'legacy'; 00026 $itemid = 0; 00027 00028 list($context, $course, $cm) = get_context_info_array($contextid); 00029 00030 $url = new moodle_url('/files/coursefilesedit.php', array('contextid'=>$contextid)); 00031 00032 require_login($course); 00033 require_capability('moodle/course:managefiles', $context); 00034 00035 $PAGE->set_url($url); 00036 $heading = get_string('coursefiles') . ': ' . format_string($course->fullname, true, array('context' => $context)); 00037 $strfiles = get_string("files"); 00038 if ($node = $PAGE->settingsnav->find('coursefiles', navigation_node::TYPE_SETTING)) { 00039 $node->make_active(); 00040 } else { 00041 $PAGE->navbar->add($strfiles); 00042 } 00043 $PAGE->set_context($context); 00044 $PAGE->set_title($heading); 00045 $PAGE->set_heading($heading); 00046 $PAGE->set_pagelayout('course'); 00047 00048 $data = new stdClass(); 00049 $options = array('subdirs'=>1, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL); 00050 file_prepare_standard_filemanager($data, 'files', $options, $context, $component, $filearea, $itemid); 00051 $form = new coursefiles_edit_form(null, array('data'=>$data, 'contextid'=>$contextid)); 00052 00053 $returnurl = new moodle_url('/files/index.php', array('contextid'=>$contextid)); 00054 00055 if ($form->is_cancelled()) { 00056 redirect($returnurl); 00057 } 00058 00059 if ($data = $form->get_data()) { 00060 $data = file_postupdate_standard_filemanager($data, 'files', $options, $context, $component, $filearea, $itemid); 00061 redirect($returnurl); 00062 } 00063 00064 echo $OUTPUT->header(); 00065 00066 echo $OUTPUT->container_start(); 00067 $form->display(); 00068 echo $OUTPUT->container_end(); 00069 00070 echo $OUTPUT->footer();