]> git.mjollnir.org Git - moodle.git/commitdiff
mod-glossary MDL-20256 Upgraded module to use the new navigation blocks
authorsamhemelryk <samhemelryk>
Fri, 11 Sep 2009 05:38:44 +0000 (05:38 +0000)
committersamhemelryk <samhemelryk>
Fri, 11 Sep 2009 05:38:44 +0000 (05:38 +0000)
lang/en_utf8/glossary.php
mod/glossary/edit.php
mod/glossary/export.php
mod/glossary/import.php
mod/glossary/lib.php
mod/glossary/view.php

index e569803b2d0bfce4f19944baf0572f6c7fcb51de..33984291f1a12dd102885c6710b94046ef50c58e 100644 (file)
@@ -122,6 +122,7 @@ $string['fillfields'] = 'Concept and definition are mandatory fields.';
 $string['filtername'] = 'Glossary Auto-linking';
 $string['fullmatch'] = 'Match whole words only';
 $string['globalglossary'] = 'Global glossary';
+$string['glossaryadministration'] = 'Glossary Administration';
 $string['glossary:approve'] = 'Approve unapproved entries';
 $string['glossary:comment'] = 'Create comments';
 $string['glossary:export'] = 'Export entries';
index 77f6df21e4f623c5638608a7625bee1f535b9631..f67b109d4bb9988777756009fe9d2958dbb72814 100644 (file)
@@ -27,6 +27,12 @@ if (!$glossary = $DB->get_record('glossary', array('id'=>$cm->instance))) {
     print_error('invalidid', 'glossary');
 }
 
+$url = new moodle_url($CFG->wwwroot.'/mod/glossary/edit.php', array('cmid'=>$cm->id));
+if (!empty($id)) {
+    $url->param('id', $id);
+}
+$PAGE->set_url($url);
+
 if ($id) { // if entry is specified
     if (!$entry = $DB->get_record('glossary_entries', array('id'=>$id, 'glossaryid'=>$glossary->id))) {
         print_error('invalidentry');
index abf2d7a2561af29ece7feeeba167e3581e544187..94804cc76522fa0edf9dabbfac8b413853938342 100644 (file)
@@ -37,6 +37,7 @@
     $strexportfile = get_string("exportfile", "glossary");
     $strexportentries = get_string('exportentriestoxml', 'glossary');
 
+    $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/export.php', array('id'=>$cm->id)));
     $PAGE->navbar->add($strexportentries);
     $PAGE->set_title(format_string($glossary->name));
     $PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
index 45b1ba183896ce37a361265549be3eb98fb9626e..759ee38e9000ec0f3ab11e4c9f8fe77a1b35fece 100644 (file)
@@ -44,6 +44,7 @@
     $strsearch = get_string("search");
     $strimportentries = get_string('importentriesfromxml', 'glossary');
 
+    $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/import.php', array('id'=>$cm->id, 'mode'=>$mode, 'hook'=>$hook)));
     $PAGE->navbar->add($strimportentries);
     $PAGE->set_title(format_string($glossary->name));
     $PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
index 91ae0eadbeaa46a0dc9bf4dde435063c6b670812..690ec05410c5e831909f2758ff64fdffa92b75a9 100644 (file)
@@ -2887,3 +2887,43 @@ class glossary_entry_portfolio_caller extends portfolio_module_caller_base {
         return sha1(serialize($this->entry));
     }
 }
+
+function glossary_extend_navigation($navigation, $course, $module, $cm) {
+    global $CFG;
+    $navigation->add(get_string('standardview', 'glossary'), new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->instance, 'mode'=>'letter')));
+    $navigation->add(get_string('categoryview', 'glossary'), new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->instance, 'mode'=>'cat')));
+    $navigation->add(get_string('dateview', 'glossary'), new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->instance, 'mode'=>'date')));
+    $navigation->add(get_string('authorview', 'glossary'), new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->instance, 'mode'=>'author')));
+}
+
+function glossary_extend_settings_navigation($settings, $module) {
+    global $PAGE, $DB, $CFG, $USER;
+
+    $mode = optional_param('mode', '', PARAM_ALPHA);
+    $hook = optional_param('hook', 'ALL', PARAM_CLEAN);
+
+    $glossary = $DB->get_record('glossary', array('id'=>$PAGE->cm->instance));
+    $glossarynavkey = $settings->add(get_string('glossaryadministration', 'glossary'));
+    $glossarynav = $settings->get($glossarynavkey);
+    $glossarynav->forceopen = true;
+
+    if (has_capability('mod/glossary:import', $PAGE->cm->context)) {
+        $glossarynav->add(get_string('importentries', 'glossary'), new moodle_url($CFG->wwwroot.'/mod/glossary/import.php', array('id'=>$PAGE->cm->id)));
+    }
+
+    if (has_capability('mod/glossary:export', $PAGE->cm->context)) {
+        $glossarynav->add(get_string('exportentries', 'glossary'), new moodle_url($CFG->wwwroot.'/mod/glossary/export.php', array('id'=>$PAGE->cm->id, 'mode'=>$mode, 'hook'=>$hook)));
+    }
+
+    if (has_capability('mod/glossary:approve', $PAGE->cm->context) && ($hiddenentries = $DB->count_records('glossary_entries', array('glossaryid'=>$glossary->id, 'approved'=>0)))) {
+        $glossarynav->add(get_string('waitingapproval', 'glossary'), new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$PAGE->cm->id, 'mode'=>'approval')));
+    }
+
+    if (has_capability('mod/glossary:write', $PAGE->cm->context)) {
+        $glossarynav->add(get_string('addentry', 'glossary'), new moodle_url($CFG->wwwroot.'/mod/glossary/edit.php', array('cmid'=>$PAGE->cm->id)));
+    }
+
+    if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {
+        $glossarynav->add(get_string('updatethis', '', get_string('modulename', 'glossary')), new moodle_url($CFG->wwwroot.'/course/mod.php', array('update' => $PAGE->cm->id, 'return' => true, 'sesskey' => sesskey())));
+    }
+}
\ No newline at end of file
index 622b25b08fc8ef2873d35a99586e7f3936729319..43524b40dc985da7c9cac6a0539139718468d4f3 100644 (file)
 /// If we are in approval mode, prit special header
     $PAGE->set_title(format_string($glossary->name));
     $PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
+    $url = new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->id));
+    if (isset($mode)) {
+        $url->param('mode', $mode);
+    }
+    $PAGE->set_url($url);
     if ($tab == GLOSSARY_APPROVAL_VIEW) {
         require_capability('mod/glossary:approve', $context);
         $PAGE->navbar->add($strwaitingapproval);