2006-11-09 19:44:20 +00:00
|
|
|
<?php
|
2010-05-13 02:02:05 +00:00
|
|
|
if (!defined('MOODLE_INTERNAL')) {
|
|
|
|
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
|
|
|
}
|
|
|
|
|
2007-06-10 23:20:45 +00:00
|
|
|
require_once ($CFG->dirroot.'/course/moodleform_mod.php');
|
2006-11-24 06:39:15 +00:00
|
|
|
|
2006-12-28 09:32:45 +00:00
|
|
|
class mod_data_mod_form extends moodleform_mod {
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2006-12-13 20:26:11 +00:00
|
|
|
function definition() {
|
2008-06-01 21:36:11 +00:00
|
|
|
global $CFG, $DB;
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2007-08-20 10:52:59 +00:00
|
|
|
$mform =& $this->_form;
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2013-11-12 14:42:23 -02:00
|
|
|
//-------------------------------------------------------------------------------
|
2006-11-09 19:44:20 +00:00
|
|
|
$mform->addElement('header', 'general', get_string('general', 'form'));
|
|
|
|
|
2007-01-11 19:47:08 +00:00
|
|
|
$mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
|
2008-07-26 15:15:25 +00:00
|
|
|
if (!empty($CFG->formatstringstriptags)) {
|
|
|
|
$mform->setType('name', PARAM_TEXT);
|
|
|
|
} else {
|
2010-09-02 18:29:39 +00:00
|
|
|
$mform->setType('name', PARAM_CLEANHTML);
|
2008-07-26 15:15:25 +00:00
|
|
|
}
|
2006-12-13 20:26:11 +00:00
|
|
|
$mform->addRule('name', null, 'required', null, 'client');
|
2013-04-30 17:39:56 +01:00
|
|
|
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2015-03-17 09:28:16 +00:00
|
|
|
$this->standard_intro_elements(get_string('intro', 'data'));
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2013-03-26 12:04:07 +08:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
$mform->addElement('header', 'entrieshdr', get_string('entries', 'data'));
|
2006-12-07 10:39:28 +00:00
|
|
|
|
2013-03-26 12:04:07 +08:00
|
|
|
$mform->addElement('selectyesno', 'approval', get_string('requireapproval', 'data'));
|
|
|
|
$mform->addHelpButton('approval', 'requireapproval', 'data');
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2015-06-25 17:10:34 +02:00
|
|
|
$mform->addElement('selectyesno', 'manageapproved', get_string('manageapproved', 'data'));
|
|
|
|
$mform->addHelpButton('manageapproved', 'manageapproved', 'data');
|
|
|
|
$mform->setDefault('manageapproved', 1);
|
|
|
|
$mform->disabledIf('manageapproved', 'approval', 'eq', 0);
|
|
|
|
|
2013-03-26 12:04:07 +08:00
|
|
|
$mform->addElement('selectyesno', 'comments', get_string('allowcomments', 'data'));
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2007-08-20 10:52:59 +00:00
|
|
|
$countoptions = array(0=>get_string('none'))+
|
2013-03-26 12:04:07 +08:00
|
|
|
(array_combine(range(1, DATA_MAX_ENTRIES), // Keys.
|
|
|
|
range(1, DATA_MAX_ENTRIES))); // Values.
|
2006-11-09 19:44:20 +00:00
|
|
|
$mform->addElement('select', 'requiredentries', get_string('requiredentries', 'data'), $countoptions);
|
MDL-21695 Database module now uses new help strings
AMOS BEGIN
HLP data/exportzip.html,[exportaszip_help,mod_data]
HLP data/fields.html,[newfield_help,mod_data]
HLP data/fieldmappings.html,[fieldmappings_help,mod_data]
HLP data/importcsv.html,[csvimport_help,mod_data]
HLP data/importfromfile.html,[fromfile_help,mod_data]
HLP data/maxentries.html,[maxentries_help,mod_data]
HLP data/requireapproval.html,[requireapproval_help,mod_data]
HLP data/requiredentries.html,[requiredentries_help,mod_data]
HLP data/requiredentriestoview.html,[requiredentriestoview_help,mod_data]
HLP data/savepreset.html,[saveaspreset_help,mod_data]
HLP data/tags.html,[availabletags_help,mod_data]
HLP data/usepreset.html,[usestandard_help,mod_data]
AMOS END
2010-04-30 14:56:41 +00:00
|
|
|
$mform->addHelpButton('requiredentries', 'requiredentries', 'data');
|
2006-11-09 19:44:20 +00:00
|
|
|
|
|
|
|
$mform->addElement('select', 'requiredentriestoview', get_string('requiredentriestoview', 'data'), $countoptions);
|
MDL-21695 Database module now uses new help strings
AMOS BEGIN
HLP data/exportzip.html,[exportaszip_help,mod_data]
HLP data/fields.html,[newfield_help,mod_data]
HLP data/fieldmappings.html,[fieldmappings_help,mod_data]
HLP data/importcsv.html,[csvimport_help,mod_data]
HLP data/importfromfile.html,[fromfile_help,mod_data]
HLP data/maxentries.html,[maxentries_help,mod_data]
HLP data/requireapproval.html,[requireapproval_help,mod_data]
HLP data/requiredentries.html,[requiredentries_help,mod_data]
HLP data/requiredentriestoview.html,[requiredentriestoview_help,mod_data]
HLP data/savepreset.html,[saveaspreset_help,mod_data]
HLP data/tags.html,[availabletags_help,mod_data]
HLP data/usepreset.html,[usestandard_help,mod_data]
AMOS END
2010-04-30 14:56:41 +00:00
|
|
|
$mform->addHelpButton('requiredentriestoview', 'requiredentriestoview', 'data');
|
2006-11-09 19:44:20 +00:00
|
|
|
|
|
|
|
$mform->addElement('select', 'maxentries', get_string('maxentries', 'data'), $countoptions);
|
MDL-21695 Database module now uses new help strings
AMOS BEGIN
HLP data/exportzip.html,[exportaszip_help,mod_data]
HLP data/fields.html,[newfield_help,mod_data]
HLP data/fieldmappings.html,[fieldmappings_help,mod_data]
HLP data/importcsv.html,[csvimport_help,mod_data]
HLP data/importfromfile.html,[fromfile_help,mod_data]
HLP data/maxentries.html,[maxentries_help,mod_data]
HLP data/requireapproval.html,[requireapproval_help,mod_data]
HLP data/requiredentries.html,[requiredentries_help,mod_data]
HLP data/requiredentriestoview.html,[requiredentriestoview_help,mod_data]
HLP data/savepreset.html,[saveaspreset_help,mod_data]
HLP data/tags.html,[availabletags_help,mod_data]
HLP data/usepreset.html,[usestandard_help,mod_data]
AMOS END
2010-04-30 14:56:41 +00:00
|
|
|
$mform->addHelpButton('maxentries', 'maxentries', 'data');
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2013-03-26 12:04:07 +08:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
$mform->addElement('header', 'availibilityhdr', get_string('availability'));
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2013-11-12 14:42:23 -02:00
|
|
|
$mform->addElement('date_time_selector', 'timeavailablefrom', get_string('availablefromdate', 'data'),
|
|
|
|
array('optional' => true));
|
2013-03-26 12:04:07 +08:00
|
|
|
|
2013-11-12 14:42:23 -02:00
|
|
|
$mform->addElement('date_time_selector', 'timeavailableto', get_string('availabletodate', 'data'),
|
|
|
|
array('optional' => true));
|
2013-03-26 12:04:07 +08:00
|
|
|
|
2013-11-12 14:42:23 -02:00
|
|
|
$mform->addElement('date_time_selector', 'timeviewfrom', get_string('viewfromdate', 'data'),
|
|
|
|
array('optional' => true));
|
2013-03-26 12:04:07 +08:00
|
|
|
|
2013-11-12 14:42:23 -02:00
|
|
|
$mform->addElement('date_time_selector', 'timeviewto', get_string('viewtodate', 'data'),
|
|
|
|
array('optional' => true));
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2013-03-26 12:04:07 +08:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
if ($CFG->enablerssfeeds && $CFG->data_enablerssfeeds) {
|
|
|
|
$mform->addElement('header', 'rsshdr', get_string('rss'));
|
2008-01-08 13:40:32 +00:00
|
|
|
$mform->addElement('select', 'rssarticles', get_string('numberrssarticles', 'data') , $countoptions);
|
|
|
|
}
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2010-08-13 08:29:13 +00:00
|
|
|
$this->standard_grading_coursemodule_elements();
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2009-04-21 08:57:20 +00:00
|
|
|
$this->standard_coursemodule_elements();
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2006-12-19 07:03:08 +00:00
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
// buttons
|
|
|
|
$this->add_action_buttons();
|
2006-12-13 20:26:11 +00:00
|
|
|
}
|
2006-11-09 19:44:20 +00:00
|
|
|
|
2007-06-03 19:08:14 +00:00
|
|
|
function data_preprocessing(&$default_values){
|
2010-07-16 06:30:30 +00:00
|
|
|
parent::data_preprocessing($default_values);
|
2007-06-03 19:08:14 +00:00
|
|
|
}
|
2006-11-09 19:44:20 +00:00
|
|
|
|
|
|
|
}
|
2009-11-01 14:55:15 +00:00
|
|
|
|