コード例 #1
0
ファイル: CoreOverview.class.php プロジェクト: ratbird/hope
 function getTabNavigation($course_id)
 {
     $object_type = get_object_type($course_id, array('sem', 'inst'));
     if ($object_type === 'sem') {
         $course = Course::find($course_id);
         $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$course->status]['class']] ?: SemClass::getDefaultSemClass();
     } else {
         $institute = Institute::find($course_id);
         $sem_class = SemClass::getDefaultInstituteClass($institute->type);
     }
     $navigation = new Navigation(_('Übersicht'));
     $navigation->setImage(Icon::create('seminar', 'info_alt'));
     $navigation->setActiveImage(Icon::create('seminar', 'info'));
     if ($object_type !== 'sem') {
         $navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/institute/overview'));
         $navigation->addSubNavigation('courses', new Navigation(_('Veranstaltungen'), 'show_bereich.php?level=s&id=' . $course_id));
         $navigation->addSubNavigation('schedule', new Navigation(_('Veranstaltungs-Stundenplan'), 'dispatch.php/calendar/instschedule?cid=' . $course_id));
         if ($GLOBALS['perm']->have_studip_perm('admin', $course_id)) {
             $navigation->addSubNavigation('admin', new Navigation(_('Administration der Einrichtung'), 'dispatch.php/institute/basicdata/index?new_inst=TRUE'));
         }
     } else {
         $navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/course/overview'));
         if (!$sem_class['studygroup_mode']) {
             $navigation->addSubNavigation('details', new Navigation(_('Details'), 'dispatch.php/course/details/'));
         }
         if (!$course->admission_binding && in_array($GLOBALS['perm']->get_studip_perm($course_id), array('user', 'autor'))) {
             $navigation->addSubNavigation('leave', new Navigation(_('Austragen aus der Veranstaltung'), 'dispatch.php/my_courses/decline/' . $course_id . '?cmd=suppose_to_kill'));
         }
     }
     return array('main' => $navigation);
 }
コード例 #2
0
ファイル: sem_classes.php プロジェクト: ratbird/hope
 public function overview_action()
 {
     Navigation::activateItem("/admin/locations/sem_classes");
     if (count($_POST) && Request::submitted('delete') && Request::get("delete_sem_class")) {
         $sem_class = $GLOBALS['SEM_CLASS'][Request::get("delete_sem_class")];
         if ($sem_class->delete()) {
             PageLayout::postMessage(MessageBox::success(_("Veranstaltungskategorie wurde gelöscht.")));
             $GLOBALS['SEM_CLASS'] = SemClass::refreshClasses();
         }
     }
     if (count($_POST) && Request::get("add_name")) {
         $statement = DBManager::get()->prepare("SELECT 1 FROM sem_classes WHERE name = :name");
         $statement->execute(array('name' => Request::get("add_name")));
         $duplicate = $statement->fetchColumn();
         if ($duplicate) {
             $message = sprintf(_("Es existiert bereits eine Veranstaltungskategorie mit dem Namen \"%s\""), Request::get("add_name"));
             PageLayout::postMessage(MessageBox::error($message));
             $this->redirect('admin/sem_classes/overview');
         } else {
             $statement = DBManager::get()->prepare("INSERT INTO sem_classes SET name = :name, mkdate = UNIX_TIMESTAMP(), chdate = UNIX_TIMESTAMP() " . "");
             $statement->execute(array('name' => Request::get("add_name")));
             $id = DBManager::get()->lastInsertId();
             if (Request::get("add_like")) {
                 $sem_class = clone $GLOBALS['SEM_CLASS'][Request::get("add_like")];
                 $sem_class->set('name', Request::get("add_name"));
                 $sem_class->set('id', $id);
                 $sem_class->store();
             }
             $this->redirect(URLHelper::getURL($this->url_for('admin/sem_classes/details'), array('id' => $id)));
             PageLayout::postMessage(MessageBox::success(_("Veranstaltungskategorie wurde erstellt.")));
             $GLOBALS['SEM_CLASS'] = SemClass::refreshClasses();
         }
     }
 }
