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');
function local_hsh_boostnavigation_extend_navigation(global_navigation $navigation) {
global $CFG, $PAGE;
$todaysSemesterNodeKey = getFirstDayOfSem(strtotime("now"));
$collapsenodesforjs[] = '';
$semesterList[] = '';
$semesterKeys[] = '';
......@@ -86,11 +88,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
// Semesterliste sortieren (Neuestes Semeste oben)
if($semesterOrder == 0) { // Wenn die Order auf 1 ist -> Neueste Unten
rsort($semesterList);
if(isset($semesterList[0])) {
$newestNode = $semesterList[0];
} else {
$newestNode = $unabhaengig;
}
}
// Position der Semesterunabhängigen Kurse - Oberhalb der Semester
......@@ -104,7 +101,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
if($semesterOrder == 0) {
// Neueste Oben
if(isset($semesterList[0])) {
$newestNode = $semesterList[0]->key;
for ($i = 0; $i < $maxSemesters; $i++) {
if($i < sizeof($semesterList) && $semesterList[$i]) {
$customnav->add_node($semesterList[$i]);
......@@ -112,14 +108,11 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
break;
}
}
} else {
$newestNode = $unabhaengig;
}
} else {
// Neueste Unten
$count = sizeof($semesterList) - $maxSemesters;
$newestNode = $semesterList[sizeof($semesterList)-1]->key;
if ($count < 0) {
$count = 0;
}
......@@ -168,6 +161,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
// if settings gewählt "aktuelles Semester aufklappen"
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 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'local_hsh_boostnavigation';
$plugin->version = 2018091600;
$plugin->release = 'v1.1-r6';
$plugin->version = 2019020600;
$plugin->release = 'v1.1-r7';
$plugin->requires = 2016120500;
#$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