function getBlockCode_All($id) { $this->oSearch->clearFilters(array('activeStatus', 'allow_view', 'album_status', 'albumType', 'ownerStatus'), array('albumsObjects', 'albums')); $this->oSearch->aCurrent['paginate']['perPage'] = (int) $this->oConfig->getGlParam('number_all'); $this->oSearch->aCurrent['view'] = 'full'; if (isset($this->oSearch->aCurrent['rss'])) { $this->oSearch->aCurrent['rss']['link'] = $this->oSearch->getCurrentUrl('browseAll', 0, ''); } $sCode = $this->oSearch->displayResultBlock(); if ($this->oSearch->aCurrent['paginate']['totalNum'] > 0) { $sCode = $GLOBALS['oFunctions']->centerContent($sCode, '.sys_file_search_unit'); $aExclude = array('r'); $sMode = isset($_GET[$this->oConfig->getMainPrefix() . '_mode']) ? '&_' . $this->oConfig->getMainPrefix() . '_mode=' . $_GET['bx_' . $this->oConfig->getUri() . '_mode'] : ''; $sLink = $this->oConfig->getBaseUri() . 'home/'; $aLinkAddon = $this->oSearch->getLinkAddByPrams($aExclude); $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $this->oSearch->aCurrent['paginate']['totalNum'], 'per_page' => $this->oSearch->aCurrent['paginate']['perPage'], 'page' => $this->oSearch->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => 'return !loadDynamicBlock(' . $id . ', \'' . $sLink . $sMode . $aLinkAddon['params'] . '&page={page}&per_page={per_page}\');', 'on_change_per_page' => 'return !loadDynamicBlock(' . $id . ', \'' . $sLink . $sMode . $aLinkAddon['params'] . '&page=1&per_page=\' + this.value);')); $aTopMenu = $this->oSearch->getTopMenu(array($this->oConfig->getMainPrefix() . '_mode')); $sPaginate = $oPaginate->getPaginate(); } else { $sCode = MsgBox(_t("_Empty")); $aTopMenu = array(); $sPaginate = ''; } return array($sCode, $aTopMenu, $sPaginate, ''); }
function GenStoredMemIPs() { $sCntSQL = "SELECT COUNT(*) FROM `sys_ip_members_visits`"; //////////////////////////// $iTotalNum = db_value($sCntSQL); if (!$iTotalNum) { return MsgBox(_t('_Empty')); } $iPerPage = (int) $_GET['per_page']; if (!$iPerPage) { $iPerPage = 10; } $iCurPage = (int) $_GET['page']; if ($iCurPage < 1) { $iCurPage = 1; } $sLimitFrom = ($iCurPage - 1) * $iPerPage; $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}"; //////////////////////////// $sSQL = "SELECT *, UNIX_TIMESTAMP(`DateTime`) AS `DateTimeTS` FROM `sys_ip_members_visits` ORDER BY `DateTime` DESC {$sqlLimit}"; $rIPList = db_res($sSQL); $aTmplVarsItems = array(); while ($aIPList = mysql_fetch_assoc($rIPList)) { $iID = (int) $aIPList['ID']; $sFrom = long2ip($aIPList['From']); $sLastDT = getLocaleDate($aIPList['DateTimeTS'], BX_DOL_LOCALE_DATE); $sMember = $aIPList['MemberID'] ? '<a href="' . getProfileLink($aIPList['MemberID']) . '">' . getNickname($aIPList['MemberID']) . '</a>' : ''; $aTmplVarsItems[] = array('from' => $sFrom, 'bx_if:show_profile_link' => array('condition' => !empty($aIPList['MemberID']), 'content' => array('href' => getProfileLink($aIPList['MemberID']), 'caption' => getNickname($aIPList['MemberID']))), 'date' => $sLastDT); } $oPaginate = new BxDolPaginate(array('page_url' => $GLOBALS['site']['url_admin'] . 'ip_blacklist.php?mode=list&page={page}&per_page={per_page}', 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage)); return $GLOBALS['oAdmTemplate']->parseHtmlByName('ip_blacklist_list_ips.html', array('bx_repeat:items' => $aTmplVarsItems, 'paginate' => $oPaginate->getPaginate())); }
function showPagination($bAdmin = false) { require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolPaginate.php'; $aLinkAddon = $this->getLinkAddByPrams(); $oPaginate = new BxDolPaginate(array('page_url' => $this->aCurrent['paginate']['page_url'], 'count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true)); $sPaginate = '<div class="clear_both"></div>' . $oPaginate->getPaginate(); return $sPaginate; }
function PageCodeSubscribers($oSubscription) { $iStart = bx_get('start') !== false ? (int) bx_get('start') : 0; $iPerPage = 20; $oPaginate = new BxDolPaginate(array('start' => $iStart, 'per_page' => $iPerPage, 'count' => $oSubscription->getSubscribersCount(), 'page_url' => $GLOBALS['site']['url_admin'] . 'manage_subscribers.php?start={start}')); $sControls = BxTemplSearchResult::showAdminActionsPanel('adm-ms-form', array('adm-ms-delete' => _t('_adm_btn_ms_delete')), 'members'); $aSubscribers = $oSubscription->getSubscribers(BX_DOL_SBS_TYPE_VISITOR, $iStart, $iPerPage); return $GLOBALS['oAdmTemplate']->parseHtmlByName('manage_subscribers.html', array('bx_repeat:items' => is_array($aSubscribers) && !empty($aSubscribers) ? $aSubscribers : MsgBox(_t('_Empty')), 'paginate' => $oPaginate->getPaginate(), 'controls' => $sControls)); }
function PageCodeManageSubscribers($oSubscription) { $iStart = bx_get('start') !== false ? (int) bx_get('start') : 0; $iPerPage = 20; $oPaginate = new BxDolPaginate(array('start' => $iStart, 'per_page' => $iPerPage, 'count' => $oSubscription->getSubscribersCount(), 'page_url' => BX_DOL_URL_ADMIN . 'notifies.php?mode=manage_subscribers&start={start}')); $sControls = BxTemplSearchResult::showAdminActionsPanel('adm-ms-form', array('adm-ms-delete' => _t('_adm_btn_ms_delete')), 'members'); $aSubscribers = $oSubscription->getSubscribers(BX_DOL_SBS_TYPE_VISITOR, $iStart, $iPerPage); $s = $GLOBALS['oAdmTemplate']->parseHtmlByName('manage_subscribers.html', array('bx_repeat:items' => is_array($aSubscribers) && !empty($aSubscribers) ? $aSubscribers : MsgBox(_t('_Empty')), 'paginate' => $oPaginate->getPaginate(), 'controls' => $sControls)); return array('page_main_code' => DesignBoxAdmin(_t('_adm_page_cpt_manage_subscribers'), $s, $GLOBALS['aTopItems'], '', 1)); }
function showPagination($sUrlAdmin = false) { $oMain = $this->getMain(); $oConfig = $oMain->_oConfig; bx_import('BxDolPaginate'); $sUrlStart = BX_DOL_URL_ROOT . $oConfig->getBaseUri() . ($sUrlAdmin ? $sUrlAdmin : $this->sBrowseUrl); $sUrlStart .= false === strpos($sUrlStart, '?') ? '?' : '&'; $oPaginate = new BxDolPaginate(array('page_url' => $sUrlStart . 'page={page}&per_page={per_page}' . (false !== bx_get($this->sFilterName) ? '&' . $this->sFilterName . '=' . bx_get($this->sFilterName) : ''), 'count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => '', 'on_change_per_page' => "document.location='" . $sUrlStart . "page=1&per_page=' + this.value + '" . (false !== bx_get($this->sFilterName) ? '&' . $this->sFilterName . '=' . bx_get($this->sFilterName) . "';" : "';"))); return '<div class="clear_both"></div>' . $oPaginate->getPaginate(); }
function GenStoredMemIPs() { $sFromC = _t('_From'); $sMemberC = _t('_Member'); $sDatatimeC = _t('_Date'); $sCaptionC = _t('_adm_ipbl_Stored_members_caption'); $sRes = '<br /><h2>' . $sCaptionC . '</h2>'; $sTableRes .= <<<EOF <table style="width:99%;" border="1" cellpadding="2" cellspacing="1" style="border-collapse: collapse"> \t<tr> \t\t<td>{$sFromC}</td> <td>{$sMemberC}</td> \t\t<td>{$sDatatimeC}</td> \t</tr> EOF; $sCntSQL = "SELECT COUNT(*) FROM `sys_ip_members_visits`"; //////////////////////////// $iTotalNum = db_value($sCntSQL); if (!$iTotalNum) { return $sRes . MsgBox(_t('_Empty')); } $iPerPage = (int) $_GET['per_page']; if (!$iPerPage) { $iPerPage = 10; } $iCurPage = (int) $_GET['page']; if ($iCurPage < 1) { $iCurPage = 1; } $sLimitFrom = ($iCurPage - 1) * $iPerPage; $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}"; //////////////////////////// $sSQL = "SELECT * FROM `sys_ip_members_visits` ORDER BY `DateTime` ASC {$sqlLimit}"; $rIPList = db_res($sSQL); while ($aIPList = mysql_fetch_assoc($rIPList)) { $iID = (int) $aIPList['ID']; $sFrom = long2ip($aIPList['From']); $sLastDT = $aIPList['DateTime']; $sMember = $aIPList['MemberID'] ? '<a href="' . getProfileLink($aIPList['MemberID']) . '">' . getNickname($aIPList['MemberID']) . '</a>' : ''; $sTableRes .= "<tr><td>{$sFrom}</td><td>{$sMember}</td><td>{$sLastDT}</td></tr>"; } $sTableRes .= <<<EOF </table> <div class="clear_both"></div> <br /> EOF; $sRequest = $GLOBALS['site']['url_admin'] . 'ip_blacklist.php?page={page}&per_page={per_page}'; $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage, 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => null, 'on_change_per_page' => null)); return $sRes . $sTableRes . $oPaginate->getPaginate(); }
function GenStoredMemIPs() { $sRes = ''; $sFromC = _t('_From'); $sMemberC = _t('_Member'); $sDatatimeC = _t('_Date'); $sTableRes .= <<<EOF <table style="width:99%; border-collapse:collapse;" cellpadding="4" style="border-collapse: collapse"> <tr> <td class="bx-def-border">{$sFromC}</td> <td class="bx-def-border">{$sMemberC}</td> <td class="bx-def-border">{$sDatatimeC}</td> </tr> EOF; $sCntSQL = "SELECT COUNT(*) FROM `sys_ip_members_visits`"; //////////////////////////// $iTotalNum = db_value($sCntSQL); if (!$iTotalNum) { return $sRes . MsgBox(_t('_Empty')); } $iPerPage = (int) $_GET['per_page']; if (!$iPerPage) { $iPerPage = 10; } $iCurPage = (int) $_GET['page']; if ($iCurPage < 1) { $iCurPage = 1; } $sLimitFrom = ($iCurPage - 1) * $iPerPage; $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}"; //////////////////////////// $sSQL = "SELECT *, UNIX_TIMESTAMP(`DateTime`) AS `DateTimeTS` FROM `sys_ip_members_visits` ORDER BY `DateTime` DESC {$sqlLimit}"; $rIPList = db_res($sSQL); while ($aIPList = mysql_fetch_assoc($rIPList)) { $iID = (int) $aIPList['ID']; $sFrom = long2ip($aIPList['From']); $sLastDT = getLocaleDate($aIPList['DateTimeTS'], BX_DOL_LOCALE_DATE); $sMember = $aIPList['MemberID'] ? '<a href="' . getProfileLink($aIPList['MemberID']) . '">' . getNickname($aIPList['MemberID']) . '</a>' : ''; $sTableRes .= "<tr><td class='bx-def-border'>{$sFrom}</td><td class='bx-def-border'>{$sMember}</td><td class='bx-def-border'>{$sLastDT}</td></tr>"; } $sTableRes .= <<<EOF </table> <div class="clear_both"></div> EOF; $sRequest = $GLOBALS['site']['url_admin'] . 'ip_blacklist.php?mode=list&page={page}&per_page={per_page}'; $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage, 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => null, 'on_change_per_page' => null)); $sContent = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $sRes . $sTableRes)); return $sContent . $oPaginate->getPaginate(); }
function actionGetCurrentImage($iPicId) { $iPicId = (int) $iPicId; if ($iPicId > 0) { bx_import('Search', $this->_aModule); $oMedia = new BxPhotosSearch(); $aInfo = $oMedia->serviceGetPhotoArray($iPicId, 'file'); $aInfo['ownerUrl'] = getProfileLink($aInfo['owner']); $aInfo['ownerName'] = getNickName($aInfo['owner']); $aInfo['date'] = defineTimeInterval($aInfo['date']); $oMedia->getRatePart(); $aInfo['rate'] = $oMedia->oRate->getJustVotingElement(0, 0, $aInfo['rate']); $aLinkAddon = $oMedia->getLinkAddByPrams(); $oPaginate = new BxDolPaginate(array('count' => (int) $_GET['total'], 'per_page' => 1, 'page' => (int) $_GET['page'], 'on_change_page' => 'getCurrentImage({page})')); $aInfo['paginate'] = $oPaginate->getPaginate(); header('Content-Type:text/javascript; charset=utf-8'); echo json_encode($aInfo); } }
function actionGetCurrentImage($iPicId) { $iPicId = (int) $iPicId; if ($iPicId > 0) { require_once 'BxPhotosSearch.php'; $oMedia = new BxPhotosSearch(); $aInfo = $oMedia->serviceGetPhotoArray($iPicId, 'file'); $aInfo['ownerUrl'] = getProfileLink($aInfo['owner']); $aInfo['ownerName'] = getNickName($aInfo['owner']); $aInfo['date'] = defineTimeInterval($aInfo['date']); $oMedia->getRatePart(); $aInfo['rate'] = $oMedia->oRate->getJustVotingElement(0, 0, $aInfo['rate']); $aLinkAddon = $oMedia->getLinkAddByPrams(); $oPaginate = new BxDolPaginate(array('count' => (int) $_GET['total'], 'per_page' => 1, 'page' => (int) $_GET['page'], 'info' => false, 'per_page_changer' => false, 'page_reloader' => false, 'on_change_page' => 'getCurrentImage({page})')); $aInfo['paginate'] = $oPaginate->getPaginate(); header('Content-Type:text/javascript'); $oJSON = new Services_JSON(); echo $oJSON->encode($aInfo); } }
function getSearchContent($aRestrictions, $sUri, $iPage = 1, $iPerPage = 0) { $iPerPage = !empty($iPerPage) ? $iPerPage : $this->_oConfig->getPerPage(); $sClassName = $this->_oConfig->getClassPrefix() . 'SearchResult'; $oSearchResult = new $sClassName($this); foreach ($aRestrictions as $sKey => $mixedValue) { if (is_array($mixedValue)) { $oSearchResult->aCurrent['restriction'][$sKey] = $mixedValue; } else { if (is_string($mixedValue)) { $oSearchResult->aCurrent['restriction'][$sKey]['value'] = $mixedValue; } } } $oSearchResult->aCurrent['paginate']['forcePage'] = $iPage; $oSearchResult->aCurrent['paginate']['perPage'] = $iPerPage; $sCode = $oSearchResult->displayResultBlock(); if (!empty($sCode)) { $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . $sUri . '{page}/{per_page}', 'count' => $oSearchResult->aCurrent['paginate']['totalNum'], 'per_page' => $iPerPage, 'page' => $iPage, 'per_page_changer' => true, 'page_reloader' => false, 'on_change_page' => '', 'on_change_per_page' => '')); $sCode .= $oPaginate->getPaginate(); } return $sCode; }
function getBlockCode_Objects($iBlockId) { if (!empty($this->sBrowseCode)) { return $this->sBrowseCode; } $sClassName = $this->oConfig->getClassPrefix() . 'Search'; bx_import('Search', $this->oModule->_aModule); $oSearch = new $sClassName('album'); $aParams = array('album' => $this->aInfo['Uri'], 'owner' => getUsername($this->aInfo['Owner'])); $aCustom = array('enable_center' => true, 'per_page' => $this->oConfig->getGlParam('number_top'), 'sorting' => 'album_order'); $aHtml = $oSearch->getBrowseBlock($aParams, $aCustom); $iCount = $oSearch->aCurrent['paginate']['totalNum']; $sPaginate = ''; if ($iCount > $oSearch->aCurrent['paginate']['perPage']) { $sLink = $this->oConfig->getBaseUri() . 'browse/album/' . $aParams['album'] . '/owner/' . $aParams['owner']; $oPaginate = new BxDolPaginate(array('page_url' => $sLink . '&page={page}&per_page={per_page}', 'count' => $iCount, 'per_page' => $oSearch->aCurrent['paginate']['perPage'], 'page' => $oSearch->aCurrent['paginate']['page'], 'on_change_per_page' => 'document.location=\'' . BX_DOL_URL_ROOT . $sLink . '&page=1&per_page=\' + this.value;')); $sPaginate = $oPaginate->getPaginate(); } if (empty($aHtml['code'])) { $aHtml['code'] = MsgBox(_t('_Empty')); } return DesignBoxContent(_t('_' . $this->oConfig->getMainPrefix() . '_browse_by_album', $this->aInfo['Caption']), $aHtml['code'], 1, '', $sPaginate); }
/** * Generate List of Blogs * * @param $sType - tyle of list ('top', 'last') * @return HTML presentation of data */ function GenBlogLists($sType = '', $bBlock = true) { if (!$this->isAllowedBlogsBrowse()) { return $this->_oTemplate->displayAccessDenied(); } // lang keys $sPostsC = _t('_bx_blog_Posts'); $sNoBlogsC = _t('_Empty'); $sAllBlogsC = _t('_bx_blog_All_Blogs'); $sTopBlogsC = _t('_bx_blog_Top_Blogs'); $iCheckedMemberID = $this->_iVisitorID; //////////////////pagination addition////////////////////////// //number elements for per page $iPerPage = false !== bx_get('per_page') ? (int) bx_get('per_page') : 10; if ($iPerPage > 100) { $iPerPage = 100; } $iCurPage = false !== bx_get('page') ? (int) bx_get('page') : 1; if ($iCurPage < 1) { $iCurPage = 1; } $sLimitFrom = ($iCurPage - 1) * $iPerPage; $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}"; //////////////////////////// $sCaption = $sAllBlogsC; $sStatusFilter = $this->isAdmin() == true || $this->isAllowedApprove() || $this->isAllowedPostEdit(-1) || $this->isAllowedPostDelete(-1) ? '1' : "`PostStatus`='approval'"; switch ($sType) { case 'top': $vBlogsRes = $this->_oDb->getTopBlogs($sStatusFilter, $sqlLimit); $sCaption = $sTopBlogsC; break; case 'last': default: $vBlogsRes = $this->_oDb->getLastBlogs($sStatusFilter, $sqlLimit); break; } $iTotalBlogs = $this->_oDb->getAllBlogsCnt($sStatusFilter); // process database queries $iTotalNum = mysql_num_rows($vBlogsRes); if ($iTotalNum == 0) { $sCode = MsgBox($sNoBlogsC); return $bBlock ? DesignBoxContent($sCaption, $sCode, 1) : $sCode; } $iGenPostsCnt = 0; while ($aBlogsRes = mysql_fetch_assoc($vBlogsRes)) { if ($aBlogsRes['PostCount'] == 0 && $sType == 'top') { //in Top blogs skip posts with 0 comments continue; } $aOwnerInfo = getProfileInfo($aBlogsRes['OwnerID']); $sOwnerNickname = getNickName($aBlogsRes['OwnerID']); if ($aBlogsRes['OwnerID'] == 0) { $sOwnerNickname = _t('_Admin'); } if ($sOwnerNickname) { $sCont = get_member_thumbnail($aBlogsRes['OwnerID'], 'left'); $sBlogOwnerLink = $this->genBlogLink('show_member_blog', array('Permalink' => $aOwnerInfo['NickName'], 'Link' => $aBlogsRes['OwnerID'])); $sDescription = htmlspecialchars(strip_tags($aBlogsRes['Description'])); $aBlogUnitVariables = array('owner_thumbnail' => $sCont, 'owner_nickname' => $sOwnerNickname . ' ' . _t('_bx_blog_Blog'), 'posts_count' => $aBlogsRes['PostCount'] . ' ' . $sPostsC, 'blog_link' => $sBlogOwnerLink, 'blog_description' => $sDescription); $sRetHtml .= $this->_oTemplate->parseHtmlByTemplateName('blog_unit', $aBlogUnitVariables); $iGenPostsCnt++; } } /////////pagination addition////////////////// if ($this->isPermalinkEnabled() == false) { $sRequest = bx_html_attribute($_SERVER['PHP_SELF']) . '?action=top_blogs&page={page}&per_page={per_page}'; } else { $sRequest = bx_get('action') == 'top_blogs' ? BX_DOL_URL_ROOT . 'blogs/top/' : BX_DOL_URL_ROOT . 'blogs/all/'; $sRequest .= '{per_page}/{page}' . $sPaginAddon; } /////////////////////////// $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalBlogs, 'per_page' => $iPerPage, 'page' => $iCurPage)); $sPagination = $oPaginate->getPaginate(); $sRetHtmlVal = <<<EOF <div class="bx-def-bc-padding"> {$sRetHtml} </div> {$sPagination} EOF; return $bBlock ? DesignBoxContent($sCaption, $sRetHtmlVal, 1) : $sRetHtmlVal; }
function getAlbumsBlock($aSectionParams = array(), $aAlbumParams = array(), $aCustom = array()) { $aCustomTmpl = array('caption' => _t('_' . $this->oModule->_oConfig->getMainPrefix() . '_albums'), 'enable_center' => true, 'unit_css_class' => '.sys_album_unit', 'page' => isset($_GET['page']) ? (int) $_GET['page'] : 1, 'per_page' => isset($_GET['per_page']) ? (int) $_GET['per_page'] : (int) $this->oModule->_oConfig->getGlParam('number_albums_home'), 'simple_paginate' => true, 'menu_top' => '', 'menu_bottom' => '', 'paginate_url' => '', 'simple_paginate_url' => BX_DOL_URL_ROOT . $this->oModule->_oConfig->getUri() . '/albums/browse', 'simple_paginate_view_all' => true); $aCustom = array_merge($aCustomTmpl, $aCustom); $this->aCurrent['paginate']['perPage'] = $aCustom['per_page']; $this->aCurrent['paginate']['page'] = $aCustom['page']; $this->fillFilters($aSectionParams); $sCode = $this->getAlbumList($this->aCurrent['paginate']['page'], $this->aCurrent['paginate']['perPage'], $aAlbumParams); if ($this->aCurrent['paginate']['totalAlbumNum'] > 0) { if ($aCustom['enable_center']) { $sCode = $GLOBALS['oFunctions']->centerContent($sCode, $aCustom['unit_css_class']); } if (empty($aCustom['menu_bottom'])) { $aLinkAddon = $this->getLinkAddByPrams(array('r')); $oPaginate = new BxDolPaginate(array('page_url' => $aCustom['paginate_url'], 'count' => $this->aCurrent['paginate']['totalAlbumNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'on_change_page' => 'return !loadDynamicBlock({id}, \'' . $aCustom['paginate_url'] . $aLinkAddon['params'] . '&page={page}&per_page={per_page}\');')); $aCode['menu_bottom'] = $aCustom['simple_paginate'] ? $oPaginate->getSimplePaginate($aCustom['simple_paginate_url'], -1, -1, $aCustom['simple_paginate_view_all']) : $oPaginate->getPaginate(); } else { $aCode['menu_bottom'] = $aCustom['menu_bottom']; } $aCode['code'] = DesignBoxContent($aCustom['caption'], $sCode); } $aCode['menu_top'] = $aCustom['menu_top']; return array($aCode['code'], $aCode['menu_top'], $aCode['menu_bottom'], !empty($aCode['code']) ? false : ''); }
<input id="ch{$iRssID}" type="checkbox" value="{$iRssID}" name="crsss[]" /> </div> <div class="bx-def-font-h3" > {$sRssUrl} </div> <div> <span style="color:{$sStatusColor};">{$sRssStatus}</span> <span class="sys-bullet"></span> {$sRssDesc} </div> </div> EOF; } $sRequest = bx_html_attribute($_SERVER['PHP_SELF']) . '?page={page}&per_page={per_page}'; ///////////////pagination///////////////////// // gen pagination block ; $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage)); $sPagination = $oPaginate->getPaginate(); ///////////////eof pagination///////////////////// bx_import('BxTemplSearchResult'); $oSearchResult = new BxTemplSearchResult(); $sAdmPanel = $oSearchResult->showAdminActionsPanel('crss_box', array('action_approve' => '_Approve', 'action_disapprove' => '_Disapprove', 'action_delete' => '_Delete'), 'crsss'); $sUrl = bx_html_attribute($_SERVER['PHP_SELF']); $sCode .= <<<EOF <form action="{$sUrl}" method="post" name="ads_moderation"> <div id="crss_box" class="bx-def-bc-padding"> {$sRSSs} </div> {$sPagination} {$sAdmPanel} </form> EOF; }
function display($aParam, $iBoxId, $sAction = '', $bOrderPanel = false, $iColumns, $sUrl = '') { if (!isset($aParam['type']) || !$aParam['type']) { return MsgBox(_t('_Empty')); } $sPaginate = ''; $sCode = ''; $sPageUrl = $sUrl ? $sUrl : bx_html_attribute($_SERVER['PHP_SELF']); $sPageUrl .= '?tags_mode=' . $aParam['type']; if (!isset($aParam['orderby']) && isset($_REQUEST['orderby']) && $_REQUEST['orderby'] && isset($this->_aOrderValues[$_REQUEST['orderby']])) { $aParam['orderby'] = $_REQUEST['orderby']; } if (isset($aParam['filter']) && $aParam['filter']) { $sPageUrl .= '&filter=' . $aParam['filter']; } if (isset($aParam['orderby']) && $aParam['orderby']) { $sPageUrl .= '&orderby=' . $aParam['orderby']; } if ($sAction) { $sPageUrl .= '&action=' . $sAction; } if (isset($aParam['date']) && $aParam['date']) { $sPageUrl .= '&year=' . $aParam['date']['year'] . '&month=' . $aParam['date']['month'] . '&day=' . $aParam['date']['day']; } if (isset($aParam['pagination']) && $aParam['pagination']) { bx_import('BxDolPaginate'); $aPaginate = array('page_url' => $sPageUrl . '&page={page}&per_page={per_page}', 'info' => true, 'page_links' => true, 'on_change_page' => "!loadDynamicBlock({$iBoxId}, this.href)"); $aParam['limit'] = $aPaginate['per_page'] = $aParam['pagination']; $aPaginate['count'] = $this->getTagsCount($aParam); $aPaginate['page'] = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1; $aParam['start'] = $aParam['limit'] * ($aPaginate['page'] - 1); if ($aParam['start'] <= 0) { $aParam['start'] = 0; } $oPaginate = new BxDolPaginate($aPaginate); $sPaginate = '<div class="clear_both"></div>' . $oPaginate->getPaginate(); } $sHrefTmpl = $this->getHrefWithType($aParam['type']); $aTotalTags = $this->getTagList($aParam); if ($aTotalTags) { if ($bOrderPanel) { $sCode .= $this->_getTopBox($aParam, $iBoxId, $sPageUrl); } $sCode .= $this->getCategoriesView($aTotalTags, $sHrefTmpl, $iColumns) . $sPaginate; } else { return MsgBox(_t('_Empty')); } return $sCode; }
function showMatchProfiles($iBlockID) { $iProfileId = getLoggedId(); if (!$iProfileId) { return array('', MsgBox(_t('_Empty'))); } $sSort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'none'; $aProfiles = getMatchProfiles($iProfileId, false, $sSort); if (empty($aProfiles)) { return array('', MsgBox(_t('_Empty'))); } $sBaseUri = 'search.php?show=match'; $sTopLinksUri = ''; $sPaginateUri = ''; foreach ($_REQUEST as $sKey => $sVal) { switch ($sKey) { case 'page': $sPaginateUri .= '&page=' . $sVal; break; case 'per_page': $sPaginateUri .= '&per_page=' . $sVal; break; case 'sort': $sPaginateUri .= '&sort=' . $sVal; break; case 'mode': $sTopLinksUri .= '&mode=' . $sVal; break; } } $aPaginate = array('page_url' => $sBaseUri . $sTopLinksUri . '&page={page}&per_page={per_page}&sort={sorting}', 'info' => true, 'page_links' => true, 'per_page' => isset($_REQUEST['per_page']) ? (int) $_REQUEST['per_page'] : 25, 'sorting' => $sSort, 'count' => count($aProfiles), 'page' => isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1); $sMode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'simple'; $oPaginate = new BxDolPaginate($aPaginate); $oSearchProfile = new BxBaseSearchProfile(); $aExtendedCss = array('ext_css_class' => 'search_filled_block'); $sTemplateName = $sMode == 'extended' ? 'search_profiles_ext.html' : 'search_profiles_sim.html'; $iIndex = 0; $sOutputHtml = ''; $sOutputMode = isset($_REQUEST['search_result_mode']) && $_REQUEST['search_result_mode'] == 'ext' ? 'ext' : 'sim'; for ($i = ($aPaginate['page'] - 1) * $aPaginate['per_page']; $i < $aPaginate['page'] * $aPaginate['per_page'] && $i < $aPaginate['count']; $i++) { $aProfile = getProfileInfo($aProfiles[$i]); if ($aProfile['Couple']) { $aCoupleInfo = getProfileInfo($aProfile['Couple']); if (!($iIndex % 2)) { $sOutputHtml .= $oSearchProfile->PrintSearhResult($aProfile, $aCoupleInfo, null, $sTemplateName); } else { $sOutputHtml .= $oSearchProfile->PrintSearhResult($aProfile, $aCoupleInfo, $aExtendedCss, $sTemplateName); } } else { if (!($iIndex % 2)) { $sOutputHtml .= $oSearchProfile->PrintSearhResult($aProfile, '', null, $sTemplateName); } else { $sOutputHtml .= $oSearchProfile->PrintSearhResult($aProfile, '', $aExtendedCss, $sTemplateName); } } $iIndex++; } // gen sorting block ( type of : drop down ); $sSortBlock = $oPaginate->getSorting(array('none' => _t('_None'), 'activity' => _t('_Latest activity'), 'date_reg' => _t('_FieldCaption_DateReg_View'))); $sSortBlock = '<div class="ordered_block">' . $sSortBlock . '</div><div class="clear_both"></div>'; $sContent = $GLOBALS['oSysTemplate']->parseHtmlByName('designbox_top_controls.html', array('top_controls' => $sSortBlock)); $sContent .= $GLOBALS['oSysTemplate']->parseHtmlByName('view_profiles.html', array('margin_type' => $sOutputMode == 'sim' ? '-thd' : '', 'content' => $sOutputHtml)) . $oPaginate->getPaginate(); $aLinks = array(_t('_Simple') => array('href' => $sBaseUri . $sPaginateUri . '&mode=simple', 'dynamic' => true, 'active' => $sMode == 'simple'), _t('_Extended') => array('href' => $sBaseUri . $sPaginateUri . '&mode=extended', 'dynamic' => true, 'active' => $sMode == 'extended')); return array($aLinks, $sContent); }
function getMembers($aParams) { if (!isset($aParams['view_start']) || empty($aParams['view_start'])) { $aParams['view_start'] = 0; } if (!isset($aParams['view_per_page']) || empty($aParams['view_per_page'])) { $aParams['view_per_page'] = BX_DOL_ADM_MP_PER_PAGE; } $aParams['view_order_way'] = 'ASC'; if (!isset($aParams['view_order']) || empty($aParams['view_order'])) { $aParams['view_order'] = 'ID'; } else { $aOrder = explode(' ', $aParams['view_order']); if (count($aOrder) > 1) { $aParams['view_order'] = $aOrder[0]; $aParams['view_order_way'] = $aOrder[1]; } } $sDateFormat = getLocaleFormat(BX_DOL_LOCALE_DATE, BX_DOL_LOCALE_DB); $sSelectClause = $sJoinClause = $sWhereClause = $sGroupClause = ''; if (isset($aParams['ctl_type'])) { switch ($aParams['ctl_type']) { case 'qlinks': switch ($aParams['ctl_params']['by']) { case 'status': $sWhereClause .= " AND `tp`.`Status`='" . ucfirst($aParams['ctl_params']['value']) . "'"; break; case 'featured': $sWhereClause .= " AND `tp`.`Featured`='1'"; break; case 'banned': $sWhereClause .= " AND (`tbl`.`Time`='0' OR (`tbl`.`Time`<>'0' AND DATE_ADD(`tbl`.`DateTime`, INTERVAL `tbl`.`Time` HOUR)>NOW()))"; break; case 'type': $sWhereClause .= $aParams['ctl_params']['value'] == 'single' ? " AND `tp`.`Couple`='0'" : " AND `tp`.`Couple`<>'0' AND `tp`.`Couple`>`tp`.`ID`"; break; case 'role': $iRole = BX_DOL_ROLE_MEMBER; if ($aParams['ctl_params']['value'] == 'admins') { $iRole = BX_DOL_ROLE_ADMIN; } $sWhereClause .= " AND `tp`.`Role` & " . $iRole . ""; break; case 'sex': $sWhereClause .= " AND LOWER(`tp`.`Sex`)='" . strtolower($aParams['ctl_params']['value']) . "' AND `tp`.`Couple` = 0 "; break; case 'membership': $sWhereClause .= " AND LOWER(`tl`.`Name`)='" . strtolower($aParams['ctl_params']['value']) . "'"; break; } break; case 'tags': $sWhereClause .= " AND `tp`.`Tags` LIKE '%" . $aParams['ctl_params']['value'] . "%'"; break; case 'search': $sWhereClause .= " AND (\n `tp`.`ID` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`NickName` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`Email` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`DescriptionMe` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`Tags` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`DateReg` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR\n `tp`.`DateLastLogin` LIKE '%" . $aParams['ctl_params']['value'] . "%'\n )"; break; } } //--- Get Paginate ---// $oPaginate = new BxDolPaginate(array('start' => $aParams['view_start'], 'count' => (int) db_value("SELECT COUNT(`tp`.`ID`) FROM `Profiles` AS `tp` LEFT JOIN `sys_admin_ban_list` AS `tbl` ON `tp`.`ID`=`tbl`.`ProfID` LEFT JOIN `sys_acl_levels_members` AS `tlm` ON `tp`.`ID`=`tlm`.`IDMember` AND `tlm`.`DateStarts` < NOW() AND (`tlm`.`DateExpires`>NOW() || ISNULL(`tlm`.`DateExpires`)) LEFT JOIN `sys_acl_levels` AS `tl` ON `tlm`.`IDLevel`=`tl`.`ID` " . $sJoinClause . " WHERE 1 AND (`tp`.`Couple`=0 OR `tp`.`Couple`>`tp`.`ID`)" . $sWhereClause), 'per_page' => $aParams['view_per_page'], 'page_url' => $GLOBALS['site']['url_admin'] . 'profiles.php?start={start}', 'on_change_page' => BX_DOL_ADM_MP_JS_NAME . '.changePage({start})')); $sPaginate = $oPaginate->getPaginate(); //--- Get Controls ---// $GLOBALS['oAdmTemplate']->addJsTranslation(array('_adm_btn_mp_ban_duration')); $aButtons = array('adm-mp-activate' => _t('_adm_btn_mp_activate'), 'adm-mp-deactivate' => _t('_adm_btn_mp_deactivate'), 'adm-mp-ban' => array('type' => 'submit', 'name' => 'adm-mp-ban', 'value' => _t('_adm_btn_mp_ban'), 'onclick' => 'onclick="javascript: return ' . BX_DOL_ADM_MP_JS_NAME . '.actionBan(this);"'), 'adm-mp-unban' => _t('_adm_btn_mp_unban'), 'adm-mp-confirm' => _t('_adm_btn_mp_confirm'), 'adm-mp-delete' => _t('_adm_btn_mp_delete'), 'adm-mp-delete-spammer' => _t('_adm_btn_mp_delete_spammer')); $sControls = BxTemplSearchResult::showAdminActionsPanel('adm-mp-members-' . $aParams['view_type'], $aButtons, 'members'); //--- Get Items ---// $sQuery = "\n SELECT\n `tp`.`ID` as `id`,\n `tp`.`NickName` AS `username`,\n `tp`.`Sex` AS `sex`,\n `tp`.`DateOfBirth` AS `date_of_birth`,\n `tp`.`Country` AS `country`,\n `tp`.`City` AS `city`,\n `tp`.`DescriptionMe` AS `description`,\n `tp`.`Email` AS `email`,\n DATE_FORMAT(`tp`.`DateReg`, '" . $sDateFormat . "' ) AS `registration`,\n DATE_FORMAT(`tp`.`DateLastLogin`, '" . $sDateFormat . "' ) AS `last_login`,\n DATE_FORMAT(`tp`.`DateLastNav`, '" . $sDateFormat . "' ) AS `last_activity`,\n `tp`.`Status` AS `status`,\n IF(`tbl`.`Time`='0' OR DATE_ADD(`tbl`.`DateTime`, INTERVAL `tbl`.`Time` HOUR)>NOW(), 1, 0) AS `banned`,\n `tl`.`ID` AS `ml_id`,\n IF(ISNULL(`tl`.`Name`),'', `tl`.`Name`) AS `ml_name`\n " . $sSelectClause . "\n FROM `Profiles` AS `tp`\n LEFT JOIN `sys_admin_ban_list` AS `tbl` ON `tp`.`ID`=`tbl`.`ProfID`\n LEFT JOIN `sys_acl_levels_members` AS `tlm` ON `tp`.`ID`=`tlm`.`IDMember` AND `tlm`.`DateStarts` < NOW() AND (`tlm`.`DateExpires`>NOW() || ISNULL(`tlm`.`DateExpires`))\n LEFT JOIN `sys_acl_levels` AS `tl` ON `tlm`.`IDLevel`=`tl`.`ID`\n " . $sJoinClause . "\n WHERE\n 1 AND (`tp`.`Couple`=0 OR `tp`.`Couple`>`tp`.`ID`)" . $sWhereClause . "\n " . $sGroupClause . "\n ORDER BY `tp`.`" . $aParams['view_order'] . "` " . $aParams['view_order_way'] . "\n LIMIT " . $aParams['view_start'] . ", " . $aParams['view_per_page']; $aProfiles = $GLOBALS['MySQL']->getAll($sQuery); //--- Display ---// $sFunction = 'getMembers' . ucfirst($aParams['view_type']); return $sFunction($aProfiles, $sPaginate, $sControls); }
/** * Ads block for profile page (as PHP function). List of latest ads of member. * * @param $_iProfileID - member id * * @return html of last ads units */ function serviceAdsProfilePage($_iProfileID) { $GLOBALS['oTopMenu']->setCurrentProfileID($_iProfileID); bx_import('SearchUnit', $this->_aModule); $oTmpAdsSearch = new BxAdsSearchUnit(); $oTmpAdsSearch->aCurrent['paginate']['perPage'] = 10; $oTmpAdsSearch->aCurrent['sorting'] = 'last'; $oTmpAdsSearch->aCurrent['restriction']['owner']['value'] = $_iProfileID; $sMemberAds = $oTmpAdsSearch->displayResultBlock(); if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] > 0) { $sClr = '<div class="clear_both"></div>'; if ($oTmpAdsSearch->aCurrent['paginate']['perPage'] < $oTmpAdsSearch->aCurrent['paginate']['totalNum']) { $sAjLink = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'get_list/'; bx_import('BxDolPaginate'); $sBoxId = 'ads_' . $_iProfileID . '_view'; $oPgn = new BxDolPaginate(array('page_url' => 'javascript:void();', 'count' => $oTmpAdsSearch->aCurrent['paginate']['totalNum'], 'per_page' => $oTmpAdsSearch->aCurrent['paginate']['perPage'], 'page' => $oTmpAdsSearch->aCurrent['paginate']['page'], 'on_change_page' => "getHtmlData('{$sBoxId}', '{$sAjLink}view/{$_iProfileID}&page={page}&per_page={per_page}');", 'on_change_per_page' => "getHtmlData('{$sBoxId}', '{$sAjLink}view/{$_iProfileID}&page=1&per_page=' + this.value);")); $sMemberAds = '<div id="' . $sBoxId . '">' . $sMemberAds . $sClr . $oPgn->getPaginate() . '</div>'; } return <<<EOF <div class="clear_both"></div> <div class="dbContent"> {$sMemberAds} {$sClr} </div> EOF; } }
/** * Function will generate the messages rows ; * * @return : Html presentation data ; */ function genMessagesRows() { global $oSysTemplate; global $oFunctions; global $site; // init some needed variables ; $sOutputHtml = null; $sMessageBoxActions = null; $sMessagesTypesList = null; $sPerPageBlock = null; $aSortToglleElements = array('date_sort_toggle', 'subject_sort_toggle', 'type_sort_toggle', 'author_sort_toggle'); $aMessageRows = array(); // language keys ; $aLanguageKeys = array('author' => _t('_Author'), 'type' => _t('_Type'), 'subject' => _t('_Subject'), 'date' => _t('_Date'), 'new' => _t('_new'), 'select' => _t('_Select'), 'all' => _t('_All'), 'none' => _t('_None'), 'read' => _t('_Read'), 'unread' => _t('_Unread'), 'delete' => _t('_Delete'), 'spam' => _t('_Spam report'), 'more' => _t('_More actions'), 'mark_read' => _t('_Mark as old'), 'mark_unread' => _t('_Mark as New'), 'restore' => _t('_Restore'), 'click_sort' => _t('_Click to sort'), 'recipient' => _t('_Recipient')); // get messages array ; $aMessages =& $this->getMessages(); // generate list of messages types if (is_array($this->aRegisteredMessageTypes) and !empty($this->aRegisteredMessageTypes)) { foreach ($this->aRegisteredMessageTypes as $iKey => $sRegisteredType) { $sChecked = null; if (!empty($this->aReceivedMessagesTypes) and in_array($sRegisteredType, $this->aReceivedMessagesTypes)) { $sChecked = ' checked="checked" '; } $aTemplateKeys = array('letters_type' => $sRegisteredType, 'letters_type_caption' => _t('_' . $sRegisteredType), 'checked' => $sChecked); $sMessagesTypesList .= $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_types_list'], $aTemplateKeys); } unset($aTemplateKeys); } // processing all messages ; if (is_array($aMessages) and !empty($aMessages)) { // need for row devide ; $iIndex = 1; foreach ($aMessages as $iKey => $aItems) { // generate image and keyword for type of message ; $sTypeIcon = getTemplateIcon($this->sMessageIconPrefix . $aItems['Type'] . $this->sMessageIconExtension); $sTypeLang = _t('_' . $aItems['Type']); // get message's subject ; $sSubject = mb_strlen($aItems['Subject']) > $this->iMessageSubjectLength ? mb_substr($aItems['Subject'], 0, $this->iMessageSubjectLength) . '...' : $aItems['Subject']; // get message's description ; $sDescription = strip_tags($aItems['Text']); mb_strlen($sDescription) > $this->iMessageDescrLength ? $sDescription = mb_substr($sDescription, 0, $this->iMessageDescrLength) . '...' : null; // generate the `new` message's icon ; $sNewMessageImg = $aItems['New'] ? getTemplateIcon('new_message.png') : getTemplateIcon(null); // color devider ; $sFiledCss = !($iIndex % 2) ? 'filled' : 'not_filled'; $aProfileInfo = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? getProfileInfo($aItems['Sender']) : getProfileInfo($aItems['Recipient']); $sMemberIcon = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? get_member_icon($aItems['Sender'], 'left') : get_member_icon($aItems['Recipient'], 'left'); $sMemberLocation = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? getProfileLink($aItems['Sender']) : getProfileLink($aItems['Recipient']); $sMemberNickName = $aProfileInfo['NickName']; $sMemberAge = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aProfileInfo['DateOfBirth'])) : null; $sMemberCountry = $aProfileInfo['Country']; $sMemberFlag = $site['flags'] . strtolower($sMemberCountry) . $this->sMembersFlagExtension; $sMemberSexImg = $oFunctions->genSexIcon($aProfileInfo['Sex']); if ($sMemberCountry) { $sMemberCountryFlag = '<img src="' . $sMemberFlag . '" alt="' . $sMemberCountry . '" />'; } // generate the message status ; $sMessageStatus = $aItems['New'] ? 'unread' : 'read'; $aMessageRows[] = array('message_id' => $aItems['ID'], 'message_status' => $sMessageStatus, 'message_owner' => $aItems['Sender'], 'message_link' => $aItems['ID'], 'message_page' => 'mail.php', 'member_icon' => $sMemberIcon, 'member_location' => $sMemberLocation, 'member_nickname' => $sMemberNickName, 'member_sex_img' => $sMemberSexImg, 'member_sex' => $aProfileInfo['Sex'], 'member_age' => $sMemberAge, 'member_flag' => $sMemberCountryFlag, 'member_country' => $sMemberCountry, 'message_type' => $sTypeLang, 'message_type_icon' => $sTypeIcon, 'message_subject' => $sSubject, 'message_new_img' => $sNewMessageImg, 'message_new' => $aLanguageKeys['new'], 'message_descr' => $sDescription, 'message_date' => $aItems['Date'], 'filled_class' => $sFiledCss); $iIndex++; } } // init sort toggle ellements ; switch ($this->aMailBoxSettings['sort_mode']) { case 'date': $aSortToglleElements['date_sort_toggle'] = 'toggle_up'; break; case 'date_desc': $aSortToglleElements['date_sort_toggle'] = 'toggle_down'; break; case 'subject': $aSortToglleElements['subject_sort_toggle'] = 'toggle_up'; break; case 'subject_desc': $aSortToglleElements['subject_sort_toggle'] = 'toggle_down'; break; case 'type': $aSortToglleElements['type_sort_toggle'] = 'toggle_up'; break; case 'type_desc': $aSortToglleElements['type_sort_toggle'] = 'toggle_down'; break; case 'author': $aSortToglleElements['author_sort_toggle'] = 'toggle_up'; break; case 'author_desc': $aSortToglleElements['author_sort_toggle'] = 'toggle_down'; break; } // generate the pagination ; $sRequest = BX_DOL_URL_ROOT . 'mail.php?'; // need for additional parameters ; $aGetParams = array('mode', 'sorting', 'messages_types'); if (is_array($aGetParams) and !empty($aGetParams)) { foreach ($aGetParams as $sValue) { if (isset($_GET[$sValue])) { $sRequest .= '&' . $sValue . '=' . $_GET[$sValue]; } } } $sCuttedUrl = $sRequest; $sRequest = $sRequest . '&page={page}&per_page={per_page}'; $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $this->iTotalMessageCount, 'per_page' => $this->aMailBoxSettings['per_page'], 'sorting' => $this->aMailBoxSettings['sort_mode'], 'page' => $this->aMailBoxSettings['page'], 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => "oMailBoxMessages.getPaginatePage('{$sRequest}')", 'on_change_per_page' => "oMailBoxMessages.getPage(this.value, '{$sCuttedUrl}')")); $sPagination = $oPaginate->getPaginate(); // generate messages section if (!empty($aMessageRows)) { $aTemplateKeys = array('per_page' => $this->aMailBoxSettings['per_page'], 'page_number' => $this->aMailBoxSettings['page'], 'page_mode' => $this->aMailBoxSettings['mailbox_mode'], 'messages_types' => $this->aMailBoxSettings['messages_types'], 'messages_types_list' => $sMessagesTypesList, 'per_page_block' => $oPaginate->getPages(), 'author' => $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? $aLanguageKeys['author'] : $aLanguageKeys['recipient'], 'type' => $aLanguageKeys['type'], 'subject' => $aLanguageKeys['subject'], 'date' => $aLanguageKeys['date'], 'click_sort' => $aLanguageKeys['click_sort'], 'bx_repeat:messages' => $aMessageRows, 'sort_date' => $this->aMailBoxSettings['sort_mode'] == 'date' ? 'date_desc' : 'date', 'sort_subject' => $this->aMailBoxSettings['sort_mode'] == 'subject' ? 'subject_desc' : 'subject', 'sort_type' => $this->aMailBoxSettings['sort_mode'] == 'type' ? 'type_desc' : 'type', 'sort_author' => $this->aMailBoxSettings['sort_mode'] == 'author' ? 'author_desc' : 'author', 'date_sort_toggle_ellement' => $aSortToglleElements['date_sort_toggle'], 'subject_sort_toggle_ellement' => $aSortToglleElements['subject_sort_toggle'], 'type_sort_toggle_ellement' => $aSortToglleElements['type_sort_toggle'], 'author_sort_toggle_ellement' => $aSortToglleElements['author_sort_toggle'], 'select' => $aLanguageKeys['select'], 'current_page' => 'mail.php', 'all_messages' => $aLanguageKeys['all'], 'none_messages' => $aLanguageKeys['none'], 'read_messages' => $aLanguageKeys['read'], 'unread_messages' => $aLanguageKeys['unread'], 'pagination_block' => $sPagination); // generate extended mailbox actions switch ($this->aMailBoxSettings['mailbox_mode']) { case 'inbox': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['spam'], 'attrs' => array('onclick' => 'if (typeof oMailBoxMessages != \'undefined\') oMailBoxMessages.spamMessages(\'messages_container\')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.deleteMessages(\'messages_container\', \'genMessagesRows\')')), 2 => array('type' => 'select', 'values' => array('' => $aLanguageKeys['more'], 'unread' => $aLanguageKeys['mark_unread'], 'read' => $aLanguageKeys['mark_read']), 'attrs' => array('onchange' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.markMessages(this.value, \'genMessagesRows\')'))))); $oForm = new BxTemplFormView($aForm); $sMessageBoxActions = $oForm->getCode(); break; case 'outbox': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.deleteMessages(\'messages_container\', \'genMessagesRows\')'))))); $oForm = new BxTemplFormView($aForm); $sMessageBoxActions = $oForm->getCode(); break; case 'trash': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['restore'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.restoreMessages(\'messages_container\', \'genMessagesRows\')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.hideDeletedMessages(\'messages_container\', \'genMessagesRows\')'))))); $oForm = new BxTemplFormView($aForm); $sMessageBoxActions = $oForm->getCode(); break; } $aTemplateKeys['messages_actions_block'] = $sMessageBoxActions; //return builded rows ; $sMessagesSection = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_box'], $aTemplateKeys); $sPerPageBlock = $oPaginate->getPages(); } else { $sMessagesSection = MsgBox(_t('_Empty')); } // generate mailboxe's top section ; $aTemplateKeys = array('per_page' => $this->aMailBoxSettings['per_page'], 'page_number' => $this->aMailBoxSettings['page'], 'page_mode' => $this->aMailBoxSettings['mailbox_mode'], 'messages_types' => $this->aMailBoxSettings['messages_types'], 'messages_sort' => $this->aMailBoxSettings['sort_mode'], 'messages_section' => $sMessagesSection, 'messages_types_list' => $sMessagesTypesList, 'per_page_block' => $sPerPageBlock); $sOutputHtml = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_top_section'], $aTemplateKeys); // return all builded data ; return $sOutputHtml; }
function showPagination($sModulePath = null) { $aParameters['settings'] = array('count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true); //define some pagination parameters; if (!$sModulePath) { $aLinkAddon = $this->getLinkAddByPrams(); $aParameters['settings']['page_url'] = $this->getCurrentUrl('browseAll', 0, ''); $aParameters['settings']['on_change_page'] = 'return !loadDynamicBlock(' . $this->id . ', \'searchKeywordContent.php?searchMode=ajax§ion[]=' . $this->aCurrent['name'] . '&keyword=' . rawurlencode($_REQUEST['keyword']) . $aLinkAddon['params'] . '&page={page}&per_page={per_page}\');'; $aParameters['settings']['on_change_per_page'] = 'return !loadDynamicBlock(' . $this->id . ', \'searchKeywordContent.php?searchMode=ajax§ion[]=' . $this->aCurrent['name'] . '&keyword=' . rawurlencode($_REQUEST['keyword']) . $aLinkAddon['params'] . '&page=1&per_page=\' + this.value);'; } else { $aParameters['settings']['page_url'] = $sModulePath . '&page={page}&per_page={per_page}'; $aParameters['settings']['on_change_page'] = null; $aParameters['settings']['on_change_per_page'] = null; } $oPaginate = new BxDolPaginate(array_shift($aParameters)); $sPaginate = '<div class="clear_both"></div>' . $oPaginate->getPaginate(); return $sPaginate; }
function _actionBrowseFans($sUri, $sFuncAllowed, $sFuncDbGetFans, $iPerPage, $sUrlBrowse, $sTitle) { if (!($aDataEntry = $this->_preProductTabs($sUri, $sTitle))) { return; } if (!$this->{$sFuncAllowed}($aDataEntry)) { $this->_oTemplate->displayAccessDenied(); return; } $iPage = (int) $_GET['page']; if ($iPage < 1) { $iPage = 1; } $iStart = ($iPage - 1) * $iPerPage; $aProfiles = array(); $iNum = $this->_oDb->{$sFuncDbGetFans}($aProfiles, $aDataEntry[$this->_oDb->_sFieldId], $iStart, $iPerPage); if (!$iNum || !$aProfiles) { $this->_oTemplate->displayNoData(); return; } $iPages = ceil($iNum / $iPerPage); bx_import('BxTemplSearchProfile'); $oBxTemplSearchProfile = new BxTemplSearchProfile(); $sMainContent = ''; foreach ($aProfiles as $aProfile) { $sMainContent .= $oBxTemplSearchProfile->displaySearchUnit($aProfile); } $sRet = $GLOBALS['oFunctions']->centerContent($sMainContent, '.searchrow_block_simple'); $sRet .= '<div class="clear_both"></div>'; bx_import('BxDolPaginate'); $sUrlStart = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . $sUrlBrowse . $aDataEntry[$this->_oDb->_sFieldUri]; $sUrlStart .= false === strpos($sUrlStart, '?') ? '?' : '&'; $oPaginate = new BxDolPaginate(array('page_url' => $sUrlStart . 'page={page}&per_page={per_page}' . (false !== bx_get($this->sFilterName) ? '&' . $this->sFilterName . '=' . bx_get($this->sFilterName) : ''), 'count' => $iNum, 'per_page' => $iPerPage, 'page' => $iPage, 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => '', 'on_change_per_page' => "document.location='" . $sUrlStart . "page=1&per_page=' + this.value + '" . (false !== bx_get($this->sFilterName) ? '&' . $this->sFilterName . '=' . bx_get($this->sFilterName) . "';" : "';"))); $sRet .= $oPaginate->getPaginate(); $this->_oTemplate->pageStart(); echo DesignBoxContent($sTitle, $sRet, 11); $this->_oTemplate->pageCode($sTitle, false, false); }
function showPaginationAjax($sContainerId, $sBaseUrl = false) { bx_import('BxDolPaginate'); $sLink = BX_DOL_URL_ROOT . ($sBaseUrl ? $sBaseUrl : $this->aCurrent['paginate']['page_url']); $sLink = bx_append_url_params($sLink, 'ajax=1'); $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => 'getHtmlData(\'' . bx_html_attribute($sContainerId) . '\', \'' . bx_html_attribute($sLink) . '&page={page}&per_page={per_page}\'); return false;', 'on_change_per_page' => 'getHtmlData(\'' . bx_html_attribute($sContainerId) . '\', \'' . bx_html_attribute($sLink) . '&page=1&per_page=\' + this.value); return false;')); $sPaginate = '<div class="clear_both"></div>' . $oPaginate->getPaginate(); return $sPaginate; }
function genSearchPagination($iCountProfiles, $iCurrentPage, $iResultsPerPage, $aFilterSortSettings = array(), $sPgnRoot = '') { $aGetParams = $_GET; unset($aGetParams['page']); unset($aGetParams['res_per_page']); unset($aGetParams['sort']); $sRequestString = $this->collectRequestString($aGetParams); $sRequestString = BX_DOL_URL_ROOT . strip_tags($sPgnRoot) . '?' . substr($sRequestString, 1); $sPaginTmpl = $sRequestString . '&res_per_page={per_page}&page={page}&sort={sorting}'; // gen pagination block ; $oPaginate = new BxDolPaginate(array('page_url' => $sPaginTmpl, 'count' => $iCountProfiles, 'per_page' => $iResultsPerPage, 'sorting' => $aFilterSortSettings['sort'], 'page' => $iCurrentPage)); $sPagination = $oPaginate->getPaginate(); // fill array with sorting params ; $aSortingParam = array('none' => _t('_None'), 'activity' => _t('_Latest activity'), 'date_reg' => _t('_FieldCaption_DateReg_View')); // gen sorting block ( type of : drop down ) ; $sSortBlock = $oPaginate->getSorting($aSortingParam); $sSortElement = '<div class="ordered_block">' . $sSortBlock . '</div><div class="clear_both"></div>'; $sSortElement = $GLOBALS['oSysTemplate']->parseHtmlByName('designbox_top_controls.html', array('top_controls' => $sSortElement)); return array($sPagination, $sSortElement); }
/** * Function will generate received rows ; * * @return : Html presentation data ; */ function getProcessingRows($bShowEmpty = true) { global $oSysTemplate, $site, $oFunctions; // ** init some needed variables ; $sPageContent = $sActionsList = $sSettings = ''; $bShowSettings = false; $aRows = array(); $sEmptyMessage = '_Empty'; $sRowsTemplName = $this->aUsedTemplates['communicator_page']; $sJsObject = $this->_getJsObject(); // define the member's nickname; $sMemberNickName = getNickName($this->aCommunicatorSettings['member_id']); // all primary language's keys ; $aLanguageKeys = array('author' => _t('_Author'), 'type' => _t('_Type'), 'date' => _t('_Date'), 'click_sort' => _t('_Click to sort'), 'from_me' => _t('_From') . ' ' . $sMemberNickName, 'to_me' => _t('_To') . ' ' . $sMemberNickName, 'accept' => _t('_sys_cnts_btn_fr_accept'), 'reject' => _t('_sys_cnts_btn_fr_reject'), 'delete' => _t('_Delete'), 'back_invite' => _t('_Back Invite'), 'fave' => _t('_sys_cnts_btn_fave'), 'visitor' => _t('_Visitor'), 'unblock' => _t('_Unblock'), 'block' => _t('_Block'), 'select' => _t('_Select'), 'all' => _t('_All'), 'none' => _t('_None'), 'read' => _t('_Read'), 'unread' => _t('_Unread')); // get all requests from DB ; switch ($this->aCommunicatorSettings['communicator_mode']) { case 'friends_requests': $sEmptyMessage = '_sys_cnts_msg_fr_empty'; $sRowsTemplName = $this->aUsedTemplates['communicator_page_fr']; $aTypes = array('from' => _t('_MEMBERS_INVITE_YOU_FRIENDLIST'), 'to' => _t('_MEMBERS_YOU_INVITED_FRIENDLIST')); $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 0 '); break; case 'hotlist_requests': $aTypes = array('from' => _t('_MEMBERS_YOU_HOTLISTED'), 'to' => _t('_MEMBERS_YOU_HOTLISTED_BY')); $aRows = $this->getRequests('sys_fave_list', $aTypes); break; case 'greeting_requests': $aTypes = array('from' => _t('_MEMBERS_YOU_KISSED'), 'to' => _t('_MEMBERS_YOU_KISSED_BY'), 'specific_key' => '_N times'); $aRows = $this->getRequests('sys_greetings', $aTypes, null, 'Number'); break; case 'blocks_requests': $aTypes = array('from' => _t('_MEMBERS_YOU_BLOCKLISTED'), 'to' => _t('_MEMBERS_YOU_BLOCKLISTED_BY')); $aRows = $this->getRequests('sys_block_list', $aTypes); break; case 'friends_list': $aTypes = array('from' => _t('_Friend list'), 'to' => _t('_Friend list')); $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 1 OR ( `sys_friend_list`.`ID` = ' . $this->aCommunicatorSettings['member_id'] . ' AND `sys_friend_list`.`Check` = 1 )'); break; default: $aTypes = array('from' => _t('_MEMBERS_INVITE_YOU_FRIENDLIST'), 'to' => _t('_MEMBERS_YOU_INVITED_FRIENDLIST')); $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 0 '); } if (empty($aRows) && !$bShowEmpty) { return ''; } // ** Generate the page's pagination ; // fill array with all necessary `get` parameters ; $aNeededParameters = array('communicator_mode', 'person_switcher', 'sorting'); // collect the page's URL ; $sRequest = BX_DOL_URL_ROOT . 'communicator.php?action=get_page'; // add additional parameters ; foreach ($aNeededParameters as $sKey) { $sRequest .= (array_key_exists($sKey, $this->aCommunicatorSettings) and $this->aCommunicatorSettings[$sKey]) ? '&' . $sKey . '=' . $this->aCommunicatorSettings[$sKey] : null; } $sCuttedUrl = $sRequest; $sRequest .= '&page={page}&per_page={per_page}'; // create the pagination object ; $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $this->iTotalRequestsCount, 'per_page' => $this->aCommunicatorSettings['per_page'], 'sorting' => $this->aCommunicatorSettings['sorting'], 'page' => $this->aCommunicatorSettings['page'], 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".getPaginatePage('{$sRequest}')", 'on_change_per_page' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".getPage(this.value, '{$sCuttedUrl}')")); $sPagination = $oPaginate->getPaginate(); // process received requests; if ($aRows) { $iIndex = 1; foreach ($aRows as $iKey => $aItems) { // if member not a visitor ; if ($aItems['member_id']) { // ** some member's information ; $aProfileInfo = getProfileInfo($aItems['member_id']); // member's Icon ; $sMemberIcon = get_member_thumbnail($aProfileInfo['ID'], 'left', $this->aCommunicatorSettings['communicator_mode'] != 'friends_requests'); // member's profile location ; $sMemberLocation = getProfileLink($aProfileInfo['ID']); // member's nickname ; $sMemberNickName = getNickName($aProfileInfo['ID']); // define the member's age ; $sMemberAge = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aProfileInfo['DateOfBirth'])) : null; // define the member's country, sex, etc ... ; $sMemberCountry = $aProfileInfo['Country']; $sMemberFlag = $site['flags'] . strtolower($sMemberCountry) . $this->sMembersFlagExtension; $sMemberSexImg = $oFunctions->genSexIcon($aProfileInfo['Sex']); if ($sMemberCountry) { $sMemberCountryFlag = '<img src="' . $sMemberFlag . '" alt="' . $sMemberCountry . '" />'; } $iMemberMutualFriends = getMutualFriendsCount($aItems['member_id'], getLoggedId()); } else { // ** if it's a visitor // member's Icon ; $sMemberIcon = $aLanguageKeys['visitor']; // member's profile location ; $sMemberLocation = null; $sMemberSexImg = null; $sMemberAge = null; $sMemberCountryFlag = null; $sMemberCountry = null; } $aProcessedRows[] = array('js_object' => $sJsObject, 'row_value' => $aItems['member_id'], 'member_icon' => $sMemberIcon, 'member_nick_name' => $sMemberNickName, 'member_location' => $sMemberLocation ? '<a href="' . $sMemberLocation . '">' . $sMemberNickName . '</a>' : '', 'member_sex_img' => $sMemberSexImg ? ' <img src="' . $sMemberSexImg . '" alt="' . $aProfileInfo['Sex'] . '" />' : '', 'member_age' => $sMemberAge, 'member_flag' => $sMemberCountryFlag, 'member_country' => $sMemberCountry, 'member_mutual_friends' => _t('_sys_cnts_txt_mutual_friends', $iMemberMutualFriends > 0 ? $iMemberMutualFriends : _t('_sys_cnts_txt_mf_no')), 'type' => $aItems['type'], 'message_date' => $aItems['date']); $iIndex++; } // init the sort toggle ellements ; switch ($this->aCommunicatorSettings['sorting']) { case 'date': $aSortToglleElements['date_sort_toggle'] = 'toggle_up'; break; case 'date_desc': $aSortToglleElements['date_sort_toggle'] = 'toggle_down'; break; case 'author': $aSortToglleElements['author_sort_toggle'] = 'toggle_up'; break; case 'author_desc': $aSortToglleElements['author_sort_toggle'] = 'toggle_down'; break; } // define the actions list for type of requests; switch ($this->aCommunicatorSettings['communicator_mode']) { case 'friends_requests': // define the person mode ; switch ($this->aCommunicatorSettings['person_switcher']) { case 'to': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['accept'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'accept_friends_request', 'getProcessingRows')")), 1 => array('type' => 'button', 'value' => $aLanguageKeys['reject'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'reject_friends_request', 'getProcessingRows')"))))); $oForm = new BxTemplFormView($aForm); $sActionsList = $oForm->getCode(); break; case 'from': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['back_invite'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_friends_request', 'getProcessingRows')"))))); $oForm = new BxTemplFormView($aForm); $sActionsList = $oForm->getCode(); break; } break; case 'hotlist_requests': // define the person mode ; switch ($this->aCommunicatorSettings['person_switcher']) { case 'to': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['fave'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'add_hotlist', 'getProcessingRows')"))))); $oForm = new BxTemplFormView($aForm); $sActionsList = $oForm->getCode(); break; case 'from': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_hotlisted', 'getProcessingRows')"))))); $oForm = new BxTemplFormView($aForm); $sActionsList = $oForm->getCode(); break; } break; case 'greeting_requests': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_greetings', 'getProcessingRows')"))))); $oForm = new BxTemplFormView($aForm); $sActionsList = $oForm->getCode(); break; case 'blocks_requests': // define the person mode ; switch ($this->aCommunicatorSettings['person_switcher']) { case 'to': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['block'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'block_unblocked', 'getProcessingRows')"))))); $oForm = new BxTemplFormView($aForm); $sActionsList = $oForm->getCode(); break; case 'from': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['unblock'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'unblock_blocked', 'getProcessingRows')"))))); $oForm = new BxTemplFormView($aForm); $sActionsList = $oForm->getCode(); break; } break; case 'friends_list': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'reject_friends_request', 'getProcessingRows')"))))); $oForm = new BxTemplFormView($aForm); $sActionsList = $oForm->getCode(); break; } // processing the sort link ; $sSortLink = getClearedParam('sorting', $sCuttedUrl) . '&page=' . $this->aCommunicatorSettings['page'] . '&per_page=' . $this->aCommunicatorSettings['per_page']; // fill array with template keys ; $aTemplateKeys = array('js_object' => $sJsObject, 'from_me' => $aLanguageKeys['from_me'], 'to_me' => $aLanguageKeys['to_me'], 'selected_from' => $this->aCommunicatorSettings['person_switcher'] == 'from' ? 'checked="checked"' : null, 'selected_to' => $this->aCommunicatorSettings['person_switcher'] == 'to' ? 'checked="checked"' : null, 'page_sort_url' => $sSortLink, 'sort_date' => $this->aCommunicatorSettings['sorting'] == 'date' ? 'date_desc' : 'date', 'sort_author' => $this->aCommunicatorSettings['sorting'] == 'author' ? 'author_desc' : 'author', 'date_sort_toggle_ellement' => $aSortToglleElements['date_sort_toggle'], 'author_sort_toggle_ellement' => $aSortToglleElements['author_sort_toggle'], 'author' => $aLanguageKeys['author'], 'type' => $aLanguageKeys['type'], 'date' => $aLanguageKeys['date'], 'click_sort' => $aLanguageKeys['click_sort'], 'bx_repeat:rows' => $aProcessedRows, 'actions_list' => $sActionsList, 'current_page' => 'communicator.php', 'select' => $aLanguageKeys['select'], 'all_messages' => $aLanguageKeys['all'], 'none_messages' => $aLanguageKeys['none'], 'read_messages' => $aLanguageKeys['read'], 'unread_messages' => $aLanguageKeys['unread'], 'page_pagination' => $sPagination); $sPageContent = $oSysTemplate->parseHtmlByName($sRowsTemplName, $aTemplateKeys); } else { $sPageContent = $oSysTemplate->parseHtmlByName('default_margin.html', array('content' => MsgBox(_t($sEmptyMessage)))); } // ** Process the final template ; // generate the page settings ; if ($bShowSettings) { $aTemplateKeys = array('js_object' => $sJsObject, 'from_me' => $aLanguageKeys['from_me'], 'to_me' => $aLanguageKeys['to_me'], 'selected_from' => $this->aCommunicatorSettings['person_switcher'] == 'from' ? 'checked="checked"' : null, 'selected_to' => $this->aCommunicatorSettings['person_switcher'] == 'to' ? 'checked="checked"' : null); $sSettings = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['communicator_settings'], $aTemplateKeys); } // fill array with template keys ; $aTemplateKeys = array('js_object' => $sJsObject, 'current_page' => 'communicator.php', 'communicator_mode' => $this->aCommunicatorSettings['communicator_mode'], 'communicator_person_mode' => $this->aCommunicatorSettings['person_switcher'], 'error_message' => bx_js_string(_t('_Please, select at least one message')), 'sure_message' => bx_js_string(_t('_Are you sure?')), 'settings' => $sSettings, 'page_content' => $sPageContent); return $oSysTemplate->parseHtmlByName($this->aUsedTemplates['communicator_settings_page'], $aTemplateKeys); }
function showPaginationAjax() { bx_import('BxDolPaginate'); $oConfig = $this->_oMain->_oConfig; $sUrlStart = BX_DOL_URL_ROOT . $oConfig->getBaseUri() . $this->sSitesBrowseUrl; $sUrlStart .= false === strpos($sUrlStart, '?') ? '?' : '&'; $sUrlStart .= 'page={page}&per_page={per_page}'; $oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'view_all_url' => BX_DOL_URL_ROOT . $oConfig->getBaseUri() . $this->sSitesBrowseAll, 'info' => false, 'view_all' => true, 'page_links' => false, 'on_change_page' => "getHtmlData('search_result_block_{$this->sMode}', '{$sUrlStart}')")); return '<div class="clear_both"></div>' . $oPaginate->getPaginate(); }
function displayOrders($sType, $aParams) { if (empty($aParams['per_page'])) { $aParams['per_page'] = $this->_oConfig->getPerPage('orders'); } $sJsObject = $this->_oConfig->getJsObject('orders'); $sMethodNameInfo = 'get' . ucfirst($sType) . 'Orders'; $aOrders = $this->_oDb->{$sMethodNameInfo}($aParams); if (empty($aOrders)) { return MsgBox(_t($this->_sLangsPrefix . 'msg_no_results')); } $aAdministrator = $this->_oDb->getVendorInfoProfile(BX_PMT_ADMINISTRATOR_ID); $sTxtMoreProducts = _t($this->_sLangsPrefix . 'txt_more_products'); $sTxtMoreItems = _t($this->_sLangsPrefix . 'txt_more_items'); $sTxtActionMore = _t($this->_sLangsPrefix . 'txt_action_more'); //--- Get Orders ---// $aResultOrders = array(); foreach ($aOrders as $aOrder) { if (empty($aOrder['user_id'])) { $aOrder['user_name'] = $aAdministrator['profile_name']; $aOrder['user_url'] = $aAdministrator['profile_url']; } else { $aOrder['user_name'] = getNickName($aOrder['user_id']); $aOrder['user_url'] = getProfileLink($aOrder['user_id']); if (!$aOrder['user_name']) { $aOrder['user_name'] = _t('_undefined'); $aOrder['user_url'] = ''; } } $aResultOrders[] = array_merge($aOrder, array('js_object' => $sJsObject, 'type' => $sType, 'txt_more_products' => $sTxtMoreProducts, 'txt_more_items' => $sTxtMoreItems, 'txt_action_more' => $sTxtActionMore, 'bx_if:show_link' => array('condition' => !empty($aOrder['user_url']), 'content' => array('user_name' => $aOrder['user_name'], 'user_url' => $aOrder['user_url'])), 'bx_if:show_text' => array('condition' => empty($aOrder['user_url']), 'content' => array('user_name' => $aOrder['user_name'])), 'bx_if:pending' => array('condition' => $sType == BX_PMT_ORDERS_TYPE_PENDING, 'content' => array('id' => $aOrder['id'], 'order' => $aOrder['order'])), 'bx_if:processed' => array('condition' => $sType == BX_PMT_ORDERS_TYPE_PROCESSED || BX_PMT_ORDERS_TYPE_SUBSCRIPTION || $sType == BX_PMT_ORDERS_TYPE_HISTORY, 'content' => array('order' => $aOrder['order'])), 'products' => $aOrder['products'], 'items' => $aOrder['items'], 'subscription' => $this->_isSubscription($aOrder))); } //--- Get Paginate Panel ---// $sPaginatePanel = ""; $sMethodNameCount = 'get' . ucfirst($sType) . 'OrdersCount'; if (($iCount = $this->_oDb->{$sMethodNameCount}($aParams)) > $aParams['per_page']) { $oPaginate = new BxDolPaginate(array('start' => $aParams['start'], 'count' => $iCount, 'per_page' => $aParams['per_page'], 'per_page_step' => 2, 'per_page_interval' => 3, 'page_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . ($sType == BX_PMT_ORDERS_TYPE_HISTORY ? 'history' : 'orders') . '/', 'on_change_page' => $sJsObject . ".changePage('" . $sType . "', {start}, {per_page}, " . $aParams['seller_id'] . ")")); $sPaginatePanel = $oPaginate->getPaginate(); } return $this->parseHtmlByName($sType . '_orders.html', array('bx_repeat:orders' => $aResultOrders, 'paginate_panel' => $sPaginatePanel)); }
function getPhotoBlock($aParams = array()) { $aShowParams = array('showRate' => 1, 'showPaginate' => 0, 'showViews' => 0, 'showDate' => 0, 'showLink' => 0, 'showFrom' => 0); if (count($aParams) > 0) { foreach ($aParams as $sKeyName => $sKeyValue) { switch ($sKeyName) { case 'PID': $this->aCurrent['restriction']['owner']['value'] = (int) $sKeyValue; break; case 'Category': $this->aCurrent['restriction']['category']['value'] = strip_tags($sKeyValue); break; case 'Tag': $this->aCurrent['restriction']['tag']['value'] = strip_tags($sKeyValue); break; case 'Limit': $this->aCurrent['paginate']['perPage'] = (int) $sKeyValue; break; case 'DisplayPagination': if ($sKeyValue == 1) { $aShowParams['showPaginate'] = 1; } break; case 'DisplayViews': if ($sKeyValue == 1) { $aShowParams['showViews'] = 1; } break; case 'DisplayWhenAgo': if ($sKeyValue == 1) { $aShowParams['showDate'] = 1; } break; case 'DisplayLink': if ($sKeyValue == 1) { $aShowParams['showLink'] = 1; } break; case 'DisplayProfile': if ($sKeyValue == 1) { $aShowParams['showFrom'] = 1; } break; } } } $this->aCurrent['paginate']['perPage'] = 20; $aFilesList = $this->getSearchData(); $iCnt = $this->aCurrent['paginate']['totalNum']; if ($iCnt) { $aUnit = array(); $aUnits = array(); if (defined('BX_PROFILE_PAGE') || defined('BX_MEMBER_PAGE')) { $iPhotoWidth = 294; $sImgWidth = 'style="width:' . $iPhotoWidth . 'px;"'; } else { $iPhotoWidth = (int) $this->oModule->_oConfig->getGlParam('file_width'); $iPhotoWidth = $iPhotoWidth > 1 ? $iPhotoWidth : 600; $sImgWidth = ''; } foreach ($aFilesList as $iKey => $aData) { $sPicUrl = $this->getImgUrl($aData['Hash'], 'icon'); $aUnits[] = array('imageId' => $iKey + 1, 'picUrl' => $sPicUrl); $sPicLinkElements .= 'aPicLink[' . ($iKey + 1) . '] = ' . $aData['id'] . ';'; if ($iKey == 0) { $aAdd = array('switchWidth' => $iPhotoWidth + 2, 'imgWidth' => $sImgWidth); $aUnit['switcherUnit'] = $this->getSwitcherUnit($aData, $aShowParams, $aAdd); } } $aUnit['moduleUrl'] = BX_DOL_URL_ROOT . $this->oModule->_oConfig->getBaseUri(); $aUnit['bx_repeat:iconBlock'] = $aUnits; $aUnit['count'] = $iCnt; $aUnit['contWidth'] = $iCnt * 40; $aUnit['picWidth'] = $iPhotoWidth; $aUnit['picBoxWidth'] = $aUnit['switchWidth'] = $iPhotoWidth + 2; $aUnit['switchWidthOut'] = $aUnit['switchWidth'] + 4; if ($aUnit['contWidth'] > $aUnit['picWidth']) { $bScroller = true; $aUnit['containerWidth'] = $aUnit['picBoxWidth'] - 72; } else { $bScroller = false; $aUnit['containerWidth'] = $aUnit['contWidth']; } $aUnit['bx_if:scrollerBack'] = array('condition' => $bScroller, 'content' => array(1)); $aUnit['bx_if:scrollerNext'] = array('condition' => $bScroller, 'content' => array(1)); $aUnit['picLinkElements'] = $sPicLinkElements; if ($aShowParams['showPaginate'] == 1) { $aLinkAddon = $this->getLinkAddByPrams(); $oPaginate = new BxDolPaginate(array('page_url' => $aUnit['changeUrl'], 'count' => $iCnt, 'info' => false, 'per_page' => 1, 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => false, 'page_reloader' => false, 'on_change_page' => 'getCurrentImage({page})')); $aUnit['paginate'] = $oPaginate->getPaginate(); } else { $aUnit['paginate'] = ''; } $this->oTemplate->addCss('search.css'); return $this->oTemplate->parseHtmlByName('photo_switcher.html', $aUnit); } elseif ($this->oModule->_iProfileId != 0 && $this->oModule->_iProfileId == (int) $this->aCurrent['restriction']['owner']['value']) { ob_start(); ?> <div class="paginate"> <div class="view_all" style="background-image:url(__img_src__)"> <a href="__lnk_url__" title="__lnk_title__">__lnk_content__</a> </div> </div> <?php $sCode = ob_get_clean(); $sLinkTitle = _t('_bx_photos_add'); $sNickName = getNickName($this->oModule->_iProfileId); $sCaption = uriFilter(str_replace('{nickname}', $sNickName, $this->oModule->_oConfig->getGlParam('profile_album_name'))); $aUnit = array('img_src' => $this->oTemplate->getIconUrl('more.png'), 'lnk_url' => $this->oModule->_oConfig->getBaseUri() . 'albums/my/add_objects/' . $sCaption . '/owner/' . $sNickName, 'lnk_title' => $sLinkTitle, 'lnk_content' => $sLinkTitle); return MsgBox(_t('_Empty')) . $this->oTemplate->parseHtmlByContent($sCode, $aUnit); } return MsgBox(_t('_Empty')); }
function getResultCodeArray(&$oSearch, $sCode) { $aCode = array('code' => MsgBox(_t('_Empty')), 'paginate' => ''); $iCount = $oSearch->aCurrent['paginate']['totalNum']; if ($iCount > 0) { $aCode['code'] = $GLOBALS['oFunctions']->centerContent($sCode, '.sys_file_search_unit'); $sLink = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/home/' . $oSearch->aCurrent['restriction']['activeStatus']['value']; $sKeyWord = bx_get('keyword'); if ($sKeyWord !== false) { $sLink .= '&keyword=' . clear_xss($sKeyWord); } $aExclude = array('r'); $aLinkAddon = $oSearch->getLinkAddByPrams($aExclude); $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $iCount, 'per_page' => $oSearch->aCurrent['paginate']['perPage'], 'page' => $oSearch->aCurrent['paginate']['page'], 'on_change_page' => 'return !loadDynamicBlock(' . $oSearch->id . ', \'' . $sLink . $aLinkAddon['params'] . $aLinkAddon['paginate'] . '\');', 'on_change_per_page' => 'return !loadDynamicBlock(' . $oSearch->id . ', \'' . $sLink . $aLinkAddon['params'] . '&page=1&per_page=\' + this.value);')); $aCode['paginate'] = $oPaginate->getPaginate(); } return $aCode; }
/** * @description : function will generate friends list ; * @return : array ; */ function getBlockCode_Friends() { // init some variables ; $sOutputHtml = ''; $sEmpty = ''; $iIndex = ''; $aUsedTemplates = array('browse_searched_block.html'); // lang keys ; $sPhotoCaption = _t('_With photos only'); $sOnlineCaption = _t('_online only'); // collect the SQL parameters ; $aWhereParam = array(); if ($this->aDisplayParameters['photos']) { $aWhereParam[] = 'p.`Avatar` <> 0'; } if ($this->aDisplayParameters['online']) { $aWhereParam[] = "(p.`DateLastNav` > SUBDATE(NOW(), INTERVAL " . $this->iMemberOnlineTime . " MINUTE)) "; } $sWhereParam = null; foreach ($aWhereParam as $sValue) { if ($sValue) { $sWhereParam .= ' AND ' . $sValue; } } $iTotalNum = getFriendNumber($this->iProfileID, 1, 0, $sWhereParam); if (!$iTotalNum) { $sEmpty = MsgBox(_t('_Empty')); } $iPerPage = $this->aDisplayParameters['per_page']; $iCurPage = $this->aDisplayParameters['page']; $sLimitFrom = ($iCurPage - 1) * $iPerPage; $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}"; // switch member's template ; $sTemplateName = $this->aDisplayParameters['mode'] == 'extended' ? 'search_profiles_ext.html' : 'search_profiles_sim.html'; // select the sorting parameters ; $sSortParam = 'activity_desc'; if (isset($this->aDisplayParameters['sort'])) { switch ($this->aDisplayParameters['sort']) { case 'activity': $sSortParam = 'activity_desc'; break; case 'date_reg': $sSortParam = 'date_reg_desc'; break; case 'rate': $sSortParam = 'rate'; break; default: $this->aDisplayParameters['sort'] = 'activity'; break; } } else { $this->aDisplayParameters['sort'] = 'activity'; } $aAllFriends = getMyFriendsEx($this->iProfileID, $sWhereParam, $sSortParam, $sqlLimit); $aExtendedCss = array('ext_css_class' => $this->aDisplayParameters['mode'] == 'extended' ? 'search_filled_block' : ''); foreach ($aAllFriends as $iFriendID => $aFriendsPrm) { $aMemberInfo = getProfileInfo($iFriendID); if ($aMemberInfo['Couple']) { $aCoupleInfo = getProfileInfo($aMemberInfo['Couple']); $sOutputHtml .= $this->oSearchProfileTmpl->PrintSearhResult($aMemberInfo, $aCoupleInfo, $iIndex % 2 ? $aExtendedCss : array(), $sTemplateName); } else { $sOutputHtml .= $this->oSearchProfileTmpl->PrintSearhResult($aMemberInfo, array(), $iIndex % 2 ? $aExtendedCss : array(), $sTemplateName); } $iIndex++; } $sOutputHtml .= '<div class="clear_both"></div>'; // work with link pagination ; $aGetParams = array('mode', 'iUser', 'photos_only', 'online_only'); $sRequest = BX_DOL_URL_ROOT . 'viewFriends.php?'; $sRequest .= bx_encode_url_params($_GET, array(), $aGetParams) . 'page={page}&per_page={per_page}&sort={sorting}'; // gen pagination block ; $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage, 'sorting' => $this->aDisplayParameters['sort'])); $sPagination = $oPaginate->getPaginate(); // ** GENERATE HEADER PART ; // gen per page block ; $sPerPageBlock = $oPaginate->getPages($iPerPage); // fill array with sorting params ; $aSortingParam = array('activity' => _t('_Latest activity'), 'date_reg' => _t('_FieldCaption_DateReg_View'), 'rate' => _t('_Rate')); // gen sorting block ( type of : drop down ) ; $sSortBlock = $oPaginate->getSorting($aSortingParam); $sRequest = str_replace('{page}', '1', $sRequest); $sRequest = str_replace('{per_page}', $iPerPage, $sRequest); $sRequest = str_replace('{sorting}', $this->aDisplayParameters['sort'], $sRequest); // init some visible parameters ; $sPhotosChecked = $this->aDisplayParameters['photos'] ? 'checked="checked"' : null; $sOnlineChecked = $this->aDisplayParameters['online'] ? 'checked="checked"' : null; // link for photos section ; $sPhotoLocation = $this->getCutParam('photos_only', $sRequest); // link for online section ; $sOnlineLocation = $this->getCutParam('online_only', $sRequest); // link for `mode switcher` ; $sModeLocation = $this->getCutParam('mode', $sRequest); $sModeLocation = $this->getCutParam('per_page', $sModeLocation); bx_import('BxDolMemberInfo'); $oMemberInfo = BxDolMemberInfo::getObjectInstance(getParam('sys_member_info_thumb')); $sTopControls = $GLOBALS['oSysTemplate']->parseHtmlByName('browse_sb_top_controls.html', array('sort_block' => $sSortBlock, 'bx_if:show_with_photos' => array('condition' => $oMemberInfo->isAvatarSearchAllowed(), 'content' => array('photo_checked' => $sPhotosChecked, 'photo_location' => $sPhotoLocation, 'photo_caption' => $sPhotoCaption)), 'online_checked' => $sOnlineChecked, 'online_location' => $sOnlineLocation, 'online_caption' => $sOnlineCaption, 'per_page_block' => $sPerPageBlock)); // build template ; $sOutputHtml = $GLOBALS['oSysTemplate']->parseHtmlByName($aUsedTemplates[0], array('top_controls' => $sTopControls, 'bx_if:show_sim_css' => array('condition' => $this->aDisplayParameters['mode'] != 'extended', 'content' => array()), 'bx_if:show_ext_css' => array('condition' => $this->aDisplayParameters['mode'] == 'extended', 'content' => array()), 'searched_data' => $sOutputHtml, 'pagination' => $sPagination)); // build the toggle block ; $aToggleItems = array('' => _t('_Simple'), 'extended' => _t('_Extended')); foreach ($aToggleItems as $sKey => $sValue) { $aToggleEllements[$sValue] = array('href' => $sModeLocation . '&mode=' . $sKey, 'dynamic' => true, 'active' => $this->aDisplayParameters['mode'] == $sKey); } return array($sOutputHtml . $sEmpty, $aToggleEllements, array(), true); }