コード例 #3
0
ファイル: Studip.php プロジェクト: ratbird/hope
 /**
  * Grundlegende Systemeinstellungen
  *
  * @get /studip/settings
  */
 public function getSettings()
 {
     $sem_types = array_map(function ($item) {
         return array('name' => $item['name'], 'class' => $item['class']);
     }, \SemType::getTypes());
     $sem_classes = array_map(function ($item) {
         $item = (array) $item;
         return reset($item);
     }, \SemClass::getClasses());
     return array('ALLOW_CHANGE_USERNAME' => $GLOBALS['ALLOW_CHANGE_USERNAME'], 'ALLOW_CHANGE_EMAIL' => $GLOBALS['ALLOW_CHANGE_EMAIL'], 'ALLOW_CHANGE_NAME' => $GLOBALS['ALLOW_CHANGE_NAME'], 'ALLOW_CHANGE_TITLE' => $GLOBALS['ALLOW_CHANGE_TITLE'], 'INST_TYPE' => $GLOBALS['INST_TYPE'], 'SEM_TYPE' => $sem_types, 'SEM_CLASS' => $sem_classes, 'TERMIN_TYP' => $GLOBALS['TERMIN_TYP'], 'PERS_TERMIN_KAT' => $GLOBALS['PERS_TERMIN_KAT'], 'SUPPORT_EMAIL' => $GLOBALS['UNI_CONTACT'], 'TITLES' => $GLOBALS['DEFAULT_TITLE_FOR_STATUS'], 'UNI_NAME_CLEAN' => $GLOBALS['UNI_NAME_CLEAN']);
 }
コード例 #4
0
ファイル: show.php プロジェクト: anantace/SeminarTabs
 public function before_filter(&$action, &$args)
 {
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox'));
     $this->course = Course::findCurrent();
     if (!$this->course) {
         throw new CheckObjectException(_('Sie haben kein Objekt gewählt.'));
     } else {
         if (Navigation::hasItem('/course/admin')) {
             Navigation::activateItem('/course/admin/seminar_tabs');
         } else {
             if (Navigation::hasItem('/admin/course/seminar_tabs')) {
                 Navigation::activateItem('/admin/course/seminar_tabs');
             }
         }
         $this->ignore_tabs = array('modules', 'mini_course');
         $this->ignore_visibility_tabs = array('admin', 'main');
         $this->course_id = $this->course->id;
         $this->sem = Seminar::getInstance($this->course_id);
         $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$this->sem->status]['class']];
         $sem_class || ($sem_class = SemClass::getDefaultSemClass());
         $this->studygroup_mode = $SEM_CLASS[$SEM_TYPE[$this->sem->status]["class"]]["studygroup_mode"];
     }
 }
