public function __construct($name, $style = 'default', $format = null) { $this->setName($name); $this->setStyle($style); $base = LAYOUT_DIR . $this->getName() . DIRECTORY_SEPARATOR; $action = $this->getStyle(); if (!$format) { if (Request::isAjax() && $this->exist($base, $action, 'ajax') || Ajde::app()->getDocument()->getFormat() === 'ajax') { $format = 'ajax'; } else { if (Ajde::app()->getDocument()->getFormat() === 'crud') { $format = 'crud'; } else { $format = 'html'; } } } parent::__construct($base, $action, $format); }
private function _hasCustomTemplate() { $base = $this->_getCustomTemplateBase(); $action = $this->_getCustomTemplateAction(); return Template::exist($base, $action) !== false; }
private function _getTemplateActionDefault(Template $template) { $actionArray = explode('/', $template->getAction()); end($actionArray); $actionArray[key($actionArray)] = 'default'; return implode('/', $actionArray); }