Esempio n. 1
0
 /**
  * This function is called before any output is generated or any other
  * actions are performed. Initializations happen here.
  *
  * @param $action Name of the action to perform
  * @param $args   Arguments for the given action
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $this->modules = array();
     // Set Navigation
     PageLayout::setHelpKeyword("Basis.ProfileModules");
     PageLayout::setTitle(_("Mehr Funktionen"));
     PageLayout::addSqueezePackage('lightbox');
     Navigation::activateItem('/profile/modules');
     // Get current user.
     $this->username = Request::username('username', $GLOBALS['user']->username);
     $this->user_id = get_userid($this->username);
     $this->plugins = array();
     $blubber = PluginEngine::getPlugin('Blubber');
     // Add blubber to plugin list so status can be updated.
     if ($blubber) {
         $this->plugins[] = $blubber;
     }
     // Get homepage plugins from database.
     $this->plugins = array_merge($this->plugins, PluginEngine::getPlugins('HomepagePlugin'));
     // Show info message if user is not on his own profile
     if ($this->user_id != $GLOBALS['user']->id) {
         $current_user = User::find($this->user_id);
         $message = sprintf(_('Daten von: %s %s (%s), Status: %s'), htmlReady($current_user->Vorname), htmlReady($current_user->Nachname), htmlReady($current_user->username), htmlReady($current_user->perms));
         PageLayout::postMessage(MessageBox::info($message));
     }
     $this->setupSidebar();
 }
Esempio n. 2
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setHelpKeyword('Basis.Terminkalender');
     $this->settings = UserConfig::get($GLOBALS['user']->id)->getValue('CALENDAR_SETTINGS');
     if (!is_array($this->settings)) {
         $this->settings = Calendar::getDefaultUserSettings();
     }
     URLHelper::bindLinkParam('atime', $this->atime);
     $this->atime = Request::int('atime', time());
     $this->category = Request::int('category');
     $this->last_view = Request::option('last_view', $this->settings['view']);
     $this->action = $action;
     $this->restrictions = $this->category ? array('STUDIP_CATEGORY' => $this->category) : null;
     if ($this->category) {
         URLHelper::bindLinkParam('category', $this->category);
     }
     $self = Request::option('self');
     //   var_dump($_SESSION['SessSemName'], $self); exit;
     if (!$self && $_SESSION['SessSemName']['class'] == 'sem') {
         $this->range_id = Request::option('cid');
         Navigation::activateItem('/course/calendar');
     } else {
         $this->range_id = Request::option('range_id', $GLOBALS['user']->id);
         Navigation::activateItem('/calendar/calendar');
         URLHelper::bindLinkParam('range_id', $this->range_id);
     }
     URLHelper::bindLinkParam('last_view', $this->last_view);
 }
Esempio n. 3
0
 /**
  * common tasks for all actions
  */
 function before_filter(&$action, &$args)
 {
     global $perm;
     parent::before_filter($action, $args);
     $course_id = $args[0];
     $this->course_id = Request::option('cid', $course_id);
     Navigation::activateItem('/course/admin/admission');
     if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) {
         throw new Trails_Exception(403);
     }
     $this->course = Course::find($this->course_id);
     $this->user_id = $GLOBALS['user']->id;
     PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenZugangsberechtigungen");
     PageLayout::setTitle($this->course->getFullname() . " - " . _("Verwaltung von Zugangsberechtigungen"));
     $lockrules = words('admission_turnout admission_type admission_endtime admission_binding passwort read_level write_level admission_prelim admission_prelim_txt admission_starttime admission_endtime_sem admission_disable_waitlist user_domain admission_binding admission_studiengang');
     foreach ($lockrules as $rule) {
         $this->is_locked[$rule] = LockRules::Check($this->course_id, $rule) ? 'disabled readonly' : '';
     }
     if (!SeminarCategories::GetByTypeId($this->course->status)->write_access_nobody) {
         $this->is_locked['write_level'] = 'disabled readonly';
     }
     update_admission($this->course->id);
     PageLayout::addSqueezePackage('admission');
     URLHelper::addLinkParam('return_to_dialog', Request::get('return_to_dialog'));
 }