コード例 #5
0
ファイル: BlubberStream.class.php プロジェクト: ratbird/hope
 /**
  * Returns all Seminar_ids to courses I am member of and in which blubber
  * is an active plugin.
  * @return array of string : array of Seminar_ids
  */
 protected function getMyCourses()
 {
     if ($GLOBALS['perm']->have_perm("admin", $this->user_id)) {
         return array();
     }
     $mandatory_classes = array();
     $standard_classes = array();
     $forbidden_classes = array();
     $mandatory_types = array();
     $standard_types = array();
     $forbidden_types = array();
     foreach (SemClass::getClasses() as $key => $class) {
         $blubber_setting = $class->getModuleMetadata("Blubber");
         if ($class->isModuleMandatory("Blubber")) {
             $mandatory_classes[] = $key;
         }
         if ($class->isSlotModule("Blubber") or $blubber_setting['activated'] && !$blubber_setting['sticky']) {
             $standard_classes[] = $key;
         }
         if (!$class->isModuleAllowed("Blubber")) {
             $forbidden_classes[] = $key;
         }
     }
     foreach (SemType::getTypes() as $key => $type) {
         if (in_array($type['class'], $mandatory_classes)) {
             $mandatory_types[] = $key;
         }
         if (in_array($type['class'], $standard_classes)) {
             $standard_types[] = $key;
         }
         if (in_array($type['class'], $forbidden_classes)) {
             $forbidden_types[] = $key;
         }
     }
     $is_deputy = get_config('DEPUTIES_ENABLE') && DBManager::get()->fetchColumn("SELECT 1 FROM deputies WHERE user_id=? LIMIT 1", array($this->user_id));
     $blubber_plugin_info = PluginManager::getInstance()->getPluginInfo('Blubber');
     $statement = DBManager::get()->prepare("\r\n            SELECT seminare.Seminar_id\r\n            FROM seminar_user\r\n                INNER JOIN seminare ON (seminare.Seminar_id = seminar_user.Seminar_id)\r\n            WHERE seminar_user.user_id = :me\r\n                AND seminare.status IN (:mandatory_types)\r\n                AND seminare.status NOT IN (:forbidden_types)\r\n\r\n            UNION DISTINCT SELECT seminare.Seminar_id\r\n            FROM seminar_user\r\n                INNER JOIN seminare ON (seminare.Seminar_id = seminar_user.Seminar_id)\r\n                INNER JOIN plugins_activated ON (pluginid = :blubber_plugin_id\r\n                    AND plugins_activated.poiid = CONCAT('sem', seminare.Seminar_id))\r\n            WHERE seminar_user.user_id = :me\r\n                AND plugins_activated.state = 'on'\r\n                AND seminare.status NOT IN (:forbidden_types)\r\n\r\n            UNION DISTINCT SELECT seminare.Seminar_id\r\n            FROM seminar_user\r\n                INNER JOIN seminare ON (seminare.Seminar_id = seminar_user.Seminar_id)\r\n                LEFT JOIN plugins_activated ON (pluginid = :blubber_plugin_id\r\n                    AND plugins_activated.poiid = CONCAT('sem', seminare.Seminar_id))\r\n            WHERE seminar_user.user_id = :me\r\n                AND plugins_activated.state IS NULL\r\n                AND seminare.status NOT IN (:forbidden_types)\r\n        ");
     $parameter = array('me' => $this->user_id);
     $parameter['mandatory_types'] = count($mandatory_types) ? $mandatory_types : null;
     $parameter['standard_types'] = count($standard_types) ? $standard_types : null;
     $parameter['forbidden_types'] = count($forbidden_types) ? $forbidden_types : array(-1);
     $parameter['blubber_plugin_id'] = $blubber_plugin_info['id'];
     $statement->execute($parameter);
     $my_courses = $statement->fetchFirst();
     if ($is_deputy) {
         $statement = DBManager::get()->prepare("SELECT deputies.range_id " . "FROM deputies " . "INNER JOIN seminare ON (seminare.Seminar_id = deputies.range_id) " . "LEFT JOIN plugins_activated ON (pluginid = :blubber_plugin_id AND plugins_activated.poiid = CONCAT('sem', seminare.Seminar_id)) " . "WHERE deputies.user_id = :me " . "AND (" . "seminare.status IN (:mandatory_types) " . "OR (plugins_activated.state = 'on') " . "OR (seminare.status IN (:standard_types) AND plugins_activated.state != 'off') " . ") " . "AND seminare.status NOT IN (:forbidden_types) " . "");
         $statement->execute($parameter);
         $my_courses = array_merge($my_courses, $statement->fetchFirst());
     }
     return $my_courses;
 }
