_restAlias) { if ('login' === \Qs_Request::getGetValue('action')) { $this->_action = 'login'; } else { $this->_getDataObj()->setPrimaryKey($this->_restAlias); $this->_action = 'view'; } } return parent::exec(); } public function preDispatch(&$items) { if (!$this->_restAlias) { return $this; } foreach ($items as $index => $item) { if ('HtmlBlock_' == $item['type'] && 'ITEMS' == $item['groupName']) { unset($items[$index]); } } return $this; } protected function _doView() { $item = $this->_getDataObj()->getData(); if (empty($item)) { $this->_doc->display404(); } if (!empty($item['title'])) { $this->_doc->setHeader($item['title'] . ' '. $this->getConfig('itemName')); } if (!empty($item['metaKeyword'])) { $this->_doc->setKeywords($item['metaKeyword']); } if (!empty($item['metaDescription'])) { $this->_doc->setDescription($item['metaDescription']); } $item['config'] = $this->getConfig()->toArray(); $item['tpl'] = $this->getTemplate('view.tpl'); $item['backUrl'] = ($backUrl = $this->_getBackUrl(CURRENT_PAGE_FINAL)) ? $backUrl : CURRENT_PAGE_FINAL; $item['memberUrl'] = \App_User_Member_View::getMemberUrl(); if ($this->_isLeadership()) { $item['isLeadership'] = true; $item['manageUrl'] = UserView::getManageUrl($this->_getDataObj()->getPrimaryKey()); } else { $item['isLeadership'] = false; $item['manageUrl'] = ''; } $item['isLogged'] = \App_User_Auth::getInstance()->isLoggedIn(); $item['isMember'] = $this->_isMember(); $item['loginUrl'] = $this->url(array('action' => 'login')); $this->_addItem($item); $this->_postView(); return $this; } protected function _doLogin() { if ($loginUrl = \Qs_SiteMap::findFirst(null, array('type' => 'User_Login_'), null, 'url')) { LoginView::setSessionRedirectPage(CURRENT_PAGE, LoginView::REDIRECT_PAGE_ALIAS); Qs_Http::redirect($loginUrl); exit; } $this->_doBack(); } protected function _isLeadership() { if (!\App_User_Auth::getInstance()->isLoggedIn() || !$this->_getDataObj()->isLeadership(\App_User_Auth::getInstance()->getData('id')) ) { return false; } return true; } protected function _isMember() { if (\App_User_Auth::getInstance()->isLoggedIn() && $this->_getDataObj()->isMember(\App_User_Auth::getInstance()->getData('id')) ) { return true; } return false; } }