コード例 #1
0
ファイル: SignPresenter.php プロジェクト: joseki/sandbox
 protected function startup()
 {
     parent::startup();
     if ($this->user->isLoggedIn() && $this->action != 'out') {
         $this->redirect(':Admin:Homepage:');
     }
 }
コード例 #2
0
 public function startup()
 {
     parent::startup();
     $this->template->registerHelper('fshl_highlighter', array($this, 'fshl_highlighter'));
     $this->template->registerHelper('ansi_console_colors', array($this, 'ansi_console_colors'));
     $this->template->registerHelper('wordwrap', 'wordwrap');
 }
コード例 #3
0
 public function startup()
 {
     parent::startup();
     $this->loadBlackboard();
     $this->loadBlock(function () {
         $block = $this->blackboard->getRandomParent();
         if ($block) {
             $this->redirectToEntity($this->blackboard, $block);
         }
     });
     $this->loadSchema(function () {
         if (!$this->block) {
             return NULL;
         }
         $schema = $this->block->getRandomParent();
         if ($schema) {
             $this->redirectToEntity($this->blackboard, $this->block, $schema);
         }
     });
     if ($this->block && !$this->block->contains($this->blackboard)) {
         $this->redirectToEntity($this->blackboard);
     }
     if ($this->block && $this->schema && !$this->schema->contains($this->block)) {
         $this->redirectToEntity($this->blackboard);
     }
     $this->checkSlug($this->blackboard);
 }
コード例 #4
0
 protected function startup()
 {
     if (!$this->lang) {
         $this->lang = 'sk';
     }
     // not calling parent::startup to avoid redirection to Homepage
     Presenter::startup();
     //		parent::startup();
 }
コード例 #5
0
ファイル: BasePresenter.php プロジェクト: bazo/diplomovka
 public function startup()
 {
     //$this->oldLayoutMode = false;
     //$this->oldModuleMode = false;
     parent::startup();
     $application = Environment::getApplication();
     if (!isset($this->lang)) {
         $this->lang = $this->getHttpRequest()->detectLanguage(array('en', 'sk'));
         $this->canonicalize();
     }
     $this->translator = new Translator($this->lang);
     $this->template->setTranslator($this->translator);
     $modul = explode(':', $this->getName());
     $this->module = $modul[0];
     $this->template->module = $this->module;
 }
コード例 #6
0
ファイル: FrontBasePresenter.php プロジェクト: bazo/Mokuji
 * @package    FrontModule
 */
