Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/blocks/private_files/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 
00026 require('../../config.php');
00027 require_once("$CFG->dirroot/blocks/private_files/edit_form.php");
00028 require_once("$CFG->dirroot/repository/lib.php");
00029 
00030 require_login();
00031 if (isguestuser()) {
00032     die();
00033 }
00034 //TODO: add capability check here!
00035 
00036 $context = get_context_instance(CONTEXT_USER, $USER->id);
00037 $title = get_string('privatefiles', 'block_private_files');
00038 $struser = get_string('user');
00039 
00040 $PAGE->set_url('/blocks/private_files/edit.php');
00041 $PAGE->set_context($context);
00042 $PAGE->set_title($title);
00043 $PAGE->set_heading($title);
00044 $PAGE->set_pagelayout('mydashboard');
00045 $PAGE->set_pagetype('user-private-files');
00046 
00047 $data = new stdClass();
00048 $options = array('subdirs'=>1, 'maxbytes'=>$CFG->userquota, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL);
00049 file_prepare_standard_filemanager($data, 'files', $options, $context, 'user', 'private', 0);
00050 
00051 $mform = new block_private_files_form(null, array('data'=>$data, 'options'=>$options));
00052 
00053 if ($mform->is_cancelled()) {
00054     redirect(new moodle_url('/my/'));
00055 
00056 } else if ($formdata = $mform->get_data()) {
00057     $formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'user', 'private', 0);
00058     redirect(new moodle_url('/my/'));
00059 }
00060 
00061 echo $OUTPUT->header();
00062 echo $OUTPUT->box_start('generalbox');
00063 $mform->display();
00064 echo $OUTPUT->box_end();
00065 echo $OUTPUT->footer();
 All Data Structures Namespaces Files Functions Variables Enumerations