diff options
| author | Michaela Brückner <brueckner@data-quest.de> | 2025-06-26 09:51:32 +0200 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2025-06-26 07:51:32 +0000 |
| commit | d87fff87cd24cfcd7ad72a02af251ad890cf646e (patch) | |
| tree | 20dc6e62a02b0ca1396998bcb90871ffa3994b79 /app/controllers/admin/courseplanning.php | |
| parent | f385c70d09166f6a41cc49922510daa1ec3402b4 (diff) | |
Resolve "Veranstaltungs-Stundenplan: Anzeigefilter für Terminkachel einbauen"
Closes #5585
Merge request studip/studip!4209
Diffstat (limited to 'app/controllers/admin/courseplanning.php')
| -rw-r--r-- | app/controllers/admin/courseplanning.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/app/controllers/admin/courseplanning.php b/app/controllers/admin/courseplanning.php index 81e90a5..100088e 100644 --- a/app/controllers/admin/courseplanning.php +++ b/app/controllers/admin/courseplanning.php @@ -72,6 +72,12 @@ class Admin_CourseplanningController extends AuthenticatedController Icon::create('file-pdf') ); + Sidebar::get()->getWidget('actions')->addLink( + _('Ansichtsoptionen'), + $this->tilefilterURL('overview'), + Icon::create('admin') + )->asDialog('size=400x350'); + $this->courses = $this->getFilteredCourses(); $this->events = InstituteCalendarHelper::getEvents( $this->courses, @@ -128,6 +134,12 @@ class Admin_CourseplanningController extends AuthenticatedController Icon::create('admin') )->asDialog('size=auto'); + Sidebar::get()->getWidget('actions')->addLink( + _('Ansichtsoptionen'), + $this->tilefilterURL('weekday', $day_of_week), + Icon::create('admin') + )->asDialog('size=400x350'); + $this->cal_date = $cal_date; $this->courses = $this->getFilteredCourses(); $this->events = InstituteCalendarHelper::getEvents($this->courses, $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT, $this->semester, $day_of_week); @@ -887,4 +899,50 @@ class Admin_CourseplanningController extends AuthenticatedController } $this->redirect('admin/courseplanning/index'); } + + /** + * Sets filters for the title on the date tile + */ + public function tilefilter_action($view = null, $weekday = null) + { + PageLayout::setTitle(_('Angezeigte Veranstaltungsdaten')); + + $config = User::findCurrent()->getConfiguration(); + + $this->render_vue_app( + Studip\VueApp::create('CoursePlanningTileFilter') + ->withProps([ + 'view' => $view, + 'weekday' => $weekday, + 'config' => [ + 'course_number' => (bool) $config->getValue('TIMETABLE_COURSE_NUMBER_VISIBLE'), + 'course_name' => (bool) $config->getValue('TIMETABLE_COURSE_NAME_VISIBLE'), + 'lecturers' => (bool) $config->getValue('TIMETABLE_LECTURERS_VISIBLE'), + 'rooms' => (bool) $config->getValue('TIMETABLE_ROOMS_VISIBLE'), + ] + ]) + ); + + $this->view = $view; + $this->weekday = $weekday; + $this->config = UserConfig::get($GLOBALS['user']->id); + } + + public function store_tilefilter_action($view = null, $weekday = null) + { + CSRFProtection::verifyUnsafeRequest(); + + $GLOBALS['user']->cfg->store('TIMETABLE_COURSE_NUMBER_VISIBLE', Request::bool('course_number')); + $GLOBALS['user']->cfg->store('TIMETABLE_COURSE_NAME_VISIBLE', Request::bool('course_name')); + $GLOBALS['user']->cfg->store('TIMETABLE_LECTURERS_VISIBLE', Request::bool('lecturers')); + $GLOBALS['user']->cfg->store('TIMETABLE_ROOMS_VISIBLE', Request::bool('rooms')); + + if ($view === 'overview') { + $this->redirect('admin/courseplanning/index'); + } elseif ($view === 'weekday') { + $this->redirect('admin/courseplanning/weekday/' . $weekday); + } + + PageLayout::postSuccess(_('Ihre Einstellungen wurden gespeichert.')); + } } |
