diff options
Diffstat (limited to 'app/controllers/quickselection.php')
| -rw-r--r-- | app/controllers/quickselection.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/app/controllers/quickselection.php b/app/controllers/quickselection.php new file mode 100644 index 0000000..88d24f0 --- /dev/null +++ b/app/controllers/quickselection.php @@ -0,0 +1,45 @@ +<?php + +class QuickselectionController extends AuthenticatedController +{ + public function save_action() + { + if (Config::get()->QUICK_SELECTION === null) { + Config::get()->create('QUICK_SELECTION', [ + 'range' => 'user', + 'type' => 'array', + 'description' => 'Einstellungen des QuickSelection-Widgets', + ]); + } + + $add_removes = Request::optionArray('add_removes'); + + // invert add_removes so that only unchecked values are stored into config + $names = []; + + $navigation = Navigation::getItem('/start'); + foreach ($navigation as $name => $nav) { + if (!in_array($name, $add_removes)) { + $names[$name] = 'deactivated'; + } + + } + + WidgetHelper::addWidgetUserConfig($GLOBALS['user']->id, 'QUICK_SELECTION', $names); + + $template = PluginEngine::getPlugin('QuickSelection')->getPortalTemplate(); + + $this->response->add_header('X-Dialog-Close', 1); + $this->response->add_header('X-Dialog-Execute', 'STUDIP.QuickSelection.update'); + + $this->render_template($template); + } + + public function configuration_action() + { + $this->links = Navigation::getItem('/start'); + $this->config = WidgetHelper::getWidgetUserConfig($GLOBALS['user']->id, 'QUICK_SELECTION'); + + PageLayout::setTitle(_('Schnellzugriff konfigurieren')); + } +} |
