Skip to content
Snippets Groups Projects
Commit ba9bfe62 authored by Tobias Baden's avatar Tobias Baden
Browse files

Added "open newest Semester" function

- Added a function to automatically open the current semester
- Removed old "newestSemester" code
- Updated version number and release
parent 79a29f2f
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,8 @@ include_once($CFG->dirroot . '/local/hsh_boostnavigation/locallib.php'); ...@@ -28,6 +28,8 @@ include_once($CFG->dirroot . '/local/hsh_boostnavigation/locallib.php');
function local_hsh_boostnavigation_extend_navigation(global_navigation $navigation) { function local_hsh_boostnavigation_extend_navigation(global_navigation $navigation) {
global $CFG, $PAGE; global $CFG, $PAGE;
$todaysSemesterNodeKey = getFirstDayOfSem(strtotime("now"));
$collapsenodesforjs[] = ''; $collapsenodesforjs[] = '';
$semesterList[] = ''; $semesterList[] = '';
$semesterKeys[] = ''; $semesterKeys[] = '';
...@@ -86,11 +88,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati ...@@ -86,11 +88,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
// Semesterliste sortieren (Neuestes Semeste oben) // Semesterliste sortieren (Neuestes Semeste oben)
if($semesterOrder == 0) { // Wenn die Order auf 1 ist -> Neueste Unten if($semesterOrder == 0) { // Wenn die Order auf 1 ist -> Neueste Unten
rsort($semesterList); rsort($semesterList);
if(isset($semesterList[0])) {
$newestNode = $semesterList[0];
} else {
$newestNode = $unabhaengig;
}
} }
// Position der Semesterunabhängigen Kurse - Oberhalb der Semester // Position der Semesterunabhängigen Kurse - Oberhalb der Semester
...@@ -104,7 +101,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati ...@@ -104,7 +101,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
if($semesterOrder == 0) { if($semesterOrder == 0) {
// Neueste Oben // Neueste Oben
if(isset($semesterList[0])) { if(isset($semesterList[0])) {
$newestNode = $semesterList[0]->key;
for ($i = 0; $i < $maxSemesters; $i++) { for ($i = 0; $i < $maxSemesters; $i++) {
if($i < sizeof($semesterList) && $semesterList[$i]) { if($i < sizeof($semesterList) && $semesterList[$i]) {
$customnav->add_node($semesterList[$i]); $customnav->add_node($semesterList[$i]);
...@@ -112,14 +108,11 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati ...@@ -112,14 +108,11 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
break; break;
} }
} }
} else {
$newestNode = $unabhaengig;
} }
} else { } else {
// Neueste Unten // Neueste Unten
$count = sizeof($semesterList) - $maxSemesters; $count = sizeof($semesterList) - $maxSemesters;
$newestNode = $semesterList[sizeof($semesterList)-1]->key;
if ($count < 0) { if ($count < 0) {
$count = 0; $count = 0;
} }
...@@ -168,6 +161,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati ...@@ -168,6 +161,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
// if settings gewählt "aktuelles Semester aufklappen" // if settings gewählt "aktuelles Semester aufklappen"
if($openNewestSemester) { if($openNewestSemester) {
$PAGE->requires->js_call_amd('local_hsh_boostnavigation/collapse', 'openSemester', [$newestNode]); $PAGE->requires->js_call_amd('local_hsh_boostnavigation/collapse', 'openSemester', [$todaysSemesterNodeKey]);
} }
} }
\ No newline at end of file
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->component = 'local_hsh_boostnavigation'; $plugin->component = 'local_hsh_boostnavigation';
$plugin->version = 2018091600; $plugin->version = 2019020600;
$plugin->release = 'v1.1-r6'; $plugin->release = 'v1.1-r7';
$plugin->requires = 2016120500; $plugin->requires = 2016120500;
#$plugin->maturity = MATURITY_STABLE; #$plugin->maturity = MATURITY_STABLE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment