public function beforeAction()
 {
     $this->contexts = Contexts::instance();
     $this->reqCon = RequestContext::instance();
     $this->sesCon = SessionContext::instance();
     $this->em = Zool::app()->em;
 }
 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 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);
 }
 /**
  *
  */
 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;
     }
 }
 public function render()
 {
     parent::render();
     $request = Zool::app()->request;
     $this->aspect = new ZWebAspect($request);
     $view = $this->aspect->run();
     echo $view;
 }
 /** @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;
 }
 public function __construct($object, $method, $params, $context)
 {
     $this->object = $object;
     $this->method = $method;
     $this->params = $params;
     $class = get_class($context);
     $ns = substr($class, 0, strpos($class, '\\'));
     $this->contextRootPath = array($ns, Zool::getRootPath($ns));
 }
 public function __construct($request)
 {
     $aspectPath = $this->getLibraryPath();
     $rootAlias = $this->getName();
     Zool::import($aspectPath, $rootAlias);
     $doc = ZXmlParser::fromFileToTree(APP_PATH . '/' . $request);
     $this->baseDocuemt = $doc;
     $this->currentViewId = APP_PATH . '/' . $request;
     $this->init();
 }
 /**
  * @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::CONTEXT_NAME])) {
         $_SESSION[ZOOL_CONTEXT_NAME][self::CONTEXT_NAME] = array();
     }
     if (isset($_SESSION[ZOOL_CONTEXT_NAME][self::CONTEXT_CLASSES_NAME])) {
         $this->classesNeedToLoad = $_SESSION[ZOOL_CONTEXT_NAME][self::CONTEXT_CLASSES_NAME];
     }
     foreach ($this->classesNeedToLoad as $class) {
         Zool::loadClass($class);
     }
     foreach ($_SESSION[ZOOL_CONTEXT_NAME][self::CONTEXT_NAME] as $key => $value) {
         $this->context[$key] = unserialize($value);
     }
 }
 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);
     }
 }
 /**
  *
  * @return \zool\xml\view\AbstractViewProvider
  */
 public function getViewProvider()
 {
     return Zool::app()->viewProvider;
 }
 /**
  * Constructor.
  * @param mixed $config application configuration.
  * If a string, it is treated as the path of the file that contains the configuration;
  * If an array, it is the actual configuration information.
  * Please make sure you specify the {@link getBasePath basePath} property in the configuration,
  * which should point to the directory containing all application logic, template and data.
  * If not, the directory will be defaulted to 'protected'.
  */
 public function __construct($config = null)
 {
     Zool::setApplication($this);
 }
 /** @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);
 }
 /**
  * Constructor.
  * @param mixed $config application configuration.
  * If a string, it is treated as the path of the file that contains the configuration;
  * If an array, it is the actual configuration information.
  * Please make sure you specify the {@link getBasePath basePath} property in the configuration,
  * which should point to the directory containing all application logic, template and data.
  * If not, the directory will be defaulted to 'protected'.
  */
 public function __construct($name, $config)
 {
     parent::__construct($name, $config);
     Zool::setApplication($this);
     $this->initSystemHandlers();
 }
<?php

use zool\xml\ZXmlParser;
use zool\Zool;
define('ZOOL_DEBUG', true);
define('ZOOL_TRACE', false);
define('BASE_PATH', dirname(__FILE__));
require_once 'zool/zool.php';
$config = (include APP_PATH . '/config/main.php');
$app = Zool::createApplication($config);
$app->run();