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); }
/** * View list of latest entries for mobile app */ function actionMobileLatestEntries($iPage = 1) { $sUri = $this->_oConfig->getUri(); $iPerPage = 10; $iPage = (int) $iPage; if ($iPage < 1) { $iPage = 1; } bx_import('BxDolMobileTemplate'); $oMobileTemplate = new BxDolMobileTemplate($this->_oConfig, $this->_oDb); $oMobileTemplate->pageStart(); $sCaption = _t('_' . $sUri . '_bcaption_latest'); $aParams = array('sample_type' => 'archive', 'sample_params' => '', 'viewer_type' => $this->_oTextData->getViewerType(), 'start' => ($iPage - 1) * $iPerPage, 'count' => $iPerPage, 'filter_value' => ''); $iTotalCount = $this->_oDb->getCount($aParams); $aEntries = $iTotalCount ? $this->_oDb->getEntries($aParams) : array(); if (empty($aEntries)) { $oMobileTemplate->displayNoData($sCaption); return; } foreach ($aEntries as $aEntry) { $aVars = array('content' => '<h2>' . $aEntry['caption'] . '</h2>' . getLocaleDate($aEntry['when_uts'], BX_DOL_LOCALE_DATE), 'url' => bx_js_string(BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'mobile_entry/' . $aEntry['id'])); echo $oMobileTemplate->parseHtmlByName('mobile_row.html', $aVars); } bx_import('BxDolPaginate'); $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'mobile_latest_entries/{page}', 'count' => $iTotalCount, 'per_page' => $iPerPage, 'page' => $iPage)); echo $oPaginate->getMobilePaginate(); $oMobileTemplate->pageCode($sCaption, false); }