/** * Initializes the controller. * * @param string $action Action to execute * @param array $args Passed parameters */ public function before_filter(&$action, &$args) { parent::before_filter($action, $args); if (!Config::get()->ENABLE_FREE_ACCESS) { throw new AccessDeniedException(_('Öffentliche Veranstaltungen sind nicht aktiviert.')); } Navigation::activateItem('/browse'); PageLayout::setTitle(_('Öffentliche Veranstaltungen')); PageLayout::setHelpKeyword('Basis.SymboleFreieVeranstaltungen'); // we are definitely not in an lexture or institute closeObject(); }
public function before_filter(&$action, &$args) { parent::before_filter($action, $args); if ($GLOBALS['perm']->have_perm('admin')) { $this->redirect('admin/courses/index'); return; } // we are defintely not in an lecture or institute closeObject(); $_SESSION['links_admin_data'] = ''; // measure performance of #index_action if ($action === 'index') { $this->performance_timer = Metrics::startTimer(); } }
/** * Common tasks for all actions * * @param String $action Called action * @param Array $args Possible arguments */ public function before_filter(&$action, &$args) { parent::before_filter($action, $args); if (!$GLOBALS['perm']->have_perm('admin')) { throw new AccessDeniedException(); } Navigation::activateItem('/browse/my_courses/list'); // we are defintely not in an lecture or institute closeObject(); //delete all temporary permission changes if (is_array($_SESSION)) { foreach (array_keys($_SESSION) as $key) { if (strpos($key, 'seminar_change_view_') !== false) { unset($_SESSION[$key]); } } } $this->insts = Institute::getMyInstitutes($GLOBALS['user']->id); if (empty($this->insts) && !$GLOBALS['perm']->have_perm('root')) { PageLayout::postMessage(MessageBox::error(_('Sie wurden noch keiner Einrichtung zugeordnet'))); } if (!$GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT) { $GLOBALS['user']->cfg->store('MY_INSTITUTES_DEFAULT', $this->insts[0]['Institut_id']); } // Semester selection if ($GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE) { $this->semester = Semester::find($GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE); } if (Request::submitted("search") || Request::get("reset-search")) { $GLOBALS['user']->cfg->store('ADMIN_COURSES_SEARCHTEXT', Request::get("search")); } if (Request::submitted("teacher_filter")) { $GLOBALS['user']->cfg->store('ADMIN_COURSES_TEACHERFILTER', Request::option("teacher_filter")); } PageLayout::setHelpKeyword("Basis.Veranstaltungen"); PageLayout::setTitle(_("Verwaltung von Veranstaltungen und Einrichtungen")); Sidebar::Get()->setTitle(_('Veranstaltungsadministration')); PageLayout::addSqueezePackage('raumzeit'); // Add admission functions. PageLayout::addSqueezePackage('admission'); }
closeStructure ($resource_id, $root_id, $level + 1); } } /***************************************************************************** handle the view-logic /*****************************************************************************/ //got a fresh session? if ((!$view && !$quick_view && !isset($_SESSION['resources_data']['view'])) || ( sizeof($_POST) == 0 && sizeof($_GET) == 0 && (!isset($_SESSION['resources_data']['view']) || $_SESSION['resources_data']['view_mode'] == 'oobj' || $_SESSION['resources_data']['view_mode'] == 'search') ) ) { $_SESSION['resources_data']=''; $_SESSION['resources_data']["view"]="search"; $_SESSION['resources_data']["view_mode"]=FALSE; closeObject(); } //get views/view_modes if ($view) $_SESSION['resources_data']["view"]=$view; else //or we take back the persistant view from $_SESSION['resources_data'] $view = $_SESSION['resources_data']["view"]; if ($view_mode) $_SESSION['resources_data']["view_mode"]=$view_mode; else //or... see above ;) $view_mode = $_SESSION['resources_data']["view_mode"]; if (strpos($view, "openobject") !== FALSE) { $_SESSION['resources_data']["view_mode"] = "oobj";
/** * displays a form for creating studygroups * * @return void */ function new_action() { PageLayout::setHelpKeyword('Basis.StudiengruppenAnlegen'); closeObject(); PageLayout::setTitle(_("Studiengruppe anlegen")); Navigation::activateItem('/community/studygroups/new'); $this->terms = Config::Get()->STUDYGROUP_TERMS; $this->available_modules = StudygroupModel::getInstalledModules(); $this->available_plugins = StudygroupModel::getInstalledPlugins(); $this->modules = new Modules(); $this->groupaccess = $this->flash['request']['groupaccess']; foreach ($GLOBALS['SEM_CLASS'] as $key => $sem_class) { if ($sem_class['studygroup_mode']) { $this->sem_class = $sem_class; break; } } }
/** * This function "selects" an Einrichtung to work with it * * Note: Stud.IP treats Einrichtungen like Veranstaltungen, yu can see this * especially if you look at the variable names.... * * The following variables will bet set: * $SessionSeminar Einrichtung id<br> * $SessSemName[0] Einrichtung name<br> * $SessSemName[1] Einrichtung id<br> * $SessSemName["art"] Einrichtung type in alphanumeric form<br> * $SessSemName["art_num"] Einrichtung type in numeric form<br> * $SessSemName["art_generic"] Einrichtung generic type in alhanumeric form (self description)<br> * $SessSemName["class"] Einrichtung class (sem or inst, in this function always inst)<br> * $SessSemName["header_line"] the header-line to use on every page of the Einrichtung<br> * * @param string $inst_id the id of the Veranstaltung * * @return boolean true if successful * */ function selectInst($inst_id) { global $SessionSeminar, $SessSemName, $INST_TYPE, $SemUserStatus, $rechte, $perm, $auth; closeObject(); if (!get_config('ENABLE_FREE_ACCESS') && !$perm->have_perm('user')) { // redirect to login page if user is not logged in $auth->login_if($auth->auth["uid"] == "nobody"); throw new AccessDeniedException(); } $SessionSeminar = $inst_id; $institute = Institute::findCurrent(); if ($institute) { if (!($SemUserStatus = $perm->get_studip_perm($institute["Institut_id"]))) { $SemUserStatus = 'nobody'; } $rechte = $perm->have_studip_perm("tutor", $institute["Institut_id"]); $SessionSeminar = $institute["Institut_id"]; $SessSemName[0] = $institute["Name"]; $SessSemName[1] = $institute["Institut_id"]; $SessSemName["art_generic"] = _("Einrichtung"); $SessSemName["art"] = $INST_TYPE[$row["type"]]["name"]; if (!$SessSemName["art"]) { $SessSemName["art"] = $SessSemName["art_generic"]; } $SessSemName["class"] = "inst"; $SessSemName["is_fak"] = $institute["is_fak"]; $SessSemName["art_num"] = $institute["type"]; $SessSemName["fak"] = $institute["fakultaets_id"]; $SessSemName["header_line"] = $institute->getFullname(); $_SESSION['SessionSeminar'] =& $SessionSeminar; $_SESSION['SessSemName'] =& $SessSemName; URLHelper::addLinkParam('cid', $SessionSeminar); return true; } else { $SessionSeminar = null; return false; } }
/** * show institute basicdata page * * @param mixed $i_id Optional institute id * @throws AccessDeniedException */ public function index_action($i_id = false) { PageLayout::setTitle(_('Verwaltung der Grunddaten')); Navigation::activateItem('/admin/institute/details'); //get ID from an open Institut $i_view = $i_id ?: Request::option('i_view', $GLOBALS['SessSemName'][1]); if (!$i_view) { require_once 'lib/admin_search.inc.php'; // This search just died a little inside, so it should be safe to // continue here but we nevertheless return just to be sure return; } elseif ($i_view === 'new') { closeObject(); } // allow only inst-admin and root to view / edit if ($i_view && !$GLOBALS['perm']->have_studip_perm('admin', $i_view) && $i_view !== 'new') { throw new AccessDeniedException(); } //Change header_line if open object $header_line = getHeaderLine($i_view); if ($header_line) { PageLayout::setTitle($header_line . ' - ' . PageLayout::getTitle()); } if (Request::get('i_trykill')) { $message = _('Sind Sie sicher, dass Sie diese Einrichtung löschen wollen?'); $post['i_kill'] = 1; $post['studipticket'] = get_ticket(); $this->question = createQuestion2($message, $post, array(), $this->url_for('institute/basicdata/delete/' . $i_view)); } $lockrule = LockRules::getObjectRule($i_view); if ($lockrule->description && LockRules::CheckLockRulePermission($i_view, $lockrule['permission'])) { PageLayout::postMessage(MessageBox::info(formatLinks($lockrule->description))); } // Load institute data $institute = new Institute($i_view === 'new' ? null : $i_view); //add the free administrable datafields $datafields = array(); $localEntries = DataFieldEntry::getDataFieldEntries($institute->id, 'inst'); if ($localEntries) { $invalidEntries = $this->flash['invalid_entries'] ?: array(); foreach ($localEntries as $entry) { if (!$entry->isVisible()) { continue; } $color = '#000000'; if (in_array($entry->getId(), $invalidEntries)) { $color = '#ff0000'; } $datafields[] = array('color' => $color, 'title' => $entry->getName(), 'value' => $GLOBALS['perm']->have_perm($entry->isEditable()) && !LockRules::Check($institute['Institut_id'], $entry->getId()) ? $entry->getHTML('datafields') : $entry->getDisplayValue()); } } // Read faculties if neccessary if (count($institute->sub_institutes) === 0) { if ($GLOBALS['perm']->have_perm('root')) { $this->faculties = Institute::findBySQL('Institut_id = fakultaets_id ORDER BY Name ASC', array($i_view)); } else { $temp = User::find($GLOBALS['user']->id)->institute_memberships->findBy('inst_perms', 'admin')->pluck('institute'); $institutes = SimpleORMapCollection::createFromArray($temp); $faculties = $institutes->filter(function ($institute) { return $institute->is_fak; }); $this->faculties = $faculties; } } // Indicates whether the current user is allowed to delete the institute $this->may_delete = $i_view !== 'new' && !(count($institute->home_courses) || count($institute->sub_institutes)) && ($GLOBALS['perm']->have_perm('root') || $GLOBALS['perm']->is_fak_admin() && get_config('INST_FAK_ADMIN_PERMS') == 'all'); if (!$this->may_delete) { //Set infotext for disabled delete-button $reason_txt = _('Löschen nicht möglich.'); if (count($institute->home_courses) > 0) { $reason_txt .= ' '; $reason_txt .= sprintf(ngettext('Es ist eine Veranstaltung zugeordnet.', 'Es sind %u Veranstaltungen zugeordnet.', count($institute->home_courses)), count($institute->home_courses)); } if (count($institute->sub_institutes) > 0) { $reason_txt .= ' '; $reason_txt .= sprintf(ngettext('Es ist eine Einrichtung zugeordnet.', 'Es sind %u Einrichtungen zugeordnet.', count($institute->sub_institutes)), count($institute->sub_institutes)); } } // Indicates whether the current user is allowed to change the faculty $this->may_edit_faculty = $GLOBALS['perm']->is_fak_admin() && !LockRules::Check($institute['Institut_id'], 'fakultaets_id') && ($GLOBALS['perm']->have_studip_perm('admin', $institute['fakultaets_id']) || $i_view === 'new'); // Prepare template $this->institute = $institute; $this->i_view = $i_view; $this->datafields = $datafields; $this->reason_txt = $reason_txt; }
/** * Displays page for literature search */ public function search_action() { $GLOBALS['perm']->check("autor"); PageLayout::setHelpKeyword("Basis.Literatursuche"); PageLayout::setTitle(_("Literatursuche")); if (Request::option('return_range') == "self") { $this->return_range = $GLOBALS['user']->id; } else { if (Request::option('return_range')) { $this->return_range = Request::option('return_range'); } else { $this->return_range = $_SESSION['_lit_range']; } } if (!$this->return_range) { $this->return_range = $GLOBALS['user']->id; } $_SESSION['_lit_range'] = $this->return_range; if ($this->return_range != $GLOBALS['user']->id) { Navigation::activateItem('/course/literature/search'); $this->return_range = $_SESSION['SessSemName'][1] ? $_SESSION['SessSemName'][1] : $this->return_range; } else { Navigation::activateItem('/tools/literature/search'); closeObject(); } $_the_search = new StudipLitSearch(); $_the_clipboard = StudipLitClipBoard::GetInstance(); $_the_clip_form = $_the_clipboard->getFormObject(); if (Request::quoted('change_start_result')) { $_the_search->start_result = Request::quoted('change_start_result'); } if ($_the_clip_form->isClicked("clip_ok")) { $_the_clipboard->doClipCmd(); } if ($_the_search->outer_form->isClicked("search") || $_the_search->outer_form->isSended() && !$_the_search->outer_form->isClicked("reset") && !$_the_search->outer_form->isClicked("change") && !$_the_search->outer_form->isClicked("search_add") && !$_the_search->outer_form->isClicked("search_sub") && !$_the_search->outer_form->isChanged("search_plugin")) { $hits = $_the_search->doSearch(); if (!$_the_search->search_plugin->getNumError()) { if ($_the_search->getNumHits() == 0) { $_msg = sprintf(_("Ihre Suche ergab %s Treffer."), $_the_search->getNumHits()); } else { $_msg = sprintf(_("Ihre Suche ergab %s Treffer."), $_the_search->getNumHits()); } PageLayout::postMessage(MessageBox::info($_msg)); } $_the_search->start_result = 1; } if (Request::option('cmd') == "add_to_clipboard") { $catalog_id = Request::option('catalog_id'); if ($catalog_id[0] == "_") { $parts = explode("__", $catalog_id); if ($fields = $_SESSION[$parts[0]][$parts[1]]) { $cat_element = new StudipLitCatElement(); $cat_element->setValues($fields); $cat_element->setValue("catalog_id", "new_entry"); $cat_element->setValue("user_id", "studip"); if ($existing_element = $cat_element->checkElement()) { $cat_element->setValue('catalog_id', $existing_element); } $cat_element->insertData(); $catalog_id = $cat_element->getValue("catalog_id"); $_SESSION[$parts[0]][$parts[1]]['catalog_id'] = $catalog_id; unset($cat_element); } } $_the_clipboard->insertElement($catalog_id); } $_msg .= $_the_search->search_plugin->getError("msg"); $this->msg = $_msg; $this->search = $_the_search; $this->clipboard = $_the_clipboard; $this->clip_form = $_the_clip_form; }