diff options
| author | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2021-07-22 16:07:19 +0200 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2021-07-22 16:19:12 +0200 |
| commit | a3da1483a9e689846179159355badfec8073dbec (patch) | |
| tree | 770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /app/controllers/my_studygroups.php | |
current code from svn, revision 62608
Diffstat (limited to 'app/controllers/my_studygroups.php')
| -rw-r--r-- | app/controllers/my_studygroups.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/app/controllers/my_studygroups.php b/app/controllers/my_studygroups.php new file mode 100644 index 0000000..579d47e --- /dev/null +++ b/app/controllers/my_studygroups.php @@ -0,0 +1,47 @@ +<?php +class MyStudygroupsController extends AuthenticatedController +{ + public function before_filter(&$action, &$args) + { + parent::before_filter($action, $args); + + if (!$GLOBALS['perm']->have_perm('root')) { + Navigation::activateItem('/browse/my_studygroups/index'); + } + } + + public function index_action() + { + PageLayout::setHelpKeyword('Basis.MeineStudiengruppen'); + PageLayout::setTitle(_('Meine Studiengruppen')); + URLHelper::removeLinkParam('cid'); + + $this->studygroups = MyRealmModel::getStudygroups(); + $this->nav_elements = MyRealmModel::calc_single_navigation($this->studygroups); + $this->set_sidebar(); + } + + public function set_sidebar() + { + if ($GLOBALS['user']->perms === 'user') { + return; + } + + $sidebar = Sidebar::Get(); + + $actions = new ActionsWidget(); + $actions->addLink( + _('Neue Studiengruppe anlegen'), + URLHelper::getURL('dispatch.php/course/wizard', ['studygroup' => 1]), + Icon::create('add') + )->asDialog('size=auto'); + if (count($this->studygroups) > 0) { + $actions->addLink( + _('Farbgruppierung ändern'), + URLHelper::getURL('dispatch.php/my_courses/groups/all/true'), + Icon::create('group4') + )->asDialog(); + } + $sidebar->addWidget($actions); + } +} |
