/** * Common code for all actions: set default layout and page title. * * @param type $action * @param type $args */ function before_filter(&$action, &$args) { $this->validate_args($args, array('option', 'option')); parent::before_filter($action, $args); // set correct encoding if this is an ajax-call if (Request::isAjax()) { header('Content-Type: text/html; charset=Windows-1252'); } $this->flash = Trails_Flash::instance(); // set default layout $layout = $GLOBALS['template_factory']->open('layouts/base'); $this->set_layout($layout); // Set help keyword for Stud.IP's user-documentation and page title PageLayout::setHelpKeyword('Basis.Forum'); PageLayout::setTitle($_SESSION['SessSemName']['header_line'] . ' - ' . _('Forum')); $this->AVAILABLE_DESIGNS = array('web20', 'studip'); if ($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] && $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] != '/') { $this->picturepath = $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] . '/' . $this->dispatcher->trails_root . '/img'; } else { $this->picturepath = '/' . $this->dispatcher->trails_root . '/img'; } // we want to display the dates in german setlocale(LC_TIME, 'de_DE@euro', 'de_DE', 'de', 'ge'); // the default for displaying timestamps $this->time_format_string = "%a %d. %B %Y, %H:%M"; $this->time_format_string_short = "%d.%m.%Y, %H:%M"; $this->template_factory = new Flexi_TemplateFactory(dirname(__FILE__) . '/../templates'); //$this->check_token(); ForumVisit::setVisit($this->getId()); if (Request::int('page')) { ForumHelpers::setPage(Request::int('page')); } $this->seminar_id = $this->getId(); }
function before_filter($action, $args) { $this->current_action = $action; $this->flash = Trails_Flash::instance(); $this->standard_templates = $GLOBALS['STUDIP_BASE_PATH'] . '/templates/'; $this->standard_trails_root = $GLOBALS['STUDIP_BASE_PATH'] . '/app/'; $this->set_layout('layout.php'); PageLayout::setTitle($this->plugin->getDisplayTitle()); $this->url = $this->plugin->getPluginUrl() . '/public/'; PageLayout::addHeadElement('link', array("rel" => "stylesheet", "href" => $this->url . "stylesheets/application.css", "type" => "text/css")); PageLayout::addHeadElement('script', array("src" => $this->url . "javascripts/application.js", "type" => "text/javascript")); }
function before_filter($action, $args) { $this->current_action = $action; $this->flash = Trails_Flash::instance(); $this->standard_templates = $GLOBALS['STUDIP_BASE_PATH'] . '/templates/'; $this->set_layout($GLOBALS['template_factory']->open('layouts/base')); $this->assets_url = $this->plugin->getPluginUrl(). '/assets/'; PageLayout::addScript('jquery.tablesorter.min.js'); PageLayout::addHeadElement("link", array("href" => $this->assets_url.'stylesheets/blubberforum.css', "rel" => "stylesheet"), ""); }
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); } } }
function test_should_be_a_singleton() { $flash1 = Trails_Flash::instance(); $flash2 = Trails_Flash::instance(); $this->assertReference($flash1, $flash2); }
function before_filter() { session_start(); $this->flash = Trails_Flash::instance(); }