class Front_BasePresenter extends Presenter
{
    public $pathToTheme, $viewTemplatePath, $presenterTemplatePath;
    protected $themesDir = 'themes';
    protected $data;
    /** @persistent */
    public $lang;
    private $translator;
    public function startup()
    {
        parent::startup();
        //$application = Environment::getApplication();
        if (!isset($this->lang)) {
            $this->lang = $this->getHttpRequest()->detectLanguage(array('en', 'sk'));
            $this->canonicalize();
コード例 #7
0
 protected function startup()
 {
     parent::startup();
     // block Internet Explorer browser itself (force to use Google Chrome Frame)
     //		$this->blockIE();
     //canonicalization for non-existing flash messages
     if (!empty($this->params[self::FLASH_KEY]) && !$this->hasFlashSession()) {
         $params = $this->params;
         unset($params[self::FLASH_KEY]);
         $this->redirect(IHttpResponse::S301_MOVED_PERMANENTLY, 'this', $params);
     }
     //		if (Environment::getConfig('langs')->multipleLangs) {
     $this->setSupportedLangs();
     $this->checkAndRegisterLang();
     //		}
     $this->registerTranslator();
     $this->registerUser();
     Environment::setVariable('basePath', substr(Environment::getVariable('baseUri'), 0, -1));
     UserPanel::register()->addCredentials('admin', 'adminHeslo')->addCredentials('user', 'userHeslo')->setNameColumn('username');
 }
コード例 #8
0
ファイル: AdminBasePresenter.php プロジェクト: bazo/Mokuji
 public function startup()
 {
     parent::startup();
     if (!isset($this->lang)) {
         $this->lang = $this->getHttpRequest()->detectLanguage($this->langs);
         if ($this->lang == null) {
             $this->lang = 'en';
         }
         $this->canonicalize();
     }
     $this->translator = Environment::getService('Mokuji\\Translator\\Admin');
     $this->translator->lang = $this->lang;
     //$this->translator = new Admin_Translator($this->lang);
     $cache = Environment::getCache('langs');
     $langs = $cache->offsetGet('langs');
     if ($langs == NULL) {
         $this->langs = $this->translator->getSupportedLangs();
         //$this->model('lang')->getAll();
         $cache->save('langs', $this->langs);
     } else {
         $this->langs = $langs;
     }
     $this->refreshConfig();
 }
コード例 #9
0
ファイル: BasePresenter.php プロジェクト: jaroslavlibal/MDW
 public function startup()
 {
     //Debug::timer();
     parent::startup();
     dibi::query('SET AUTOCOMMIT=0');
 }
コード例 #10
0
ファイル: test.link.php プロジェクト: vrana/nette
 protected function startup()
 {
     parent::startup();
     $this->mycontrol = new TestControl($this, 'mycontrol');
     echo "\n<hr><h2>Presenter & action link</h2>\n";
     $uri = $this->link('product', array('var1' => $this->var1));
     echo "1.1 {$uri}\n\n";
     $uri = $this->link('product', array('var1' => $this->var1 * 2, 'ok' => TRUE));
     echo "1.2 {$uri}\n\n";
     $uri = $this->link('product', array('var1' => TRUE, 'ok' => '0'));
     echo "1.3 {$uri}\n\n";
     $uri = $this->link('product', array('var1' => NULL, 'ok' => 'a'));
     echo "1.4 {$uri}\n\n";
     $uri = $this->link('product', array('var1' => array(1), 'ok' => FALSE));
     echo "1.5 {$uri}\n\n";
     $uri = $this->link('product', 1, 2);
     echo "1.6 {$uri}\n\n";
     $uri = $this->link('product', array('x' => 1, 'y' => 2));
     echo "1.7 {$uri}\n\n";
     $uri = $this->link('product');
     echo "1.8 {$uri}\n\n";
     $uri = $this->link('');
     echo "1.9 {$uri}\n\n";
     $uri = $this->link('product?x=1&y=2');
     echo "1.10 {$uri}\n\n";
     $uri = $this->link('product?x=1&y=2#fragment');
     echo "1.11 {$uri}\n\n";
     $uri = $this->link('//product?x=1&y=2#fragment');
     echo "1.12 {$uri}\n\n";
     echo "\n<hr><h2>Presenter & signal link</h2>\n";
     $uri = $this->link('buy!', array('var1' => $this->var1));
     echo "2.1 {$uri}\n\n";
     $uri = $this->link('buy!', array('var1' => $this->var1 * 2));
     echo "2.2 {$uri}\n\n";
     $uri = $this->link('buy!', 1, 2);
     echo "2.3 {$uri}\n\n";
     $uri = $this->link('buy!', '1', '2');
     echo "2.4 {$uri}\n\n";
     $uri = $this->link('buy!', '1a', NULL);
     echo "2.5 {$uri}\n\n";
     $uri = $this->link('buy!', TRUE, FALSE);
     echo "2.6 {$uri}\n\n";
     $uri = $this->link('buy!', array(1), (object) array(1));
     echo "2.7 {$uri}\n\n";
     $uri = $this->link('buy!', array(1, 'y' => 2));
     echo "2.8 {$uri}\n\n";
     $uri = $this->link('buy!', array('x' => 1, 'y' => 2, 'var1' => $this->var1));
     echo "2.9 {$uri}\n\n";
     $uri = $this->link('!');
     echo "2.10 {$uri}\n\n";
     $uri = $this->link('this', array('var1' => $this->var1));
     echo "2.11 {$uri}\n\n";
     $uri = $this->link('this!', array('var1' => $this->var1));
     echo "2.12 {$uri}\n\n";
     echo "\n<hr><h2>Component link</h2>\n";
     $uri = $this->mycontrol->link('', 0, 1);
     echo "3.1 {$uri}\n\n";
     $uri = $this->mycontrol->link('click', 0, 1);
     echo "3.2 {$uri}\n\n";
     $uri = $this->mycontrol->link('click', '0a', '1a');
     echo "3.3 {$uri}\n\n";
     $uri = $this->mycontrol->link('click', array(1), (object) array(1));
     echo "3.4 {$uri}\n\n";
     $uri = $this->mycontrol->link('click', TRUE, FALSE);
     echo "3.5 {$uri}\n\n";
     $uri = $this->mycontrol->link('click', NULL, '');
     echo "3.6 {$uri}\n\n";
     $uri = $this->mycontrol->link('click', 1, 2, 3);
     echo "3.7 {$uri}\n\n";
     $uri = $this->mycontrol->link('click!', array('x' => 1, 'y' => 2, 'round' => 0));
     echo "3.8 {$uri}\n\n";
     $uri = $this->mycontrol->link('click', array('x' => 1, 'round' => 1));
     echo "3.9 {$uri}\n\n";
     $uri = $this->mycontrol->link('this', array('x' => 1, 'round' => 1));
     echo "3.10 {$uri}\n\n";
     $uri = $this->mycontrol->link('this?x=1&round=1');
     echo "3.11 {$uri}\n\n";
     $uri = $this->mycontrol->link('this?x=1&round=1#frag');
     echo "3.12 {$uri}\n\n";
     $uri = $this->mycontrol->link('//this?x=1&round=1#frag');
     echo "3.13 {$uri}\n\n";
 }
コード例 #11
0
ファイル: CommonBasePresenter.php プロジェクト: osmcz/website
 public function startup()
 {
     parent::startup();
     PagesModel::$lang = $this->lang;
     $this->pages = PagesModel::getRoot();
 }