Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/folder/edit.php
Go to the documentation of this file.
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 require('../../config.php');
00028 require_once("$CFG->dirroot/mod/folder/locallib.php");
00029 require_once("$CFG->dirroot/mod/folder/edit_form.php");
00030 require_once("$CFG->dirroot/repository/lib.php");
00031 
00032 $id = required_param('id', PARAM_INT);  // Course module ID
00033 
00034 $cm = get_coursemodule_from_id('folder', $id, 0, false, MUST_EXIST);
00035 $context = get_context_instance(CONTEXT_MODULE, $cm->id, MUST_EXIST);
00036 $folder = $DB->get_record('folder', array('id'=>$cm->instance), '*', MUST_EXIST);
00037 $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
00038 
00039 require_login($course, false, $cm);
00040 require_capability('mod/folder:managefiles', $context);
00041 
00042 add_to_log($course->id, 'folder', 'edit', 'edit.php?id='.$cm->id, $folder->id, $cm->id);
00043 
00044 $PAGE->set_url('/mod/folder/edit.php', array('id' => $cm->id));
00045 $PAGE->set_title($course->shortname.': '.$folder->name);
00046 $PAGE->set_heading($course->fullname);
00047 $PAGE->set_activity_record($folder);
00048 
00049 $data = new stdClass();
00050 $data->id = $cm->id;
00051 $options = array('mainfile'=>true, 'subdirs'=>1, 'maxbytes'=>$CFG->maxbytes, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL);
00052 file_prepare_standard_filemanager($data, 'files', $options, $context, 'mod_folder', 'content', 0);
00053 
00054 $mform = new mod_folder_edit_form(null, array('data'=>$data, 'options'=>$options));
00055 
00056 if ($mform->is_cancelled()) {
00057     redirect(new moodle_url('/mod/folder/view.php', array('id'=>$cm->id)));
00058 
00059 } else if ($formdata = $mform->get_data()) {
00060     $formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'mod_folder', 'content', 0);
00061     redirect(new moodle_url('/mod/folder/view.php', array('id'=>$cm->id)));
00062 }
00063 
00064 echo $OUTPUT->header();
00065 echo $OUTPUT->box_start('generalbox foldertree');
00066 $mform->display();
00067 echo $OUTPUT->box_end();
00068 echo $OUTPUT->footer();
 All Data Structures Namespaces Files Functions Variables Enumerations