Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-31528 navigation: Fixed up missing break and optimised category.php

  • Loading branch information...
commit aa7574545f73389e5a816e98da87c565844a99ff 1 parent fa0f103
@samhemelryk samhemelryk authored
Showing with 8 additions and 7 deletions.
  1. +7 −7 course/category.php
  2. +1 −0  lib/navigationlib.php
View
14 course/category.php
@@ -264,15 +264,16 @@
$table->attributes = array('border' => '0', 'cellspacing' => '2', 'cellpadding' => '4', 'class' => 'generalbox boxaligncenter category_subcategories');
$table->head = array(new lang_string('subcategories'));
$table->data = array();
+$baseurl = new moodle_url('/course/category.php');
foreach ($subcategories as $subcategory) {
// Preload the context we will need it to format the category name shortly.
context_instance_preload($subcategory);
$context = get_context_instance(CONTEXT_COURSECAT, $subcategory->id);
// Prepare the things we need to create a link to the subcategory
$attributes = $subcategory->visible ? array() : array('class' => 'dimmed');
- $url = new moodle_url('/course/category.php', array('id' => $subcategory->id));
$text = format_string($subcategory->name, true, array('context' => $context));
// Add the subcategory to the table
+ $url->param('id', $subcategory->id);
$table->data[] = array(html_writer::link($url, $text, $attributes));
}
@@ -329,6 +330,7 @@
$atlastpage = true;
}
+ $baseurl = new moodle_url('/course/category.php', $urlparams + array('sesskey' => sesskey()));
foreach ($courses as $acourse) {
$coursecontext = get_context_instance(CONTEXT_COURSE, $acourse->id);
@@ -360,12 +362,11 @@
// MDL-8885, users with no capability to view hidden courses, should not be able to lock themselves out
if (has_capability('moodle/course:visibility', $coursecontext) && has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
- $baseurl = new moodle_url('/course/category.php', $urlparams);
if (!empty($acourse->visible)) {
- $url = new moodle_url($baseurl, array('hide' => $acourse->id, 'sesskey' => sesskey()));
+ $url = new moodle_url($baseurl, array('hide' => $acourse->id));
echo $OUTPUT->action_icon($url, new pix_icon('t/hide', get_string('hide')));
} else {
- $url = new moodle_url($baseurl, array('show' => $acourse->id, 'sesskey' => sesskey()));
+ $url = new moodle_url($baseurl, array('show' => $acourse->id));
echo $OUTPUT->action_icon($url, new pix_icon('t/show', get_string('show')));
}
}
@@ -381,14 +382,13 @@
}
if ($canmanage) {
- $baseurl = new moodle_url('/course/category.php', $urlparams);
if ($up) {
- $url = new moodle_url($baseurl, array('moveup' => $acourse->id, 'sesskey' => sesskey()));
+ $url = new moodle_url($baseurl, array('moveup' => $acourse->id));
echo $OUTPUT->action_icon($url, new pix_icon('t/up', get_string('moveup')));
}
if ($down) {
- $url = new moodle_url($baseurl, array('movedown' => $acourse->id, 'sesskey' => sesskey()));
+ $url = new moodle_url($baseurl, array('movedown' => $acourse->id));
echo $OUTPUT->action_icon($url, new pix_icon('t/down', get_string('movedown')));
}
$abletomovecourses = true;
View
1  lib/navigationlib.php
@@ -1259,6 +1259,7 @@ public function initialise() {
if ($issite) {
// The users profile information etc is already loaded
// for the front page.
+ break;
}
$course = $this->page->course;
if ($showcategories && !$ismycourse) {
Please sign in to comment.
Something went wrong with that request. Please try again.