/** * @return TemplatePathsController */ function createControllerFor($action_name, $mime_type = 'html') { $controller_class_name = AkInflector::camelize($this->controller_name) . 'Controller'; $controller = new $controller_class_name(); $Request = $this->createGetRequest($action_name, $mime_type); $Response = $this->getMock('AkResponse', array('outputResults')); $controller->setRequestAndResponse($Request, $Response); $this->Template = $controller->Template = $this->getMock('AkActionView', array('renderFile'), array(AK_VIEWS_DIR . DS . $this->controller_name)); $this->Template->_registerTemplateHandler('tpl', 'AkPhpTemplateHandler'); $this->Template->_registerTemplateHandler('html.tpl', 'AkPhpTemplateHandler'); $this->action_name = $action_name; return $this->Controller = $controller; }
/** * Render detailed diagnostics for unhandled exceptions rescued from * a controller action. */ public function rescueActionLocally($Exception) { $exception_class_name = get_class($Exception); if (!isset($this->rescue_templates[$exception_class_name])) { AkError::handle($Exception); } AkConfig::rebaseApp(AK_ACTION_PACK_DIR . DS . 'rescues'); $Template = new AkActionView(); $Template->registerTemplateHandler('tpl', 'AkPhpTemplateHandler'); $Template->Request = $this->Request; $file = $this->rescue_templates[$exception_class_name]; $body = $Template->render(array('file' => $file, 'layout' => 'layouts/exception', 'locals' => array('Exception' => $Exception, 'Template' => $Template, 'Request' => $this->Request))); AkConfig::leaveBase(); $this->render($this->getStatusCode($Exception), $body); }
function test_content_for() { $str = "test CaptureHelper content_for"; $this->capture_helper->content_for('content_for'); echo $str; $this->assertEqual($this->capture_helper->end(), $str); $globals = AkActionView::_getGlobals(); $this->assertEqual($globals['content_for_content_for'], $str); }
public function test_concatenation() { $this->capture_helper->content_for('concatenation'); echo 'A'; $this->assertEqual($this->capture_helper->end(), 'A'); $this->capture_helper->content_for('concatenation'); echo 'B'; $this->assertEqual($this->capture_helper->end(), 'B'); $globals = AkActionView::_getGlobals(); $this->assertEqual($globals['content_for_concatenation'], 'AB'); }
public function &_initializeTemplateClass($assigns) { require_once AK_LIB_DIR . DS . 'AkActionView.php'; $TemplateInstance = new AkActionView($this->getTemplatePath(), $assigns, $this); require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'AkPhpTemplateHandler.php'; $TemplateInstance->_registerTemplateHandler('tpl', 'AkPhpTemplateHandler'); return $TemplateInstance; }
/** * @static */ function _getGlobals() { return AkActionView::_addGlobalVar(null, null, true); }
function _addVarToView($var_name, $content) { AkActionView::_addGlobalVar($var_name, $content); }
protected function &_initializeTemplateClass($assigns) { $TemplateInstance = new AkActionView($this->getTemplatePath(), $assigns, $this); $TemplateInstance->registerTemplateHandler('tpl', 'AkPhpTemplateHandler'); $TemplateInstance->setHelperLoader($this->getHelperLoader()); return $TemplateInstance; }
static function getGlobals() { return AkActionView::addGlobalVar(null, null, true); }
/** * @return AkActionView */ public function createView() { $View = new AkActionView(AkConfig::getDir('views') . DS . $this->controller_name); $View->registerTemplateHandler('tpl', 'AkPhpTemplateHandler'); return $this->Template = $View; }