mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
86 lines
4.5 KiB
PHP
86 lines
4.5 KiB
PHP
<?php
|
|
require_once ($CFG->libdir.'/formslib.php');
|
|
class data_mod_form extends moodleform_mod {
|
|
|
|
function definition() {
|
|
|
|
global $CFG;
|
|
$mform =& $this->_form;
|
|
$renderer =& $mform->defaultRenderer();
|
|
|
|
//-------------------------------------------------------------------------------
|
|
$mform->addElement('header', 'general', get_string('general', 'form'));
|
|
|
|
$mform->addElement('text', 'name', get_string('name'));
|
|
$mform->setType('name', PARAM_TEXT);
|
|
$mform->addRule('name', null, 'required', null, 'client');
|
|
|
|
$mform->addElement('htmleditor', 'intro', get_string('intro', 'data'));
|
|
$mform->setType('intro', PARAM_RAW);
|
|
$mform->addRule('intro', get_string('required'), 'required', null, 'client');
|
|
|
|
$availablefromgroup=array();
|
|
$availablefromgroup[]=&MoodleQuickForm::createElement('date_selector', 'availablefrom', '');
|
|
$availablefromgroup[]=&MoodleQuickForm::createElement('checkbox', 'availablefromenabled', '', get_string('enable'));
|
|
$mform->addGroup($availablefromgroup, 'availablefromgroup', get_string('availablefromdate', 'data'), ' ', false);
|
|
$mform->disabledIf('availablefromgroup', 'availablefromenabled');
|
|
|
|
$availabletogroup=array();
|
|
$availabletogroup[]=&MoodleQuickForm::createElement('date_selector', 'availableto', '');
|
|
$availabletogroup[]=&MoodleQuickForm::createElement('checkbox', 'availabletoenabled', '', get_string('enable'));
|
|
$mform->addGroup($availabletogroup, 'availabletogroup', get_string('availabletodate', 'data'), ' ', false);
|
|
$mform->disabledIf('availabletogroup', 'availabletoenabled');
|
|
|
|
$viewfromgroup=array();
|
|
$viewfromgroup[]=&MoodleQuickForm::createElement('date_selector', 'viewfrom', '');
|
|
$viewfromgroup[]=&MoodleQuickForm::createElement('checkbox', 'viewfromenabled', '', get_string('enable'));
|
|
$mform->addGroup($viewfromgroup, 'viewfromgroup', get_string('viewfromdate', 'data'), ' ', false);
|
|
$mform->disabledIf('viewfromgroup', 'viewfromenabled');
|
|
|
|
$viewtogroup=array();
|
|
$viewtogroup[]=&MoodleQuickForm::createElement('date_selector', 'viewto', '');
|
|
$viewtogroup[]=&MoodleQuickForm::createElement('checkbox', 'viewtoenabled', '', get_string('enable'));
|
|
$mform->addGroup($viewtogroup, 'viewtogroup', get_string('viewtodate', 'data'), ' ', false);
|
|
$mform->disabledIf('viewtogroup', 'viewtoenabled');
|
|
|
|
|
|
$countoptions= array(0=>get_string('none'))+
|
|
(array_combine(range(1, DATA_MAX_ENTRIES),//keys
|
|
range(1, DATA_MAX_ENTRIES)));//values
|
|
$mform->addElement('select', 'requiredentries', get_string('requiredentries', 'data'), $countoptions);
|
|
$mform->setHelpButton('requiredentries', array('requiredentries', get_string('requiredentries', 'data'), 'data'));
|
|
|
|
$mform->addElement('select', 'requiredentriestoview', get_string('requiredentriestoview', 'data'), $countoptions);
|
|
$mform->setHelpButton('requiredentriestoview', array('requiredentriestoview', get_string('requiredentriestoview', 'data'), 'data'));
|
|
|
|
$mform->addElement('select', 'maxentries', get_string('maxentries', 'data'), $countoptions);
|
|
$mform->setHelpButton('maxentries', array('maxentries', get_string('maxentries', 'data'), 'data'));
|
|
|
|
$ynoptions = array( 0 => get_string('no'), 1 => get_string('yes'));
|
|
$mform->addElement('select', 'comments', get_string('comments', 'data'), $ynoptions);
|
|
$mform->setHelpButton('comments', array('comments', get_string('allowcomments', 'data'), 'data'));
|
|
|
|
$mform->addElement('select', 'approval', get_string('requireapproval', 'data'), $ynoptions);
|
|
$mform->setHelpButton('approval', array('requireapproval', get_string('requireapproval', 'data'), 'data'));
|
|
|
|
$mform->addElement('select', 'numberrssarticles', get_string('numberrssarticles', 'data') , $countoptions);
|
|
|
|
$mform->addElement('checkbox', 'assessed', get_string("allowratings", "data") , get_string('ratingsuse', 'data'));
|
|
|
|
$mform->addElement('modgrade', 'scale', get_string('grade'), false);
|
|
$mform->disabledIf('scale', 'assessed');
|
|
|
|
|
|
$this->standard_coursemodule_elements();
|
|
|
|
$buttonarray=array();
|
|
$buttonarray[] = &MoodleQuickForm::createElement('submit', 'submit', get_string('savechanges'));
|
|
$buttonarray[] = &MoodleQuickForm::createElement('submit', 'cancel', get_string('cancel'));
|
|
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
|
|
$renderer->addStopFieldsetElements('buttonar');
|
|
}
|
|
|
|
|
|
|
|
}
|
|
?>
|