class blog_edit_form extends moodleform {
- function definition() {
+ function definition() {
- global $CFG, $COURSE, $USER;
- $mform =& $this->_form;
+ global $CFG, $COURSE, $USER;
+ $mform =& $this->_form;
- $post = $this->_customdata['existing'];
+ $post = $this->_customdata['existing'];
$sitecontext = $this->_customdata['sitecontext'];
// the upload manager is used directly in entry processing, moodleform::save_files() is not used yet
$this->set_upload_manager(new upload_manager('attachment', true, false, $COURSE, false, 0, true, true, false));
$mform->addElement('header', 'general', get_string('general', 'form'));
- $mform->addElement('text', 'subject', get_string('entrytitle', 'blog'), 'size="60"');
- $mform->setType('subject', PARAM_TEXT);
- $mform->addRule('subject', get_string('emptytitle', 'blog'), 'required', null, 'client');
+ $mform->addElement('text', 'subject', get_string('entrytitle', 'blog'), 'size="60"');
+ $mform->setType('subject', PARAM_TEXT);
+ $mform->addRule('subject', get_string('emptytitle', 'blog'), 'required', null, 'client');
- $mform->addElement('htmleditor', 'summary', get_string('entrybody', 'blog'), array('rows'=>25));
- $mform->setType('summary', PARAM_RAW);
- $mform->addRule('summary', get_string('emptybody', 'blog'), 'required', null, 'client');
+ $mform->addElement('htmleditor', 'summary', get_string('entrybody', 'blog'), array('rows'=>25));
+ $mform->setType('summary', PARAM_RAW);
+ $mform->addRule('summary', get_string('emptybody', 'blog'), 'required', null, 'client');
$mform->setHelpButton('summary', array('writing', 'richtext'), false, 'editorhelpbutton');
$mform->addElement('format', 'format', get_string('format'));
$this->add_action_buttons();
$mform->addElement('hidden', 'action');
- $mform->setType('action', PARAM_ACTION);
- $mform->setDefault('action', '');
-
- $mform->addElement('hidden', 'courseid');
- $mform->setType('courseid', PARAM_INT);
-
- $mform->addElement('hidden', 'id');
- $mform->setType('id', PARAM_INT);
- $mform->setDefault('id', 0);
-
- }
-
- /**
- * This function sets up options of otag select element. This is called from definition and also
- * after adding new official tags with the add tag button.
- *
- */
- function otags_select_setup(){
- global $CFG;
- $mform =& $this->_form;
+ $mform->setType('action', PARAM_ACTION);
+ $mform->setDefault('action', '');
+
+ $mform->addElement('hidden', 'courseid');
+ $mform->setType('courseid', PARAM_INT);
+
+ $mform->addElement('hidden', 'id');
+ $mform->setType('id', PARAM_INT);
+ $mform->setDefault('id', 0);
+
+ }
+
+ /**
+ * This function sets up options of otag select element. This is called from definition and also
+ * after adding new official tags with the add tag button.
+ *
+ */
+ function otags_select_setup(){
+ global $CFG;
+ $mform =& $this->_form;
$otagsselect =& $mform->getElement('otags');
$otagsselect->removeOptions();
if ($otags = get_records_sql_menu('SELECT id, text from '.$CFG->prefix.'tags WHERE type=\'official\' ORDER by text ASC')){
$otagsselect->loadArray($otags);
}
- }
+ }
}
?>
class course_import_activities_form_1 extends moodleform {
- function definition() {
+ function definition() {
- global $CFG;
- $mform =& $this->_form;
- $text = $this->_customdata['text'];
- $options = $this->_customdata['options'];
+ global $CFG;
+ $mform =& $this->_form;
+ $text = $this->_customdata['text'];
+ $options = $this->_customdata['options'];
$courseid = $this->_customdata['courseid'];
$mform->addElement('header', 'general', '');//fill in the data depending on page params
- //later using set_data
- $mform->addElement('select', 'fromcourse', $text, $options);
+ //later using set_data
+ $mform->addElement('select', 'fromcourse', $text, $options);
// buttons
$submit_string = get_string('usethiscourse');
$this->add_action_buttons(false, $submit_string);
$mform->addElement('hidden', 'id');
- $mform->setType('id', PARAM_INT);
- $mform->setConstants(array('id'=> $courseid));
+ $mform->setType('id', PARAM_INT);
+ $mform->setConstants(array('id'=> $courseid));
- }
+ }
- function validation($data) {
+ function validation($data) {
return true;
- }
+ }
}
class course_import_activities_form_2 extends moodleform {
- function definition() {
+ function definition() {
- global $CFG;
- $mform =& $this->_form;
- $courseid = $this->_customdata['courseid'];
+ global $CFG;
+ $mform =& $this->_form;
+ $courseid = $this->_customdata['courseid'];
$mform->addElement('header', 'general', '');//fill in the data depending on page params
- //later using set_data
- $mform->addElement('text', 'fromcoursesearch', get_string('searchcourses'));
+ //later using set_data
+ $mform->addElement('text', 'fromcoursesearch', get_string('searchcourses'));
// buttons
$this->add_action_buttons(false, get_string('searchcourses'));
$mform->addElement('hidden', 'id');
- $mform->setType('id', PARAM_INT);
- $mform->setConstants(array('id'=> $courseid));
+ $mform->setType('id', PARAM_INT);
+ $mform->setConstants(array('id'=> $courseid));
- }
+ }
- function validation($data) {
+ function validation($data) {
return true;
- }
+ }
}
?>
class mod_forum_mod_form extends moodleform_mod {
- function definition() {
+ function definition() {
- global $CFG, $FORUM_TYPES, $COURSE;
- $mform =& $this->_form;
+ global $CFG, $FORUM_TYPES, $COURSE;
+ $mform =& $this->_form;
//-------------------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('text', 'name', get_string('forumname', 'forum'), array('size'=>'64'));
- $mform->setType('name', PARAM_TEXT);
- $mform->addRule('name', null, 'required', null, 'client');
+ $mform->setType('name', PARAM_TEXT);
+ $mform->addRule('name', null, 'required', null, 'client');
asort($FORUM_TYPES);
$mform->addElement('select', 'type', get_string('forumtype', 'forum'), $FORUM_TYPES);
- $mform->setHelpButton('type', array('forumtype', get_string('forumtype', 'forum'), 'forum'));
- $mform->setDefault('type', 'general');
+ $mform->setHelpButton('type', array('forumtype', get_string('forumtype', 'forum'), 'forum'));
+ $mform->setDefault('type', 'general');
- $mform->addElement('htmleditor', 'intro', get_string('forumintro', 'forum'));
- $mform->setType('intro', PARAM_RAW);
- $mform->addRule('intro', get_string('required'), 'required', null, 'client');
+ $mform->addElement('htmleditor', 'intro', get_string('forumintro', 'forum'));
+ $mform->setType('intro', PARAM_RAW);
+ $mform->addRule('intro', get_string('required'), 'required', null, 'client');
$mform->setHelpButton('intro', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$options = array();
$options[FORUM_INITIALSUBSCRIBE] = get_string('yesinitially', 'forum');
$options[FORUM_DISALLOWSUBSCRIBE] = get_string('disallowsubscribe','forum');
$mform->addElement('select', 'forcesubscribe', get_string('forcesubscribeq', 'forum'), $options);
- $mform->setHelpButton('forcesubscribe', array('subscription2', get_string('forcesubscribeq', 'forum'), 'forum'));
+ $mform->setHelpButton('forcesubscribe', array('subscription2', get_string('forcesubscribeq', 'forum'), 'forum'));
$options = array();
$options[FORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'forum');
$options[FORUM_TRACKING_OFF] = get_string('trackingoff', 'forum');
$options[FORUM_TRACKING_ON] = get_string('trackingon', 'forum');
$mform->addElement('select', 'trackingtype', get_string('trackingtype', 'forum'), $options);
- $mform->setHelpButton('trackingtype', array('trackingtype', get_string('trackingtype', 'forum'), 'forum'));
+ $mform->setHelpButton('trackingtype', array('trackingtype', get_string('trackingtype', 'forum'), 'forum'));
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
$choices[1] = get_string('uploadnotallowed');
$choices[0] = get_string('courseuploadlimit') . ' ('.display_size($COURSE->maxbytes).')';
$mform->addElement('select', 'maxbytes', get_string('maxattachmentsize', 'forum'), $choices);
- $mform->setHelpButton('maxbytes', array('maxattachmentsize', get_string('maxattachmentsize', 'forum'), 'forum'));
- $mform->setDefault('maxbytes', $CFG->forum_maxbytes);
+ $mform->setHelpButton('maxbytes', array('maxattachmentsize', get_string('maxattachmentsize', 'forum'), 'forum'));
+ $mform->setDefault('maxbytes', $CFG->forum_maxbytes);
if ($CFG->enablerssfeeds && isset($CFG->forum_enablerssfeeds) && $CFG->forum_enablerssfeeds) {
//-------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
$mform->addElement('header', '', get_string('blockafter', 'forum'));
- $options = array();
+ $options = array();
$options[0] = get_string('blockperioddisabled','forum');
$options[60*60*24] = '1 '.get_string('day');
$options[60*60*24*2] = '2 '.get_string('days');
$options[60*60*24*6] = '6 '.get_string('days');
$options[60*60*24*7] = '1 '.get_string('week');
$mform->addElement('select', 'blockperiod', get_string("blockperiod", "forum") , $options);
- $mform->setHelpButton('blockperiod', array('manageposts', get_string('blockperiod', 'forum'),'forum'));
+ $mform->setHelpButton('blockperiod', array('manageposts', get_string('blockperiod', 'forum'),'forum'));
- $mform->addElement('text', 'blockafter', get_string('blockafter', 'forum'));
- $mform->setType('blockafter', PARAM_INT);
- $mform->setDefault('blockafter', '0');
- $mform->addRule('blockafter', null, 'numeric', null, 'client');
- $mform->setHelpButton('blockafter', array('manageposts', get_string('blockafter', 'forum'),'forum'));
- $mform->disabledIf('blockafter', 'blockperiod', 'eq', 0);
+ $mform->addElement('text', 'blockafter', get_string('blockafter', 'forum'));
+ $mform->setType('blockafter', PARAM_INT);
+ $mform->setDefault('blockafter', '0');
+ $mform->addRule('blockafter', null, 'numeric', null, 'client');
+ $mform->setHelpButton('blockafter', array('manageposts', get_string('blockafter', 'forum'),'forum'));
+ $mform->disabledIf('blockafter', 'blockperiod', 'eq', 0);
$mform->addElement('text', 'warnafter', get_string('warnafter', 'forum'));
- $mform->setType('warnafter', PARAM_INT);
- $mform->setDefault('warnafter', '0');
- $mform->addRule('warnafter', null, 'numeric', null, 'client');
- $mform->setHelpButton('warnafter', array('manageposts', get_string('warnafter', 'forum'),'forum'));
- $mform->disabledIf('warnafter', 'blockperiod', 'eq', 0);
+ $mform->setType('warnafter', PARAM_INT);
+ $mform->setDefault('warnafter', '0');
+ $mform->addRule('warnafter', null, 'numeric', null, 'client');
+ $mform->setHelpButton('warnafter', array('manageposts', get_string('warnafter', 'forum'),'forum'));
+ $mform->disabledIf('warnafter', 'blockperiod', 'eq', 0);
//-------------------------------------------------------------------------------
- $this->standard_coursemodule_elements();
+ $this->standard_coursemodule_elements();
//-------------------------------------------------------------------------------
- // buttons
+// buttons
$this->add_action_buttons();
- }
+ }
- function definition_after_data(){
- $mform =& $this->_form;
- $type=&$mform->getElement('type');
+ function definition_after_data(){
+ $mform =& $this->_form;
+ $type=&$mform->getElement('type');
$typevalue=$mform->getElementValue('type');
//we don't want to have these appear as possible selections in the form but
//we want the form to display them if they are set.
$type->setPersistantFreeze(true);
}
- }
- function data_preprocessing($default_values){
- if (isset($default_values['assessed'])){
- $default_values['ratingtime']=($default_values['assessed']
- && $default_values['assesstimestart']
- && $default_values['assesstimefinish'] )?1:0;
- }
- }
-
-
+ }
+ function data_preprocessing($default_values){
+ if (isset($default_values['assessed'])){
+ $default_values['ratingtime']=($default_values['assessed']
+ && $default_values['assesstimestart']
+ && $default_values['assesstimefinish'] )?1:0;
+ }
+ }
}
-?>
\ No newline at end of file
+?>
class mod_forum_post_form extends moodleform {
- function definition() {
+ function definition() {
- global $CFG;
- $mform =& $this->_form;
+ global $CFG;
+ $mform =& $this->_form;
$course = $this->_customdata['course'];
- $coursecontext = $this->_customdata['coursecontext'];
+ $coursecontext = $this->_customdata['coursecontext'];
$modcontext = $this->_customdata['modcontext'];
$forum = $this->_customdata['forum'];
$post = $this->_customdata['post'];
$mform->addElement('header', 'general', '');//fill in the data depending on page params
//later using set_data
- $mform->addElement('text', 'subject', get_string('subject', 'forum'), 'size="48"');
- $mform->setType('subject', PARAM_TEXT);
- $mform->addRule('subject', get_string('required'), 'required', null, 'client');
+ $mform->addElement('text', 'subject', get_string('subject', 'forum'), 'size="48"');
+ $mform->setType('subject', PARAM_TEXT);
+ $mform->addRule('subject', get_string('required'), 'required', null, 'client');
- $mform->addElement('htmleditor', 'message', get_string('message', 'forum'), array('cols'=>50, 'rows'=>30));
- $mform->setType('message', PARAM_RAW);
- $mform->addRule('message', get_string('required'), 'required', null, 'client');
+ $mform->addElement('htmleditor', 'message', get_string('message', 'forum'), array('cols'=>50, 'rows'=>30));
+ $mform->setType('message', PARAM_RAW);
+ $mform->addRule('message', get_string('required'), 'required', null, 'client');
$mform->setHelpButton('message', array('reading', 'writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->addElement('format', 'format', get_string('format'));
- if (isset($forum->id) && forum_is_forcesubscribed($forum->id)) {
+ if (isset($forum->id) && forum_is_forcesubscribed($forum->id)) {
- $mform->addElement('static', 'subscribemessage', get_string('subscription', 'forum'), get_string('everyoneissubscribed', 'forum'));
+ $mform->addElement('static', 'subscribemessage', get_string('subscription', 'forum'), get_string('everyoneissubscribed', 'forum'));
$mform->addElement('hidden', 'subscribe');
$mform->setHelpButton('subscribemessage', array('subscription', get_string('subscription', 'forum'), 'forum'));
- } else if (isset($forum->forcesubscribe)&& $forum->forcesubscribe != FORUM_DISALLOWSUBSCRIBE ||
- has_capability('moodle/course:manageactivities', $coursecontext)) {
- $options = array();
- $options[0] = get_string('subscribestop', 'forum');
- $options[1] = get_string('subscribestart', 'forum');
+ } else if (isset($forum->forcesubscribe)&& $forum->forcesubscribe != FORUM_DISALLOWSUBSCRIBE ||
+ has_capability('moodle/course:manageactivities', $coursecontext)) {
- $mform->addElement('select', 'subscribe', get_string('subscription', 'forum'), $options);
+ $options = array();
+ $options[0] = get_string('subscribestop', 'forum');
+ $options[1] = get_string('subscribestart', 'forum');
+
+ $mform->addElement('select', 'subscribe', get_string('subscription', 'forum'), $options);
$mform->setHelpButton('subscribe', array('subscription', get_string('subscription', 'forum'), 'forum'));
- } else if ($forum->forcesubscribe == FORUM_DISALLOWSUBSCRIBE) {
- $mform->addElement('static', 'subscribemessage', get_string('subscription', 'forum'), get_string('disallowsubscribe', 'forum'));
+ } else if ($forum->forcesubscribe == FORUM_DISALLOWSUBSCRIBE) {
+ $mform->addElement('static', 'subscribemessage', get_string('subscription', 'forum'), get_string('disallowsubscribe', 'forum'));
$mform->addElement('hidden', 'subscribe');
$mform->setHelpButton('subscribemessage', array('subscription', get_string('subscription', 'forum'), 'forum'));
- }
+ }
if ($forum->maxbytes != 1 && has_capability('mod/forum:createattachment', $modcontext)) { // 1 = No attachments at all
$mform->addElement('file', 'attachment', get_string('attachment', 'forum'));
$mform->addElement('checkbox', 'mailnow', get_string('mailnow', 'forum'));
}
- if (!empty($CFG->forum_enabletimedposts) && !$post->parent) {
+ if (!empty($CFG->forum_enabletimedposts) && !$post->parent) {
$mform->addElement('header', '', get_string('displayperiod', 'forum'));
- $mform->addElement('date_selector', 'timestart', get_string('displaystart', 'forum'), array('optional'=>true));
- $mform->setHelpButton('timestart', array('displayperiod', get_string('displayperiod', 'forum'), 'forum'));
+ $mform->addElement('date_selector', 'timestart', get_string('displaystart', 'forum'), array('optional'=>true));
+ $mform->setHelpButton('timestart', array('displayperiod', get_string('displayperiod', 'forum'), 'forum'));
- $mform->addElement('date_selector', 'timeend', get_string('displayend', 'forum'), array('optional'=>true));
- $mform->setHelpButton('timeend', array('displayperiod', get_string('displayperiod', 'forum'), 'forum'));
+ $mform->addElement('date_selector', 'timeend', get_string('displayend', 'forum'), array('optional'=>true));
+ $mform->setHelpButton('timeend', array('displayperiod', get_string('displayperiod', 'forum'), 'forum'));
- } else {
- $mform->addElement('hidden', 'timestart');
- $mform->setType('timestart', PARAM_INT);
- $mform->addElement('hidden', 'timeend');
- $mform->setType('timeend', PARAM_INT);
- $mform->setConstants(array('timestart'=> 0, 'timeend'=>0));
- }
+ } else {
+ $mform->addElement('hidden', 'timestart');
+ $mform->setType('timestart', PARAM_INT);
+ $mform->addElement('hidden', 'timeend');
+ $mform->setType('timeend', PARAM_INT);
+ $mform->setConstants(array('timestart'=> 0, 'timeend'=>0));
+ }
//-------------------------------------------------------------------------------
// buttons
- if (isset($post->edit)) {
- $submit_string = get_string('savechanges');
- } else {
- $submit_string = get_string('posttoforum', 'forum');
- }
+ if (isset($post->edit)) {
+ $submit_string = get_string('savechanges');
+ } else {
+ $submit_string = get_string('posttoforum', 'forum');
+ }
$this->add_action_buttons(false, $submit_string);
- $mform->addElement('hidden', 'course');
- $mform->setType('course', PARAM_INT);
+ $mform->addElement('hidden', 'course');
+ $mform->setType('course', PARAM_INT);
- $mform->addElement('hidden', 'forum');
- $mform->setType('forum', PARAM_INT);
+ $mform->addElement('hidden', 'forum');
+ $mform->setType('forum', PARAM_INT);
- $mform->addElement('hidden', 'discussion');
- $mform->setType('discussion', PARAM_INT);
+ $mform->addElement('hidden', 'discussion');
+ $mform->setType('discussion', PARAM_INT);
- $mform->addElement('hidden', 'parent');
- $mform->setType('parent', PARAM_INT);
+ $mform->addElement('hidden', 'parent');
+ $mform->setType('parent', PARAM_INT);
- $mform->addElement('hidden', 'userid');
- $mform->setType('userid', PARAM_INT);
+ $mform->addElement('hidden', 'userid');
+ $mform->setType('userid', PARAM_INT);
- $mform->addElement('hidden', 'groupid');
- $mform->setType('groupid', PARAM_INT);
+ $mform->addElement('hidden', 'groupid');
+ $mform->setType('groupid', PARAM_INT);
- $mform->addElement('hidden', 'edit');
- $mform->setType('edit', PARAM_INT);
+ $mform->addElement('hidden', 'edit');
+ $mform->setType('edit', PARAM_INT);
- $mform->addElement('hidden', 'reply');
- $mform->setType('reply', PARAM_INT);
+ $mform->addElement('hidden', 'reply');
+ $mform->setType('reply', PARAM_INT);
- }
+ }
- function validation($data) {
- $error = array();
+ function validation($data) {
+ $error = array();
if (($data['timeend']!=0) && ($data['timestart']!=0)
- && $data['timeend'] <= $data['timestart']) {
- $error['timeend'] = get_string('timestartenderror', 'forum');
- }
+ && $data['timeend'] <= $data['timestart']) {
+ $error['timeend'] = get_string('timestartenderror', 'forum');
+ }
return (count($error)==0) ? true : $error;
- }
+ }
}
?>
class mod_glossary_entry_form extends moodleform {
- function definition() {
+ function definition() {
- global $CFG, $COURSE;
- $mform =& $this->_form;
+ global $CFG, $COURSE;
+ $mform =& $this->_form;
- $glossary =& $this->_customdata['glossary'];
- $mode =& $this->_customdata['mode'];
- $cm =& $this->_customdata['cm'];
- $hook =& $this->_customdata['hook'];
- $e =& $this->_customdata['e'];
+ $glossary =& $this->_customdata['glossary'];
+ $mode =& $this->_customdata['mode'];
+ $cm =& $this->_customdata['cm'];
+ $hook =& $this->_customdata['hook'];
+ $e =& $this->_customdata['e'];
//-------------------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('text', 'concept', get_string('concept', 'glossary'));
- $mform->setType('concept', PARAM_TEXT);
- $mform->addRule('concept', null, 'required', null, 'client');
+ $mform->setType('concept', PARAM_TEXT);
+ $mform->addRule('concept', null, 'required', null, 'client');
- $mform->addElement('htmleditor', 'definition', get_string('definition', 'glossary'), array('rows'=>20));
- $mform->setType('definition', PARAM_RAW);
- $mform->addRule('definition', null, 'required', null, 'client');
+ $mform->addElement('htmleditor', 'definition', get_string('definition', 'glossary'), array('rows'=>20));
+ $mform->setType('definition', PARAM_RAW);
+ $mform->addRule('definition', null, 'required', null, 'client');
$mform->setHelpButton('definition', array('writing', 'richtext'), false, 'editorhelpbutton');
- $mform->addElement('format');
+ $mform->addElement('format');
$categories = array();
if ($categories = get_records_menu('glossary_categories', 'glossaryid', $glossary->id, 'name ASC', 'id, name')){
$categoriesEl->setMultiple(true);
$categoriesEl->setSize(5);
- $mform->addElement('textarea', 'aliases', get_string('aliases', 'glossary'), 'rows="2" cols="40"');
- $mform->setType('aliases', PARAM_TEXT);
+ $mform->addElement('textarea', 'aliases', get_string('aliases', 'glossary'), 'rows="2" cols="40"');
+ $mform->setType('aliases', PARAM_TEXT);
$mform->setHelpButton('aliases', array('aliases2', strip_tags(get_string('aliases', 'glossary')), 'glossary'));
$this->set_upload_manager(new upload_manager('attachment', true, false, $COURSE, false, 0, true, true, false));
- $mform->addElement('file', 'attachment', get_string('attachment', 'forum'));
+ $mform->addElement('file', 'attachment', get_string('attachment', 'forum'));
$mform->setHelpButton('attachment', array('attachment', get_string('attachment', 'glossary'), 'glossary'));
if (isset($CFG->glossary_linkentries)) {
//-------------------------------------------------------------------------------
$this->add_action_buttons();
- }
-
- function validation($data){
- global $CFG, $USER;
- $errors = array();
- $e = $this->_customdata['e'];
- $glossary = $this->_customdata['glossary'];
- $context = $this->_customdata['context'];
- $data['concept'] = trim($data['concept']);
+ }
+
+ function validation($data){
+ global $CFG, $USER;
+ $errors = array();
+ $e = $this->_customdata['e'];
+ $glossary = $this->_customdata['glossary'];
+ $context = $this->_customdata['context'];
+ $data['concept'] = trim($data['concept']);
if ($e) {
//We are updating an entry, so we compare current session user with
//existing entry user to avoid some potential problems if secureforms=off
}
}
return $errors;
- }
+ }
}
-?>
\ No newline at end of file
+?>
class mod_glossary_mod_form extends moodleform_mod {
- function definition() {
+ function definition() {
- global $CFG, $COURSE;
- $mform =& $this->_form;
+ global $CFG, $COURSE;
+ $mform =& $this->_form;
//-------------------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
- $mform->setType('name', PARAM_TEXT);
- $mform->addRule('name', null, 'required', null, 'client');
+ $mform->setType('name', PARAM_TEXT);
+ $mform->addRule('name', null, 'required', null, 'client');
- $mform->addElement('htmleditor', 'intro', get_string('description'));
- $mform->setType('intro', PARAM_RAW);
- $mform->addRule('intro', get_string('required'), 'required', null, 'client');
+ $mform->addElement('htmleditor', 'intro', get_string('description'));
+ $mform->setType('intro', PARAM_RAW);
+ $mform->addRule('intro', get_string('required'), 'required', null, 'client');
$mform->setHelpButton('intro', array('writing', 'questions', 'text'), false, 'editorhelpbutton');
$mform->addElement('text', 'entbypage', get_string('entbypage', 'glossary'));
//-------------------------------------------------------------------------------
// buttons
$this->add_action_buttons();
- }
+ }
- function definition_after_data(){
- global $COURSE;
- $mform =& $this->_form;
+ function definition_after_data(){
+ global $COURSE;
+ $mform =& $this->_form;
$mainglossaryel =& $mform->getElement('mainglossary');
$mainglossary = get_record('glossary', 'mainglossary', 1, 'course', $COURSE->id);
if ($mainglossary && ($mainglossary->id != $mform->getElementValue('instance'))){
$mainglossaryel->setPersistantFreeze(false);
}
+ }
- }
- function data_preprocessing($default_values){
+ function data_preprocessing($default_values){
if (isset($default_values['assessed'])){
- $default_values['userating']=($default_values['assessed'])?true:false;
- }
+ $default_values['userating']=($default_values['assessed'])?true:false;
+ }
if (isset($default_values['assessed'])){
- $default_values['ratingtime']=($default_values['assessed']
- && $default_values['assesstimestart']
- && $default_values['assesstimefinish'] )?1:0;
- }
- }
+ $default_values['ratingtime']=($default_values['assessed']
+ && $default_values['assesstimestart']
+ && $default_values['assesstimefinish'] )?1:0;
+ }
+ }
}
-?>
\ No newline at end of file
+?>
class mod_quiz_mod_form extends moodleform_mod {
var $_feedbacks;
- function definition() {
+ function definition() {
- global $COURSE, $CFG, $QUIZ_GRADE_METHOD;
- $mform =& $this->_form;
+ global $COURSE, $CFG, $QUIZ_GRADE_METHOD;
+ $mform =& $this->_form;
//-------------------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
- $mform->setType('name', PARAM_TEXT);
+ $mform->setType('name', PARAM_TEXT);
- $mform->addElement('htmleditor', 'intro', get_string("introduction", "quiz"));
- $mform->setType('intro', PARAM_RAW);
+ $mform->addElement('htmleditor', 'intro', get_string("introduction", "quiz"));
+ $mform->setType('intro', PARAM_RAW);
$mform->setHelpButton('intro', array('richtext', get_string('helprichtext')));
//-------------------------------------------------------------------------------
$mform->addElement('header', 'timinghdr', get_string('timing', 'form'));
$mform->addElement('date_time_selector', 'timeopen', get_string("quizopen", "quiz"), array('optional'=>true));
- $mform->setHelpButton('timeopen', array('timeopen', get_string('quizopens', 'quiz'), 'quiz'));
+ $mform->setHelpButton('timeopen', array('timeopen', get_string('quizopens', 'quiz'), 'quiz'));
$mform->addElement('date_time_selector', 'timeclose', get_string("quizcloses", "quiz"), array('optional'=>true));
- $mform->setHelpButton('timeclose', array('timeopen', get_string('quizcloses', 'quiz'), 'quiz'));
+ $mform->setHelpButton('timeclose', array('timeopen', get_string('quizcloses', 'quiz'), 'quiz'));
$timelimitgrp=array();
$timelimitgrp[] = &$mform->createElement('text', 'timelimit');
$timelimitgrp[] = &$mform->createElement('checkbox', 'timelimitenable', '', get_string('enable'));
$mform->addGroup($timelimitgrp, 'timelimitgrp', get_string("timelimit", "quiz"), array(' '), false);
- $mform->setType('timelimit', PARAM_TEXT);
- $timelimitgrprules = array();
- $timelimitgrprules['timelimit'][] = array(null, 'numeric', null, 'client');
- $mform->addGroupRule('timelimitgrp', $timelimitgrprules);
+ $mform->setType('timelimit', PARAM_TEXT);
+ $timelimitgrprules = array();
+ $timelimitgrprules['timelimit'][] = array(null, 'numeric', null, 'client');
+ $mform->addGroupRule('timelimitgrp', $timelimitgrprules);
$mform->disabledIf('timelimitgrp', 'timelimitenable');
- $mform->setAdvanced('timelimitgrp', $CFG->quiz_fix_timelimit);
- $mform->setHelpButton('timelimitgrp', array("timelimit", get_string("quiztimer","quiz"), "quiz"));
+ $mform->setAdvanced('timelimitgrp', $CFG->quiz_fix_timelimit);
+ $mform->setHelpButton('timelimitgrp', array("timelimit", get_string("quiztimer","quiz"), "quiz"));
$mform->setDefault('timelimit', $CFG->quiz_timelimit);
$timedelayoptions[$seconds] = get_string('numdays', '', $i);
}
$mform->addElement('select', 'delay1', get_string("delay1", "quiz"), $timedelayoptions);
- $mform->setHelpButton('delay1', array("timedelay1", get_string("delay1", "quiz"), "quiz"));
- $mform->setAdvanced('delay1', $CFG->quiz_fix_delay1);
+ $mform->setHelpButton('delay1', array("timedelay1", get_string("delay1", "quiz"), "quiz"));
+ $mform->setAdvanced('delay1', $CFG->quiz_fix_delay1);
$mform->setDefault('delay1', $CFG->quiz_delay1);
$mform->addElement('select', 'delay2', get_string("delay2", "quiz"), $timedelayoptions);
- $mform->setHelpButton('delay2', array("timedelay2", get_string("delay2", "quiz"), "quiz"));
- $mform->setAdvanced('delay2', $CFG->quiz_fix_delay2);
+ $mform->setHelpButton('delay2', array("timedelay2", get_string("delay2", "quiz"), "quiz"));
+ $mform->setAdvanced('delay2', $CFG->quiz_fix_delay2);
$mform->setDefault('delay2', $CFG->quiz_delay2);
//-------------------------------------------------------------------------------
$mform->addElement('header', 'displayhdr', get_string('display', 'form'));
- $perpage = array();
+ $perpage = array();
for ($i = 0; $i <= 50; ++$i) {
$perpage[$i] = $i;
}
$perpage[0] = get_string('allinone', 'quiz');
- $mform->addElement('select', 'questionsperpage', get_string('questionsperpage', 'quiz'), $perpage);
- $mform->setHelpButton('questionsperpage', array('questionsperpage', get_string('questionsperpage', 'quiz'), 'quiz'));
- $mform->setAdvanced('questionsperpage', $CFG->quiz_fix_questionsperpage);
+ $mform->addElement('select', 'questionsperpage', get_string('questionsperpage', 'quiz'), $perpage);
+ $mform->setHelpButton('questionsperpage', array('questionsperpage', get_string('questionsperpage', 'quiz'), 'quiz'));
+ $mform->setAdvanced('questionsperpage', $CFG->quiz_fix_questionsperpage);
$mform->setDefault('questionsperpage', $CFG->quiz_questionsperpage);
- $mform->addElement('selectyesno', 'shufflequestions', get_string("shufflequestions", "quiz"));
- $mform->setHelpButton('shufflequestions', array("shufflequestions", get_string("shufflequestions","quiz"), "quiz"));
- $mform->setAdvanced('shufflequestions', $CFG->quiz_fix_shufflequestions);
+ $mform->addElement('selectyesno', 'shufflequestions', get_string("shufflequestions", "quiz"));
+ $mform->setHelpButton('shufflequestions', array("shufflequestions", get_string("shufflequestions","quiz"), "quiz"));
+ $mform->setAdvanced('shufflequestions', $CFG->quiz_fix_shufflequestions);
$mform->setDefault('shufflequestions', $CFG->quiz_shufflequestions);
- $mform->addElement('selectyesno', 'shuffleanswers', get_string("shufflewithin", "quiz"));
- $mform->setHelpButton('shuffleanswers', array("shufflewithin", get_string("shufflewithin","quiz"), "quiz"));
- $mform->setAdvanced('shuffleanswers', $CFG->quiz_fix_shuffleanswers);
+ $mform->addElement('selectyesno', 'shuffleanswers', get_string("shufflewithin", "quiz"));
+ $mform->setHelpButton('shuffleanswers', array("shufflewithin", get_string("shufflewithin","quiz"), "quiz"));
+ $mform->setAdvanced('shuffleanswers', $CFG->quiz_fix_shuffleanswers);
$mform->setDefault('shuffleanswers', $CFG->quiz_shuffleanswers);
//-------------------------------------------------------------------------------
$mform->addElement('header', 'attemptshdr', get_string('attempts', 'quiz'));
- $attemptoptions = array();
+ $attemptoptions = array();
$attemptoptions[0] = get_string("attemptsunlimited", "quiz");
$attemptoptions[1] = "1 ".moodle_strtolower(get_string("attempt", "quiz"));
for ($i=2;$i<=6;$i++) {
$attemptoptions[$i] = "$i ".moodle_strtolower(get_string("attempts", "quiz"));
}
- $mform->addElement('select', 'attempts', get_string("attemptsallowed", "quiz"), $attemptoptions);
- $mform->setHelpButton('attempts', array("attempts", get_string("attemptsallowed","quiz"), "quiz"));
- $mform->setAdvanced('attempts', $CFG->quiz_fix_attempts);
+ $mform->addElement('select', 'attempts', get_string("attemptsallowed", "quiz"), $attemptoptions);
+ $mform->setHelpButton('attempts', array("attempts", get_string("attemptsallowed","quiz"), "quiz"));
+ $mform->setAdvanced('attempts', $CFG->quiz_fix_attempts);
$mform->setDefault('attempts', $CFG->quiz_attempts);
- $mform->addElement('selectyesno', 'attemptonlast', get_string("eachattemptbuildsonthelast", "quiz"));
- $mform->setHelpButton('attemptonlast', array("repeatattempts", get_string("eachattemptbuildsonthelast", "quiz"), "quiz"));
- $mform->setAdvanced('attemptonlast', $CFG->quiz_fix_attemptonlast);
+ $mform->addElement('selectyesno', 'attemptonlast', get_string("eachattemptbuildsonthelast", "quiz"));
+ $mform->setHelpButton('attemptonlast', array("repeatattempts", get_string("eachattemptbuildsonthelast", "quiz"), "quiz"));
+ $mform->setAdvanced('attemptonlast', $CFG->quiz_fix_attemptonlast);
$mform->setDefault('attemptonlast', $CFG->quiz_attemptonlast);
- $mform->addElement('selectyesno', 'adaptive', get_string("adaptive", "quiz"));
- $mform->setHelpButton('adaptive', array("adaptive", get_string("adaptive","quiz"), "quiz"));
- $mform->setAdvanced('adaptive', $CFG->quiz_fix_adaptive);
- $mform->setDefault('adaptive', $CFG->quiz_optionflags & QUESTION_ADAPTIVE);
+ $mform->addElement('selectyesno', 'adaptive', get_string("adaptive", "quiz"));
+ $mform->setHelpButton('adaptive', array("adaptive", get_string("adaptive","quiz"), "quiz"));
+ $mform->setAdvanced('adaptive', $CFG->quiz_fix_adaptive);
+ $mform->setDefault('adaptive', $CFG->quiz_optionflags & QUESTION_ADAPTIVE);
//-------------------------------------------------------------------------------
$mform->addElement('header', 'gradeshdr', get_string('grades', 'grades'));
- $mform->addElement('select', 'grademethod', get_string("grademethod", "quiz"), $QUIZ_GRADE_METHOD);
- $mform->setHelpButton('grademethod', array("grademethod", get_string("grademethod","quiz"), "quiz"));
- $mform->setAdvanced('grademethod', $CFG->quiz_fix_grademethod);
+ $mform->addElement('select', 'grademethod', get_string("grademethod", "quiz"), $QUIZ_GRADE_METHOD);
+ $mform->setHelpButton('grademethod', array("grademethod", get_string("grademethod","quiz"), "quiz"));
+ $mform->setAdvanced('grademethod', $CFG->quiz_fix_grademethod);
$mform->setDefault('grademethod', $CFG->quiz_grademethod);
- $mform->addElement('selectyesno', 'penaltyscheme', get_string("penaltyscheme", "quiz"));
- $mform->setHelpButton('penaltyscheme', array("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz"));
- $mform->setAdvanced('penaltyscheme', $CFG->quiz_fix_penaltyscheme);
+ $mform->addElement('selectyesno', 'penaltyscheme', get_string("penaltyscheme", "quiz"));
+ $mform->setHelpButton('penaltyscheme', array("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz"));
+ $mform->setAdvanced('penaltyscheme', $CFG->quiz_fix_penaltyscheme);
$mform->setDefault('penaltyscheme', $CFG->quiz_penaltyscheme);
- $options = array(
+ $options = array(
0 => '0',
1 => '1',
2 => '2',
3 => '3');
- $mform->addElement('select', 'decimalpoints', get_string("decimaldigits", "quiz"), $options);
- $mform->setHelpButton('decimalpoints', array("decimalpoints", get_string("decimaldigits","quiz"), "quiz"));
- $mform->setAdvanced('decimalpoints', $CFG->quiz_fix_decimalpoints);
+ $mform->addElement('select', 'decimalpoints', get_string("decimaldigits", "quiz"), $options);
+ $mform->setHelpButton('decimalpoints', array("decimalpoints", get_string("decimaldigits","quiz"), "quiz"));
+ $mform->setAdvanced('decimalpoints', $CFG->quiz_fix_decimalpoints);
$mform->setDefault('decimalpoints', $CFG->quiz_decimalpoints);
- $mform->addElement('hidden', 'grade', $CFG->quiz_maximumgrade);
+ $mform->addElement('hidden', 'grade', $CFG->quiz_maximumgrade);
//-------------------------------------------------------------------------------
$mform->addElement('header', 'reviewoptionshdr', get_string("reviewoptions", "quiz"));
- $mform->setHelpButton('reviewoptionshdr', array("review2", get_string("allowreview","quiz"), "quiz"));
- $mform->setAdvanced('reviewoptionshdr', $CFG->quiz_fix_review);
+ $mform->setHelpButton('reviewoptionshdr', array("review2", get_string("allowreview","quiz"), "quiz"));
+ $mform->setAdvanced('reviewoptionshdr', $CFG->quiz_fix_review);
- $immediatelyoptionsgrp=array();
+ $immediatelyoptionsgrp=array();
$immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'responsesimmediately', '', get_string('responses', 'quiz'));
$immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'scoreimmediately', '', get_string('scores', 'quiz'));
$immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'feedbackimmediately', '', get_string('feedback', 'quiz'));
$mform->setDefault('answersimmediately', $CFG->quiz_review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_IMMEDIATELY);
$mform->setDefault('generalfeedbackimmediately', $CFG->quiz_review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_IMMEDIATELY);
- $openoptionsgrp=array();
+ $openoptionsgrp=array();
$openoptionsgrp[] = &$mform->createElement('checkbox', 'responsesopen', '', get_string('responses', 'quiz'));
$openoptionsgrp[] = &$mform->createElement('checkbox', 'scoreopen', '', get_string('scores', 'quiz'));
$openoptionsgrp[] = &$mform->createElement('checkbox', 'feedbackopen', '', get_string('feedback', 'quiz'));
$mform->setDefault('generalfeedbackopen', $CFG->quiz_review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_OPEN);
- $closedoptionsgrp=array();
+ $closedoptionsgrp=array();
$closedoptionsgrp[] = &$mform->createElement('checkbox', 'responsesclosed', '', get_string('responses', 'quiz'));
$closedoptionsgrp[] = &$mform->createElement('checkbox', 'scoreclosed', '', get_string('scores', 'quiz'));
$closedoptionsgrp[] = &$mform->createElement('checkbox', 'feedbackclosed', '', get_string('feedback', 'quiz'));
$mform->addElement('header', 'security', get_string('security', 'form'));
$mform->addElement('selectyesno', 'popup', get_string("popup", "quiz"));
- $mform->setHelpButton('popup', array("popup", get_string("popup", "quiz"), "quiz"));
- $mform->setAdvanced('popup', $CFG->quiz_fix_popup);
+ $mform->setHelpButton('popup', array("popup", get_string("popup", "quiz"), "quiz"));
+ $mform->setAdvanced('popup', $CFG->quiz_fix_popup);
$mform->setDefault('popup', $CFG->quiz_popup);
$mform->addElement('passwordunmask', 'quizpassword', get_string("requirepassword", "quiz"));
- $mform->setType('quizpassword', PARAM_TEXT);
- $mform->setHelpButton('quizpassword', array("requirepassword", get_string("requirepassword", "quiz"), "quiz"));
- $mform->setAdvanced('quizpassword', $CFG->quiz_fix_password);
+ $mform->setType('quizpassword', PARAM_TEXT);
+ $mform->setHelpButton('quizpassword', array("requirepassword", get_string("requirepassword", "quiz"), "quiz"));
+ $mform->setAdvanced('quizpassword', $CFG->quiz_fix_password);
$mform->setDefault('quizpassword', $CFG->quiz_password);
- $mform->addElement('text', 'subnet', get_string("requiresubnet", "quiz"));
- $mform->setType('subnet', PARAM_TEXT);
- $mform->setHelpButton('subnet', array("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"));
- $mform->setAdvanced('subnet', $CFG->quiz_fix_subnet);
+ $mform->addElement('text', 'subnet', get_string("requiresubnet", "quiz"));
+ $mform->setType('subnet', PARAM_TEXT);
+ $mform->setHelpButton('subnet', array("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"));
+ $mform->setAdvanced('subnet', $CFG->quiz_fix_subnet);
$mform->setDefault('subnet', $CFG->quiz_subnet);
//-------------------------------------------------------------------------------
- $this->standard_coursemodule_elements();
+ $this->standard_coursemodule_elements();
//-------------------------------------------------------------------------------
$mform->addElement('header', 'overallfeedbackhdr', get_string('overallfeedback', 'quiz'));
- $mform->setHelpButton('overallfeedbackhdr', array('overallfeedback', get_string('overallfeedback', 'quiz'), 'quiz'));
+ $mform->setHelpButton('overallfeedbackhdr', array('overallfeedback', get_string('overallfeedback', 'quiz'), 'quiz'));
- $mform->addElement('static', 'gradeboundarystatic1', get_string('gradeboundary', 'quiz'), '100%');
+ $mform->addElement('static', 'gradeboundarystatic1', get_string('gradeboundary', 'quiz'), '100%');
$repeatarray=array();
$repeatarray[] = &MoodleQuickForm::createElement('text', 'feedbacktext', get_string('feedback', 'quiz'));
//-------------------------------------------------------------------------------
// buttons
$this->add_action_buttons();
- }
+ }
- function data_preprocessing(&$default_values){
+ function data_preprocessing(&$default_values){
if (count($this->_feedbacks)) {
$key = 0;
foreach ($this->_feedbacks as $feedback){
// Password field - different in form to stop browsers that remember passwords
// getting confused.
- if (isset($default_values['password'])) {
+ if (isset($default_values['password'])) {
$default_values['quizpassword'] = $default_values['password'];
unset($default_values['password']);
}
- }
+ }
- function validation($data){
- $errors = array();
+ function validation($data){
+ $errors = array();
// Check open and close times are consistent.
if ($data['timeopen'] != 0 && $data['timeclose'] != 0 && $data['timeclose'] < $data['timeopen']) {
$errors['timeclose'] = get_string('closebeforeopen', 'quiz');
}
}
return $errors;
- }
+ }
}
-?>
\ No newline at end of file
+?>
#-- cdata
if($tname=='![cdata[') {
- $tname = strtoupper($tname); // Needs to be uppercase for XHTML compliance
+ $tname = strtoupper($tname); // Needs to be uppercase for XHTML compliance
// LEAVE THE POOR THING ALONE!
}
#-- standalone tag
* held by current user then the the second element has a member ->id only.
*/
function wiki_obtain_lock($wikiid,$pagename) {
- global $USER;
+ global $USER;
- // Check for lock
+ // Check for lock
$alreadyownlock=false;
if($lock=get_record('wiki_locks','pagename',$pagename,'wikiid', $wikiid)) {
// Consider the page locked if the lock has been confirmed within WIKI_LOCK_PERSISTENCE seconds
$lockid=$lock->id;
$alreadyownlock=true;
} else if(time()-$lock->lockedseen < WIKI_LOCK_PERSISTENCE) {
- return array(false,$lock);
+ return array(false,$lock);
} else {
// Not locked any more. Get rid of the old lock record.
if(!delete_records('wiki_locks','pagename',$pagename,'wikiid', $wikiid)) {
// Add lock
if(!$alreadyownlock) {
- // Lock page
- $newlock=new stdClass;
- $newlock->lockedby=$USER->id;
- $newlock->lockedsince=time();
- $newlock->lockedseen=$newlock->lockedsince;
- $newlock->wikiid=$wikiid;
- $newlock->pagename=$pagename;
- if(!$lockid=insert_record('wiki_locks',$newlock)) {
- error('Unable to insert lock record');
- }
+ // Lock page
+ $newlock=new stdClass;
+ $newlock->lockedby=$USER->id;
+ $newlock->lockedsince=time();
+ $newlock->lockedseen=$newlock->lockedsince;
+ $newlock->wikiid=$wikiid;
+ $newlock->pagename=$pagename;
+ if(!$lockid=insert_record('wiki_locks',$newlock)) {
+ error('Unable to insert lock record');
+ }
}
// Store lock information in session so we can clear it later
if(!array_key_exists(SESSION_WIKI_LOCKS,$_SESSION)) {
- $_SESSION[SESSION_WIKI_LOCKS]=array();
+ $_SESSION[SESSION_WIKI_LOCKS]=array();
}
- $_SESSION[SESSION_WIKI_LOCKS][$wikiid.'_'.$pagename]=$lockid;
+ $_SESSION[SESSION_WIKI_LOCKS][$wikiid.'_'.$pagename]=$lockid;
$lockdata=new StdClass;
$lockdata->id=$lockid;
return array(true,$lockdata);
*/
function wiki_release_lock($wikiid,$pagename) {
if(!array_key_exists(SESSION_WIKI_LOCKS,$_SESSION)) {
- // No locks at all in session
- return;
+ // No locks at all in session
+ return;
}
$key=$wikiid.'_'.$pagename;
if(array_key_exists($key,$_SESSION[SESSION_WIKI_LOCKS])) {
- $lockid=$_SESSION[SESSION_WIKI_LOCKS][$key];
- unset($_SESSION[SESSION_WIKI_LOCKS][$key]);
+ $lockid=$_SESSION[SESSION_WIKI_LOCKS][$key];
+ unset($_SESSION[SESSION_WIKI_LOCKS][$key]);
if(!delete_records('wiki_locks','id',$lockid)) {
error("Unable to delete lock record.");
}
}
-?>
\ No newline at end of file
+?>
class mod_wiki_mod_form extends moodleform_mod {
- function definition() {
+ function definition() {
- global $CFG, $COURSE, $WIKI_TYPES;
- $mform =& $this->_form;
+ global $CFG, $COURSE, $WIKI_TYPES;
+ $mform =& $this->_form;
if (!empty($this->_instance)) {
$queryobject = new stdClass();
//-------------------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
- $mform->setType('name', PARAM_NOTAGS);
- $mform->addRule('name', null, 'required', null, 'client');
+ $mform->setType('name', PARAM_NOTAGS);
+ $mform->addRule('name', null, 'required', null, 'client');
- $mform->addElement('htmleditor', 'summary', get_string('summary'));
- $mform->setType('summary', PARAM_RAW);
+ $mform->addElement('htmleditor', 'summary', get_string('summary'));
+ $mform->setType('summary', PARAM_RAW);
$mform->setHelpButton('summary', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
- $mform->addRule('summary', get_string('required'), 'required', null, 'client');
+ $mform->addRule('summary', get_string('required'), 'required', null, 'client');
if (!$wikihasentries){
asort($WIKI_TYPES);
$mform->addElement('select', 'wtype', get_string('wikitype', 'wiki'), $WIKI_TYPES);
- $mform->setHelpButton('wtype', array('wikitype', get_string('wikitype', 'wiki'), 'wiki'));
- $mform->setDefault('wtype', 'group');
+ $mform->setHelpButton('wtype', array('wikitype', get_string('wikitype', 'wiki'), 'wiki'));
+ $mform->setDefault('wtype', 'group');
} else {
$mform->addElement('static', 'wtype', get_string('wikitype', 'wiki'));
}
$mform->addElement('selectyesno', 'ewikiprinttitle', get_string('ewikiprinttitle', 'wiki'));
$mform->setDefault('ewikiprinttitle', 1);
- $mform->setAdvanced('ewikiprinttitle');
+ $mform->setAdvanced('ewikiprinttitle');
$htmlmodes = array(0 => get_string('nohtml', 'wiki'),
- 1 => get_string('safehtml', 'wiki'),
- 2 => get_string('htmlonly', 'wiki'));
+ 1 => get_string('safehtml', 'wiki'),
+ 2 => get_string('htmlonly', 'wiki'));
$mform->addElement('select', 'htmlmode', get_string('htmlmode', 'wiki'), $htmlmodes);
$mform->setDefault('htmlmode', 2);
- $mform->setAdvanced('htmlmode');
+ $mform->setAdvanced('htmlmode');
$mform->addElement('selectyesno', 'ewikiacceptbinary', get_string('ewikiacceptbinary', 'wiki'));
$mform->setDefault('ewikiacceptbinary', 0);
- $mform->setHelpButton('ewikiacceptbinary', array('ewikiacceptbinary', get_string('ewikiacceptbinary', 'wiki'), 'wiki'));
- $mform->setAdvanced('ewikiacceptbinary');
-
- $mform->addElement('advcheckbox', 'disablecamelcase', get_string('wikilinkoptions', 'wiki'), get_string('disablecamel', 'wiki'));
- $mform->setDefault('disablecamelcase', 0);
- $mform->setHelpButton('disablecamelcase', array('wikilinkoptions', get_string('wikilinkoptions', 'wiki'), 'wiki'));
- $mform->setAdvanced('disablecamelcase');
-
- $studentadminoptionsgrp = array();
- $studentadminoptionsgrp[] =& $mform->createElement('advcheckbox', 'setpageflags', '', get_string('allowsetpage', 'wiki'));
- $mform->setDefault('setpageflags', 0);
- $studentadminoptionsgrp[] =& $mform->createElement('advcheckbox', 'strippages', '', get_string('allowstrippages', 'wiki'));
- $mform->setDefault('strippages', 0);
- $studentadminoptionsgrp[] =& $mform->createElement('advcheckbox', 'removepages', '', get_string('allowremovepages', 'wiki'));
- $mform->setDefault('removepages', 0);
- $studentadminoptionsgrp[] =& $mform->createElement('advcheckbox', 'revertchanges', '', get_string('allowrevertchanges', 'wiki'));
- $mform->setDefault('revertchanges', 0);
- $mform->addGroup($studentadminoptionsgrp, 'studentadminoptions', get_string('studentadminoptions', 'wiki'), null, false);
+ $mform->setHelpButton('ewikiacceptbinary', array('ewikiacceptbinary', get_string('ewikiacceptbinary', 'wiki'), 'wiki'));
+ $mform->setAdvanced('ewikiacceptbinary');
+
+ $mform->addElement('advcheckbox', 'disablecamelcase', get_string('wikilinkoptions', 'wiki'), get_string('disablecamel', 'wiki'));
+ $mform->setDefault('disablecamelcase', 0);
+ $mform->setHelpButton('disablecamelcase', array('wikilinkoptions', get_string('wikilinkoptions', 'wiki'), 'wiki'));
+ $mform->setAdvanced('disablecamelcase');
+
+ $studentadminoptionsgrp = array();
+ $studentadminoptionsgrp[] =& $mform->createElement('advcheckbox', 'setpageflags', '', get_string('allowsetpage', 'wiki'));
+ $mform->setDefault('setpageflags', 0);
+ $studentadminoptionsgrp[] =& $mform->createElement('advcheckbox', 'strippages', '', get_string('allowstrippages', 'wiki'));
+ $mform->setDefault('strippages', 0);
+ $studentadminoptionsgrp[] =& $mform->createElement('advcheckbox', 'removepages', '', get_string('allowremovepages', 'wiki'));
+ $mform->setDefault('removepages', 0);
+ $studentadminoptionsgrp[] =& $mform->createElement('advcheckbox', 'revertchanges', '', get_string('allowrevertchanges', 'wiki'));
+ $mform->setDefault('revertchanges', 0);
+ $mform->addGroup($studentadminoptionsgrp, 'studentadminoptions', get_string('studentadminoptions', 'wiki'), null, false);
$mform->setAdvanced('studentadminoptions');
//-------------------------------------------------------------------------------
}
$mform->setHelpButton('pagename', array('wikiname', get_string('wikiname', 'wiki'), 'wiki'));
$mform->setType('pagename', PARAM_NOTAGS);
- $mform->setAdvanced('pagename');
+ $mform->setAdvanced('pagename');
if ($wikihasentries){
$mform->addElement('choosecoursefile', 'initialcontent', get_string('initialcontent', 'wiki'));
$mform->addElement('static', 'initialcontent', get_string('initialcontent', 'wiki'));
}
$mform->setHelpButton('initialcontent', array('initialcontent', get_string('initialcontent', 'wiki'), 'wiki'));
- $mform->setAdvanced('initialcontent');
+ $mform->setAdvanced('initialcontent');
//-------------------------------------------------------------------------------
- $this->standard_coursemodule_elements();
+ $this->standard_coursemodule_elements();
//-------------------------------------------------------------------------------
- // buttons
+// buttons
$this->add_action_buttons();
- }
-
-
-
-
-
+ }
}
-?>
\ No newline at end of file
+?>