_restAlias) { if (1 == count($this->_restParams)) { $this->_defaultAction = 'view'; $this->_getDataObj()->setPrimaryKeyByAlias($this->_restAlias); $this->_doc->setBodyTemplate('member.tpl'); } else if ('blog' === $this->getRestParam(1)) { $this->_getDataObj()->setPrimaryKeyByAlias($this->getRestParam(0)); if (!$this->_getDataObj()->getData()) { $this->_do404(); return $this; } $this->_action = 'blog'; } else { $this->_do404(); return $this; } } $this->_initAction(); if (in_array($this->_action, ['view', 'blog']) && $this->_getDataObj()->getPrimaryKey() == $this->_doc->getAuthData('id') && 1 == $this->_doc->getAuthData('membershipExpired') ) { $url = MembershipRenewView::getPage('url'); $this->_doc->setGroupName('BOTTOM_ITEMS'); $this->_doc->displayError( 'Your Membership is expired and member page is not available. ' . 'Please renew your membership.'); return $this; } $this->_callAction(); return $this; } public function preDispatch(&$items) { if (!empty($this->_restAlias)) { foreach ($items as $index => $item) { if ($item['type'] == 'HtmlBlock_' && $item['groupName'] == 'ITEMS') { unset($items[$index]); } } } return $this; } protected function _initDetailsPage(array $item) { $this->_doc->setOption('disableHeaderImage', true); Qs_Navigation::append(['title' => $item['fullName']]); parent::_initDetailsPage($item); $this->_doc->setHeader(''); $this->_addDetailPageResources(); return $this; } protected function _prepareViewItem(array &$item) { $item['backUrl'] = static::getPage('url'); $item['title'] = $item['fullName']; $item['youtubeId'] = AbstractForm::parseYoutubeVideoId($item['youtubeVideo']); $item['blog'] = (new BlogMemberBlock([ 'userId' => $this->_getDataObj()->getPrimaryKey(), 'userBlogBaseUrl' => $this->getUserBlogBaseUrl(), ]))->render(); return parent::_prepareViewItem($item); } protected function _addDetailPageResources() { $this->_doc->addScript('js/app/user/member/sticky-navigate-panel.js'); $this->_doc->addInitObject('app.user.member.StickyNavigatePanel'); $this->_doc->addScript('js/app/user/member/scrollToSection.js'); $this->_doc->addInitObject('app.user.member.ScrollToSection'); $this->_doc->addScript('js/app/user/member/video.js'); $this->_doc->addInitObject('app.user.member.Video'); return $this; } public function writeXmlSitemap(App_Sitemap_Xml_Writer $xml) { $stmt = $this->_getDataObj()->getListStatement4XmlSitemap(['alias', 'video', 'youtubeVideo', 'changed']); $pageUrl = ('y' == $this->_doc->getOption('isSecure')) ? BASE_URL_HTTPS : BASE_URL_HTTP; $pageUrl .= '/' . $this->_doc->getOption('fullAlias'); $videoSitemapInfoObj = new \App\VideoSitemapInfo\Admin\Obj(); while ($item = $stmt->fetch()) { $videos = []; if ($item['video']) { $sitemapInfo = $videoSitemapInfoObj->getVideoSitemapInfo($item['video']); $videos[] = [ 'content_loc' => $videoSitemapInfoObj->prepareVideoUrl($item['video']), 'thumbnail_loc' => Qs_ImageFs::getUrl($sitemapInfo['image']), 'title' => $sitemapInfo['title'], 'description' => $sitemapInfo['description'], ]; } elseif ($item['youtubeVideo']) { $sitemapInfo = $videoSitemapInfoObj->getVideoSitemapInfo($item['youtubeVideo']); $videos[] = [ 'player_loc' => $videoSitemapInfoObj->prepareYoutubeVideoUrl($item['youtubeVideo']), 'thumbnail_loc' => Qs_ImageFs::getUrl($sitemapInfo['image']), 'title' => $sitemapInfo['title'], 'description' => $sitemapInfo['description'], ]; } $xml->writeUrl($pageUrl . '/' . $item['alias'], Qs_Array::get($item, 'changed'), $videos); } return $this; } protected function getUserBlogBaseUrl() { return self::getPage('fullAlias') . '/' . $this->_getDataObj()->getData('alias') . '/blog'; } protected function _doBlog() { $restParams = $this->getRestParams(); array_shift($restParams); // remove user alias array_shift($restParams); // remove blog $view = new BlogUserView([ 'doc' => $this->_doc, 'idItem' => -2048, 'restParams' => $restParams, 'viewAlias' => $this->getUserBlogBaseUrl(), 'filter' => [ 'createdBy' => 'user', 'createdById' => $this->_getDataObj()->getData('id'), ], ]); $view->exec(); $title = $this->_getDataObj()->getData('fullName') . '\'s Blog Posts'; $this->_doc->setTitle($title)->setHeader($title); return $this; } }