Merge branch 'MDL-46239-28-2' of git://github.com/xow/moodle into MOODLE_28_STABLE
[moodle.git] / mod / glossary / settings.php
blob507d589032da70f0027b003af1d7e2e9f228c291
1 <?php
3 defined('MOODLE_INTERNAL') || die;
5 if ($ADMIN->fulltree) {
6 require_once($CFG->dirroot.'/mod/glossary/lib.php');
8 $settings->add(new admin_setting_heading('glossary_normal_header', get_string('glossaryleveldefaultsettings', 'glossary'), ''));
10 $settings->add(new admin_setting_configtext('glossary_entbypage', get_string('entbypage', 'glossary'),
11 get_string('entbypage', 'glossary'), 10, PARAM_INT));
14 $settings->add(new admin_setting_configcheckbox('glossary_dupentries', get_string('allowduplicatedentries', 'glossary'),
15 get_string('cnfallowdupentries', 'glossary'), 0));
17 $settings->add(new admin_setting_configcheckbox('glossary_allowcomments', get_string('allowcomments', 'glossary'),
18 get_string('cnfallowcomments', 'glossary'), 0));
20 $settings->add(new admin_setting_configcheckbox('glossary_linkbydefault', get_string('usedynalink', 'glossary'),
21 get_string('cnflinkglossaries', 'glossary'), 1));
23 $settings->add(new admin_setting_configcheckbox('glossary_defaultapproval', get_string('defaultapproval', 'glossary'),
24 get_string('cnfapprovalstatus', 'glossary'), 1));
27 if (empty($CFG->enablerssfeeds)) {
28 $options = array(0 => get_string('rssglobaldisabled', 'admin'));
29 $str = get_string('configenablerssfeeds', 'glossary').'<br />'.get_string('configenablerssfeedsdisabled2', 'admin');
31 } else {
32 $options = array(0=>get_string('no'), 1=>get_string('yes'));
33 $str = get_string('configenablerssfeeds', 'glossary');
35 $settings->add(new admin_setting_configselect('glossary_enablerssfeeds', get_string('enablerssfeeds', 'admin'),
36 $str, 0, $options));
39 $settings->add(new admin_setting_heading('glossary_levdev_header', get_string('entryleveldefaultsettings', 'glossary'), ''));
41 $settings->add(new admin_setting_configcheckbox('glossary_linkentries', get_string('usedynalink', 'glossary'),
42 get_string('cnflinkentry', 'glossary'), 0));
44 $settings->add(new admin_setting_configcheckbox('glossary_casesensitive', get_string('casesensitive', 'glossary'),
45 get_string('cnfcasesensitive', 'glossary'), 0));
47 $settings->add(new admin_setting_configcheckbox('glossary_fullmatch', get_string('fullmatch', 'glossary'),
48 get_string('cnffullmatch', 'glossary'), 0));
51 //Update and get available formats
52 $recformats = glossary_get_available_formats();
53 $formats = array();
54 //Take names
55 foreach ($recformats as $format) {
56 $formats[$format->id] = get_string("displayformat$format->name", "glossary");
58 asort($formats);
60 $str = '<table>';
61 foreach ($formats as $formatid=>$formatname) {
62 $recformat = $DB->get_record('glossary_formats', array('id'=>$formatid));
63 $str .= '<tr>';
64 $str .= '<td>' . $formatname . '</td>';
65 $eicon = "<a title=\"".get_string("edit")."\" href=\"$CFG->wwwroot/mod/glossary/formats.php?id=$formatid&amp;mode=edit\"><img class=\"iconsmall\" src=\"".$OUTPUT->pix_url('t/edit')."\" alt=\"".get_string("edit")."\" /></a>";
66 if ( $recformat->visible ) {
67 $vtitle = get_string("hide");
68 $vicon = "t/hide";
69 } else {
70 $vtitle = get_string("show");
71 $vicon = "t/show";
73 $vicon = "<a title=\"".$vtitle."\" href=\"$CFG->wwwroot/mod/glossary/formats.php?id=$formatid&amp;mode=visible&amp;sesskey=".sesskey()."\"><img class=\"iconsmall\" src=\"".$OUTPUT->pix_url($vicon)."\" alt=\"$vtitle\" /></a>";
75 $str .= '<td align="center">'.$eicon.'&nbsp;&nbsp;'.$vicon.'</td>';
76 $str .= '</tr>';
78 $str .= '</table>';
80 $settings->add(new admin_setting_heading('glossary_formats_header', get_string('displayformatssetup', 'glossary'), $str));