コード例 #1
0
ファイル: Course.php プロジェクト: ratbird/hope
 private function courseToJSON($course)
 {
     $json = array();
     $json['course_id'] = $course->id;
     $json['number'] = $course->VeranstaltungsNummer;
     $json['title'] = $course->Name;
     $json['subtitle'] = $course->Untertitel;
     $json['type'] = $course->status;
     $json['description'] = $course->Beschreibung;
     $json['location'] = $course->Ort;
     // lecturers
     foreach ($course->getMembersWithStatus('dozent') as $lecturer) {
         $url = $this->urlf('/user/%s', array(htmlReady($lecturer->user_id)));
         $json['lecturers'][$url] = User::getMiniUser($this, $lecturer->user);
     }
     // other members
     foreach (words("user autor tutor dozent") as $status) {
         $json['members'][$status] = $this->urlf('/course/%s/members?status=%s', array($course->id, $status));
         $json['members'][$status . '_count'] = $course->countMembersWithStatus($status);
     }
     foreach (words("start_semester end_semester") as $key) {
         $json[$key] = $course->{$key} ? $this->urlf('/semester/%s', array(htmlReady($course->{$key}->id))) : null;
     }
     $modules = new \Modules();
     $activated = $modules->getLocalModules($course->id, 'sem');
     $json['modules'] = array();
     foreach (array('forum' => 'forum_categories', 'documents' => 'files', 'wiki' => 'wiki') as $module => $uri) {
         if ($activated[$module]) {
             $json['modules'][$module] = $this->urlf('/course/%s/%s', array(htmlReady($course->id), $uri));
         }
     }
     return $json;
 }
コード例 #2
0
ファイル: my_courses.php プロジェクト: ratbird/hope
 /**
  * TODO: Caching
  * @param string $type
  * @param string $sem
  */
 public function tabularasa_action($sem = 'all', $timestamp = null)
 {
     NotificationCenter::postNotification('OverviewWillClear', $GLOBALS['user']->id);
     $timestamp = $timestamp ?: time();
     $deputies_enabled = Config::get()->DEPUTIES_ENABLE;
     $semesters = MyRealmModel::getSelectedSemesters($sem);
     $min_sem_key = min($semesters);
     $max_sem_key = max($semesters);
     $courses = MyRealmModel::getCourses($min_sem_key, $max_sem_key, compact('deputies_enabled'));
     $courses = $courses->toArray('seminar_id modules status');
     $modules = new Modules();
     foreach ($courses as $index => $course) {
         $courses[$index]['modules'] = $modules->getLocalModules($course['seminar_id'], 'sem', $course['modules'], $course['status']);
         $courses[$index]['obj_type'] = 'sem';
         MyRealmModel::setObjectVisits($courses[$index], $course['seminar_id'], $GLOBALS['user']->id, $timestamp);
     }
     NotificationCenter::postNotification('OverviewDidClear', $GLOBALS['user']->id);
     $this->flash['tabularasa'] = $timestamp;
     $this->redirect('my_courses/index');
 }
