Ejemplo n.º 1
0
 /**
  * getInstance
  * 
  * @return void
  */
 public static function getInstance()
 {
     if (!is_object(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Ejemplo n.º 2
0
 public function __toString()
 {
     $file = implode("/", $this->_path);
     $this->_path = array();
     $block = new Joy_View_Block(array("file" => $file));
     $context = Joy_Context::getInstance();
     return $context->response->getRender()->execute($block);
 }
Ejemplo n.º 3
0
 public function __toString()
 {
     if (!$this->_view instanceof Joy_View_Layout) {
         return "Action importer only work Joy_View_Layout";
     }
     $context = Joy_Context::getInstance();
     $render = $context->response->getRender();
     return $render->execute($this->_view->getPlaceHolder());
 }
Ejemplo n.º 4
0
 protected function _registerEvents()
 {
     parent::_registerEvents();
     // page.init uygulama için ek objeleri ekleyebilirsiniz.
     $this->event->register("page.init", $this, "onInit");
     // page.load uygulamanın çalıştırılmaya hazır olduğu halidir.
     $this->event->register("page.load", $this, "onLoad");
     // page.assign kısmında action çalıştırılmış ve assign edilecek dataya manipülasyon yapılmasına izin verilen halidir.
     $this->event->register("page.assign", $this, "onAssign");
     // page.resource ise css ve js include listelerinde manipülasyon yapılabilmesine izin verir.
     $this->event->register("page.resource", $this, "onResource");
     // page.render kısmında ise render edilen metin içerisinde oynama yapılabilir.
     $this->event->register("page.render", $this, "onRender");
     // page.disposal kısımda ise sayfa ekrana basılmış olur ve tüm sayfa verisi öldürülür.
     $this->event->register("page.disposal", $this, "onDisposal");
 }
Ejemplo n.º 5
0
 public function execute($view)
 {
     parent::execute($view);
     return $view->render();
     $context = Joy_Context::getInstance();
     $resource = $view->getResourceList();
     $context->response->addScript($resource["javascripts"]);
     $context->response->addStyle($resource["stylesheets"]);
     $application = $context->config->application->get("application");
     $application["i18n"] = $view->getLocale();
     $tpl = new PHPTAL();
     $tpl->setSource($view->getTemplate());
     $tpl->import = new Joy_Render_Template_Importer($view);
     $tpl->application = $application;
     $tpl->get = (array) $view->assignAll();
     return $tpl->execute();
 }
Ejemplo n.º 6
0
 public function onRunning()
 {
     $item = $this->router->match($_SERVER["REQUEST_URI"]);
     if ($item instanceof Joy_Router_Match) {
         // Instance Context
         $context = Joy_Context::getInstance();
         $context->request->setAction($item->getController(), $item->getAction(), $item->getArguments());
         $context->request->setParameters($item->getParameters());
         $context->request->setMethod($item->getMethod());
         // Render Factory
         $render = $item->getRender();
         // Set Theme To Render
         $theme = $item->getTheme();
         $render->setTheme($theme);
         // Injection Render In The Response Object
         $context->response->setRender($render);
         // Page Factory
         $page = Joy_Page::factory($item->getPage());
         // Page is building
         $page->build();
     } else {
         throw new Joy_Exception_NotFound_Class("Joy_Router_Match class not found");
     }
 }
Ejemplo n.º 7
0
 protected function _init()
 {
     parent::_init();
     $this->_assign = array();
     $this->_canvas = Joy_Controller_Canvas::getInstance(get_class($this));
 }
Ejemplo n.º 8
0
 /**
  * getLocalePath method is getter {name}.{language}.locale file
  *
  * @return string locale file path
  */
 public function getLocalePath()
 {
     $context = Joy_Context::getInstance();
     return sprintf("%s/%s.locale", $this->getViewFolder(), $this->getName());
 }