Exemple #1
0
 /**
  * Constructor
  * 
  * @access public
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     // Standard Template
     $this->sTemplate = $this->sTemplateDir . '/layout/index.tpl';
     // Standard Variable
     $this->sContentVar = 'sContent';
 }
 public function __construct()
 {
     $this->app = App::getInstance();
     $this->view = View::getInstance();
     $this->config = $this->app->getConfig();
     $this->input = InputData::getInstance();
     $this->session = $this->app->getSession();
     $this->db = new SimpleDB();
 }
 /**
  * Add Module
  * 
  * @param Module $module
  * @return Container
  * @throws \LogicException
  */
 public function addModule(Module $module)
 {
     $name = $module->getName();
     if (isset($this->modules[$name])) {
         throw new \LogicException(sprintf('Trying to register two modules with the same name "%s"', $name));
     }
     $this->view->addTemplatePath($module->getPath() . '/Resources/views');
     $this->modules[$name] = $module;
     return $this;
 }
 public function send($result)
 {
     if (!$result) {
         $result = array();
     }
     $type = $this->request->type;
     if ($type == 'json') {
         return $this->sendJson($result);
     }
     if ($type == 'html' || $type == 'ajax') {
         $layout = Registry::get('app')->layout;
         $view = new View();
         $view->setData($result);
         $content = $view->render('modules/' . $this->request->module . '/views/' . $this->request->controller . '/' . $this->request->action);
         if ($layout->isLayout()) {
             $layout->content = $content;
             $content = $layout->render();
         }
         echo $content;
         return $content;
     }
     return null;
 }
 /**
  * Renders a view.
  * @access public
  * @param string $file      The file to be rendered.
  * @param array $vars       The variables to be substituted in the view.
  * @return mixed
  */
 public function renderHtml($file, $vars = array())
 {
     return $this->view->render($file, $vars);
 }
Exemple #6
0
 /**
  * @param $title
  *
  * @return $this
  */
 protected function setTitle($title)
 {
     View::getInstance()->setTitle($title);
     return $this;
 }
 public function partial($path, $data = array())
 {
     $view = new View();
     $view->setData($data);
     return $view->render($path);
 }