コード例 #3
0
ファイル: studygroup.php プロジェクト: ratbird/hope
 /**
  * updates studygroups with respect to the corresponding form data
  *
  * @param string id of a studygroup
  *
  * @return void
  */
 function update_action($id)
 {
     global $perm;
     // if we are permitted to edit the studygroup get some data...
     if ($perm->have_studip_perm('dozent', $id)) {
         $errors = array();
         $admin = $perm->have_studip_perm('admin', $id);
         $founders = StudygroupModel::getFounders($id);
         $sem = new Seminar($id);
         $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$sem->status]['class']];
         CSRFProtection::verifyUnsafeRequest();
         if (Request::get('abort_deactivate')) {
             // let's do nothing and go back to the studygroup
             return $this->redirect('course/studygroup/edit/' . $id);
         } else {
             if (Request::get('really_deactivate')) {
                 $modules = Request::optionArray('deactivate_modules');
                 $plugins = Request::optionArray('deactivate_plugins');
                 // really deactive modules
                 // 1. Modules
                 if (is_array($modules)) {
                     $mods = new Modules();
                     $admin_mods = new AdminModules();
                     $bitmask = $sem->modules;
                     foreach ($modules as $key) {
                         $module_name = $sem_class->getSlotModule($key);
                         if ($module_name && ($sem_class->isModuleMandatory($module_name) || !$sem_class->isModuleAllowed($module_name))) {
                             continue;
                         }
                         $mods->clearBit($bitmask, $mods->registered_modules[$key]["id"]);
                         $methodDeactivate = "module" . ucfirst($key) . "Deactivate";
                         if (method_exists($admin_mods, $methodDeactivate)) {
                             $admin_mods->{$methodDeactivate}($sem->id);
                             $studip_module = $sem_class->getModule($key);
                             if (is_a($studip_module, "StandardPlugin")) {
                                 PluginManager::getInstance()->setPluginActivated($studip_module->getPluginId(), $id, false);
                             }
                         }
                     }
                     $sem->modules = $bitmask;
                     $sem->store();
                 }
                 // 2. Plugins
                 if (is_array($plugins)) {
                     $plugin_manager = PluginManager::getInstance();
                     $available_plugins = StudygroupModel::getInstalledPlugins();
                     foreach ($plugins as $class) {
                         $plugin = $plugin_manager->getPlugin($class);
                         // Deaktiviere Plugin
                         if ($available_plugins[$class] && !$sem_class->isModuleMandatory($class) && !$sem_class->isSlotModule($class)) {
                             $plugin_manager->setPluginActivated($plugin->getPluginId(), $id, false);
                         }
                     }
                 }
                 // Success message
                 $this->flash['success'] .= _("Inhaltselement(e) erfolgreich deaktiviert.");
                 return $this->redirect('course/studygroup/edit/' . $id);
             } else {
                 if (Request::submitted('replace_founder')) {
                     // retrieve old founder
                     $old_dozent = current(StudygroupModel::getFounder($id));
                     // remove old founder
                     StudygroupModel::promote_user($old_dozent['uname'], $id, 'tutor');
                     // add new founder
                     $new_founder = Request::option('choose_founder');
                     StudygroupModel::promote_user(get_username($new_founder), $id, 'dozent');
                     //checks
                 } else {
                     // test whether we have a group name...
                     if (!Request::get('groupname')) {
                         $errors[] = _("Bitte Gruppennamen angeben");
                         //... if so, test if this is not taken by another group
                     } else {
                         $query = "SELECT 1 FROM seminare WHERE name = ? AND Seminar_id != ?";
                         $statement = DBManager::get()->prepare($query);
                         $statement->execute(array(Request::get('groupname'), $id));
                         if ($statement->fetchColumn()) {
                             $errors[] = _("Eine Veranstaltung/Studiengruppe mit diesem Namen existiert bereits. Bitte wählen Sie einen anderen Namen");
                         }
                     }
                     if (count($errors)) {
                         $this->flash['errors'] = $errors;
                         $this->flash['edit'] = true;
                         // Everything seems fine, let's update the studygroup
                     } else {
                         $sem->name = Request::get('groupname');
                         // seminar-class quotes itself
                         $sem->description = Request::get('groupdescription');
                         // seminar-class quotes itself
                         $sem->read_level = 1;
                         $sem->write_level = 1;
                         $sem->visible = 1;
                         if (Request::get('groupaccess') == 'all') {
                             $sem->admission_prelim = 0;
                         } else {
                             $sem->admission_prelim = 1;
                             if (Config::get()->STUDYGROUPS_INVISIBLE_ALLOWED && Request::get('groupaccess') == 'invisible') {
                                 $sem->visible = 0;
                             }
                             $sem->admission_prelim_txt = _("Die ModeratorInnen der Studiengruppe können Ihren Aufnahmewunsch bestätigen oder ablehnen. Erst nach Bestätigung erhalten Sie vollen Zugriff auf die Gruppe.");
                         }
                         // get the current bitmask
                         $mods = new Modules();
                         $admin_mods = new AdminModules();
                         $bitmask = $sem->modules;
                         // de-/activate modules
                         $available_modules = StudygroupModel::getInstalledModules();
                         $orig_modules = $mods->getLocalModules($sem->id, "sem");
                         $active_plugins = Request::getArray("groupplugin");
                         $deactivate_modules = array();
                         foreach (array_keys($available_modules) as $key) {
                             $module_name = $sem_class->getSlotModule($key);
                             if (!$module_name || $module_name && ($sem_class->isModuleMandatory($module_name) || !$sem_class->isModuleAllowed($module_name))) {
                                 continue;
                             }
                             if (!$module_name) {
                                 $module_name = $key;
                             }
                             if ($active_plugins[$module_name]) {
                                 // activate modules
                                 $mods->setBit($bitmask, $mods->registered_modules[$key]["id"]);
                                 if (!$orig_modules[$key]) {
                                     $methodActivate = "module" . ucfirst($key) . "Activate";
                                     if (method_exists($admin_mods, $methodActivate)) {
                                         $admin_mods->{$methodActivate}($sem->id);
                                         $studip_module = $sem_class->getModule($key);
                                         if (is_a($studip_module, "StandardPlugin")) {
                                             PluginManager::getInstance()->setPluginActivated($studip_module->getPluginId(), $id, true);
                                         }
                                     }
                                 }
                             } else {
                                 // prepare for deactivation
                                 // (user will have to confirm)
                                 if ($orig_modules[$key]) {
                                     $deactivate_modules[] = $key;
                                 }
                             }
                         }
                         $this->flash['deactivate_modules'] = $deactivate_modules;
                         $sem->modules = $bitmask;
                         $sem->store();
                         // de-/activate plugins
                         $available_plugins = StudygroupModel::getInstalledPlugins();
                         $plugin_manager = PluginManager::getInstance();
                         $deactivate_plugins = array();
                         foreach ($available_plugins as $key => $name) {
                             $plugin = $plugin_manager->getPlugin($key);
                             $plugin_id = $plugin->getPluginId();
                             if ($active_plugins[$key] && $name && $sem_class->isModuleAllowed($key)) {
                                 $plugin_manager->setPluginActivated($plugin_id, $id, true);
                             } else {
                                 if ($plugin_manager->isPluginActivated($plugin_id, $id) && !$sem_class->isSlotModule($key)) {
                                     $deactivate_plugins[$plugin_id] = $key;
                                 }
                             }
                         }
                         $this->flash['deactivate_plugins'] = $deactivate_plugins;
                     }
                 }
             }
         }
     }
     if (!$this->flash['errors'] && !$deactivate_modules && !$deactivate_plugins) {
         // Everything seems fine
         $this->flash['success'] = _("Die Änderungen wurden erfolgreich übernommen.");
     }
     // let's go to the studygroup
     $this->redirect('course/studygroup/edit/' . $id);
 }
