Beispiel #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;
 }
Beispiel #2
0
 private function currentAppUrl()
 {
     $strResult = '';
     $strConfigName = '_appUrlsByEnvironment';
     $objRequest = Request::getInstance();
     $strRequestDomain = $objRequest->domain();
     //        echo $strRequestDomain;
     //        exit();
     foreach ($this->arrWorkingEnvironments as $numEnvironment) {
         $strConfigKeyName = sprintf('environment::%d', $numEnvironment);
         $arrEnvironmentUrls = Config::get($strConfigKeyName, $strConfigName);
         if (empty($arrEnvironmentUrls)) {
             continue;
         }
         foreach ($arrEnvironmentUrls as $strEnvironmentUrl) {
             if ($strEnvironmentUrl === $strRequestDomain) {
                 $strResult = $strRequestDomain;
                 self::$numCurrentEnvironment = $numEnvironment;
                 break;
             }
         }
     }
     return $strResult;
 }
Beispiel #3
0
 public function __construct()
 {
     $strTemplaterName = Config::get('templater');
     $this->objSpecifiedTemplater = new $strTemplaterName();
 }