Beispiel #1
0
 /**
  * Define template and template variables
  */
 public function setTemplate()
 {
     $path = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../templates/pages');
     $this->template = Manager::getTemplate($path);
     $this->template->context('manager', Manager::getInstance());
     $this->template->context('page', $this);
     $this->template->context('charset', Manager::getOptions('charset'));
     $this->template->context('template', $this->template);
 }
 public static function getInstance()
 {
     if (self::$instance == NULL) {
         $configLoader = Manager::getConf('maestro.db.configLoader') ?: 'PHP';
         $manager = self::$instance = new PersistentManager();
         self::$container = Manager::getInstance();
         $manager->setConfigLoader($configLoader);
     }
     return self::$instance;
 }
Beispiel #3
0
 public function __construct($path = '')
 {
     if (function_exists('mb_internal_charset')) {
         mb_internal_charset('UTF-8');
     }
     $this->engine = new \Latte\Engine();
     $this->path = $path ?: Manager::getPublicPath() . '/templates';
     $this->engine->setTempDirectory(sys_get_temp_dir());
     $this->engine->getParser()->defaultSyntax = 'double';
     $this->engine->addFilter('translate', function ($s) {
         return _M($s);
     });
     $this->context = array();
     $this->context('manager', Manager::getInstance());
 }
Beispiel #4
0
 /**
  * Processa o arquivo da view
  * @param type $controller
  * @param type $parameters
  * @return type
  */
 public function process($controller, $parameters)
 {
     mtrace('view file = ' . $this->viewFile);
     $extension = pathinfo($this->viewFile, PATHINFO_EXTENSION);
     if ($extension == 'xml') {
         $content = $this->processXML();
     } elseif ($extension == 'php') {
         $content = $this->processPHP();
     } else {
         $content = $this->processFile();
     }
     $parameters->manager = Manager::getInstance();
     $painter = Manager::getPainter();
     $result = $painter->generate($content, $parameters);
     return $result;
 }
Beispiel #5
0
 private function processTemplate()
 {
     $baseName = basename($this->viewFile);
     $template = Manager::getTemplate(dirname($this->viewFile));
     $template->context('manager', Manager::getInstance());
     $template->context('page', Manager::getPage());
     $template->context('view', $this);
     $template->context('data', $this->data);
     $template->context('template', $template);
     $template->context('painter', Manager::getPainter());
     return $template->fetch($baseName);
 }
Beispiel #6
0
 /**
  * Define template and template variables
  */
 public function setTemplate()
 {
     $path = Manager::getThemePath();
     $this->template = new MTemplate($path);
     $this->template->context('manager', Manager::getInstance());
     $this->template->context('page', $this);
     $this->template->context('charset', Manager::getOptions('charset'));
     $this->template->context('template', $this->template);
 }