diff options
| author | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2022-05-11 07:19:42 +0000 |
|---|---|---|
| committer | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2022-05-11 07:19:42 +0000 |
| commit | 20240b2aacb15ab3264afbfbbc9dae952db4bb63 (patch) | |
| tree | 597cae73c5ae7ab9eda6d066d45430c3f17a4560 /app/controllers/quickselection.php | |
| parent | c054faf90288a75fc3680480434ba93b7f5b287b (diff) | |
convert old core plugins to new model, re #814
Merge request studip/studip!440
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')); + } +} |
