Beispiel #1
0
 function before_filter(&$action, &$args)
 {
     $this->current_action = $action;
     // allow only "word" characters in arguments
     $this->validate_args($args);
     parent::before_filter($action, $args);
     if ($this->with_session) {
         # open session
         page_open(array('sess' => 'Seminar_Session', 'auth' => $this->allow_nobody ? 'Seminar_Default_Auth' : 'Seminar_Auth', 'perm' => 'Seminar_Perm', 'user' => 'Seminar_User'));
         // show login-screen, if authentication is "nobody"
         $GLOBALS['auth']->login_if((Request::get('again') || !$this->allow_nobody) && $GLOBALS['user']->id == 'nobody');
         // Setup flash instance
         $this->flash = Trails_Flash::instance();
         // set up user session
         include 'lib/seminar_open.php';
     }
     # Set base layout
     #
     # If your controller needs another layout, overwrite your controller's
     # before filter:
     #
     #   class YourController extends AuthenticatedController {
     #     function before_filter(&$action, &$args) {
     #       parent::before_filter($action, $args);
     #       $this->set_layout("your_layout");
     #     }
     #   }
     #
     # or unset layout by sending:
     #
     #   $this->set_layout(NULL)
     #
     $layout_file = Request::isXhr() ? 'layouts/dialog.php' : 'layouts/base.php';
     $layout = $GLOBALS['template_factory']->open($layout_file);
     $this->set_layout($layout);
     if ($this->encoding) {
         $this->set_content_type('text/html;charset=' . $this->encoding);
     }
     if (Request::isXhr() && $this->utf8decode_xhr) {
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
     }
 }
Beispiel #2
0
 /**
  *
  **/
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $this->set_layout(null);
 }