$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;
}
$this->content->icons[] = '';
$this->content->items[] = " <a href=\"$CFG->wwwroot/course/\">".get_string("searchcourses")."</a>...<br />";
- $this->content->icons[] = '';
- $this->content->items[] = " <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[] = " <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);
"href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
$this->content->icons[]=$icon;
}
- $this->content->icons[] = '';
- $this->content->items[] = " <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[] = " <a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>...";
+ }
$this->get_remote_courses();
} else {
<?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>