public function beforeAction() { $this->contexts = Contexts::instance(); $this->reqCon = RequestContext::instance(); $this->sesCon = SessionContext::instance(); $this->em = Zool::app()->em; }
public function select($id) { $em = Zool::app()->entityManager; $estate = $em->find('app\\model\\Estate', $id); SessionContext::instance()->set('estate', $estate); Zool::app()->viewProvider->envelope->message = array('title' => 'Mentés', 'content' => $estate->name); }
public function init() { $this->setJSONErrorHandlers(); $this->envelope = new XulJsonEnvelope(); $request = Zool::app()->request; $this->aspect = new ZXulAspect($request); }
public function bugger($bugid) { $em = Zool::app()->em; $bug = $em->find('app\\model\\Bug', $bugid); SessionContext::instance()->set('bugstringm', 'Selected: ' . $bug->description); SessionContext::instance()->set('selectedBug', $bug); }
/** * * @param string $key message key * @return string messages */ public function get($key) { $fileKey = Strings::splitBy($key, self::MESSAGE_PATH_SEPARATOR); if ($fileKey[0] == $key) { throw new MessageException("Key must separated with " . self::MESSAGE_PATH_SEPARATOR . " in {$key}"); } $fileBase = $fileKey[0]; $messageKey = $fileKey[1]; $lang = Zool::app()->getLanguage(); if (!isset($this->messsages[$lang][$fileBase])) { $this->loadLocale($lang, $fileBase, $messageKey); } if (isset($this->messsages[$lang][$fileBase][$messageKey])) { return $this->messsages[$lang][$fileBase][$messageKey]; } elseif (Strings::contains($messageKey, self::MESSAGE_PATH_SEPARATOR)) { // find module locale $tmp = Strings::splitBy($messageKey, self::MESSAGE_PATH_SEPARATOR); $fileBase .= self::MESSAGE_PATH_SEPARATOR . $tmp[0]; $messageKey = $tmp[1]; } if (isset($this->messsages[$lang][$fileBase][$messageKey])) { return $this->messsages[$lang][$fileBase][$messageKey]; } return $key; }
public function render() { parent::render(); $request = Zool::app()->request; $this->aspect = new ZWebAspect($request); $view = $this->aspect->run(); echo $view; }
/** * */ protected function __construct($name, $config = null) { $this->name = $name; $this->configuration = $config == null ? Zool::app()->getConfiguration()->get($name) : new Configuration($config); if (!isset(self::$modules[$name])) { self::$modules[$name] = $this; } }
/** @Factory("zool.database.entityManager") */ public function entityManager() { if (self::$entityManager === null) { $config = Setup::createAnnotationMetadataConfiguration(array(APP_PATH . '/model'), DEBUG); $connectionDescriptor = Zool::app()->getConfig()->get('db')->asArray(); self::$entityManager = EntityManager::create($connectionDescriptor, $config); } return self::$entityManager; }
/** * @param object|string $classOrObject classname or object * @return \zool\util\log\Log logger */ public static function forClass($classOrObject, $toFile = true) { $logKey = $classOrObject; if (is_object($classOrObject) || class_exists($classOrObject)) { $class = is_object($classOrObject) ? get_class($classOrObject) : $classOrObject; $logKey = (new \ReflectionClass($class))->getShortName(); } $path = Zool::isActiveApplication() ? Zool::app()->config->log->path : 'log/log'; return new Log($logKey, $toFile ? $path : null); }
private function __construct() { //$this->reset(); if (!isset($_SESSION[ZOOL_CONTEXT_NAME][self::PREVIOUS_PAGE_NAME])) { $_SESSION[ZOOL_CONTEXT_NAME][self::PREVIOUS_PAGE_NAME] = $this->previousPage = $this->currentPage = Zool::app()->request; } else { $this->previousPage = $_SESSION[ZOOL_CONTEXT_NAME][self::PREVIOUS_PAGE_NAME]; $this->currentPage = isset($_SESSION[ZOOL_CONTEXT_NAME][self::CURRENT_PAGE_NAME]) ? $_SESSION[ZOOL_CONTEXT_NAME][self::CURRENT_PAGE_NAME] : $this->previousPage; } /* * Persist previous page */ if (!isset($this->currentPage) || $this->currentPage != $this->previousPage) { $this->previousPage = isset($_SESSION[ZOOL_CONTEXT_NAME][self::CURRENT_PAGE_NAME]) ? $_SESSION[ZOOL_CONTEXT_NAME][self::CURRENT_PAGE_NAME] : Zool::app()->request; $_SESSION[ZOOL_CONTEXT_NAME][self::CURRENT_PAGE_NAME] = $this->currentPage = Zool::app()->request; $this->reset(); } /* * Reset context, if other page */ if (!isset($_SESSION[ZOOL_CONTEXT_NAME][self::CONTEXT_NAME]) || $this->currentPage != $this->previousPage) { $this->reset(); } if (isset($_SESSION[ZOOL_CONTEXT_NAME][self::CONTEXT_CLASSES_NAME])) { $this->classesNeedToLoad = $_SESSION[ZOOL_CONTEXT_NAME][self::CONTEXT_CLASSES_NAME]; } else { $this->classesNeedToLoad = array(); } if (isset($_SESSION[ZOOL_CONTEXT_NAME][self::CONTEXT_ROOT_PATHS_NAME])) { $this->rootPaths = $_SESSION[ZOOL_CONTEXT_NAME][self::CONTEXT_ROOT_PATHS_NAME]; } else { $this->rootPaths = array(); } foreach ($this->classesNeedToLoad as $class) { Zool::loadClass($class); } foreach ($this->rootPaths as $ns => $path) { Zool::import($path, $ns); } foreach ($_SESSION[ZOOL_CONTEXT_NAME][self::CONTEXT_NAME] as $key => $value) { $this->context[$key] = unserialize($value); } }
/** @Factory("zool.application") */ public function application() { return Zool::app(); }
private function __construct() { $this->delegate = $_REQUEST; self::$viewIdParamName = Zool::app()->getConfiguration()->zool->request->get('viewIdParamName', self::$viewIdParamName); }
/** * * @return \zool\xml\view\AbstractViewProvider */ public function getViewProvider() { return Zool::app()->viewProvider; }