moodle/mod/glossary/mod_form.php

208 lines
9.1 KiB
PHP
Raw Normal View History

<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once ($CFG->dirroot.'/course/moodleform_mod.php');
class mod_glossary_mod_form extends moodleform_mod {
function definition() {
2008-06-01 21:36:11 +00:00
global $CFG, $COURSE, $DB;
$mform =& $this->_form;
//-------------------------------------------------------------------------------
$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'));
if (!empty($CFG->formatstringstriptags)) {
$mform->setType('name', PARAM_TEXT);
} else {
$mform->setType('name', PARAM_CLEANHTML);
}
$mform->addRule('name', null, 'required', null, 'client');
$this->add_intro_editor(true);
$mform->addElement('text', 'entbypage', get_string('entbypage', 'glossary'));
$mform->setDefault('entbypage', 10);
$mform->addRule('entbypage', null, 'required', null, 'client');
$mform->addRule('entbypage', null, 'numeric', null, 'client');
if (has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
$mform->addElement('checkbox', 'globalglossary', get_string('isglobal', 'glossary'));
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('globalglossary', 'isglobal', 'glossary');
}else{
$mform->addElement('hidden', 'globalglossary');
$mform->setType('globalglossary', PARAM_INT);
}
$options = array(1=>get_string('mainglossary', 'glossary'), 0=>get_string('secondaryglossary', 'glossary'));
$mform->addElement('select', 'mainglossary', get_string('glossarytype', 'glossary'), $options);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('mainglossary', 'glossarytype', 'glossary');
$mform->setDefault('mainglossary', 0);
$mform->addElement('selectyesno', 'allowduplicatedentries', get_string('allowduplicatedentries', 'glossary'));
$mform->setDefault('allowduplicatedentries', $CFG->glossary_dupentries);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('allowduplicatedentries', 'allowduplicatedentries', 'glossary');
$mform->addElement('selectyesno', 'allowcomments', get_string('allowcomments', 'glossary'));
$mform->setDefault('allowcomments', $CFG->glossary_allowcomments);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('allowcomments', 'allowcomments', 'glossary');
$mform->addElement('selectyesno', 'allowprintview', get_string('allowprintview', 'glossary'));
$mform->setDefault('allowprintview', 1);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('allowprintview', 'allowprintview', 'glossary');
$mform->addElement('selectyesno', 'usedynalink', get_string('usedynalink', 'glossary'));
$mform->setDefault('usedynalink', $CFG->glossary_linkbydefault);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('usedynalink', 'usedynalink', 'glossary');
$mform->addElement('selectyesno', 'defaultapproval', get_string('defaultapproval', 'glossary'));
$mform->setDefault('defaultapproval', $CFG->glossary_defaultapproval);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('defaultapproval', 'defaultapproval', 'glossary');
//get and update available formats
$recformats = glossary_get_available_formats();
$formats = array();
//Take names
foreach ($recformats as $format) {
$formats[$format->name] = get_string('displayformat'.$format->name, 'glossary');
}
//Sort it
asort($formats);
$mform->addElement('select', 'displayformat', get_string('displayformat', 'glossary'), $formats);
$mform->setDefault('displayformat', 'dictionary');
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('displayformat', 'displayformat', 'glossary');
$displayformats['default'] = get_string('displayformatdefault', 'glossary');
$displayformats = array_merge($displayformats, $formats);
$mform->addElement('select', 'approvaldisplayformat', get_string('approvaldisplayformat', 'glossary'), $displayformats);
$mform->setDefault('approvaldisplayformat', 'default');
$mform->addHelpButton('approvaldisplayformat', 'approvaldisplayformat', 'glossary');
$mform->addElement('selectyesno', 'showspecial', get_string('showspecial', 'glossary'));
$mform->setDefault('showspecial', 1);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('showspecial', 'showspecial', 'glossary');
$mform->addElement('selectyesno', 'showalphabet', get_string('showalphabet', 'glossary'));
$mform->setDefault('showalphabet', 1);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('showalphabet', 'showalphabet', 'glossary');
$mform->addElement('selectyesno', 'showall', get_string('showall', 'glossary'));
$mform->setDefault('showall', 1);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('showall', 'showall', 'glossary');
$mform->addElement('selectyesno', 'editalways', get_string('editalways', 'glossary'));
$mform->setDefault('editalways', 0);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('editalways', 'editalways', 'glossary');
if ($CFG->enablerssfeeds && isset($CFG->glossary_enablerssfeeds) && $CFG->glossary_enablerssfeeds) {
//-------------------------------------------------------------------------------
$mform->addElement('header', '', get_string('rss'));
$choices = array();
$choices[0] = get_string('none');
$choices[1] = get_string('withauthor', 'glossary');
$choices[2] = get_string('withoutauthor', 'glossary');
$mform->addElement('select', 'rsstype', get_string('rsstype'), $choices);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('rsstype', 'rsstype', 'glossary');
$choices = array();
$choices[0] = '0';
$choices[1] = '1';
$choices[2] = '2';
$choices[3] = '3';
$choices[4] = '4';
$choices[5] = '5';
$choices[10] = '10';
$choices[15] = '15';
$choices[20] = '20';
$choices[25] = '25';
$choices[30] = '30';
$choices[40] = '40';
$choices[50] = '50';
$mform->addElement('select', 'rssarticles', get_string('rssarticles'), $choices);
MDL-21695 Glossary module now uses new help strings AMOS BEGIN HLP glossary/aliases2.html,[aliases_help,mod_glossary] HLP glossary/allowcomments.html,[allowcomments_help,mod_glossary] HLP glossary/allowduplicatedentries.html,[allowduplicatedentries_help,mod_glossary] HLP glossary/allowprintview.html,[allowprintview_help,mod_glossary] HLP glossary/attachment2.html,[attachment_help,mod_glossary] HLP glossary/attachment.html,[attachment_help,mod_glossary] HLP glossary/casesensitive.html,[casesensitive_help,mod_glossary] HLP glossary/defaultapproval.html,[defaultapproval_help,mod_glossary] HLP glossary/destination.html,[destination_help,mod_glossary] HLP glossary/displayformat.html,[displayformat_help,mod_glossary] HLP glossary/editalways.html,[editalways_help,mod_glossary] HLP glossary/filetoimport.html,[filetoimport_help,mod_glossary] HLP glossary/fullmatch.html,[fullmatch_help,mod_glossary] HLP glossary/globalglossary.html,[isglobal_help,mod_glossary] HLP glossary/linkcategory.html,[linkcategory_help,mod_glossary] HLP glossary/mainglossary.html,[glossarytype_help,mod_glossary] HLP glossary/rssarticles.html,[rssarticles_help,mod_glossary] HLP glossary/rsstype.html,[rsstype_help,mod_glossary] HLP glossary/shows.html,[showspecial_help,mod_glossary] HLP glossary/shows.html,[showalphabet_help,mod_glossary] HLP glossary/shows.html,[showall_help,mod_glossary] HLP glossary/usedynalinkentry.html,[entryusedynalink_help,mod_glossary] HLP glossary/usedynalink.html,[usedynalink_help,mod_glossary] AMOS END
2010-05-03 09:51:47 +00:00
$mform->addHelpButton('rssarticles', 'rssarticles', 'glossary');
$mform->disabledIf('rssarticles', 'rsstype', 'eq', 0);
}
//-------------------------------------------------------------------------------
$this->standard_grading_coursemodule_elements();
$this->standard_coursemodule_elements();
//-------------------------------------------------------------------------------
* Added setAdvanced functionality see http://docs.moodle.org/en/Development:lib/formslib.php_setAdvanced * Added MoodleQuickForm method closeHeaderBefore($elementName); http://docs.moodle.org/en/Development:lib/formslib.php_Form_Definition#Use_Fieldsets_to_group_Form_Elements * Added moodleform method add_action_buttons(); see http://docs.moodle.org/en/Development:lib/formslib.php_Form_Definition#add_action_buttons.28.24cancel_.3D_true.2C_.24revert_.3D_true.2C_.24submitlabel.3Dnull.29.3B * is_cancelled method added to moodleform http://docs.moodle.org/en/Development:lib/formslib.php_Usage#Basic_Usage_in_A_Normal_Page * added hidden labels to elements within groups such as the date_selector select boxes and other elements in 'groups' * quiz/mod.html migrated to formslib * glossary/edit.html migrated to formslib * extended registerNoSubmitButton() functionality to automatically add js to onclick to bypass client side js input validation. * added no_submit_button_pressed() function that can be used in a similar way to is_cancelled() as a test in the main script to see if some button in the page has been pressed that is a submit button that is used for some dynamic functionality within the form and not to submit the data for the whole form. * added new condition for disabledIf which allows to disable another form element if no options are selected from within a select element. * added default 'action' for moodleform - strip_querystring(qualified_me()) http://docs.moodle.org/en/Development:lib/formslib.php_Usage#Basic_Usage_in_A_Normal_Page
2006-12-19 07:03:08 +00:00
// buttons
$this->add_action_buttons();
}
2007-07-31 14:34:11 +00:00
function definition_after_data() {
2008-06-08 10:43:39 +00:00
global $COURSE, $DB;
2007-07-31 14:34:11 +00:00
parent::definition_after_data();
$mform =& $this->_form;
$mainglossaryel =& $mform->getElement('mainglossary');
2008-06-08 10:43:39 +00:00
$mainglossary = $DB->get_record('glossary', array('mainglossary'=>1, 'course'=>$COURSE->id));
if ($mainglossary && ($mainglossary->id != $mform->getElementValue('instance'))){
//secondary glossary, a main one already exists in this course.
$mainglossaryel->setValue(0);
$mainglossaryel->freeze();
$mainglossaryel->setPersistantFreeze(true);
} else {
$mainglossaryel->unfreeze();
$mainglossaryel->setPersistantFreeze(false);
}
}
function data_preprocessing(&$default_values){
parent::data_preprocessing($default_values);
// Set up the completion checkboxes which aren't part of standard data.
// We also make the default value (if you turn on the checkbox) for those
// numbers to be 1, this will not apply unless checkbox is ticked.
$default_values['completionentriesenabled']=
!empty($default_values['completionentries']) ? 1 : 0;
if (empty($default_values['completionentries'])) {
$default_values['completionentries']=1;
}
}
function add_completion_rules() {
$mform =& $this->_form;
$group=array();
$group[] =& $mform->createElement('checkbox', 'completionentriesenabled', '', get_string('completionentries','glossary'));
$group[] =& $mform->createElement('text', 'completionentries', '', array('size'=>3));
$mform->setType('completionentries', PARAM_INT);
$mform->addGroup($group, 'completionentriesgroup', get_string('completionentriesgroup','glossary'), array(' '), false);
$mform->disabledIf('completionentries','completionentriesenabled','notchecked');
return array('completionentriesgroup');
}
function completion_rule_enabled($data) {
return (!empty($data['completionentriesenabled']) && $data['completionentries']!=0);
}
function get_data() {
$data = parent::get_data();
if (!$data) {
return false;
}
// Turn off completion settings if the checkboxes aren't ticked
$autocompletion = !empty($data->completion) && $data->completion==COMPLETION_TRACKING_AUTOMATIC;
if (empty($data->completionentriesenabled) || !$autocompletion) {
$data->completionentries = 0;
}
return $data;
}
}