Esempio n. 4
0
 /**
  * Things to do before every page load.
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // AJAX request, so no page layout.
     if (Request::isXhr()) {
         $this->via_ajax = true;
         $this->set_layout(null);
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
         // Open base layout for normal
     } else {
         $layout = $GLOBALS['template_factory']->open('layouts/base');
         $this->set_layout($layout);
         PageLayout::setTitle(_('Anmeldesets'));
         // Get only own courses if user doesn't have permission to edit institute-wide coursesets.
         $this->onlyOwnCourses = true;
         if ($GLOBALS['perm']->have_perm('admin') || $GLOBALS['perm']->have_perm('dozent') && get_config('ALLOW_DOZENT_COURSESET_ADMIN')) {
             // We have access to institute-wide course sets, so all courses may be assigned.
             $this->onlyOwnCourses = false;
             Navigation::activateItem('/tools/coursesets/sets');
         } else {
             throw new AccessDeniedException();
         }
     }
     PageLayout::addSqueezePackage('admission');
     $this->set_content_type('text/html;charset=windows-1252');
     $views = new ViewsWidget();
     $views->setTitle(_('Aktionen'));
     $views->addLink(_('Anmeldeset anlegen'), $this->url_for('admission/courseset/configure'))->setActive($action == 'configure');
     Sidebar::Get()->addWidget($views);
 }
Esempio n. 5
0
 /**
  * common tasks for all actions
  */
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setTitle(_('Teilnahmebeschränkte Veranstaltungen'));
     Navigation::activateItem('/tools/coursesets/restricted_courses');
     PageLayout::addSqueezePackage('tablesorter');
 }
Esempio n. 6
0
 /**
  * @todo der include muss weg
  */
 public function showweek_action($timestamp = null)
 {
     $calendar = Calendar::getInstance(Calendar::RANGE_INST, $this->institute_id);
     PageLayout::setTitle(getHeaderLine($this->institute_id) . ' - ' . _("Terminkalender - Wochenansicht"));
     $_SESSION['calendar_sess_control_data']['view_prv'] = 'showweek';
     Navigation::activateItem("/course/calendar/week");
     $atime = $timestamp ?: time();
     $at = date('G', $atime);
     if ($at >= $this->calendar_settings['start'] && $at <= $this->calendar_settings['end'] || !$atime) {
         $st = $this->calendar_settings['start'];
         $et = $this->calendar_settings['end'];
     } elseif ($at < $this->calendar_settings['start']) {
         $st = 0;
         $et = $this->calendar_settings['start'] + 2;
     } else {
         $st = $this->calendar_settings['end'] - 2;
         $et = 23;
     }
     include_once $GLOBALS['RELATIVE_PATH_CALENDAR'] . '/lib/DbCalendarWeek.class.php';
     $this->_calendar = $calendar;
     $this->atime = $atime;
     $this->cmd = 'showweek';
     $this->st = $st;
     $this->et = $et;
 }
Esempio n. 7
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!$GLOBALS['perm']->have_perm("root")) {
         Navigation::activateItem('/browse/my_studygroups/index');
     }
 }
Esempio n. 8
0
 /**
  * common tasks for all actions
  */
 function before_filter(&$action, &$args)
 {
     global $perm, $template_factory;
     parent::before_filter($action, $args);
     $perm->check(Config::get()->LOCK_RULE_ADMIN_PERM ? Config::get()->LOCK_RULE_ADMIN_PERM : 'admin');
     $layout = $template_factory->open('layouts/base');
     $this->set_layout($layout);
     PageLayout::setTitle(_('Verwaltung der Sperrebenen'));
     Navigation::activateItem('/admin/locations/lock_rules');
     URLHelper::bindLinkParam('lock_rule_type', $this->lock_rule_type);
     if (!$this->lock_rule_type || !$GLOBALS['perm']->have_perm('root')) {
         $this->lock_rule_type = 'sem';
     }
     if ($this->lock_rule_type == 'sem') {
         $this->lock_rule_permissions = $GLOBALS['perm']->have_perm('root') ? array('tutor', 'dozent', 'admin', 'root') : array('tutor', 'dozent');
     } elseif ($this->lock_rule_type == 'inst') {
         $this->lock_rule_permissions = array('admin', 'root');
     } elseif ($this->lock_rule_type == 'user') {
         $this->lock_rule_permissions = array('tutor', 'dozent', 'admin', 'root');
     }
     $this->rule_type_names = array('sem' => _('Veranstaltung'), 'inst' => _('Einrichtung'), 'user' => _('Person'));
     $this->sidebar = Sidebar::Get();
     $this->sidebar->setTitle(_('Sperrebenen'));
     $this->sidebar->setImage('sidebar/lock-sidebar.png');
 }
