]> git.mjollnir.org Git - moodle.git/commitdiff
Merged additions from stable
authormoodler <moodler>
Mon, 26 Feb 2007 08:52:38 +0000 (08:52 +0000)
committermoodler <moodler>
Mon, 26 Feb 2007 08:52:38 +0000 (08:52 +0000)
blocks/course_list/block_course_list.php
blocks/course_list/config_global.html

index b68b5b6407e2d5f0712cde0848ec78e105092178..df9b145ec4185eed7c3df99010011efa337941f1 100644 (file)
@@ -49,7 +49,10 @@ class block_course_list extends block_list {
                     $this->content->icons[]=$icon;
                 }
                 $this->title = get_string('mycourses');
-                $this->content->footer = "<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>...";
+            /// If we can update any course of the view all isn't hidden, show the view all courses link
+                if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
+                    $this->content->footer = "<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>...";
+                }
                 $this->get_remote_courses();
                 if ($this->content->items) { // make sure we don't return an empty list
                     return $this->content;
@@ -67,8 +70,11 @@ class block_course_list extends block_list {
                 }
                 $this->content->icons[] = '';
                 $this->content->items[] = "&nbsp;&nbsp;&nbsp;<a href=\"$CFG->wwwroot/course/\">".get_string("searchcourses")."</a>...<br />";
-                $this->content->icons[] = '';
-                $this->content->items[] = "&nbsp;&nbsp;&nbsp;<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>...";
+            /// If we can update any course of the view all isn't hidden, show the view all courses link
+                if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
+                    $this->content->icons[] = '';
+                    $this->content->items[] = "&nbsp;&nbsp;&nbsp;<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>...";
+                }
                 $this->title = get_string('categories');
             } else {                          // Just print course names of single category
                 $category = array_shift($categories);
@@ -81,8 +87,11 @@ class block_course_list extends block_list {
                                    "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
                         $this->content->icons[]=$icon;
                     }
-                    $this->content->icons[] = '';
-                    $this->content->items[] = "&nbsp;&nbsp;&nbsp;<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>...";
+                /// If we can update any course of the view all isn't hidden, show the view all courses link
+                    if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
+                        $this->content->icons[] = '';
+                        $this->content->items[] = "&nbsp;&nbsp;&nbsp;<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>...";
+                    }
                     $this->get_remote_courses();
                 } else {
                     
index 91d9c298db2f7d34ce29e7787b27b104b9b00944..5e1b61406e26d6aadd60f2c80a5fea70fb43c479 100644 (file)
     <?php print_string("configadminview", "block_course_list") ?>
     </td>
 </tr>
+<tr valign="top">
+    <td align="right">block_course_list_hideallcourseslink:</td>
+    <td>
+    <select name="block_course_list_hideallcourseslink">
+     <option value="1" <?php if(isset($CFG->block_course_list_allcourseslink)){ 
+     if($CFG->block_course_list_hideallcourseslink){ echo "selected=\"selected\"";}
+     }?>     
+     ><?php p(get_string('yes')) ?></option>
+     <option value="0" <?php if(isset($CFG->block_course_list_hideallcourseslink)){ 
+         if(!$CFG->block_course_list_hideallcourseslink){ echo "selected=\"selected\""; }
+     }else{
+         echo "selected=\"selected\"";
+     }?>
+     ><?php p(get_string('no')) ?></option>
+    </select>
+    </td>
+    <td>
+    <?php print_string("confighideallcourseslink", "block_course_list") ?>
+    </td>
+</tr>
 <tr>
     <td colspan="3" align="center">
     <input type="submit" value="<?php print_string("savechanges") ?>" /></td>