public function transform() { //// // fetch attributes from taglib tag // navigation level $level = $this->getAttribute('level', '0'); // navigation is relative (in respect to level of current page) $rellevel = $this->getAttribute('rellevel', 'false'); // depth of levels (how many levels are displayed (in submenus)) $depth = $this->getAttribute('depth', '1'); // base page id $basePageId = $this->getAttribute('basePageId'); // keep request parameters $keepRequestParams = $this->getAttribute('keepRequestParams'); //// // fetch template name and namespace $tmplName = $this->getAttribute('template', 'navTaglib'); $tmplNamespace = $this->getAttribute('namespace', 'APF\\extensions\\apfelsms\\pres\\templates'); $page = new Page(); $page->setContext($this->getContext()); $page->setLanguage($this->getLanguage()); $page->loadDesign($tmplNamespace, $tmplName); $rootDoc = $page->getRootDocument(); $rootDoc->setAttribute('SMSNavLevel', $level); $rootDoc->setAttribute('SMSNavRelLevel', $rellevel); $rootDoc->setAttribute('SMSNavDepth', $depth); $rootDoc->setAttribute('SMSNavBasePageId', $basePageId); $rootDoc->setAttribute('SMSBaseNavKeepRequestParams', $keepRequestParams); return $page->transform(); }
public function transform() { //// // fetch attributes from taglib tag // fetch basePageId $basePageId = $this->getAttribute('basePageId'); // fetch basePageIdTitle $basePageIdTitle = $this->getAttribute('basePageIdTitle'); // keep request parameters $keepRequestParams = $this->getAttribute('keepRequestParams'); //// // fetch template name and namespace $tmplName = $this->getAttribute('template', 'breadcrumbNavTaglib'); $tmplNamespace = $this->getAttribute('namespace', 'APF\\extensions\\apfelsms\\pres\\templates'); $page = new Page(); $page->setContext($this->getContext()); $page->setLanguage($this->getLanguage()); $page->loadDesign($tmplNamespace, $tmplName); $rootDoc = $page->getRootDocument(); $rootDoc->setAttribute('SMSBreadcrumbNavBasePageId', $basePageId); $rootDoc->setAttribute('SMSBreadcrumbNavBasePageIdTitle', $basePageIdTitle); $rootDoc->setAttribute('SMSBaseNavKeepRequestParams', $keepRequestParams); return $page->transform(); }
/** * @param string $stringPager name of the pager * * @return string The HTML representation of the pager * @throws Exception In case no pager configuration can be found. * * @author Lutz Mahlstedt * @version * Version 0.1, 21.12.2009<br /> */ public function getPager($stringPager) { $stringOutput = ''; $objectArrayPagerMapper = $this->getDataMapper(); $arrayData = $objectArrayPagerMapper->loadEntries($stringPager); if (is_array($arrayData) === true) { if (is_array($arrayData) === true and count($arrayData) > 0) { // create pager page $pager = new Page(); // apply context and language (form configuration purposes!) $pager->setLanguage($this->getLanguage()); $pager->setContext($this->getContext()); // load the configured design $pager->loadDesign($this->pagerConfig['DesignNamespace'], $this->pagerConfig['DesignTemplate']); // add the necessary config params and pages $rootDoc = $pager->getRootDocument(); $rootDoc->setAttribute('Config', ['ParameterPage' => $this->pagerConfig['ParameterPage'], 'ParameterEntries' => $this->pagerConfig['ParameterEntries'], 'Entries' => intval($this->getRequest()->getParameter($this->pagerConfig['ParameterEntries'], $this->pagerConfig['Entries'])), 'EntriesPossible' => $this->pagerConfig['EntriesPossible'], 'EntriesChangeable' => $this->pagerConfig['EntriesChangeable']]); $rootDoc->setAttribute('DataCount', count($arrayData)); // add the anchor if desired if ($this->anchorName !== null) { $rootDoc->setAttribute('AnchorName', $this->anchorName); } $stringOutput = $pager->transform(); } } else { throw new Exception('[ArrayPagerManager->getPager()] There is no pager named "' . $stringPager . '" registered!', E_USER_WARNING); } return $stringOutput; }
/** * Creates the exception page. * * @return string the exception page content. * * @author Christian Achatz * @version * Version 0.1, 21.02.2009<br /> */ protected function buildExceptionPage() { // at this point we have to re-include the benchmark timer, because PHP // sometimes forgets about this import and throws a // Fatal error: Exception thrown without a stack frame in Unknown on line 0 // exception. // create page $stackTrace = new Page(); $stackTrace->setContext('APF\\core\\exceptionhandler'); $stackTrace->loadDesign('APF\\core\\exceptionhandler\\templates', 'exceptionpage'); // inject exception information into the document attributes array $doc = $stackTrace->getRootDocument(); $doc->setAttribute('id', $this->generateExceptionID()); $doc->setAttribute('message', $this->exceptionMessage); $doc->setAttribute('number', $this->exceptionNumber); $doc->setAttribute('file', $this->exceptionFile); $doc->setAttribute('line', $this->exceptionLine); $doc->setAttribute('trace', array_reverse($this->exceptionTrace)); $doc->setAttribute('type', $this->exceptionType); // create exception page return $stackTrace->transform(); }
/** * Creates the graphical output of the pagerc concerning the configured presentation layer template. * * @param array $addStmtParams list of additional statement params * * @return string The HTML representation of the pager * * @author Christian Achatz * @version * Version 0.1, 05.08.2006<br /> * Version 0.2, 11.03.2007 (Ported to new document controller, removed MessageQueue)<br /> * Version 0.3, 29.08.2007 (Anchor name is not set as the document's attribute)<br /> * Version 0.4, 02.03.2008 (The page is now applied the context and language)<br /> */ public function getPager($addStmtParams = []) { $pager = new Page(); // apply context and language (form configuration purposes!) $pager->setLanguage($this->language); $pager->setContext($this->context); // load the configured design $pager->loadDesign($this->pagerUiNamespace, $this->pagerUiTemplate); // add the necessary config params and pages $document = $pager->getRootDocument(); $document->setAttribute('Pages', $this->createPages4PagerDisplay($addStmtParams)); $document->setAttribute('PageUrlParameterName', $this->pageUrlParameterName); $document->setAttribute('CountUrlParameterName', $this->countUrlParameterName); $document->setAttribute('EntriesPerPage', $this->entriesPerPage); $document->setAttribute('DynamicPageSizeActivated', $this->isDynamicPageSizeActivated()); // add the anchor if desired if ($this->anchorName !== null) { $document->setAttribute('AnchorName', $this->anchorName); } return $pager->transform(); }
/** * Executes the desired actions and creates the page output. * * @param string $namespace Namespace of the templates. * @param string $template Name of the templates. * * @return string The content of the transformed page. * * @author Christian Achatz * @version * Version 0.1, 20.01.2007<br /> * Version 0.2, 27.01.2007<br /> * Version 0.3, 31.01.2007<br /> * Version 0.4, 03.02.2007 (Added permanent actions)<br /> * Version 0.5, 08.06.2007 (Outsourced URL filtering to generic input filter)<br /> * Version 0.6, 01.07.2007 (Removed permanentpre and permanentpost actions)<br /> * Version 0.7, 29.09.2007 (Added further benchmark tags)<br /> * Version 0.8, 21.06.2008 (Introduced Registry to retrieve URLRewrite configuration)<br /> * Version 0.9, 13.10.2008 (Removed $URLRewriting parameter, because URL rewriting must be configured in the registry)<br /> * Version 1.0, 11.12.2008 (Switched to the new input filter concept)<br /> */ public function start($namespace, $template) { // check if the context is set. If not, use the current namespace $context = $this->getContext(); if (empty($context)) { $this->setContext($namespace); } // Create request and response implementations for OO abstraction $request = $this->getRequest(); $response = $this->getResponse(); $response->setContentType('text/html; charset=' . Registry::retrieve('APF\\core', 'Charset')); // apply input filter to process request $request = InputFilterChain::getInstance()->filter($request); // execute pre page create actions (see timing model) $this->runActions(Action::TYPE_PRE_PAGE_CREATE); // create new page $page = new Page(); // set context $page->setContext($this->getContext()); // set language $page->setLanguage($this->getLanguage()); // load desired design $page->loadDesign($namespace, $template); // execute actions before transformation (see timing model) $this->runActions(Action::TYPE_PRE_TRANSFORM); // transform page and apply to response $response->setBody(OutputFilterChain::getInstance()->filter($page->transform())); // execute actions after page transformation (see timing model) $this->runActions(Action::TYPE_POST_TRANSFORM); return $response; }