Beispiel #1
0
 /**
  * Autor / Tutor / Teacher action
  */
 public function index_action($order_by = null, $order = 'asc')
 {
     if ($GLOBALS['perm']->have_perm('root')) {
         throw new AccessDeniedException();
     }
     if ($GLOBALS['perm']->have_perm('admin')) {
         $this->redirect('my_courses/admin');
         return;
     }
     Navigation::activateItem('/browse/my_courses/list');
     PageLayout::setHelpKeyword("Basis.MeineVeranstaltungen");
     PageLayout::setTitle(_("Meine Veranstaltungen"));
     $config_sem = $GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE;
     if (!Config::get()->MY_COURSES_ENABLE_ALL_SEMESTERS && $config_sem == 'all') {
         $config_sem = 'future';
     }
     $this->_my_sem_open = $GLOBALS['user']->cfg->MY_COURSES_OPEN_GROUPS;
     $group_field = $GLOBALS['user']->cfg->MY_COURSES_GROUPING;
     $deputies_enabled = Config::get()->DEPUTIES_ENABLE;
     $default_deputies_enabled = Config::get()->DEPUTIES_DEFAULTENTRY_ENABLE;
     $deputies_edit_about_enabled = Config::get()->DEPUTIES_EDIT_ABOUT_ENABLE;
     $studygroups_enabled = Config::get()->MY_COURSES_ENABLE_STUDYGROUPS;
     $this->config_sem_number = Config::get()->IMPORTANT_SEMNUMBER;
     $sem_create_perm = in_array(Config::get()->SEM_CREATE_PERM, array('root', 'admin', 'dozent')) ? Config::get()->SEM_CREATE_PERM : 'dozent';
     $this->sem_data = SemesterData::GetSemesterArray();
     $sem = $config_sem && $config_sem != '0' ? $config_sem : Config::get()->MY_COURSES_DEFAULT_CYCLE;
     if (Request::option('sem_select')) {
         $sem = Request::get('sem_select', $sem);
     }
     if (!in_array($sem, words('future all last current')) && isset($sem)) {
         Request::set('sem_select', $sem);
     }
     $forced_grouping = in_array(Config::get()->MY_COURSES_FORCE_GROUPING, getValidGroupingFields()) ? Config::get()->MY_COURSES_FORCE_GROUPING : 'sem_number';
     if ($forced_grouping == 'not_grouped') {
         $forced_grouping = 'sem_number';
     }
     if (!$group_field) {
         $group_field = 'sem_number';
     }
     if ($group_field == 'sem_number' && $forced_grouping != 'sem_number') {
         $group_field = $forced_grouping;
     }
     $this->group_field = $group_field === 'not_grouped' ? 'sem_number' : $group_field;
     // Needed parameters for selecting courses
     $params = array('group_field' => $this->group_field, 'order_by' => $order_by, 'order' => $order, 'studygroups_enabled' => $studygroups_enabled, 'deputies_enabled' => $deputies_enabled);
     // Save the semester in session
     $this->sem_courses = MyRealmModel::getPreparedCourses($sem, $params);
     $this->waiting_list = MyRealmModel::getWaitingList($GLOBALS['user']->id);
     $this->sem = $sem;
     $this->order = $order;
     $this->order_by = $order_by;
     $this->default_deputies_enabled = $default_deputies_enabled;
     $this->deputies_edit_about_enabled = $deputies_edit_about_enabled;
     $this->my_bosses = $default_deputies_enabled ? getDeputyBosses($GLOBALS['user']->id) : array();
     // Check for new contents
     $new_contents = $this->check_for_new($this->sem_courses, $this->group_field);
     $this->nav_elements = MyRealmModel::calc_nav_elements($this->sem_courses, $this->group_field);
     //
     if ($tabularasa = $this->flash['tabularasa']) {
         $details = array();
         if ($new_contents) {
             $details[] = sprintf(_('Seit Ihrem letzten Seitenaufruf (%s) sind allerdings neue Inhalte hinzugekommen.'), reltime($tabularasa));
         }
         $message_box = MessageBox::success(_('Alles als gelesen markiert!'), $details);
         PageLayout::postMessage($message_box);
     }
     // create settings url depended on selected cycle
     if (isset($sem) && !in_array($sem, words('future all last current'))) {
         $this->settings_url = sprintf('dispatch.php/my_courses/groups/%s', $sem);
     } else {
         $this->settings_url = 'dispatch.php/my_courses/groups';
     }
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/seminar-sidebar.png');
     $this->setSemesterWidget($sem);
     $setting_widget = new ActionsWidget();
     if ($new_contents) {
         $setting_widget->addLink(_('Alles als gelesen markieren'), $this->url_for('my_courses/tabularasa/' . $sem . '/', time()), Icon::create('accept', 'clickable'));
     }
     $setting_widget->addLink(_('Farbgruppierung ändern'), URLHelper::getLink($this->settings_url), Icon::create('group4', 'clickable'), array('data-dialog' => ''));
     if (Config::get()->MAIL_NOTIFICATION_ENABLE) {
         $setting_widget->addLink(_('Benachrichtigungen anpassen'), URLHelper::getLink('dispatch.php/settings/notification'), Icon::create('mail', 'clickable'));
     }
     if ($sem_create_perm == 'dozent' && $GLOBALS['perm']->have_perm('dozent')) {
         $setting_widget->addLink(_('Neue Veranstaltung anlegen'), URLHelper::getLink('dispatch.php/course/wizard'), Icon::create('seminar+add', 'clickable'));
     }
     $setting_widget->addLink(_('Veranstaltung hinzufügen'), URLHelper::getLink('dispatch.php/search/courses'), Icon::create('seminar', 'clickable'));
     $sidebar->addWidget($setting_widget);
     $this->setGroupingSelector($this->group_field);
 }
