/** * 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; }
public function getPainter() { return Manager::getPainter(); }
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); }
private function getControlsFromInclude($node, &$controls, $handleChildren = false) { if ($node) { if ($this->ignoreElement($node)) { return NULL; } $attributes = $node->attributes(); if ($attributes['file']) { $fileName = $attributes['file']; $file = $this->path . '/' . $this->processValue($fileName); } elseif ($attributes['component']) { $fileName = $attributes['component']; $file = Manager::getAppPath('components/' . $fileName); } $extension = pathinfo($file, PATHINFO_EXTENSION); if ($extension == 'xml') { $xmlControls = new MXMLControls(); $xmlControls->loadFile($file, $this->context); foreach ($xmlControls->get() as $c) { $controls->addControl($c); } } elseif ($extension == 'html') { $control = new MBaseControl('mhtml'); $control->tag = 'div'; $template = new \Maestro\UI\MTemplate(dirname($file)); $template->multicontext(['page' => Manager::getPage(), 'data' => Manager::getData(), 'template' => $template, 'painter' => Manager::getPainter()]); $control->inner = $template->fetch($fileName); $controls->addControl($control); } elseif ($extension == 'php') { include_once $file; $fileName = end(explode('/', $fileName)) ?: $fileName; $className = str_replace('.' . $extension, '', $fileName); $c = new $className(); $this->getPropertiesFromNode($c, $node); if ($handleChildren) { $controls->addControl($c); } else { $controls[] = $c; } } } }
public function __construct() { $this->painter = Manager::getPainter(); }
public function fetch($templateName = '', $vars = array()) { $painter = Manager::getPainter(); $html = $painter->fetch('errors/' . $templateName . '.html', $vars); return $html; }
public function __construct($baseControl) { $this->baseControl = $baseControl; $this->painter = Manager::getPainter(); }
public function generate() { $this->render = $method = $this->tag; $painter = Manager::getPainter(); //mdump($this); $this->result = $painter->{$method}($this); $painter->generateEvents($this); return $this->result; }