Ejemplo n.º 1
0
 public function render($arrLayoutData = array())
 {
     $arrBoxesResponseContents = array();
     foreach ($this->arrPlaceholderBoxes as $strPlaceholderName => $arrBoxes) {
         $arrBoxesResponseContents[$strPlaceholderName] = array();
         foreach ($arrBoxes as $objBox) {
             $objBoxResponse = $objBox->launch();
             $arrBoxesResponseContents[$strPlaceholderName][] = $objBoxResponse->__toString();
         }
     }
     $strLayoutFullName = get_called_class();
     $arrLayoutFullNameTokens = explode('\\', $strLayoutFullName);
     $strLayoutName = array_pop($arrLayoutFullNameTokens);
     $strLayoutPath = sprintf('%s/layout/view/%s', Application::getInstance()->strDirectory, $strLayoutName);
     $objTemplater = Templater::createSpecifiedTemplater(Config::get('templater'));
     $objCurrentRoute = Router::getCurrentRoute();
     if (!empty($objCurrentRoute)) {
         $arrLayoutData['route'] = array('name' => $objCurrentRoute->strRouteName, 'action' => $objCurrentRoute->strMethodName);
     }
     if (method_exists($this, 'launch')) {
         $arrLayoutData = array_merge($this->launch(), $arrLayoutData);
     }
     $strLayoutContent = $objTemplater->getTemplateFileContent($strLayoutPath, $arrLayoutData);
     foreach ($this->arrPlaceholderBoxes as $strPlaceholderName => $arrBoxes) {
         $strLayoutContent = str_replace(sprintf('[placeholder:%s]', $strPlaceholderName), join('', $arrBoxesResponseContents[$strPlaceholderName]), $strLayoutContent);
     }
     // removing unused placeholders
     $strLayoutContent = preg_replace('/\\[placeholder\\:([a-z\\-]+)\\]/', '', $strLayoutContent);
     //        echo $strLayoutContent;exit();
     //        echo $strLayoutContent;exit();
     return $strLayoutContent;
 }
Ejemplo n.º 2
0
 public static function currentUrl()
 {
     $objCurrentRoute = \webcitron\Subframe\Router::getCurrentRoute();
     $arrRequestParams = \webcitron\Subframe\Request::getParams();
     $strUrl = \webcitron\Subframe\Url::route($objCurrentRoute->strRouteFullName, $arrRequestParams);
     return $strUrl;
 }