Exemplo n.º 1
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';
     }
 }
Exemplo n.º 2
0
 /**
  * Before filter, set up the page by initializing the session and checking
  * all conditions.
  *
  * @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);
     if (!Config::Get()->LITERATURE_ENABLE) {
         throw new AccessDeniedException(_('Die Literaturverwaltung ist nicht aktiviert.'));
     }
     $this->attributes['textarea'] = array('style' => 'width:98%', 'rows' => 2);
     $this->attributes['select'] = array();
     $this->attributes['date'] = array();
     $this->attributes['combo'] = array('style' => 'width:45%; display: inline;');
     $this->attributes['lit_select'] = array('style' => 'font-size:8pt;width:100%');
     // on AJAX request set 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);
         }
     }
     $this->set_content_type('text/html;charset=windows-1252');
     /*      checkObject(); // do we have an open object?
             checkObjectModule('literature');
             object_set_visit_module('literature');/**/
 }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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');
 }
Exemplo n.º 5
0
Arquivo: bb.php Projeto: ratbird/hope
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!$GLOBALS['perm']->have_perm('root')) {
         throw new AccessDeniedException();
     }
 }
Exemplo n.º 6
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');
 }
Exemplo 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');
     }
 }
Exemplo n.º 8
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);
 }
Exemplo n.º 9
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();
 }
Exemplo n.º 10
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $course_id = Request::option('sem_id', $args[0]);
     if (empty($course_id)) {
         checkObject();
         //wirft Exception, wenn $SessionSeminar leer ist
         $course_id = $GLOBALS['SessionSeminar'];
     }
     $this->course = Course::find($course_id);
     if (!$this->course) {
         throw new Trails_Exception(400);
     }
     $this->send_from_search_page = Request::get('send_from_search_page');
     if ($GLOBALS['SessionSeminar'] != $this->course->id && !(int) $this->course->visible && !($GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM) || $GLOBALS['perm']->have_studip_perm('user', $this->course->id))) {
         throw new AccessDeniedException(_('Diese Veranstaltung ist versteckt. Hier gibt es nichts zu sehen.'));
     }
     if (!preg_match('/^(' . preg_quote($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'], '/') . ')?([a-zA-Z0-9_-]+\\.php)([a-zA-Z0-9_?&=-]*)$/', $this->send_from_search_page)) {
         $this->send_from_search_page = '';
     }
     if ($this->course->getSemClass()->offsetGet('studygroup_mode')) {
         if ($GLOBALS['perm']->have_studip_perm('autor', $this->course->id)) {
             // participants may see seminar_main
             $link = URLHelper::getUrl('seminar_main.php', array('auswahl' => $this->course->id));
         } else {
             $link = URLHelper::getUrl('dispatch.php/course/studygroup/details/' . $this->course->id, array('send_from_search_page' => $this->send_from_search_page));
         }
         $this->redirect($link);
         return;
     }
 }
Exemplo n.º 11
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');
 }
Exemplo n.º 12
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Lock context to user id
     $this->owner = $GLOBALS['user'];
     $this->context_id = $this->owner->id;
     $this->full_access = true;
     if (Config::get()->PERSONALDOCUMENT_OPEN_ACCESS) {
         $username = Request::username('username', $GLOBALS['user']->username);
         $user = User::findByUsername($username);
         if ($user && $user->id !== $GLOBALS['user']->id) {
             $this->owner = $user;
             $this->context_id = $user->id;
             $this->full_access = Config::get()->PERSONALDOCUMENT_OPEN_ACCESS_ROOT_PRIVILEDGED && $GLOBALS['user']->perms === 'root';
             URLHelper::bindLinkParam('username', $username);
         }
     }
     $this->limit = $GLOBALS['user']->cfg->PERSONAL_FILES_ENTRIES_PER_PAGE ?: Config::get()->ENTRIES_PER_PAGE;
     $this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id);
     if ($this->userConfig['area_close'] == 1) {
         $this->redirect('document/closed/index');
     }
     if (Request::isPost()) {
         CSRFProtection::verifySecurityToken();
     }
     if (($ticket = Request::get('studip-ticket')) && !check_ticket($ticket)) {
         $message = _('Bei der Verarbeitung Ihrer Anfrage ist ein Fehler aufgetreten.') . "\n" . _('Bitte versuchen Sie es erneut.');
         PageLayout::postMessage(MessageBox::error($message));
         $this->redirect('document/files/index');
     }
 }