コード例 #4
0
ファイル: functions.php プロジェクト: ratbird/hope
/**
 * This function checks, if given old style module "wiki","scm" (not "CoreWiki") etc.
 * is allowed in this stud.ip-object.
 *
 * @global array $SessSemName
 *
 * @param string $module the module to check for
 *
 * @return void
 */
function checkObjectModule($module)
{
    global $SessSemName;
    if ($SessSemName[1]) {
        $modules = new Modules();
        $local_modules = $modules->getLocalModules($SessSemName[1], $SessSemName['class']);
        $checkslot = $module;
        if ($SessSemName['class'] == 'sem' && $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$SessSemName['art_num']]['class']]) {
            $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$SessSemName['art_num']]['class']];
            $new_module_name = "Core" . ucfirst($module);
            $mandatory = false;
            foreach (SemClass::getSlots() as $slot) {
                if ($sem_class->getSlotModule($slot) === $new_module_name) {
                    $checkslot = $slot;
                    if ($sem_class->isModuleMandatory($new_module_name)) {
                        $mandatory = true;
                    }
                }
            }
        }
        if (!$local_modules[$checkslot] && !$mandatory) {
            throw new CheckObjectException(sprintf(_('Das Inhaltselement "%s" ist f�r dieses Objekt leider nicht verf�gbar.'), ucfirst($module)));
        }
    }
}
コード例 #5
0
ファイル: courses.php プロジェクト: ratbird/hope
 /**
  * Returns all courses matching set criteria.
  *
  * @param Array $params Additional parameters
  * @return Array of courses
  */
 private function getCourses($params = array())
 {
     // Init
     if ($GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT === "all") {
         $inst = new SimpleCollection($this->insts);
         $inst->filter(function ($a) use(&$inst_ids) {
             $inst_ids[] = $a->Institut_id;
         });
     } else {
         $institut = new Institute($GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT);
         $inst_ids[] = $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT;
         if ($institut->isFaculty()) {
             foreach ($institut->sub_institutes->pluck("Institut_id") as $institut_id) {
                 $inst_ids[] = $institut_id;
             }
         }
     }
     $filter = AdminCourseFilter::get(true);
     $filter->where("sem_classes.studygroup_mode = '0'");
     if (is_object($this->semester)) {
         $filter->filterBySemester($this->semester->getId());
     }
     if ($params['typeFilter'] && $params['typeFilter'] !== "all") {
         list($class_filter, $type_filter) = explode('_', $params['typeFilter']);
         if (!$type_filter && !empty($GLOBALS['SEM_CLASS'][$class_filter])) {
             $type_filter = array_keys($GLOBALS['SEM_CLASS'][$class_filter]->getSemTypes());
         }
         $filter->filterByType($type_filter);
     }
     if ($GLOBALS['user']->cfg->ADMIN_COURSES_SEARCHTEXT) {
         $filter->filterBySearchString($GLOBALS['user']->cfg->ADMIN_COURSES_SEARCHTEXT);
     }
     if ($GLOBALS['user']->cfg->ADMIN_COURSES_TEACHERFILTER && $GLOBALS['user']->cfg->ADMIN_COURSES_TEACHERFILTER !== "all") {
         $filter->filterByDozent($GLOBALS['user']->cfg->ADMIN_COURSES_TEACHERFILTER);
     }
     $filter->filterByInstitute($inst_ids);
     if ($params['sortby'] === "status") {
         $filter->orderBy(sprintf('sem_classes.name %s, sem_types.name %s, VeranstaltungsNummer', $params['sortFlag'], $params['sortFlag'], $params['sortFlag']), $params['sortFlag']);
     } elseif ($params['sortby'] === 'completion') {
         $filter->orderBy('is_complete', $params['sortFlag']);
     } elseif ($params['sortby']) {
         $filter->orderBy($params['sortby'], $params['sortFlag']);
     }
     $filter->storeSettings();
     $this->count_courses = $filter->countCourses();
     if ($this->count_courses && $this->count_courses <= $filter->max_show_courses) {
         $courses = $filter->getCourses();
     } else {
         return array();
     }
     if (in_array('contents', $params['view_filter'])) {
         $sem_types = SemType::getTypes();
         $modules = new Modules();
     }
     $seminars = array_map('reset', $courses);
     if (!empty($seminars)) {
         foreach ($seminars as $seminar_id => $seminar) {
             $dozenten = $this->getTeacher($seminar_id);
             $seminars[$seminar_id]['dozenten'] = $dozenten;
             if (in_array('teachers', $params['view_filter'])) {
                 if (SeminarCategories::getByTypeId($seminar['status'])->only_inst_user) {
                     $search_template = "user_inst_not_already_in_sem";
                 } else {
                     $search_template = "user_not_already_in_sem";
                 }
                 $sem_helper = new Seminar(Course::buildExisting($seminar));
                 $dozentUserSearch = new PermissionSearch($search_template, sprintf(_("%s suchen"), get_title_for_status('dozent', 1, $seminar['status'])), "user_id", array('permission' => 'dozent', 'seminar_id' => $this->course_id, 'sem_perm' => 'dozent', 'institute' => $sem_helper->getInstitutes()));
                 $seminars[$seminar_id]['teacher_search'] = MultiPersonSearch::get("add_member_dozent" . $seminar_id)->setTitle(_('Mehrere Lehrende hinzufügen'))->setSearchObject($dozentUserSearch)->setDefaultSelectedUser(array_keys($dozenten))->setDataDialogStatus(Request::isXhr())->setExecuteURL(URLHelper::getLink('dispatch.php/course/basicdata/add_member/' . $seminar_id, array('from' => 'admin/courses')));
             }
             if (in_array('contents', $params['view_filter'])) {
                 $seminars[$seminar_id]['sem_class'] = $sem_types[$seminar['status']]->getClass();
                 $seminars[$seminar_id]['modules'] = $modules->getLocalModules($seminar_id, 'sem', $seminar['modules'], $seminar['status']);
                 $seminars[$seminar_id]['navigation'] = MyRealmModel::getAdditionalNavigations($seminar_id, $seminars[$seminar_id], $seminars[$seminar_id]['sem_class'], $GLOBALS['user']->id);
             }
             if ($this->selected_action == 17) {
                 $seminars[$seminar_id]['admission_locked'] = false;
                 if ($seminar['course_set']) {
                     $set = new CourseSet($seminar['course_set']);
                     if (!is_null($set) && $set->hasAdmissionRule('LockedAdmission')) {
                         $seminars[$seminar_id]['admission_locked'] = 'locked';
                     } else {
                         $seminars[$seminar_id]['admission_locked'] = 'disable';
                     }
                     unset($set);
                 }
             }
         }
     }
     return $seminars;
 }
