Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/backup/util/ui/backup_moodleform.class.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 
00028 defined('MOODLE_INTERNAL') || die();
00029 
00040 abstract class backup_moodleform extends base_moodleform {
00052     public function __construct(backup_ui_stage $uistage, $action = null, $customdata = null, $method = 'post', $target = '', $attributes = null, $editable = true) {
00053         parent::__construct($uistage, $action, $customdata, $method, $target, $attributes, $editable);
00054     }
00055 }
00062 class backup_initial_form extends backup_moodleform {}
00069 class backup_schema_form extends backup_moodleform {}
00076 class backup_confirmation_form extends backup_moodleform {
00077 
00078     public function definition_after_data() {
00079         parent::definition_after_data();
00080         $this->_form->addRule('setting_root_filename', get_string('errorfilenamerequired', 'backup'), 'required');
00081         $this->_form->setType('setting_root_filename', PARAM_FILE);
00082     }
00083 
00084     public function validation($data, $files) {
00085         $errors = parent::validation($data, $files);
00086 
00087         if (!array_key_exists('setting_root_filename', $errors)) {
00088             if (trim($data['setting_root_filename']) == '') {
00089                 $errors['setting_root_filename'] = get_string('errorfilenamerequired', 'backup');
00090             } else if (!preg_match('#\.mbz$#i', $data['setting_root_filename'])) {
00091                 $errors['setting_root_filename'] = get_string('errorfilenamemustbezip', 'backup');
00092             }
00093         }
00094 
00095         return $errors;
00096     }
00097 
00098 }
 All Data Structures Namespaces Files Functions Variables Enumerations