コード例 #6
0
ファイル: basicdata.php プロジェクト: ratbird/hope
 /**
  * Zeigt die Grunddaten an. Man beachte, dass eventuell zuvor eine andere
  * Action wie Set ausgeführt wurde, von der hierher weitergeleitet worden ist.
  * Wichtige Daten dazu wurden dann über $this->flash übertragen.
  *
  * @param md5 $course_id
  */
 public function view_action($course_id = null)
 {
     global $user, $perm, $_fullname_sql;
     $deputies_enabled = get_config('DEPUTIES_ENABLE');
     //damit QuickSearch funktioniert:
     Request::set('new_doz_parameter', $this->flash['new_doz_parameter']);
     if ($deputies_enabled) {
         Request::set('new_dep_parameter', $this->flash['new_dep_parameter']);
     }
     Request::set('new_tut_parameter', $this->flash['new_tut_parameter']);
     $this->course_id = Request::option('cid', $course_id);
     Navigation::activateItem('/course/admin/details');
     //Berechtigungscheck:
     if (!$perm->have_studip_perm("tutor", $this->course_id)) {
         throw new AccessDeniedException(_("Sie haben keine Berechtigung diese " . "Veranstaltung zu verändern."));
     }
     //Kopf initialisieren:
     PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenGrunddaten");
     PageLayout::setTitle(_("Verwaltung der Grunddaten"));
     if ($this->course_id) {
         PageLayout::setTitle(Course::find($this->course_id)->getFullname() . " - " . PageLayout::getTitle());
     }
     //Daten sammeln:
     $sem = Seminar::getInstance($this->course_id);
     $data = $sem->getData();
     //Erster Reiter des Akkordions: Grundeinstellungen
     $this->attributes = array();
     $this->attributes[] = array('title' => _("Name der Veranstaltung"), 'name' => "course_name", 'must' => true, 'type' => 'text', 'value' => $data['name'], 'locked' => LockRules::Check($this->course_id, 'Name'));
     $this->attributes[] = array('title' => _("Untertitel der Veranstaltung"), 'name' => "course_subtitle", 'type' => 'text', 'value' => $data['subtitle'], 'locked' => LockRules::Check($this->course_id, 'Untertitel'));
     $sem_types = array();
     if ($perm->have_perm("admin")) {
         foreach (SemClass::getClasses() as $sc) {
             foreach ($sc->getSemTypes() as $st) {
                 if (!$sc['course_creation_forbidden']) {
                     $sem_types[$st['id']] = $st['name'] . ' (' . $sc['name'] . ')';
                 }
             }
         }
     } else {
         $sc = $sem->getSemClass();
         foreach ($sc->getSemTypes() as $st) {
             $sem_types[$st['id']] = $st['name'] . ' (' . $sc['name'] . ')';
         }
     }
     if (!isset($sem_types[$data['status']])) {
         $sem_types[$data['status']] = $sem->getSemType()->offsetGet('name');
     }
     $this->attributes[] = array('title' => _("Typ der Veranstaltung"), 'name' => "course_status", 'must' => true, 'type' => 'select', 'value' => $data['status'], 'locked' => LockRules::Check($this->course_id, 'status'), 'choices' => array_map('htmlReady', $sem_types));
     $this->attributes[] = array('title' => _("Art der Veranstaltung"), 'name' => "course_form", 'type' => 'text', 'value' => $data['form'], 'locked' => LockRules::Check($this->course_id, 'art'));
     $this->attributes[] = array('title' => _("Veranstaltungs-Nummer"), 'name' => "course_seminar_number", 'type' => 'text', 'value' => $data['seminar_number'], 'locked' => LockRules::Check($this->course_id, 'VeranstaltungsNummer'));
     $this->attributes[] = array('title' => _("ECTS-Punkte"), 'name' => "course_ects", 'type' => 'text', 'value' => $data['ects'], 'locked' => LockRules::Check($this->course_id, 'ects'));
     $this->attributes[] = array('title' => _("max. Teilnehmerzahl"), 'name' => "course_admission_turnout", 'must' => false, 'type' => 'number', 'value' => $data['admission_turnout'], 'locked' => LockRules::Check($this->course_id, 'admission_turnout'), 'min' => '0');
     $this->attributes[] = array('title' => _("Beschreibung"), 'name' => "course_description", 'type' => 'textarea', 'value' => $data['description'], 'locked' => LockRules::Check($this->course_id, 'Beschreibung'));
     //Zweiter Reiter: Institute
     $this->institutional = array();
     $institute = Institute::getMyInstitutes();
     $choices = array();
     foreach ($institute as $inst) {
         //$choices[$inst['Institut_id']] = $inst['Name'];
         $choices[$inst['Institut_id']] = ($inst['is_fak'] ? "<span style=\"font-weight: bold\">" : "&nbsp;&nbsp;&nbsp;&nbsp;") . htmlReady($inst['Name']) . ($inst['is_fak'] ? "</span>" : "");
     }
     $this->institutional[] = array('title' => _("Heimat-Einrichtung"), 'name' => "course_institut_id", 'must' => true, 'type' => 'select', 'value' => $data['institut_id'], 'choices' => $choices, 'locked' => LockRules::Check($this->course_id, 'Institut_id'));
     $institute = Institute::getInstitutes();
     $choices = array();
     foreach ($institute as $inst) {
         $choices[$inst['Institut_id']] = ($inst['is_fak'] ? "<span style=\"font-weight: bold\">" : "&nbsp;&nbsp;&nbsp;&nbsp;") . htmlReady($inst['Name']) . ($inst['is_fak'] ? "</span>" : "");
     }
     $sem_institutes = $sem->getInstitutes();
     $inst = array_flip($sem_institutes);
     unset($inst[$sem->institut_id]);
     $inst = array_flip($inst);
     $this->institutional[] = array('title' => _("beteiligte Einrichtungen"), 'name' => "related_institutes[]", 'type' => 'multiselect', 'value' => $inst, 'choices' => $choices, 'locked' => LockRules::Check($this->course_id, 'seminar_inst'));
     $this->dozent_is_locked = LockRules::Check($this->course_id, 'dozent');
     $this->tutor_is_locked = LockRules::Check($this->course_id, 'tutor');
     //Dritter Reiter: Personal
     $this->dozenten = $sem->getMembers('dozent');
     $instUsers = new SimpleCollection(InstituteMember::findByInstituteAndStatus($sem->getInstitutId(), 'dozent'));
     $this->lecturersOfInstitute = $instUsers->pluck('user_id');
     if (SeminarCategories::getByTypeId($sem->status)->only_inst_user) {
         $search_template = "user_inst_not_already_in_sem";
     } else {
         $search_template = "user_not_already_in_sem";
     }
     $this->dozentUserSearch = new PermissionSearch($search_template, sprintf(_("%s suchen"), get_title_for_status('dozent', 1, $sem->status)), "user_id", array('permission' => 'dozent', 'seminar_id' => $this->course_id, 'sem_perm' => 'dozent', 'institute' => $sem_institutes));
     $this->dozenten_title = get_title_for_status('dozent', 1, $sem->status);
     $this->deputies_enabled = $deputies_enabled;
     if ($this->deputies_enabled) {
         $this->deputies = getDeputies($this->course_id);
         $this->deputySearch = new PermissionSearch("user_not_already_in_sem_or_deputy", sprintf(_("%s suchen"), get_title_for_status('deputy', 1, $sem->status)), "user_id", array('permission' => getValidDeputyPerms(), 'seminar_id' => $this->course_id));
         $this->deputy_title = get_title_for_status('deputy', 1, $sem->status);
     }
     $this->tutoren = $sem->getMembers('tutor');
     $this->tutorUserSearch = new PermissionSearch($search_template, sprintf(_("%s suchen"), get_title_for_status('tutor', 1, $sem->status)), "user_id", array('permission' => array('dozent', 'tutor'), 'seminar_id' => $this->course_id, 'sem_perm' => array('dozent', 'tutor'), 'institute' => $sem_institutes));
     $this->tutor_title = get_title_for_status('tutor', 1, $sem->status);
     $instUsers = new SimpleCollection(InstituteMember::findByInstituteAndStatus($sem->getInstitutId(), 'tutor'));
     $this->tutorsOfInstitute = $instUsers->pluck('user_id');
     unset($instUsers);
     //Vierter Reiter: Beschreibungen (darunter Datenfelder)
     $this->descriptions[] = array('title' => _("Teilnehmde"), 'name' => "course_participants", 'type' => 'textarea', 'value' => $data['participants'], 'locked' => LockRules::Check($this->course_id, 'teilnehmer'));
     $this->descriptions[] = array('title' => _("Voraussetzungen"), 'name' => "course_requirements", 'type' => 'textarea', 'value' => $data['requirements'], 'locked' => LockRules::Check($this->course_id, 'voraussetzungen'));
     $this->descriptions[] = array('title' => _("Lernorganisation"), 'name' => "course_orga", 'type' => 'textarea', 'value' => $data['orga'], 'locked' => LockRules::Check($this->course_id, 'lernorga'));
     $this->descriptions[] = array('title' => _("Leistungsnachweis"), 'name' => "course_leistungsnachweis", 'type' => 'textarea', 'value' => $data['leistungsnachweis'], 'locked' => LockRules::Check($this->course_id, 'leistungsnachweis'));
     $this->descriptions[] = array('title' => _("Ort") . "<br><span style=\"font-size: 0.8em\"><b>" . _("Achtung:") . "&nbsp;</b>" . _("Diese Ortsangabe wird nur angezeigt, wenn keine " . "Angaben aus Zeiten oder Sitzungsterminen gemacht werden können.") . "</span>", 'name' => "course_location", 'type' => 'textarea', 'value' => $data['location'], 'locked' => LockRules::Check($this->course_id, 'Ort'));
     $datenfelder = DataFieldEntry::getDataFieldEntries($this->course_id, 'sem', $data["status"]);
     if ($datenfelder) {
         foreach ($datenfelder as $datenfeld) {
             if ($datenfeld->isVisible()) {
                 $locked = !$datenfeld->isEditable() || LockRules::Check($this->course_id, $datenfeld->getID());
                 $this->descriptions[] = array('title' => $datenfeld->getName(), 'must' => $datenfeld->isRequired(), 'name' => "datafield_" . $datenfeld->getID(), 'type' => "datafield", 'html_value' => $datenfeld->getHTML("datafields"), 'display_value' => $datenfeld->getDisplayValue(), 'locked' => $locked, 'description' => !$datenfeld->isEditable() ? "Diese Felder werden zentral durch die zuständigen Administratoren erfasst." : $datenfeld->getDescription());
             }
         }
     }
     $this->descriptions[] = array('title' => _("Sonstiges"), 'name' => "course_misc", 'type' => 'textarea', 'value' => $data['misc'], 'locked' => LockRules::Check($this->course_id, 'Sonstiges'));
     $this->perm_dozent = $perm->have_studip_perm("dozent", $this->course_id);
     $this->mkstring = $data['mkdate'] ? date("d.m.Y, G:i", $data['mkdate']) : _("unbekannt");
     $this->chstring = $data['chdate'] ? date("d.m.Y, G:i", $data['chdate']) : _("unbekannt");
     $lockdata = LockRules::getObjectRule($this->course_id);
     if ($lockdata['description'] && LockRules::CheckLockRulePermission($this->course_id, $lockdata['permission'])) {
         $this->flash['msg'] = array_merge((array) $this->flash['msg'], array(array("info", formatLinks($lockdata['description']))));
     }
     $this->flash->discard();
     //schmeißt ab jetzt unnötige Variablen aus der Session.
     $sidebar = Sidebar::get();
     $sidebar->setImage("sidebar/admin-sidebar.png");
     $widget = new ActionsWidget();
     $widget->addLink(_('Bild ändern'), $this->url_for('course/avatar/update', $course_id), Icon::create('edit', 'clickable'));
     if ($this->deputies_enabled) {
         if (isDeputy($user->id, $this->course_id)) {
             $newstatus = 'dozent';
             $text = _('Lehrende werden');
         } else {
             if (in_array($user->id, array_keys($this->dozenten)) && sizeof($this->dozenten) > 1) {
                 $newstatus = 'deputy';
                 $text = _('Vertretung werden');
             }
         }
         $widget->addLink($text, $this->url_for('course/basicdata/switchdeputy', $this->course_id, $newstatus), Icon::create('persons', 'clickable'));
     }
     $sidebar->addWidget($widget);
     // Entry list for admin upwards.
     if ($perm->have_studip_perm("admin", $this->course_id)) {
         $list = new SelectorWidget();
         $list->setUrl("?#admin_top_links");
         $list->setSelectParameterName("cid");
         foreach (AdminCourseFilter::get()->getCoursesForAdminWidget() as $seminar) {
             $list->addElement(new SelectElement($seminar['Seminar_id'], $seminar['Name']), 'select-' . $seminar['Seminar_id']);
         }
         $list->setSelection($this->course_id);
         $sidebar->addWidget($list);
     }
 }
