本文整理汇总了PHP中BxDolPaginate::getPages方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolPaginate::getPages方法的具体用法?PHP BxDolPaginate::getPages怎么用?PHP BxDolPaginate::getPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolPaginate
的用法示例。
在下文中一共展示了BxDolPaginate::getPages方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: genMessagesRows
//.........这里部分代码省略.........
// 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;
}
示例2: PageCodeMembers
function PageCodeMembers($sDefaultCtl = BX_DOL_ADM_MP_CTL, $sDefaultView = BX_DOL_ADM_MP_VIEW)
{
$aTopMenu = array('view-type-simple' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeView(this);', 'title' => _t('_adm_btn_mp_simple'), 'active' => $sDefaultView == 'simple' ? 1 : 0), 'view-type-extended' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeView(this);', 'title' => _t('_adm_btn_mp_extended'), 'active' => $sDefaultView == 'extended' ? 1 : 0), 'view-type-geeky' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeView(this);', 'title' => _t('_adm_btn_mp_geeky'), 'active' => $sDefaultView == 'geeky' ? 1 : 0));
$oPaginate = new BxDolPaginate(array('per_page' => BX_DOL_ADM_MP_PER_PAGE, 'per_page_step' => BX_DOL_ADM_MP_PER_PAGE_STEP, 'on_change_per_page' => BX_DOL_ADM_MP_JS_NAME . '.changePerPage(this);'));
$sTopControls = $GLOBALS['oAdmTemplate']->parseHtmlByName('mp_members_top_controls.html', array('change_order' => BX_DOL_ADM_MP_JS_NAME . '.changeOrder(this);', 'per_page' => $oPaginate->getPages()));
$aResult = array('action_url' => $GLOBALS['site']['url_admin'] . 'profiles.php', 'ctl_type' => is_array($sDefaultCtl) && !empty($sDefaultCtl) ? $sDefaultCtl['ctl_type'] : $sDefaultCtl, 'view_type' => $sDefaultView, 'top_controls' => $sTopControls, 'loading' => LoadingBox('adm-mp-members-loading'));
foreach (array('simple', 'extended', 'geeky') as $sType) {
if ($sType == $sDefaultView) {
$aParams = array('view_type' => $sType);
if (is_array($sDefaultCtl) && !empty($sDefaultCtl)) {
$aParams = array_merge($aParams, $sDefaultCtl);
}
$aResult = array_merge($aResult, array('style_' . $sType => '', 'content_' . $sType => getMembers($aParams)));
} else {
$aResult = array_merge($aResult, array('style_' . $sType => 'display: none;', 'content_' . $sType => ''));
}
}
return DesignBoxAdmin(_t('_adm_box_cpt_mp_members'), $GLOBALS['oAdmTemplate']->parseHtmlByName('mp_members.html', $aResult), $aTopMenu);
}
示例3: array
/**
* @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'));
//.........这里部分代码省略.........
示例4: array
//.........这里部分代码省略.........
$sSortParam = ' `Profiles`.`DateReg` DESC';
break;
case 'rate':
$sSortParam = ' `Profiles`.`Rate` DESC, `Profiles`.`RateCount` DESC';
break;
default:
$this->aDisplaySettings['sort'] = 'activity';
case 'activity':
$sSortParam = ' `Profiles`.`DateLastNav` DESC';
break;
}
} else {
$this->aDisplaySettings['sort'] = 'activity';
}
// status uptimization
$iOnlineTime = (int) getParam("member_online_time");
$sIsOnlineSQL = ", if(`DateLastNav` > SUBDATE(NOW(), INTERVAL {$iOnlineTime} MINUTE ), 1, 0) AS `is_online`";
$sQuery = "\n SELECT\n `Profiles`.* {$sIsOnlineSQL}\n FROM\n `Profiles`\n WHERE\n {$this->_sSqlActive}\n {$sWhereParam}\n ORDER BY\n {$sSortParam}\n {$sqlLimit}\n ";
$rResult = db_res($sQuery);
$iIndex = 0;
// need for the block divider ;
$aExtendedCss = array('ext_css_class' => $this->aDisplaySettings['mode'] == 'extended' ? 'search_filled_block' : '');
while (true == ($aRow = mysql_fetch_assoc($rResult))) {
// generate the `couple` thumbnail ;
if ($aRow['Couple']) {
$aCoupleInfo = getProfileInfo($aRow['Couple']);
$sOutputHtml .= $this->oSearchProfileTmpl->PrintSearhResult($aRow, $aCoupleInfo, $iIndex % 2 ? $aExtendedCss : array(), $sTemplateName);
} else {
$sOutputHtml .= $this->oSearchProfileTmpl->PrintSearhResult($aRow, array(), $iIndex % 2 ? $aExtendedCss : array(), $sTemplateName);
}
$iIndex++;
}
// # end of search generation ;
// work with link pagination ;
if ($this->bPermalinkMode) {
preg_match("|([^\\?\\&]*)|", $_SERVER['REQUEST_URI'], $aMatches);
if (isset($aMatches[1]) and $aMatches[1]) {
$sRequest = $aMatches[1] . '?';
}
// need for additional parameters ;
$aGetParams = array('photos_only', 'online_only', 'sort', 'mode');
foreach ($aGetParams as $sValue) {
if (isset($_GET[$sValue])) {
$sRequest .= '&' . $sValue . '=' . rawurlencode($_GET[$sValue]);
}
}
} else {
$sRequest = BX_DOL_URL_ROOT . 'browse.php?';
// need for additional parameters ;
$aGetParams = array('sex', 'age', 'country', 'photos_only', 'online_only', 'sort', 'mode');
foreach ($aGetParams as $sValue) {
if (isset($_GET[$sValue])) {
$sRequest .= '&' . $sValue . '=' . rawurlencode($_GET[$sValue]);
}
}
}
// cutted al aunecessary parameters ;
$sRequest = getClearedParam('sort', $sRequest);
$sRequest = $sRequest . '&page={page}&per_page={per_page}&sort={sorting}';
// gen pagination block ;
$oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'sorting' => $this->aDisplaySettings['sort'], 'page' => $iCurPage, 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => null, 'on_change_per_page' => null));
$sPagination = $oPaginate->getPaginate();
// gen per page block ;
$sPerPageBlock = $oPaginate->getPages($iPerPage);
// prepare to output ;
$sOutputHtml .= '
<div class="clear_both"></div>
';
$sRequest = str_replace('{page}', '1', $sRequest);
$sRequest = str_replace('{per_page}', $iPerPage, $sRequest);
$sRequest = str_replace('{sorting}', $this->aDisplaySettings['sort'], $sRequest);
// 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);
// init some visible parameters ;
$sPhotosChecked = $this->aAdditionalParameters['photos_only'] ? 'checked="checked"' : null;
$sOnlineChecked = $this->aAdditionalParameters['online_only'] ? 'checked="checked"' : null;
// ** cutting all unnecessary get parameters ;
// link for photos section ;
$sPhotoLocation = getClearedParam('photos_only', $sRequest);
// link for online section ;
$sOnlineLocation = getClearedParam('online_only', $sRequest);
// link for `mode switcher` ;
$sModeLocation = getClearedParam('mode', $sRequest);
$sModeLocation = getClearedParam('per_page', $sModeLocation);
// ** gen header part - with some display options ;
// fill array with template's keys ;
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->aDisplaySettings['mode'] != 'extended', 'content' => array()), 'bx_if:show_ext_css' => array('condition' => $this->aDisplaySettings['mode'] == 'extended', 'content' => array()), 'searched_data' => $sOutputHtml, 'pagination' => $sPagination));
// generate toggle ellements ;
$aToggleItems = array('' => _t('_Simple'), 'extended' => _t('_Extended'));
foreach ($aToggleItems as $sKey => $sValue) {
$aToggleEllements[$sValue] = array('href' => $sModeLocation . '&mode=' . $sKey, 'dynamic' => true, 'active' => $this->aDisplaySettings['mode'] == $sKey);
}
return array($sOutputHtml, $aToggleEllements, array(), true);
}
示例5: getProcessingRows
/**
* Function will generate received rows ;
*
* @return : Html presentation data ;
*/
function getProcessingRows()
{
global $oSysTemplate, $site, $oFunctions;
// ** init some needed variables ;
$sOutputHtml = '';
$sPageContent = '';
$sActionsList = '';
$sSettings = '';
$sShowSettings = true;
$aRows = array();
// 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('_Add to Friend List'), 'reject' => _t('_Reject Invite'), 'delete' => _t('_Delete'), 'back_invite' => _t('_Back Invite'), 'hotlist_add' => _t('_Add to Hot List'), 'visitor' => _t('_Visitor'), 'unblock' => _t('_Unblock'), 'block' => _t('_Block'));
// get all requests from DB ;
switch ($this->aCommunicatorSettings['communicator_mode']) {
case 'friends_requests':
$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 )');
// set unvisible the settings block ;
$sShowSettings = false;
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 ');
}
// ** 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 oCommunicatorPage != 'undefined' ) oCommunicatorPage.getPaginatePage('{$sRequest}')", 'on_change_per_page' => "if ( typeof oCommunicatorPage != 'undefined' ) oCommunicatorPage.getPage(this.value, '{$sCuttedUrl}')"));
$sPagination = $oPaginate->getPaginate();
$sPerPageBlock = $oPaginate->getPages();
// 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_icon($aProfileInfo['ID'], 'left');
// member's profile location ;
$sMemberLocation = getProfileLink($aProfileInfo['ID']);
// member's nickname ;
$sMemberNickName = $aProfileInfo['NickName'];
// 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 . '" />';
}
} 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;
}
// color devider ;
$sFiledCss = !($iIndex % 2) ? 'filled' : 'not_filled';
$aProcessedRows[] = array('filled_class' => $sFiledCss, 'row_value' => $aItems['member_id'], 'member_icon' => $sMemberIcon, 'member_location' => $sMemberLocation ? '<a href="' . $sMemberLocation . '">' . $sMemberNickName . '</a>' : null, 'member_sex_img' => $sMemberSexImg ? ' <img src="' . $sMemberSexImg . '" alt="' . $aProfileInfo['Sex'] . '" />' : null, 'member_age' => $sMemberAge, 'member_flag' => $sMemberCountryFlag, 'member_country' => $sMemberCountry, 'type' => $aItems['type'], 'message_date' => $aItems['date']);
$iIndex++;
//.........这里部分代码省略.........
示例6: PageCodeMembers
function PageCodeMembers($sDefaultCtl = BX_DOL_ADM_MP_CTL, $sDefaultView = BX_DOL_ADM_MP_VIEW)
{
//--- Get Controls ---//
$aButtons = array('adm-mp-activate' => _t('_adm_btn_mp_activate'), 'adm-mp-deactivate' => _t('_adm_btn_mp_deactivate'), 'adm-mp-ban' => _t('_adm_btn_mp_ban'), 'adm-mp-unban' => _t('_adm_btn_mp_unban'), 'adm-mp-confirm' => _t('_adm_btn_mp_confirm'), 'adm-mp-delete' => _t('_adm_btn_mp_delete'));
$sControls = BxTemplSearchResult::showAdminActionsPanel('adm-mp-members-form', $aButtons, 'members');
$aTopMenu = array('view-type-simple' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeView(this);', 'title' => _t('_adm_btn_mp_simple'), 'active' => $sDefaultView == 'simple' ? 1 : 0), 'view-type-extended' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeView(this);', 'title' => _t('_adm_btn_mp_extended'), 'active' => $sDefaultView == 'extended' ? 1 : 0), 'view-type-geeky' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeView(this);', 'title' => _t('_adm_btn_mp_geeky'), 'active' => $sDefaultView == 'geeky' ? 1 : 0));
$oPaginate = new BxDolPaginate(array('per_page' => BX_DOL_ADM_MP_PER_PAGE, 'per_page_step' => BX_DOL_ADM_MP_PER_PAGE_STEP, 'on_change_per_page' => BX_DOL_ADM_MP_JS_NAME . '.changePerPage(this);'));
$aResult = array('action_url' => $GLOBALS['site']['url_admin'] . 'profiles.php', 'ctl_type' => $sDefaultCtl, 'view_type' => $sDefaultView, 'change_order' => BX_DOL_ADM_MP_JS_NAME . '.changeOrder(this);', 'per_page' => $oPaginate->getPages(), 'control' => $sControls, 'loading' => LoadingBox('adm-mp-members-loading'));
foreach (array('simple', 'extended', 'geeky') as $sType) {
if ($sType == $sDefaultView) {
$aResult = array_merge($aResult, array('style_' . $sType => '', 'content_' . $sType => getMembers(array('view_type' => $sType))));
} else {
$aResult = array_merge($aResult, array('style_' . $sType => 'display: none;', 'content_' . $sType => ''));
}
}
return DesignBoxAdmin(_t('_adm_box_cpt_mp_members'), $GLOBALS['oAdmTemplate']->parseHtmlByName('mp_members.html', $aResult), $aTopMenu);
}