Esempio n. 9
0
 /**
  * Displays a page.
  */
 public function index_action($id = null)
 {
     Navigation::activateItem('/course/literature/view');
     PageLayout::setTitle($_SESSION['SessSemName']["header_line"] . " - " . _("Literatur"));
     $this->list = StudipLitList::GetFormattedListsByRange($_SESSION["SessionSeminar"], object_get_visit($_SESSION["SessionSeminar"], "literature"));
     $this->_range_id = $_SESSION["SessionSeminar"];
 }
Esempio n. 10
0
 /**
  * Set up this controller.
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setTitle(_('Allgemeine Einstellungen anpassen'));
     Navigation::activateItem('/profile/settings/general');
     SkipLinks::addIndex(_('Allgemeine Einstellungen anpassen'), 'layout_content', 100);
 }
Esempio n. 11
0
 /**
  * show the administration page for mass-editing forum-entries
  */
 function index_action()
 {
     ForumPerm::check('admin', $this->getId());
     $nav = Navigation::getItem('course/forum2');
     $nav->setImage(Icon::create('forum', 'info'));
     Navigation::activateItem('course/forum2/admin');
     $list = ForumEntry::getList('flat', $this->getId());
     // sort by cat
     $new_list = array();
     // iterate over all categories and add the belonging areas to them
     foreach ($categories = ForumCat::getListWithAreas($this->getId(), false) as $category) {
         if ($category['topic_id']) {
             $new_list[$category['category_id']][$category['topic_id']] = $list['list'][$category['topic_id']];
             unset($list['list'][$category['topic_id']]);
         } else {
             if (ForumPerm::has('add_area', $this->seminar_id)) {
                 $new_list[$category['category_id']] = array();
             }
         }
         $this->categories[$category['category_id']] = $category['entry_name'];
     }
     if (!empty($list['list'])) {
         // append the remaining entries to the standard category
         $new_list[$this->getId()] = array_merge((array) $new_list[$this->getId()], $list['list']);
     }
     $this->list = $new_list;
 }
Esempio n. 12
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Remove cid
     URLHelper::removeLinkParam('cid');
     unset($_SESSION['SessionSeminar']);
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox'));
     Navigation::activateItem('/profile/index');
     URLHelper::addLinkParam('username', Request::username('username'));
     PageLayout::setHelpKeyword('Basis.Homepage');
     SkipLinks::addIndex(_('Benutzerprofil'), 'user_profile', 100);
     $this->user = User::findCurrent();
     // current logged in user
     $this->perm = $GLOBALS['perm'];
     // perms of current logged in user
     $this->current_user = User::findByUsername(Request::username('username', $this->user->username));
     // current selected user
     // get additional informations to selected user
     $this->profile = new ProfileModel($this->current_user->user_id, $this->user->user_id);
     // set the page title depending on user selection
     if ($this->current_user['user_id'] == $this->user->id && !$this->current_user['locked']) {
         PageLayout::setTitle(_('Mein Profil'));
         UserConfig::get($this->user->id)->store('PROFILE_LAST_VISIT', time());
     } elseif ($this->current_user['user_id'] && ($this->perm->have_perm('root') || !$this->current_user['locked'] && get_visibility_by_id($this->current_user['user_id']))) {
         PageLayout::setTitle(_('Profil') . ' - ' . $this->current_user->getFullname());
         object_add_view($this->current_user->user_id);
     } else {
         PageLayout::setTitle(_('Profil'));
         $action = 'not_available';
     }
 }
Esempio n. 13
0
 function before_filter(&$action, &$args)
 {
     if (Request::option('auswahl')) {
         Request::set('cid', Request::option('auswahl'));
     }
     parent::before_filter($action, $args);
     checkObject();
     $this->institute = Institute::findCurrent();
     if (!$this->institute) {
         throw new CheckObjectException(_('Sie haben kein Objekt gewählt.'));
     }
     $this->institute_id = $this->institute->id;
     //set visitdate for institute, when coming from meine_seminare
     if (Request::option('auswahl')) {
         object_set_visit($this->institute_id, "inst");
     }
     //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);
         page_close();
         $new_query = preg_replace('/[^:0-9a-z+_\\-.#?&=\\/]/i', '', $new_query);
         header('Location: ' . URLHelper::getURL($new_query, array('cid' => $this->institute_id)));
         die;
     }
     PageLayout::setHelpKeyword("Basis.Einrichtungen");
     PageLayout::setTitle($this->institute->getFullName() . " - " . _("Kurzinfo"));
     Navigation::activateItem('/course/main/info');
 }
