Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/enrol/manual/edit_form.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 
00030 require_once($CFG->libdir.'/formslib.php');
00031 
00032 class enrol_manual_edit_form extends moodleform {
00033 
00034     function definition() {
00035         $mform = $this->_form;
00036 
00037         list($instance, $plugin, $context) = $this->_customdata;
00038 
00039         $mform->addElement('header', 'header', get_string('pluginname', 'enrol_manual'));
00040 
00041         $options = array(ENROL_INSTANCE_ENABLED  => get_string('yes'),
00042                          ENROL_INSTANCE_DISABLED => get_string('no'));
00043         $mform->addElement('select', 'status', get_string('status', 'enrol_manual'), $options);
00044         $mform->addHelpButton('status', 'status', 'enrol_manual');
00045         $mform->setDefault('status', $plugin->get_config('status'));
00046 
00047         $mform->addElement('duration', 'enrolperiod', get_string('defaultperiod', 'enrol_manual'), array('optional' => true, 'defaultunit' => 86400));
00048         $mform->setDefault('enrolperiod', $plugin->get_config('enrolperiod'));
00049         $mform->addHelpButton('enrolperiod', 'defaultperiod', 'enrol_manual');
00050 
00051         if ($instance->id) {
00052             $roles = get_default_enrol_roles($context, $instance->roleid);
00053         } else {
00054             $roles = get_default_enrol_roles($context, $plugin->get_config('roleid'));
00055         }
00056         $mform->addElement('select', 'roleid', get_string('defaultrole', 'role'), $roles);
00057         $mform->setDefault('roleid', $plugin->get_config('roleid'));
00058 
00059         $mform->addElement('hidden', 'courseid');
00060 
00061         $this->add_action_buttons(true, ($instance->id ? null : get_string('addinstance', 'enrol')));
00062 
00063         $this->set_data($instance);
00064     }
00065 }
 All Data Structures Namespaces Files Functions Variables Enumerations