コード例 #7
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)));
        }
    }
}
コード例 #8
0
ファイル: bootstrap.php プロジェクト: ratbird/hope
 }
 // set dummy navigation until db is ready
 Navigation::setRootNavigation(new Navigation(''));
 // set up default page layout
 PageLayout::initialize();
 //Besser hier globale Variablen definieren...
 $GLOBALS['_fullname_sql'] = array();
 $GLOBALS['_fullname_sql']['full'] = "TRIM(CONCAT(title_front,' ',Vorname,' ',Nachname,IF(title_rear!='',CONCAT(', ',title_rear),'')))";
 $GLOBALS['_fullname_sql']['full_rev'] = "TRIM(CONCAT(Nachname,', ',Vorname,IF(title_front!='',CONCAT(', ',title_front),''),IF(title_rear!='',CONCAT(', ',title_rear),'')))";
 $GLOBALS['_fullname_sql']['no_title'] = "CONCAT(Vorname ,' ', Nachname)";
 $GLOBALS['_fullname_sql']['no_title_rev'] = "CONCAT(Nachname ,', ', Vorname)";
 $GLOBALS['_fullname_sql']['no_title_short'] = "CONCAT(Nachname,', ',UCASE(LEFT(TRIM(Vorname),1)),'.')";
 $GLOBALS['_fullname_sql']['no_title_motto'] = "CONCAT(Vorname ,' ', Nachname,IF(motto!='',CONCAT(', ',motto),''))";
 $GLOBALS['_fullname_sql']['full_rev_username'] = "******";
 //Initialize $SEM_TYPE and $SEM_CLASS arrays
 $GLOBALS['SEM_CLASS'] = SemClass::getClasses();
 $GLOBALS['SEM_TYPE'] = SemType::getTypes();
 // set up global navigation
 Navigation::setRootNavigation(new StudipNavigation(''));
 /* set default umask to a sane value */
 umask(022);
 /*mail settings
   ----------------------------------------------------------------*/
 if ($GLOBALS['MAIL_TRANSPORT']) {
     $mail_transporter_name = strtolower($GLOBALS['MAIL_TRANSPORT']) . '_message';
 } else {
     $mail_transporter_name = 'smtp_message';
 }
 include 'vendor/email_message/email_message.php';
 include 'vendor/email_message/' . $mail_transporter_name . '.php';
 $mail_transporter_class = $mail_transporter_name . '_class';