Beispiel #2
0
 /**
  * Show all courses with more options
  */
 public function index_action()
 {
     $this->sem_create_perm = in_array(Config::get()->SEM_CREATE_PERM, array('root', 'admin', 'dozent')) ? Config::get()->SEM_CREATE_PERM : 'dozent';
     // get courses only if institutes available
     $this->actions = $this->getActions();
     $config_my_course_type_filter = $GLOBALS['user']->cfg->MY_COURSES_TYPE_FILTER;
     // Get the view filter
     $this->view_filter = $this->getFilterConfig();
     if (Request::get('sortFlag')) {
         $GLOBALS['user']->cfg->store('MEINE_SEMINARE_SORT_FLAG', Request::get('sortFlag') == 'asc' ? 'DESC' : 'ASC');
     }
     if (Request::option('sortby')) {
         $GLOBALS['user']->cfg->store('MEINE_SEMINARE_SORT', Request::option('sortby'));
     }
     $this->selected_action = $GLOBALS['user']->cfg->MY_COURSES_ACTION_AREA;
     if (is_null($this->selected_action)) {
         $this->selected_action = 1;
     }
     $this->sortby = $GLOBALS['user']->cfg->MEINE_SEMINARE_SORT;
     $this->sortFlag = $GLOBALS['user']->cfg->MEINE_SEMINARE_SORT_FLAG ?: 'ASC';
     $this->courses = $this->getCourses(array('sortby' => $this->sortby, 'sortFlag' => $this->sortFlag, 'view_filter' => $this->view_filter, 'typeFilter' => $config_my_course_type_filter));
     if (in_array('contents', $this->view_filter)) {
         $this->nav_elements = MyRealmModel::calc_nav_elements(array($this->courses));
     }
     // get all available teacher for infobox-filter
     // filter by selected teacher
     $_SESSION['MY_COURSES_LIST'] = array_map(function ($c, $id) {
         return array('Name' => $c['Name'], 'Seminar_id' => $id);
     }, array_values($this->courses), array_keys($this->courses));
     $this->all_lock_rules = new SimpleCollection(array_merge(array(array('name' => '--' . _("keine Sperrebene") . '--', 'lock_id' => 'none')), LockRule::findAllByType('sem')));
     $this->aux_lock_rules = array_merge(array(array('name' => '--' . _("keine Zusatzangaben") . '--', 'lock_id' => 'none')), AuxLockRules::getAllLockRules());
     $sidebar = Sidebar::get();
     $sidebar->setImage("sidebar/seminar-sidebar.png");
     $this->setSearchWiget();
     $this->setInstSelector();
     $this->setSemesterSelector();
     $this->setTeacherWidget();
     $this->setCourseTypeWidget($config_my_course_type_filter);
     $this->setActionsWidget($this->selected_action);
     if ($this->sem_create_perm) {
         $actions = new ActionsWidget();
         $actions->addLink(_('Neue Veranstaltung anlegen'), URLHelper::getLink('dispatch.php/course/wizard'), Icon::create('seminar+add', 'clickable'))->asDialog('size=50%');
         $sidebar->addWidget($actions, 'links');
     }
     $this->setViewWidget($this->view_filter);
     if ($this->sem_create_perm) {
         $params = array();
         if ($GLOBALS['user']->cfg->ADMIN_COURSES_SEARCHTEXT) {
             $params['search'] = $GLOBALS['user']->cfg->ADMIN_COURSES_SEARCHTEXT;
         }
         $export = new ExportWidget();
         $export->addLink(_('Als Excel exportieren'), URLHelper::getLink('dispatch.php/admin/courses/export_csv', $params), Icon::create('file-excel', 'clickable'));
         $sidebar->addWidget($export);
     }
 }