Exemplo n.º 1
0
 function _wrapMobileUnit($sContent, $iPostID, $oMain)
 {
     $aVars = array('content' => $sContent, 'url' => bx_js_string($oMain->genBlogSubUrl() . '?action=mobile&mode=post&id=' . $iPostID));
     bx_import('BxDolMobileTemplate');
     $oMobileTemplate = new BxDolMobileTemplate($oMain->_oConfig, $oMain->_oDb);
     return $oMobileTemplate->parseHtmlByName($this->sMobileWrapper, $aVars);
 }
Exemplo n.º 2
0
 /**
  * Generate List of Posts for mobile frontend
  *
  * @param $iAuthor - display posts of provided user only
  * @param $sMode - display all latest[default], featured or top posts
  * @return HTML presentation of data
  */
 function GenPostListMobile($iAuthor = 0, $sMode = false)
 {
     if ($this->_iVisitorID) {
         // some workaround for mobile apps, to force login
         bx_login($this->_iVisitorID);
     }
     bx_import('BxDolMobileTemplate');
     $oMobileTemplate = new BxDolMobileTemplate($this->_oConfig, $this->_oDb);
     $oMobileTemplate->pageStart();
     echo $oMobileTemplate->addCss('blogs_common.css', 1);
     $iPerPage = 10;
     $iPage = (int) bx_get('page');
     if ($iPage < 1) {
         $iPage = 1;
     }
     $this->iPostViewType = 4;
     $sOrder = 'last';
     $sMobileWrapper = 'mobile_row.html';
     $aParams = array();
     switch ($sMode) {
         case 'post':
             $aViewingPostInfo = $this->_oDb->getPostInfo((int) bx_get('id'));
             if (!$this->oPrivacy->check('view', (int) bx_get('id'), $this->_iVisitorID) || !$this->isAllowedBlogPostView($aViewingPostInfo['OwnerID'], true)) {
                 $oMobileTemplate->displayAccessDenied($sCaption);
                 return;
             }
             $this->iPostViewType = 3;
             $aParams = array('id' => (int) bx_get('id'));
             $sCaption = _t('_bx_blog_post_view');
             $sMobileWrapper = 'mobile_box.html';
             echo $oMobileTemplate->addCss('blogs.css', 1);
             break;
         case 'user':
             $aParams = array('id' => (int) bx_get('id'));
             $sCaption = _t('_bx_blog_Members_blog', getNickName((int) bx_get('id')));
             break;
         case 'featured':
             $sCaption = _t('_bx_blog_Featured_Posts');
             break;
         case 'top':
             $sOrder = 'top';
             $sCaption = _t('_bx_blog_Top_Posts');
             break;
         case 'popular':
             $sOrder = 'popular';
             $sCaption = _t('_bx_blog_Popular_Posts');
             break;
         case 'last':
         default:
             $sMode = 'last';
             $sCaption = _t('_bx_blog_Latest_posts');
     }
     if ('post' != $sMode && !$this->isAllowedBlogsPostsBrowse()) {
         $oMobileTemplate->displayAccessDenied($sCaption);
         return;
     }
     $oTmpBlogSearch = false;
     $sCode = $this->_GenPosts($this->iPostViewType, $iPerPage, $sMode, $aParams, $sOrder, $oBlogSearchResults, $sMobileWrapper);
     if (!$sCode || $oBlogSearchResults->aCurrent['paginate']['totalNum'] == 0) {
         $oMobileTemplate->displayNoData($sCaption);
         return;
     }
     echo $sCode;
     if ($sMode != 'post') {
         bx_import('BxDolPaginate');
         $oPaginate = new BxDolPaginate(array('page_url' => $this->genBlogSubUrl() . '?action=mobile&mode=' . $sMode . '&page={page}', 'count' => $oBlogSearchResults->aCurrent['paginate']['totalNum'], 'per_page' => $iPerPage, 'page' => $iPage));
         echo $oPaginate->getMobilePaginate();
     }
     $oMobileTemplate->pageCode($sCaption, false);
 }
Exemplo n.º 3
0
 /**
  * Entry view page for mobile app
  */
 function actionMobileEntry($iId)
 {
     bx_import('BxDolMobileTemplate');
     $oMobileTemplate = new BxDolMobileTemplate($this->_oConfig, $this->_oDb);
     $oMobileTemplate->pageStart();
     $aParams = array('sample_type' => 'id', 'id' => (int) $iId);
     $aEntry = $this->_oDb->getEntries($aParams);
     if (empty($aEntry)) {
         $oMobileTemplate->displayPageNotFound();
         return;
     }
     echo '<h1>' . $aEntry['caption'] . '</h1>';
     echo getLocaleDate($aEntry['when_uts'], BX_DOL_LOCALE_DATE);
     echo $aEntry['content'];
     $oMobileTemplate->pageCode($aEntry['caption']);
 }