コード例 #9
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);
                 }
             }
         }
     }
 }
コード例 #10
0
ファイル: new.php プロジェクト: ratbird/hope
            <?php 
echo _('Einrichtungstyp');
?>
        <? else: ?>
            <?php 
echo _('Nutzerstatus');
?>
        <? endif; ?>

        <? if ($object_typ === 'sem'): ?>
            <select name="object_class[]">
                <option value="NULL"><?php 
echo _('alle');
?>
</option>
            <? foreach (SemClass::getClasses() as $key => $val): ?>
                <option value="<?php 
echo $key;
?>
">
                    <?php 
echo htmlReady($val['name']);
?>
                </option>
            <? endforeach; ?>
        <? elseif ($object_typ === 'inst'): ?>
            <select name="object_class[]">
                <option value="NULL"><?php 
echo _('alle');
?>
</option>
コード例 #11
0
ファイル: SemType.class.php プロジェクト: ratbird/hope
 public function getClass()
 {
     return $GLOBALS['SEM_CLASS'][$this->data['class']] ?: SemClass::getDefaultSemClass();
 }
コード例 #12
0
ファイル: SemClass.class.php プロジェクト: ratbird/hope
 /**
  * Refreshes the internal $sem_classes cache-variable.
  * @return array of SemClass
  */
 public static function refreshClasses()
 {
     self::$sem_classes = null;
     return self::getClasses();
 }