Exemplo n.º 13
0
 public function init()
 {
     parent::init();
     if (!Yii::app()->user->hasRole('teacher')) {
         $this->redirect(array('/site/index'));
     }
     Layout::addBlock('sidebar.left', array('id' => 'profile_sidebar', 'content' => $this->widget('ProfileWidget', array('userModel' => Yii::app()->getUser()->getModel()), true)));
 }
Exemplo n.º 14
0
 /**
  * common tasks for all actions
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Ensure only admins gain access to this page
     if (!$GLOBALS['perm']->have_perm("admin")) {
         throw new AccessDeniedException();
     }
 }
Exemplo n.º 15
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (Request::isXhr()) {
         $this->set_layout(null);
         $this->response->add_header('Content-Type', 'text/html;charset=windows-1252');
     }
 }
Exemplo n.º 16
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);
 }
Exemplo n.º 17
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $this->keyword = Request::get('keyword');
     $this->range_id = $GLOBALS['SessSemName'][1];
     if (Request::isXhr()) {
         $this->keyword = studip_utf8decode($this->keyword);
     }
 }
Exemplo n.º 18
0
 /**
  * Checks whether we have a valid logged in user,
  * send "Forbidden" otherwise
  *
  * @param String $action The action to perform
  * @param Array  $args   Potential arguments
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Check for a valid logged in user (only when an ajax request occurs)
     if (Request::isXHR() && (!is_object($GLOBALS['user']) || $GLOBALS['user']->id === 'nobody')) {
         $this->response->set_status(403);
         $action = 'nop';
     }
 }
Exemplo n.º 19
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');
 }
Exemplo n.º 20
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!$GLOBALS['perm']->have_perm("root")) {
         throw new AccessDeniedException();
     }
     PageLayout::setHelpKeyword("Admins.SemClasses");
     PageLayout::setTitle("Veranstaltungskategorien");
 }
Exemplo n.º 21
0
 function after_filter($action, $args)
 {
     parent::after_filter($action, $args);
     // send performance metric
     if (isset($this->performance_timer)) {
         $timer = $this->performance_timer;
         $timer('core.my_courses_time');
     }
 }
Exemplo n.º 22
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');
 }
Exemplo n.º 23
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     //Configurations for the Documentarea for this user
     $this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id);
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
     PageLayout::setTitle(_('Dateiverwaltung'));
     PageLayout::setHelpKeyword('Basis.Dateien');
     Navigation::activateItem('/document/files');
 }
Exemplo n.º 24
0
 public function init()
 {
     parent::init();
     if (Yii::app()->user->hasRole('teacher') || Yii::app()->user->hasRole('student')) {
     } else {
         $this->render('//misc/unavailable', array('messageTitle' => 'Page Not Found', 'message' => 'The requested page wast not found.'));
         Yii::app()->end();
     }
     Layout::addBlock('sidebar.left', array('id' => 'profile_sidebar', 'content' => $this->widget('ProfileWidget', array('userModel' => Yii::app()->getUser()->getModel()), true)));
 }
Exemplo n.º 25
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     checkObject();
     checkObjectModule("schedule");
     PageLayout::setTitle(sprintf('%s - %s', Course::findCurrent()->getFullname(), _("Themen")));
     $seminar = new Seminar(Course::findCurrent());
     $this->forum_activated = $seminar->getSlotModule('forum');
     $this->documents_activated = $seminar->getSlotModule('documents');
 }
Exemplo n.º 26
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Load the course
     $this->course = new Course($_SESSION['SessionSeminar']);
     // Check permissions to be on this site
     if (!$GLOBALS['perm']->have_studip_perm("tutor", $this->course->id)) {
         throw new AccessDeniedException(_("Sie haben keine Berechtigung diese " . "Veranstaltung zu verändern."));
     }
 }
Exemplo n.º 27
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'));
 }
Exemplo 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');
 }
Exemplo 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'));
 }
Exemplo n.º 30
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!$GLOBALS['perm']->have_perm("root")) {
         Navigation::activateItem('/browse/my_institutes');
     }
     $this->user_id = $GLOBALS['auth']->auth['uid'];
     PageLayout::setHelpKeyword("Basis.MeineEinrichtungen");
     PageLayout::setTitle(_("Meine Einrichtungen"));
 }