コード例 #6
0
ファイル: Seminar.class.php プロジェクト: ratbird/hope
 /**
  * returns StudipModule object for given slot, null when deactivated or not available
  *
  * @param string $slot
  * @return StudipModule
  */
 public function getSlotModule($slot)
 {
     $m = new Modules();
     $activated_slots = array_filter($m->getLocalModules($this->id, 'sem', $this->modules, $this->status));
     if (isset($activated_slots[$slot])) {
         $module = $this->getSemClass()->getSlotModule($slot);
         if (is_subclass_of($module, 'StudIPPlugin')) {
             return PluginManager::getInstance()->getPlugin($module);
         } else {
             return new $module();
         }
     }
 }
コード例 #7
0
ファイル: basicdata.php プロジェクト: ratbird/hope
 /**
  * Stores the changed or created institute data
  *
  * @param String $i_id Institute id or 'new' to create
  * @throws MethodNotAllowedException
  */
 public function store_action($i_id)
 {
     // We won't accept anything but a POST request
     if (!Request::isPost()) {
         throw new MethodNotAllowedException();
     }
     $create_institute = $i_id === 'new';
     $institute = new Institute($create_institute ? null : $i_id);
     $institute->name = trim(Request::get('Name', $institute->name));
     $institute->fakultaets_id = Request::option('Fakultaet', $institute->fakultaets_id);
     $institute->strasse = Request::get('strasse', $institute->strasse);
     // Beware: Despite the name, this contains both zip code AND city name
     $institute->plz = Request::get('plz', $institute->plz);
     $institute->url = Request::get('home', $institute->url);
     $institute->telefon = Request::get('telefon', $institute->telefon);
     $institute->email = Request::get('email', $institute->email);
     $institute->fax = Request::get('fax', $institute->fax);
     $institute->type = Request::int('type', $institute->type);
     $institute->lit_plugin_name = Request::get('lit_plugin_name', $institute->lit_plugin_name);
     $institute->lock_rule = Request::option('lock_rule', $institute->lock_rule);
     // Do we have all necessary data?
     if (!$institute->name) {
         PageLayout::postMessage(MessageBox::error(_('Bitte geben Sie eine Bezeichnung für die Einrichtung ein!')));
         return $this->redirect('institute/basicdata/index/' . $i_id);
     }
     if ($create_institute) {
         $institute->id = $institute->getNewId();
         // Is the user allowed to create new faculties
         if (!$institute->fakultaets_id && !$GLOBALS['perm']->have_perm('root')) {
             PageLayout::postMessage(MessageBox::error(_('Sie haben nicht die Berechtigung, neue Fakultäten zu erstellen')));
             return $this->redirect('institute/basicdata/index/new');
         }
         // Is the user allowed to create new institutes
         if (!$GLOBALS['perm']->have_perm('root') && !($GLOBALS['perm']->is_fak_admin() && get_config('INST_FAK_ADMIN_PERMS') !== 'none')) {
             PageLayout::postMessage(MessageBox::error(_('Sie haben nicht die Berechtigung, um neue Einrichtungen zu erstellen!')));
             return $this->redirect('institute/basicdata/index/new');
         }
         // Does an institute with the given name already exist in the given faculty?
         if ($institute->fakultaets_id && Institute::findOneBySQL('Name = ? AND fakultaets_id = ?', array($institute->name, $institute->fakultaets_id)) !== null) {
             $message = sprintf(_('Die Einrichtung "%s" existiert bereits innerhalb der angegebenen Fakultät!'), $institute->name);
             PageLayout::postMessage(MessageBox::error($message));
             return $this->redirect('institute/basicdata/index/new');
         }
         // Does a faculty with the given name already exist
         if (!$institute->fakultaets_id && Institute::findOneBySQL('Name = ? AND fakultaets_id = Institut_id', array($institute->name)) !== null) {
             $message = sprintf(_('Die Fakultät "%s" existiert bereits!'), $institute->name);
             PageLayout::postMessage(MessageBox::error($message));
             return $this->redirect('institute/basicdata/index/new');
         }
         // Initialize modules
         $modules = new Modules();
         $institute->modules = $modules->getDefaultBinValue('', 'inst', $institute->type);
         // Declare faculty status if neccessary
         if (!$institute->fakultaets_id) {
             $institute->fakultaets_id = $institute->getId();
         }
     } else {
         // Is the user allowed to change the institute/faculty?
         if (!$GLOBALS['perm']->have_studip_perm('admin', $institute->id)) {
             PageLayout::postMessage(MessageBox::error(_('Sie haben nicht die Berechtigung diese Einrichtung zu verändern!')));
             return $this->redirect('institute/basicdata/index/' . $institute->id);
         }
         // Save datafields
         $datafields = Request::getArray('datafields');
         $invalidEntries = array();
         $datafields_stored = 0;
         foreach (DataFieldEntry::getDataFieldEntries($institute->id, 'inst') as $entry) {
             if (isset($datafields[$entry->getId()])) {
                 $valueBefore = $entry->getValue();
                 $entry->setValueFromSubmit($datafields[$entry->getId()]);
                 if ($valueBefore != $entry->getValue()) {
                     if ($entry->isValid()) {
                         $datafields_stored += 1;
                         $entry->store();
                     } else {
                         $invalidEntries[] = $entry->getId();
                     }
                 }
             }
         }
         // If any errors occured while updating the datafields, report them
         if (count($invalidEntries) > 0) {
             $this->flash['invalid_entries'] = $invalidEntries;
             PageLayout::postMessage(MessageBox::error(_('ungültige Eingaben (s.u.) wurden nicht gespeichert')));
         }
     }
     // Try to store the institute, report any errors
     if ($institute->isDirty() && !$institute->store()) {
         if ($institute->isNew()) {
             PageLayout::postMessage(MessageBox::error(_('Die Einrichtung konnte nicht angelegt werden.')));
         } else {
             PageLayout::postMessage(MessageBox::error(_('Die Änderungen konnten nicht gespeichert werden.')));
         }
         return $this->redirect('institute/basicdata/index/' . $i_id);
     }
     if ($create_institute) {
         // Log creation of institute
         log_event('INST_CREATE', $institute->id, null, null, '');
         // logging
         // Further initialize modules (the modules class setup is in
         // no way expensive, so it can be constructed twice, don't worry)
         $modules = new Modules();
         $module_list = $modules->getLocalModules($institute->id, 'inst', $institute->modules, $institute->type);
         if (isset($module_list['documents'])) {
             create_folder(_('Allgemeiner Dateiordner'), _('Ablage für allgemeine Ordner und Dokumente der Einrichtung'), $institute->id, 7, $institute->id);
         }
         // Report success
         $message = sprintf(_('Die Einrichtung "%s" wurde erfolgreich angelegt.'), $institute->name);
         PageLayout::postMessage(MessageBox::success($message));
         openInst($institute->id);
     } else {
         // Report success
         $message = sprintf(_('Die Änderung der Einrichtung "%s" wurde erfolgreich gespeichert.'), htmlReady($institute->name));
         PageLayout::postMessage(MessageBox::success($message));
     }
     $this->redirect('institute/basicdata/index/' . $institute->id, array('cid' => $institute->id));
 }