コード例 #13
0
ファイル: Modules.class.php プロジェクト: ratbird/hope
 function getDefaultBinValue($range_id, $range_type = '', $type = false)
 {
     global $SEM_TYPE, $SEM_CLASS;
     $bitmask = 0;
     if (!$range_type) {
         $range_type = get_object_type($range_id, array('sem', 'inst'));
     }
     if ($type === false) {
         if ($range_type == "sem") {
             $query = "SELECT status FROM seminare WHERE Seminar_id = ?";
         } else {
             $query = "SELECT type FROM Institute WHERE Institut_id = ?";
         }
         $statement = DBManager::get()->prepare($query);
         $statement->execute(array($range_id));
         $type = $statement->fetchColumn();
     }
     if ($range_type == 'sem') {
         $sem_class = $SEM_CLASS[$SEM_TYPE[$type]['class']];
     } else {
         $sem_class = SemClass::getDefaultInstituteClass($type);
     }
     foreach ($this->registered_modules as $slot => $val) {
         if ($val[$range_type == 'sem' ? 'sem' : 'inst']) {
             if ($sem_class->isModuleActivated($sem_class->getSlotModule($slot)) && $this->checkGlobal($slot)) {
                 $this->setBit($bitmask, $val['id']);
             }
         }
     }
     return $bitmask;
 }