]> git.mjollnir.org Git - moodle.git/commitdiff
question MDL-21169 removed update_module_button calls from question these are now...
authorSam Hemelryk <sam@moodle.com>
Wed, 23 Dec 2009 02:45:22 +0000 (02:45 +0000)
committerSam Hemelryk <sam@moodle.com>
Wed, 23 Dec 2009 02:45:22 +0000 (02:45 +0000)
Also fixed bug in moodle_url object coding_error to coding_exception

lib/pagelib.php
lib/weblib.php
question/addquestion.php
question/category.php
question/contextmove.php
question/contextmoveq.php
question/edit.php
question/export.php
question/import.php
question/question.php

index a7cd74a17ad7c0deb8a413df730aa2df7dc497c0..8f0047dde38c790c7556b639b8f0a7e5064e25e7 100644 (file)
@@ -1630,7 +1630,7 @@ class page_generic_activity extends page_base {
             $title = str_replace($search, $replace, $title);
         }
 
-        $buttons = '<table><tr><td>'.update_module_button($this->modulerecord->id, $this->course->id, get_string('modulename', $this->activityname)).'</td>';
+        $buttons = '<table><tr><td>'.$OUTPUT->update_module_button($this->modulerecord->id, $this->activityname).'</td>';
         if ($this->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) {
             $buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
                 '<input type="hidden" name="id" value="'.$this->modulerecord->id.'" />'.
index 3b9acbaf017ce41d9afe0ed827b892c1bd25962d..ef46fa17f981df56e1f9419c3eeb3c4ca5296c18 100644 (file)
@@ -341,13 +341,13 @@ class moodle_url {
 
         foreach ($params as $key=>$value) {
             if (is_int($key)) {
-                throw new coding_error('Url parameters can not have numeric keys!');
+                throw new coding_exception('Url parameters can not have numeric keys!');
             }
             if (is_array($value)) {
-                throw new coding_error('Url parameters values can not be arrays!');
+                throw new coding_exception('Url parameters values can not be arrays!');
             }
             if (is_object($value) and !method_exists($value, '__toString')) {
-                throw new coding_error('Url parameters values can not be objects, unless __toString() is defined!');
+                throw new coding_exception('Url parameters values can not be objects, unless __toString() is defined!');
             }
             $this->params[$key] = (string)$value;
         }
index 7a3ee303afccc16c948aff3ceef898868f73f7ca..cc39b460353cb6fa082455aa100998b5a8a4b1ad 100644 (file)
@@ -86,7 +86,6 @@ if ($cm !== null) {
     }
     $PAGE->navbar->add($chooseqtype);
     $PAGE->set_title($chooseqtype);
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, $cm->modname));
     echo $OUTPUT->header();
 } else {
     $PAGE->navbar->add(get_string('questionbank', 'question'),$returnurl);
index 7ac6930e202feff398340af7eb65a0bd04f8710f..c13777bd600df8caae936f897d9ed5bd38d164dd 100644 (file)
@@ -34,7 +34,7 @@
     $param->moveto = optional_param('moveto', 0, PARAM_INT);
     $param->edit = optional_param('edit', 0, PARAM_INT);
 
-    $url = new moodle_url($thispageurl);
+    $url = new moodle_url($CFG->wwwroot.$thispageurl);
     foreach ((array)$param as $key=>$value) {
         if (($key !== 'cancel' && $value !== 0) || ($key === 'cancel' && $value !== '')) {
             $url->param($key, $value);
         $thispageurl->remove_params('cat', 'category');
         redirect($thispageurl);
     }
-    if ($cm!==null) {
-        // Page header
-        $strupdatemodule = has_capability('moodle/course:manageactivities', $contexts->lowest())
-            ? $OUTPUT->update_module_button($cm->id, $cm->modname)
-            : "";
-        $PAGE->navbar->add(get_string('modulenameplural', $cm->modname), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/index.php', array('id'=>$COURSE->id)));
-        $PAGE->navbar->add(format_string($module->name), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/view.php', array('id'=>$cm->id)));
-    } else {
-        // Print basic page layout.
-        $strupdatemodule = '';
-    }
 
     if (!$param->edit){
         $PAGE->navbar->add($streditingcategories);
     }
 
     $PAGE->set_title($streditingcategories);
-    $PAGE->set_button($strupdatemodule);
     echo $OUTPUT->header();
 
     // print tabs
index 5982dee61d36e4b220be7fc091a737d6a9406a39..f7bd51583e9faefe10beffc974f647834a7b6463 100644 (file)
     }
 
     $streditingcategories = get_string('editcategories', 'quiz');
-    if ($cm!==null) {
-        // Page header
-        $strupdatemodule = has_capability('moodle/course:manageactivities', $contexts->lowest())
-            ? $OUTPUT->update_module_button($cm->id, $cm->modname)
-            : "";
-        $PAGE->navbar->add(get_string('modulenameplural', $cm->modname), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/index.php', array('id'=>$COURSE->id)));
-        $PAGE->navbar->add(format_string($module->name), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/view.php', array('id'=>$cm->id)));
-    } else {
-        // Print basic page layout.
-        $strupdatemodule = '';
-    }
 
     $PAGE->set_url($thispageurl->out());
     $PAGE->navbar->add($streditingcategories, $thispageurl->out());
     $PAGE->navbar->add(get_string('movingcategory', 'question'));
     $PAGE->set_title($streditingcategories);
-    $PAGE->set_button($strupdatemodule);
     echo $OUTPUT->header();
 
     // print tabs
index f19b80fc5af3d2a2ae6da0947738409f1e88c3ea..9b82b3e59f7d33d4d31f57984a429ef011721b41 100644 (file)
@@ -169,23 +169,10 @@ if ($contextmoveform->is_cancelled()){
 }
 
 $streditingcategories = get_string('editcategories', 'quiz');
-if ($cmid) {
-    // Page header
-    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-    $strupdatemodule = has_capability('moodle/course:manageactivities', $context)
-        ? $OUTPUT->update_module_button($cm->id, $cm->modname)
-        : "";
-    $PAGE->navbar->add(get_string('modulenameplural', $cm->modname), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/index.php', array('id'=>$COURSE->id)));
-    $PAGE->navbar->add(format_string($module->name), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/view.php', array('id'=>$cm->id)));
-} else {
-    // Print basic page layout.
-    $strupdatemodule = '';
-}
 $strmovingquestions = get_string('movingquestions', 'question');
 $PAGE->set_url($thispageurl->out());
 $PAGE->navbar->add($strmovingquestions);
 $PAGE->set_title($strmovingquestions);
-$PAGE->set_button($strupdatemodule);
 echo $OUTPUT->header();
 
 // print tabs
index 53d1a010f0b6a133b550f7919ca98b578e1f22cf..1d1b42904f7b63a2e5db213abeed2b79ec61c97d 100644 (file)
     $context = $contexts->lowest();
     $streditingquestions = get_string('editquestions', "quiz");
     if ($cm!==null) {
-        $strupdatemodule = has_capability('moodle/course:manageactivities', $contexts->lowest())
-            ? $OUTPUT->update_module_button($cm->id, $cm->modname)
-            : "";
-        $PAGE->navbar->add(get_string('modulenameplural', $cm->modname), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/index.php', array('id'=>$COURSE->id)));
-        $PAGE->navbar->add(format_string($module->name), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/view.php', array('id'=>$cm->id)));
         $PAGE->navbar->add($streditingquestions);
         $PAGE->set_title($streditingquestions);
-        $PAGE->set_button($strupdatemodule);
         echo $OUTPUT->header();
 
         $currenttab = 'edit';
index 1e999843cd42fb8c98dc50873dc12644072239a7..7a57c4a362be36858f58666f635047ff2b694f31 100644 (file)
     $PAGE->set_url($thispageurl->out());
     $PAGE->set_title($strexportquestions);
     if ($cm!==null) {
-        $strupdatemodule = has_capability('moodle/course:manageactivities', $contexts->lowest())
-            ? $OUTPUT->update_module_button($cm->id, $cm->modname)
-            : "";
-        $PAGE->navbar->add(get_string('modulenameplural', $cm->modname), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/index.php', array('id'=>$COURSE->id)));
-        $PAGE->navbar->add(format_string($module->name), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/view.php', array('id'=>$cm->id)));
         $PAGE->navbar->add($strexportquestions);
-        $PAGE->set_button($strupdatemodule);
         echo $OUTPUT->header();
         $currenttab = 'edit';
         $mode = 'export';
index 21a926bc040ad662eb221a1e77e5e76dd85edff1..bde0415f0bd888975920e0b35192c8495ef12793 100644 (file)
     //==========
 
     if ($cm!==null) {
-        $strupdatemodule = has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $COURSE->id))
-            ? $OUTPUT->update_module_button($cm->id, $cm->modname)
-            : "";
-        $PAGE->navbar->add(get_string('modulenameplural', $cm->modname), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/index.php', array('id'=>$COURSE->id)));
-        $PAGE->navbar->add(format_string($module->name), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/view.php', array('id'=>$cm->id)));
         $PAGE->navbar->add($txt->importquestions);
         $PAGE->set_title($txt->importquestions);
-        $PAGE->set_button($strupdatemodule);
         echo $OUTPUT->header();
 
         $currenttab = 'edit';
index f430a3325f13a4fc07091bb81f788fec0d1b0e88..c0f59169a2afcc53dc4031522de36600137762f9 100644 (file)
@@ -279,12 +279,7 @@ if ($mform->is_cancelled()){
     $PAGE->set_title($streditingquestion);
     if ($cm !== null) {
         $strmodule = get_string('modulename', $cm->modname);
-        $strupdatemodule = has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $COURSE->id))
-            ? $OUTPUT->update_module_button($cm->id, $strmodule)
-            : "";
-
         $streditingmodule = get_string('editinga', 'moodle', $strmodule);
-
         $PAGE->navbar->add(get_string('modulenameplural', $cm->modname), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/index.php', array('id'=>$cm->course)));
         $PAGE->navbar->add(format_string($module->name), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/view.php', array('id'=>$cm->id)));
         if (stripos($returnurl, "$CFG->wwwroot/mod/{$cm->modname}/view.php")!== 0){
@@ -292,7 +287,6 @@ if ($mform->is_cancelled()){
             $PAGE->navbar->add($streditingmodule, $returnurl);
         }
         $PAGE->navbar->add($streditingquestion);
-        $PAGE->set_button($strupdatemodule);
         echo $OUTPUT->header();
 
     } else {