コード例 #8
0
ファイル: CourseNavigation.php プロジェクト: ratbird/hope
 /**
  * Initialize the subnavigation of this item. This method
  * is called once before the first item is added or removed.
  */
 public function initSubNavigation()
 {
     global $SEM_CLASS, $SEM_TYPE;
     global $SessSemName, $user;
     parent::initSubNavigation();
     // list of used modules
     $Modules = new Modules();
     $modules = $Modules->getLocalModules($SessSemName[1], $SessSemName['class'], false, $SessSemName['art_num']);
     if ($SessSemName['class'] === 'sem') {
         $sem_class = $SEM_CLASS[$SEM_TYPE[$SessSemName['art_num']]['class']] ?: SemClass::getDefaultSemClass();
     } else {
         $sem_class = SemClass::getDefaultInstituteClass($SessSemName['art_num']);
     }
     // general information
     if (($modules['overview'] || $sem_class->isSlotMandatory("overview")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("overview"))) {
         foreach ($sem_class->getNavigationForSlot("overview") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // admin area
     if (($modules['admin'] || $sem_class->isSlotMandatory("admin")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("admin"))) {
         foreach ($sem_class->getNavigationForSlot("admin") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // forum
     if (($modules['forum'] || $sem_class->isSlotMandatory("forum")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("forum"))) {
         foreach ($sem_class->getNavigationForSlot("forum") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // participants
     if ($user->id != 'nobody') {
         if ($modules['personal']) {
             $navigation = new Navigation(_('Personal'));
             $navigation->setImage(Icon::create('persons', 'info_alt'));
             $navigation->setActiveImage(Icon::create('persons', 'info'));
             $navigation->addSubNavigation('view', new Navigation(_('MitarbeiterInnen'), 'dispatch.php/institute/members'));
             if ($GLOBALS['perm']->have_studip_perm('tutor', $_SESSION['SessionSeminar']) && $GLOBALS['perm']->have_perm('admin')) {
                 $navigation->addSubNavigation('edit_groups', new Navigation(_('Funktionen / Gruppen verwalten'), 'dispatch.php/admin/statusgroups'));
             }
             $this->addSubNavigation('faculty', $navigation);
         }
         if (($modules['participants'] || $sem_class->isSlotMandatory("participants")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("participants"))) {
             foreach ($sem_class->getNavigationForSlot("participants") as $nav_name => $navigation) {
                 if ($nav_name && is_a($navigation, "Navigation")) {
                     $this->addSubNavigation($nav_name, $navigation);
                 }
             }
         }
     }
     // files
     if (($modules['documents'] || $sem_class->isSlotMandatory("documents")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("documents"))) {
         foreach ($sem_class->getNavigationForSlot("documents") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // schedule
     if (($modules['schedule'] || $sem_class->isSlotMandatory("schedule")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("schedule"))) {
         foreach ($sem_class->getNavigationForSlot("schedule") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // information page
     if (($modules['scm'] || $sem_class->isSlotMandatory("scm")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("scm"))) {
         foreach ($sem_class->getNavigationForSlot("scm") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // literature
     if (($modules['literature'] || $sem_class->isSlotMandatory("literature")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("literature"))) {
         foreach ($sem_class->getNavigationForSlot("literature") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // wiki
     if (($modules['wiki'] || $sem_class->isSlotMandatory("wiki")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("wiki"))) {
         foreach ($sem_class->getNavigationForSlot("wiki") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // resources
     if (($modules['resources'] || $sem_class->isSlotMandatory("resources")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("resources"))) {
         foreach ($sem_class->getNavigationForSlot("resources") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // calendar
     if (($modules['calendar'] || $sem_class->isSlotMandatory("calendar")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("calendar"))) {
         foreach ($sem_class->getNavigationForSlot("calendar") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // content modules
     if (($modules['elearning_interface'] || $sem_class->isSlotMandatory("elearning_interface")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("elearning_interface"))) {
         foreach ($sem_class->getNavigationForSlot("elearning_interface") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     //plugins
     $standard_plugins = PluginManager::getInstance()->getPlugins("StandardPlugin", $_SESSION['SessionSeminar']);
     foreach ($standard_plugins as $plugin) {
         if (!$sem_class->isSlotModule(get_class($plugin))) {
             foreach ($sem_class->getNavigationForSlot(get_class($plugin)) as $nav_name => $navigation) {
                 if ($nav_name && is_a($navigation, "Navigation")) {
                     $this->addSubNavigation($nav_name, $navigation);
                 }
             }
         }
     }
 }
コード例 #9
0
ファイル: my_realm.php プロジェクト: ratbird/hope
 public static function getStudygroups()
 {
     $courses = array();
     $modules = new Modules();
     $studygroups = User::findCurrent()->course_memberships->filter(function ($c) {
         return $c->course->getSemClass()->offsetGet('studygroup_mode');
     })->toGroupedArray('seminar_id');
     $param_array = 'name seminar_id visible veranstaltungsnummer start_time duration_time status visible ';
     $param_array .= 'chdate admission_binding modules admission_prelim';
     $courses = Course::findAndMapMany(function ($course) use($param_array, $studygroups, $modules) {
         $ret = $course->toArray($param_array);
         $ret['sem_class'] = $course->getSemClass();
         $ret['start_semester'] = $course->start_semester->name;
         $ret['end_semester'] = $course->end_semester->name;
         $ret['obj_type'] = 'sem';
         $ret['last_visitdate'] = object_get_visit($course->id, 'sem', 'last');
         $ret['visitdate'] = object_get_visit($course->id, 'sem', '');
         $ret['user_status'] = $studygroups[$course->id]['status'];
         $ret['gruppe'] = $studygroups[$course->id]['gruppe'];
         $ret['modules'] = $modules->getLocalModules($course->id, 'sem', $course->modules, $course->status);
         MyRealmModel::getObjectValues($ret);
         return $ret;
     }, array_keys($studygroups));
     return $courses;
 }
コード例 #10
0
ファイル: seminar_main.php プロジェクト: ratbird/hope
    object_set_visit($course_id, "sem");
}
// gibt es eine Anweisung zur Umleitung?
if (Request::get('redirect_to')) {
    $query_parts = explode('&', stristr(urldecode($_SERVER['QUERY_STRING']), 'redirect_to'));
    list(, $where_to) = explode('=', array_shift($query_parts));
    $new_query = $where_to . '?' . join('&', $query_parts);
    $new_query = preg_replace('/[^:0-9a-z+_\\-.#?&=\\/]/i', '', $new_query);
    header('Location: ' . URLHelper::getURL($new_query, array('cid' => $course_id)));
    die;
}
$sem_class = Seminar::getInstance($course_id)->getSemClass();
if ($sem_class->getSlotModule("overview")) {
    foreach ($sem_class->getNavigationForSlot("overview") as $nav) {
        header('Location: ' . URLHelper::getURL($nav->getURL()));
        die;
    }
} else {
    $Modules = new Modules();
    $course_modules = $Modules->getLocalModules($course_id);
    if (!$course_modules['overview'] && !$sem_class->isSlotMandatory("overview")) {
        //Keine Übersichtsseite. Anstatt eines Fehler wird der Nutzer zum ersten
        //Reiter der Veranstaltung weiter geleitet.
        if (Navigation::hasItem("/course")) {
            foreach (Navigation::getItem("/course")->getSubNavigation() as $navigation) {
                header('Location: ' . URLHelper::getURL($navigation->getURL()));
                die;
            }
        }
    }
}