1) { $this->assign('LANGUAGES', $list); } $this->_initRightBlockContent(); $this->_initLeftColumnFiles(); $this->_initLoginForm(); // menu accordion $this->addScript('js/app/menu-addons.js'); return $this; } protected function _initLoginForm() { $formView = new App_User_Login_View(); if (!$formView->auth->isLoggedIn()) { $form = $formView->getFloatForm(); $this->assign('LOGIN_FROM', $form); } return $this; } public function getMenu() { if (null === $this->_content['menu']) { $this->_content['menu'] = Qs_SiteMap::getMenu(); $this->_prepareMenuFileList($this->_content['menu']); } return $this->_content['menu']; } protected function _initRightBlockContent() { $contentBlock = new App_RightBlock_View(); $item = $contentBlock->getBlockItems($this->getOption('id')); if (!empty($item)) { $this->addItem($item, 'RIGHT_ITEMS'); } return $this; } protected function _initLeftColumnFiles() { $filesView = new App_AppFile_View(); $item = $filesView->getFileItems($this->getOption('id')); if (!empty($item)) { $this->addItem($item, 'LEFT_ITEMS'); } return $this; } protected function _prepareMenuFileList(&$menu) { $filesView = new App_AppFile_View(); $list = $filesView->getMenuFileList(); if (!empty($list) && is_array($list) && count($list)) { foreach ($menu as &$mValue) { if ($mValue['alias'] != 'home') { $mValue['fileList'] = array(); foreach ($list as $lKey => $lValue) { if ($lValue['idPage'] == $mValue['id']) { $mValue['fileList'][] = $lValue; unset($list[$lKey]); } } } if (!empty($mValue['sub']) && $mValue['alias'] != 'home') { foreach ($mValue['sub'] as &$sValue) { $sValue['fileList'] = array(); foreach ($list as $k => $v) { if ($v['idPage'] == $sValue['id']) { $sValue['fileList'][] = $v; unset($list[$k]); } } } } } } return $this; } }