Esempio n. 14
0
 /**
  * Main action to display contacts
  */
 function index_action($filter = null)
 {
     // Check if we need to add contacts
     $mps = MultiPersonSearch::load('contacts');
     $imported = 0;
     foreach ($mps->getAddedUsers() as $userId) {
         $user_to_add = User::find($userId);
         if ($user_to_add) {
             $new_contact = array('owner_id' => User::findCurrent()->id, 'user_id' => $user_to_add->id);
             if ($filter && $this->group) {
                 $new_contact['group_assignments'][] = array('statusgruppe_id' => $this->group->id, 'user_id' => $user_to_add->id);
             }
             $imported += (bool) Contact::import($new_contact)->store();
         }
     }
     if ($imported) {
         PageLayout::postMessage(MessageBox::success(sprintf(_("%s Kontakte wurden hinzugefügt."), $imported)));
     }
     $mps->clearSession();
     // write filter to local
     $this->filter = $filter;
     // Deal with navigation
     Navigation::activateItem('community/contacts');
     // Edit CSS for quicknavigation
     PageLayout::addStyle('div.letterlist span {color: #c3c8cc;}');
     if ($filter) {
         $selected = $this->group;
         $contacts = SimpleCollection::createFromArray(User::findMany($selected->members->pluck('user_id')));
     } else {
         $contacts = User::findCurrent()->contacts;
     }
     $this->allContacts = $contacts;
     // Retrive first letter and store in that contactgroup
     $this->contacts = array();
     foreach ($contacts as $contact) {
         $this->contacts[strtoupper(SimpleCollection::translitLatin1($contact->nachname[0]))][] = $contact;
     }
     // Humans are a lot better with sorted results
     ksort($this->contacts);
     $this->contacts = array_map(function ($g) {
         return SimpleCollection::createFromArray($g)->orderBy('nachname, vorname');
     }, $this->contacts);
     // Init sidebar
     $this->initSidebar($filter);
     // Init person search
     $mps = MultiPersonSearch::get('contacts')->setTitle(_('Kontakte hinzufügen'))->setDefaultSelectedUser($this->allContacts->pluck('user_id'))->setExecuteURL($this->url_for('contact/index/' . $filter))->setSearchObject(new StandardSearch('user_id'));
     // Set default title
     $this->title = _('Alle Kontakte');
     // If we have a group
     if ($selected) {
         // Set title of Table
         $this->title = $selected->name;
         // Set title of multipersonsearch
         $mps->setTitle(sprintf(_('Kontakte zu %s hinzufügen'), $selected->name));
         $mps->addQuickfilter(_('Kontakte'), User::findCurrent()->contacts->pluck('user_id'));
     }
     // Render multiperson search
     $this->multiPerson = $mps->render();
 }
