Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/user/filesedit.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 
00026 require('../config.php');
00027 require_once("$CFG->dirroot/user/filesedit_form.php");
00028 require_once("$CFG->dirroot/repository/lib.php");
00029 
00030 require_login();
00031 if (isguestuser()) {
00032     die();
00033 }
00034 
00035 $returnurl = optional_param('returnurl', '', PARAM_URL);
00036 
00037 if (empty($returnurl)) {
00038     if (!empty($_SERVER["HTTP_REFERER"])) {
00039         $returnurl = $_SERVER["HTTP_REFERER"];
00040     } else {
00041         $returnurl = new moodle_url('/user/files.php');
00042     }
00043 }
00044 
00045 $context = get_context_instance(CONTEXT_USER, $USER->id);
00046 require_capability('moodle/user:manageownfiles', $context);
00047 
00048 $title = get_string('myfiles');
00049 $struser = get_string('user');
00050 
00051 $PAGE->set_url('/user/files.php');
00052 $PAGE->set_context($context);
00053 $PAGE->set_title($title);
00054 $PAGE->set_heading($title);
00055 $PAGE->set_pagelayout('mydashboard');
00056 $PAGE->set_pagetype('user-files');
00057 
00058 $data = new stdClass();
00059 $data->returnurl = $returnurl;
00060 $options = array('subdirs'=>1, 'maxbytes'=>$CFG->userquota, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL);
00061 file_prepare_standard_filemanager($data, 'files', $options, $context, 'user', 'private', 0);
00062 
00063 $mform = new user_filesedit_form(null, array('data'=>$data, 'options'=>$options));
00064 
00065 if ($mform->is_cancelled()) {
00066     redirect($returnurl);
00067 } else if ($formdata = $mform->get_data()) {
00068     $formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'user', 'private', 0);
00069     redirect($returnurl);
00070 }
00071 
00072 echo $OUTPUT->header();
00073 echo $OUTPUT->box_start('generalbox');
00074 $mform->display();
00075 echo $OUTPUT->box_end();
00076 echo $OUTPUT->footer();
 All Data Structures Namespaces Files Functions Variables Enumerations