]> git.mjollnir.org Git - moodle.git/commitdiff
fixed a bug where using tag to search blogs, nav menu is not working
authortoyomoyo <toyomoyo>
Thu, 16 Mar 2006 02:01:55 +0000 (02:01 +0000)
committertoyomoyo <toyomoyo>
Thu, 16 Mar 2006 02:01:55 +0000 (02:01 +0000)
blog/header.php

index 9de0bb6f819365806a135c9c8f93583aebc5d215..aab76ac9e8a13f9b1ed258c7d4f3935c64483652 100755 (executable)
@@ -61,10 +61,15 @@ else {
 $PAGE->courseid = $courseid;
 $PAGE->init_full(); //init the BlogInfo object and the courserecord object
 
-if (isset($tagid)) {
+if (isset($tagid) && $tagid) {
     $taginstance = get_record('tags', 'id', $tagid);
 } else {
     $tagid = '';
+    if (isset($tag) && $tag) {
+        $tagrec = get_record('tags', 'text', $tag);
+        $tagid = $tagrec->id;
+        $taginstance = get_record('tags', 'id', $tagid);
+    }
 }
 if (!isset($filtertype)) {
     $filtertype = 'user';
@@ -81,7 +86,7 @@ $tagstring = get_string('tag');
 
 switch ($filtertype) {
     case 'site':
-        if ($tagid) {
+        if ($tagid || (isset($tag) && $tag)) {
             print_header("$site->shortname: $blogstring", "$site->fullname",
                         '<a href="index.php?filtertype=site">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
         } else {
@@ -91,7 +96,7 @@ switch ($filtertype) {
     break;
 
     case 'course':
-        if ($tagid) {
+        if ($tagid || (isset($tag) && $tag)) {
             print_header("$course->shortname: $blogstring", "$course->fullname",
                         '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$filterselect.'">'.$course->shortname.'</a> ->
                         <a href="index.php?filtertype=course&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
@@ -106,7 +111,7 @@ switch ($filtertype) {
 
         $thisgroup = get_record('groups', 'id', $filterselect);
 
-        if ($tagid) {
+        if ($tagid || (isset($tag) && $tag)) {
             print_header("$course->shortname: $blogstring", "$course->fullname",
                         '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
                         <a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect.'">'.$thisgroup->name.'</a> ->
@@ -126,7 +131,7 @@ switch ($filtertype) {
         $participants = get_string('participants');
 
         if (isset($course->id) && $course->id && $course->id != SITEID) {
-            if ($tagid) {
+            if ($tagid || (isset($tag) && $tag)) {
                 print_header("$course->shortname: $blogstring", "$course->fullname",
                         '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
                         <a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'">'.$participants.'</a> ->
@@ -146,7 +151,7 @@ switch ($filtertype) {
         //in top view
         else {
 
-            if ($tagid) {
+            if ($tagid || (isset($tag) && $tag)) {
                 print_header("$site->shortname: $blogstring", "$site->fullname",
                         '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
                         <a href="index.php?filtertype=user&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());