コード例 #1
0
    /**
     * Generate a Block of searching result by Tag (GET is tagKey)
     *
     * @return HTML presentation of data
     */
    function GenSearchResult()
    {
        if (!$this->isAllowedBlogPostSearch(true)) {
            return $this->_oTemplate->displayAccessDenied();
        }
        $iCheckedMemberID = $this->_iVisitorID;
        $bNoProfileMode = false !== bx_get('ownerID') || false !== bx_get('blogOwnerName') ? false : true;
        $sRetHtml = '';
        $sSearchedTag = uri2title(process_db_input(bx_get('tagKey'), BX_TAGS_STRIP));
        $iMemberID = $this->defineUserId();
        $sTagsC = _t('_Tags');
        $sNoBlogC = _t('_bx_blog_No_blogs_available');
        require_once $this->_oConfig->getClassPath() . 'BxBlogsSearchUnit.php';
        $oTmpBlogSearch = new BxBlogsSearchUnit($this);
        $oTmpBlogSearch->PerformObligatoryInit($this, 4);
        $oTmpBlogSearch->aCurrent['restriction']['tag2']['value'] = $sSearchedTag;
        $oTmpBlogSearch->aCurrent['paginate']['perPage'] = $this->_oConfig->getPerPage();
        if ($iMemberID > 0) {
            $oTmpBlogSearch->aCurrent['restriction']['owner']['value'] = $iMemberID;
        }
        if ($iMemberID != 0 && $iMemberID == $iCheckedMemberID || $this->isAdmin() == true) {
            $oTmpBlogSearch->aCurrent['restriction']['activeStatus'] = '';
        }
        $sBlogPostsVal = $oTmpBlogSearch->displayResultBlock();
        $sBlogPostsVal = '<div class="blogs-view bx-def-bc-padding">' . $sBlogPostsVal . '</div>';
        $oTmpBlogSearch->aCurrent['paginate']['page_url'] = $oTmpBlogSearch->getCurrentUrl('tag', 0, title2uri($sSearchedTag));
        $sBlogPostsVal .= $oTmpBlogSearch->showPagination3();
        $sBlogPosts = $oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0 ? MsgBox(_t('_Empty')) : $sBlogPostsVal;
        $sContentSect = DesignBoxContent($sTagsC . ' - ' . $sSearchedTag, $sBlogPostsVal, 1);
        if ($bNoProfileMode == false) {
            $sRightSect = '';
            if ($iMemberID > -1) {
                $aBlogsRes = $this->_oDb->getBlogInfo($iMemberID);
                if (!$aBlogsRes) {
                    $sNoBlogC = MsgBox($sNoBlogC);
                    $sRetHtml = <<<EOF
<div class="{$sWidthClass}">
    {$sNoBlogC}
</div>
<div class="clear_both"></div>
EOF;
                } else {
                    $sRightSect = $this->GenMemberDescrAndCat($aBlogsRes);
                    $sWidthClass = $iMemberID > 0 ? 'cls_info_left' : 'cls_res_thumb';
                    $sRetHtml = $this->Templater($sContentSect, $sRightSect, $sWidthClass);
                }
            } else {
                $sRetHtml = MsgBox(_t('_Profile Not found Ex'));
            }
        } else {
            $sRetHtml = <<<EOF
<div class="{$sWidthClass}">
    {$sContentSect}
</div>
<div class="clear_both"></div>
EOF;
        }
        return $sRetHtml;
    }
コード例 #2
0
ファイル: BxBlogsModule.php プロジェクト: dalinhuang/shopexts
 function getPostOverviewBlock()
 {
     $iMemberID = (int) $this->aViewingPostInfo['OwnerID'];
     $aBlogInfo = $this->_oDb->getBlogInfo($iMemberID);
     $sBlogDescription = '<div class="blog_desc">' . process_html_output($aBlogInfo['Description']) . '</div>';
     $aAuthor = getProfileInfo($iMemberID);
     $aVars = array('author_thumb' => get_member_thumbnail($aAuthor['ID'], 'none'), 'author_username' => $aAuthor['NickName'], 'author_url' => $aAuthor ? getProfileLink($aAuthor['ID']) : 'javascript:void(0)', 'fields' => $sBlogDescription);
     if ($this->iPostViewType == 3 && $this->iViewingPostID > 0) {
         require_once $this->_oConfig->getClassPath() . 'BxBlogsSearchUnit.php';
         $oBlogSearch = new BxBlogsSearchUnit();
         bx_import('BxDolCategories');
         bx_import('BxDolTags');
         $oCategories = new BxDolCategories();
         $oTags = new BxDolTags();
         $sCats = '';
         $aCategories = $oCategories->explodeTags($this->aViewingPostInfo['Categories']);
         $aCatLinks = array();
         if (count($aCategories) > 0) {
             foreach ($aCategories as $iKey => $sCatValue) {
                 $sCatLink = $oBlogSearch->getCurrentUrl('category', title2uri(trim($sCatValue)), title2uri(trim($sCatValue)), array('ownerId' => $iMemberID, 'ownerName' => $aAuthor['NickName']));
                 $aCatLinks[] = '<a href="' . $sCatLink . '" rel="nofollow">' . $sCatValue . '</a>';
             }
             $sCats = implode(", ", $aCatLinks);
         }
         $sTags = '';
         $aTags = $oTags->explodeTags($this->aViewingPostInfo['Tags']);
         $aTagLinks = array();
         if (count($aTags) > 0) {
             foreach ($aTags as $sTagKey) {
                 if ($sTagKey != '') {
                     $sTagLink = $oBlogSearch->getCurrentUrl('tag', $iPostID, title2uri(trim($sTagKey)));
                     $aTagLinks[] = '<a href="' . $sTagLink . '" title="' . $sTagKey . '" rel="nofollow">' . $sTagKey . '</a>';
                 }
             }
             $sTags = implode(", ", $aTagLinks);
         }
         $aVars['date'] = getLocaleDate($this->aViewingPostInfo['PostDate'], BX_DOL_LOCALE_DATE_SHORT);
         $aVars['date_ago'] = defineTimeInterval($this->aViewingPostInfo['PostDate']);
         $aVars['cats'] = $sCats;
         $aVars['tags'] = $sTags;
         return $this->_oTemplate->parseHtmlByName('entry_view_block_info.html', $aVars);
     }
     return $this->_oTemplate->parseHtmlByName('entry_view_empty_block_info.html', $aVars);
 }