public function testNormalRendering() { $template = new Template('test', 'html'); $expectedOutput = file_get_contents(APPLICATION_HOME . '/templates/html/test.inc'); $this->assertEquals($expectedOutput, $template->render()); $helper = $template->getHelper('test'); $this->assertEquals('something', $helper->test('something')); $template = new Template('partials', 'html'); $expectedOutput = file_get_contents(APPLICATION_HOME . '/templates/html/partials/testPartial.inc'); $this->assertEquals($expectedOutput, $template->render()); }
/** * SITE_HOME sites should be able to override any template */ public function testSiteOverrides() { $template = new Template('test', 'test'); $expectedOutput = file_get_contents(__DIR__ . '/templates/test/test.inc'); $this->assertEquals($expectedOutput, $template->render()); $helper = $template->getHelper('test'); $this->assertEquals('something', $helper->test('something')); $template = new Template('partials', 'test'); $expectedOutput = file_get_contents(__DIR__ . '/templates/test/partials/testPartial.inc'); $this->assertEquals($expectedOutput, $template->render()); }
public function __construct(array $vars) { $format = !empty($_REQUEST['format']) ? $_REQUEST['format'] : 'html'; parent::__construct('admin', $format, $vars); $this->blocks[] = new Block('people/list.inc', ['people' => $this->people]); $this->blocks[] = new Block('pageNavigation.inc', ['paginator' => $this->people]); }
public function __construct(array $vars) { parent::__construct('admin', 'html', $vars); $this->blocks[] = new Block('users/updateForm.inc', ['user' => $this->user]); if ($this->user->getId()) { $this->blocks[] = new Block('people/info.inc', ['person' => $this->user]); } }
public function __construct(array $vars) { $format = !empty($_REQUEST['format']) ? $_REQUEST['format'] : 'html'; parent::__construct('map', $format, $vars); $this->blocks['panel1'][] = new Block('maps/searchForm.inc'); $this->blocks['panel1'][] = new Block('maps/relatedLinks.inc', ['linksMarkdown' => $this->map->getRelatedMarkdown()]); $this->blocks[] = new Block('maps/view.inc', ['map' => $this->map]); }
public function __construct(array $vars = null) { $format = !empty($_REQUEST['format']) ? $_REQUEST['format'] : 'html'; parent::__construct('default', $format, $vars); $this->blocks[] = new Block('loginForm.inc', ['return_url' => $this->return_url]); }
public function __construct(array $vars) { $format = !empty($_REQUEST['format']) ? $_REQUEST['format'] : 'html'; parent::__construct('map', $format, $vars); $this->blocks[] = new Block('maps/updateForm.inc', ['map' => $this->map]); }
public function __construct(array $vars = null) { $format = !empty($_REQUEST['format']) ? $_REQUEST['format'] : 'html'; parent::__construct('map', $format, $vars); }
public function __construct(array $vars) { parent::__construct('admin', 'html', $vars); $this->blocks[] = new Block('people/updateForm.inc', ['person' => $this->person, 'return_url' => $this->return_url]); }
$_REQUEST[$action_id] = $matches[3]; } $_REQUEST['format'] = !empty($matches[5]) ? $matches[5] : 'html'; } } elseif (preg_match('#' . BASE_URI . '/media/\\d{4}/\\d{1,2}/\\d{1,2}/(\\d+)/([a-f0-9]+\\.[a-z]+)#', $_SERVER['REQUEST_URI'], $matches)) { $resource = 'media'; $action = 'resize'; $_REQUEST['size'] = $matches[1]; $_REQUEST['media_id'] = $matches[2]; } elseif (preg_match('#' . BASE_URI . '(/([a-zA-Z0-9]+))?(/([a-zA-Z0-9]+))?#', $_SERVER['REQUEST_URI'], $matches)) { $resource = isset($matches[2]) ? $matches[2] : 'index'; $action = isset($matches[4]) ? $matches[4] : 'index'; } // Create the Template $format = !empty($_REQUEST['format']) ? $_REQUEST['format'] : 'html'; $template = new Template('default', $format); // Execute the Controller::action() if (isset($resource) && isset($action) && $ZEND_ACL->hasResource($resource)) { $role = isset($_SESSION['USER']) ? $_SESSION['USER']->getRole() : 'Anonymous'; if ($ZEND_ACL->isAllowed($role, $resource, $action)) { $controller = 'Application\\Controllers\\' . ucfirst($resource) . 'Controller'; $c = new $controller($template); $c->{$action}(); } else { header('HTTP/1.1 403 Forbidden', true, 403); $_SESSION['errorMessages'][] = new \Exception('noAccessAllowed'); } } else { header('HTTP/1.1 404 Not Found', true, 404); $template->blocks[] = new Block('404.inc'); }
public function __construct(array $vars) { parent::__construct('admin', 'html', $vars); $this->blocks[] = new Block('users/list.inc', ['users' => $this->users]); $this->blocks[] = new Block('pageNavigation.inc', ['paginator' => $this->users]); }
public function __construct(array $vars) { $format = !empty($_REQUEST['format']) ? $_REQUEST['format'] : 'html'; parent::__construct('admin', $format, $vars); $this->blocks[] = new Block('people/info.inc', ['person' => $this->person]); }
public function __construct(array $vars = null) { header('HTTP/1.1 403 Forbidden', true, 403); parent::__construct('admin', 'html', $vars); }
public function __construct(array $vars = null) { header('HTTP/1.1 404 Not Found', true, 404); parent::__construct('admin', 'html', $vars); $this->blocks[] = new Block('404.inc'); }