[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Atto text editor manage files plugin form. 19 * 20 * @package atto_managefiles 21 * @copyright 2014 Frédéric Massart 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 require_once($CFG->libdir."/formslib.php"); 28 29 /** 30 * Form allowing to edit files in one draft area. 31 * 32 * No buttons are necessary since the draft area files are saved immediately using AJAX. 33 * 34 * @package atto_managefiles 35 * @copyright 2014 Frédéric Massart 36 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 37 */ 38 class atto_managefiles_manage_form extends moodleform { 39 40 function definition() { 41 global $PAGE, $USER; 42 $mform = $this->_form; 43 44 $mform->setDisableShortforms(true); 45 46 $itemid = $this->_customdata['draftitemid']; 47 $elementid = $this->_customdata['elementid']; 48 $options = $this->_customdata['options']; 49 $files = $this->_customdata['files']; 50 51 $mform->addElement('header', 'filemanagerhdr', get_string('filemanager', 'atto_managefiles')); 52 53 $mform->addElement('hidden', 'itemid'); 54 $mform->setType('itemid', PARAM_INT); 55 $mform->addElement('hidden', 'maxbytes'); 56 $mform->setType('maxbytes', PARAM_INT); 57 $mform->addElement('hidden', 'subdirs'); 58 $mform->setType('subdirs', PARAM_INT); 59 $mform->addElement('hidden', 'accepted_types'); 60 $mform->setType('accepted_types', PARAM_RAW); 61 $mform->addElement('hidden', 'return_types'); 62 $mform->setType('return_types', PARAM_INT); 63 $mform->addElement('hidden', 'context'); 64 $mform->setType('context', PARAM_INT); 65 $mform->addElement('hidden', 'areamaxbytes'); 66 $mform->setType('areamaxbytes', PARAM_INT); 67 $mform->addElement('hidden', 'elementid'); 68 $mform->setType('elementid', PARAM_TEXT); 69 70 $mform->addElement('filemanager', 'files_filemanager', '', null, $options); 71 72 $mform->addElement('header', 'missingfileshdr', get_string('missingfiles', 'atto_managefiles')); 73 $mform->addElement('static', '', '', 74 html_writer::tag('div', 75 html_writer::tag('div', get_string('hasmissingfiles', 'atto_managefiles')) . 76 html_writer::tag('div', '', array('class' => 'missing-files') 77 ), 78 array('class' => 'file-status')) 79 ); 80 81 $mform->addElement('header', 'deletefileshdr', get_string('unusedfilesheader', 'atto_managefiles')); 82 $mform->addElement('static', '', '', 83 html_writer::tag('div', get_string('unusedfilesdesc', 'atto_managefiles'))); 84 85 foreach ($files as $hash => $file) { 86 $mform->addElement('checkbox', 'deletefile[' . $hash . ']', '', $file, array('data-filename' => $file)); 87 $mform->setType('deletefile[' . $hash . ']', PARAM_INT); 88 } 89 90 $mform->addElement('submit', 'delete', get_string('deleteselected', 'atto_managefiles')); 91 92 $PAGE->requires->yui_module('moodle-atto_managefiles-usedfiles', 'M.atto_managefiles.usedfiles.init', 93 array(array( 94 'files' => array_flip($files), 95 'usercontext' => context_user::instance($USER->id)->id, 96 'itemid' => $itemid, 97 'elementid' => $elementid, 98 ))); 99 100 $this->set_data(array( 101 'files_filemanager' => $itemid, 102 'itemid' => $itemid, 103 'elementid' => $elementid, 104 'subdirs' => $options['subdirs'], 105 'maxbytes' => $options['maxbytes'], 106 'areamaxbytes' => $options['areamaxbytes'], 107 'accepted_types' => $options['accepted_types'], 108 'return_types' => $options['return_types'], 109 'context' => $options['context']->id, 110 )); 111 } 112 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |