public function testSetDataViaMethods()
 {
     $view = new View('/path/');
     $this->assertFalse($view->isSetDataViaMethods());
     $view->templatesPath = 'aaaa';
     $this->assertEquals('/path', $view->getTemplatesPath());
     $this->assertEquals($view->getData(), ['templatesPath' => 'aaaa']);
 }
Example #2
0
 /**
  * @param string $contentType The name of the handler that the template engine should use to render the output.
  *                            Types: XHTML, RSS, XML, JSON, JSONp, JavaScript, SerializedPHP, PlainText, HTTPGET
  *                            A template engine may or may not support all of these handlers.
  *
  * @throws Exception If template engine doesn't support requested content type (thrown from TemplateEngine)
  * @throws Exception If no template engine is capable of rendering the view template supplied
  * @throws Exception If the template engine doesn't support the handler type.
  */
 public function renderView(View $view, $contentType, $cacheEnabled = true, $pushCache = false)
 {
     $this->view = $view;
     $this->contentType = $contentType;
     $this->cacheEnabled = $cacheEnabled;
     $this->pushCache = $pushCache;
     $this->noTemplatesCalled = true;
     //VIEW DATA (MODEL) IS USED AS GLOBAL VARIABLES DURING TEMPLATE RENDER
     $globals = $view->getData() == null ? array() : $view->getData();
     $templateEngine = $this->getTemplateEngine($view->getName());
     $this->Logger->debug("Starting render [{$view->getName()}] - " . ($cacheEnabled == true ? 'WITH' : 'WITHOUT') . " CACHING");
     if ($this->benchmarkRendering) {
         $this->Benchmark->start('render-' . $view->getName());
     }
     $content = $templateEngine->firstPass($view->getName(), $contentType, $globals, $this);
     foreach ($this->invokedTemplateEngines as $te) {
         $this->Logger->debug("Starting finalPass for [" . get_class($te) . "]");
         $content = $te->finalPass($content, $contentType, $globals, $this);
     }
     $this->Logger->debug("Completed rendering view [{$view->getName()}]");
     if ($this->benchmarkRendering) {
         $this->Benchmark->end('render-' . $view->getName());
     }
     $this->noTemplatesCalled = true;
     return array($content, $globals);
 }
Example #3
0
 /**
  * a helper method to assert the view vars have the expected keys
  *
  * @return void
  * @author Craig Ulliott
  */
 function assertViewVarsKeys(array $keys)
 {
     $this->assertArrayHasKeys($keys, View::getData());
 }
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
include "prepend.inc.php";
$Server = getData("Server", "integer");
$User = getData("User");
$Viewname = getData("Viewname");
$html = "<h1> Database " . $DB->Name($Server) . " - View " . $Viewname . "</h1>";
if ($Viewname) {
    $view = new View($Server);
    $view->setOwner($User);
    $view->setName($Viewname);
    $view->getData();
    $html .= "<table border=0><tr><th>Tag</th><th>Value</th></tr>";
    $html .= "<tr><td>Name</td><td>" . $view->name . "</td></tr>";
    $html .= "<tr><td>Owner</td><td>" . $view->owner . "</td></tr>";
    $html .= "<tr><td>Comment</td><td>" . $view->comment . "</td></tr>";
    $html .= "</table>";
    $html .= "<P><B>View body:</b><br>";
    $html .= nl2br($view->sql) . "<br>";
    $html .= "</P>";
}
$page = new Page("View Properties");
$page->setHead();
$page->setBody();
$page->setSQL();
$page->setBody($html);
$page->Display();