[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * This file contains the generic moodleform bridge for the backup user interface 20 * as well as the individual forms that relate to the different stages the user 21 * interface can exist within. 22 * 23 * @package moodlecore 24 * @copyright 2010 Sam Hemelryk 25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 */ 27 28 defined('MOODLE_INTERNAL') || die(); 29 30 /** 31 * Backup moodleform bridge 32 * 33 * Ahhh the mighty moodleform bridge! Strong enough to take the weight of 682 full 34 * grown african swallows all of whom have been carring coconuts for several days. 35 * EWWWWW!!!!!!!!!!!!!!!!!!!!!!!! 36 * 37 * @copyright 2010 Sam Hemelryk 38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 39 */ 40 abstract class backup_moodleform extends base_moodleform { 41 /** 42 * Creates the form 43 * 44 * @param backup_ui_stage $uistage 45 * @param moodle_url|string $action 46 * @param mixed $customdata 47 * @param string $method get|post 48 * @param string $target 49 * @param array $attributes 50 * @param bool $editable 51 */ 52 public function __construct(backup_ui_stage $uistage, $action = null, $customdata = null, $method = 'post', $target = '', $attributes = null, $editable = true) { 53 parent::__construct($uistage, $action, $customdata, $method, $target, $attributes, $editable); 54 } 55 } 56 /** 57 * Initial backup user interface stage moodleform. 58 * 59 * Nothing to override we only need it defined so that moodleform doesn't get confused 60 * between stages. 61 */ 62 class backup_initial_form extends backup_moodleform {} 63 /** 64 * Schema backup user interface stage moodleform. 65 * 66 * Nothing to override we only need it defined so that moodleform doesn't get confused 67 * between stages. 68 */ 69 class backup_schema_form extends backup_moodleform {} 70 /** 71 * Confirmation backup user interface stage moodleform. 72 * 73 * Nothing to override we only need it defined so that moodleform doesn't get confused 74 * between stages. 75 */ 76 class backup_confirmation_form extends backup_moodleform { 77 78 public function definition_after_data() { 79 parent::definition_after_data(); 80 $this->_form->addRule('setting_root_filename', get_string('errorfilenamerequired', 'backup'), 'required'); 81 $this->_form->setType('setting_root_filename', PARAM_FILE); 82 } 83 84 public function validation($data, $files) { 85 $errors = parent::validation($data, $files); 86 87 if (!array_key_exists('setting_root_filename', $errors)) { 88 if (trim($data['setting_root_filename']) == '') { 89 $errors['setting_root_filename'] = get_string('errorfilenamerequired', 'backup'); 90 } else if (!preg_match('#\.mbz$#i', $data['setting_root_filename'])) { 91 $errors['setting_root_filename'] = get_string('errorfilenamemustbezip', 'backup'); 92 } 93 } 94 95 return $errors; 96 } 97 98 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |