Ejemplo n.º 1
0
 public static function View($controllerOutput)
 {
     if (method_exists($controllerOutput, 'TemplateName')) {
         $view = new ViewTemplate($controllerOutput->TemplateName(), $controllerOutput->model);
         echo $view->GetResponse()->saveHTML();
     } else {
         echo json_encode($controllerOutput->model);
     }
 }
Ejemplo n.º 2
0
 /**
  * Prepend the xml prolog
  *
  * @param ViewContextTemplate  $context A view context object
  * @return string  The output of the view
  */
 protected function _actionRender(ViewContextTemplate $context)
 {
     //Prepend the xml prolog
     $content = '<?xml version="1.0" encoding="utf-8" ?>';
     $content .= parent::_actionRender($context);
     return $content;
 }
 public function __construct()
 {
     parent::__construct();
     // This may get called before the schema is created.
     if (!DB::getConn()->isSchemaUpdating()) {
         HtmlEditorConfig::get('cms')->setOption('viewtemplate', ViewTemplate::get()->map('Title')->toArray());
     }
 }
Ejemplo n.º 4
0
 /**
  * Get a route based on a full or partial query string.
  *
  * This function force the route to be not fully qualified and not escaped
  *
  * @param string    $route  The query string used to create the route
  * @param boolean   $fqr    If TRUE create a fully qualified route. Default FALSE.
  * @param boolean   $escape If TRUE escapes the route for xml compliance. Default FALSE.
  * @return string The route
  */
 public function getRoute($route = '', $fqr = null, $escape = null)
 {
     //If not set force to false
     if ($fqr === null) {
         $fqr = false;
     }
     return parent::getRoute($route, $fqr, $escape);
 }
Ejemplo n.º 5
0
 /**
  * Return the views output
  *
  * This function will auto assign the model data to the view if the auto_assign
  * property is set to TRUE.
  *
  * @return string 	The output of the view
  */
 public function render()
 {
     $model = $this->getModel();
     //Auto-assign the state to the view
     $this->state = $model->getState();
     //Auto-assign the data from the model
     if ($this->_auto_assign) {
         //Get the view name
         $name = $this->getName();
         //Assign the data of the model to the view
         if (StringInflector::isPlural($name)) {
             $this->{$name} = $model->getRowset();
             $this->total = $model->getTotal();
         } else {
             $this->{$name} = $model->getRow();
         }
     }
     return parent::render();
 }
Ejemplo n.º 6
0
 /**
  * Initializes the config for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   ObjectConfig $config Configuration options
  * @return  void
  */
 protected function _initialize(ObjectConfig $config)
 {
     $config->append(array('mimetype' => 'text/html', 'template_filters' => array('form', 'include')));
     parent::_initialize($config);
 }
Ejemplo n.º 7
0
 public function __construct($template, $model)
 {
     echo $template . '<br>';
     //	[A][a]	Pattern and Final docs
     $this->doc = new DOMDocument();
     $this->response = new DOMDocument();
     //	[A][b.1]	Root Result Element(s)
     $inspector = $this->response->createElement('html');
     $this->response->appendChild($inspector);
     $head = $inspector->appendChild($this->response->createElement('head'));
     $style = $head->appendChild($this->response->createElement('style'));
     $title = $head->appendChild($this->response->createElement('title'));
     $inspector = $inspector->appendChild($this->response->createElement('body'));
     $this->parentReponse = NULL;
     //	[A][b.2]	Root Document Template
     $this->doc->load(getcwd() . "/{$template}") or die("Template failed (" . getcwd() . "/{$template}).");
     $view = $this->doc->documentElement;
     $title->nodeValue = $view->getAttribute('title');
     // Copy the title from the root view note attr'
     if ($view->getAttribute('template') != '') {
         $parent = new ViewTemplate($view->getAttribute('template'), $model);
         $place = $parent->GetResponse()->getElementsByTagName('mvc:child');
         //echo var_dump($place->item(0));
         $this->response = $parent->GetResponse();
         //echo var_dump($this->response);
         $inspector = $place->item(0);
         //$this->response->createElement('div');
         //$this->response->replaceChild($inspector, $place->item(0));
         $head = $this->response->getElementsByTagName('head')->item(0);
         $style = $this->response->getElementsByTagName('style')->item(0);
         $title = $this->response->getElementsByTagName('title')->item(0);
     }
     $this->compile($this->doc, $view, $this->response, $inspector, $head, $title, $style, $model);
 }
Ejemplo n.º 8
0
 public function _showTemplate(ViewTemplate $tpl)
 {
     $tpl->show();
     exit;
 }