Esempio n. 15
0
 /**
  * Set up this controller.
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setHelpKeyword('Basis.MyStudIPPrivacy');
     PageLayout::setTitle(_('Privatsphäre'));
     Navigation::activateItem('/profile/settings/privacy');
     SkipLinks::addIndex(_('Privatsphäre'), 'layout_content', 100);
 }
Esempio n. 16
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!$GLOBALS['perm']->have_perm("root")) {
         throw new AccessDeniedException();
     }
     Navigation::activateItem("/fleximport/config");
 }
Esempio n. 17
0
 /**
  * Set up this controller and define the infobox.
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setHelpKeyword('Basis.HomepageLebenslauf');
     PageLayout::setTitle($this->user->perms == 'dozent' ? _('Lebenslauf, Arbeitsschwerpunkte und Publikationen bearbeiten') : _('Lebenslauf bearbeiten'));
     Navigation::activateItem('/profile/edit/details');
     SkipLinks::addIndex(_('Private Daten bearbeiten'), 'layout_content');
 }
Esempio n. 18
0
 /**
  * Before filter, basically initializes the controller by actvating the
  * according navigation entry and other settings.
  *
  * @param String $action Action to execute
  * @param Array $args    Arguments passed for the action (might be empty)
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setTitle(_('Dateiverwaltung'));
     PageLayout::setHelpKeyword('Basis.Dateien');
     Navigation::activateItem('/profile/files');
     PageLayout::addSqueezePackage('document');
 }
Esempio n. 19
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     Navigation::activateItem("/admin/config/lernmarktplatz");
     if (!$GLOBALS['perm']->have_perm("root")) {
         throw new AccessDeniedException();
     }
 }
Esempio n. 20
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!$GLOBALS['perm']->have_perm("root")) {
         throw new AcessDeniedException("Kein Zutritt");
     }
     Navigation::activateItem("/pluginmarket/approving");
     $this->set_content_type('text/html;charset=windows-1252');
 }
Esempio n. 21
0
 /**
  * Set up this controller and define the infobox
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setHelpKeyword('Basis.HomepagePersönlicheDaten');
     PageLayout::setTitle(_('Benutzerkonto bearbeiten'));
     Navigation::activateItem('/profile/edit/profile');
     SkipLinks::addIndex(_('Benutzerkonto bearbeiten'), 'layout_content');
     Sidebar::get()->setImage('sidebar/person-sidebar.png');
 }
Esempio n. 22
0
 public function new_topic_action()
 {
     Navigation::activateItem('/course/schedule/dates');
     if (Request::isAjax()) {
         PageLayout::setTitle(_("Thema hinzufügen"));
     }
     $this->date = new CourseDate(Request::option("termin_id"));
     $this->course = Course::findCurrent();
 }
Esempio n. 23
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!$GLOBALS['perm']->have_perm("root")) {
         throw new AccessDeniedException();
     }
     PageLayout::addScript($this->plugin->getPluginURL() . "/assets/fleximport.js");
     Navigation::activateItem("/fleximport/config");
 }
Esempio n. 24
0
 /**
  * Common tasks for all actions.
  */
 public function before_filter(&$action, &$args)
 {
     global $perm;
     parent::before_filter($action, $args);
     // user must have root permission
     $perm->check('root');
     // set navigation
     Navigation::activateItem('/admin/locations/studycourse');
 }
Esempio n. 25
0
 /**
  * Display the block appointments
  */
 public function index_action()
 {
     if (!Request::isXhr()) {
         Navigation::activateItem('/course/admin/timesrooms');
     }
     $this->editParams = array('fromDialog' => Request::get('fromDialog'));
     $this->start_ts = strtotime('this monday');
     $this->request = $this->flash['request'];
 }
Esempio n. 26
0
 /**
  * Common before filter for all actions.
  *
  * @param String $action Called actions
  * @param Array  $args   Passed arguments
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // user must have root permission
     $GLOBALS['perm']->check('root');
     // set navigation
     Navigation::activateItem('/admin/config/configuration');
     $this->setupSidebar(strpos($action, 'user') !== false);
 }
Esempio n. 27
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setTitle(_('Studiengruppen suchen'));
     Navigation::activateItem('/community/studygroups/browse');
     PageLayout::setHelpKeyword('Basis.SuchenStudiengruppen');
     // add skip link
     SkipLinks::addIndex(Navigation::getItem('/community/studygroups/browse')->getTitle(), 'layout_content', 100);
     Sidebar::get()->setImage('sidebar/studygroup-sidebar.png');
 }
Esempio n. 28
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Check permissions to be on this site
     if (!$GLOBALS['perm']->have_perm('root')) {
         throw new AccessDeniedException();
     }
     PageLayout::setTitle(_('Schritte im Veranstaltungsanlegeassistenten'));
     Navigation::activateItem('/admin/config/coursewizardsteps');
 }
Esempio n. 29
0
 /**
  * Common tasks for all actions.
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // user must have root permission
     $GLOBALS['perm']->check('root');
     // set navigation
     Navigation::activateItem('/admin/config/smileys');
     //pagelayout
     PageLayout::setTitle(_('Verwaltung der Smileys'));
 }
Esempio n. 30
0
 /**
  *
  **/
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $GLOBALS['perm']->check('autor');
     $layout = $GLOBALS['template_factory']->open('layouts/base');
     $this->set_layout($layout);
     Navigation::activateItem('/profile/settings/api');
     PageLayout::setTitle(_('Applikationen'));
     $this->types = array('website' => _('Website'), 'program' => _('Herkömmliches Desktopprogramm'), 'app' => _('Mobile App'));
 }