/** * 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 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); }
/** * @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); }
/** * Function will find all needed members by some criteria ; * * @return : Html presentation data ; */ function getBlockCode_SearchedMembersBlock() { // lang keys ; $sOutputHtml = ''; $sPhotoCaption = _t('_With photos only'); $sOnlineCaption = _t('_online only'); $sSimpleCaption = _t('_Simple'); $sExtendCaption = _t('_Extended'); $aUsedTemplates = array('browse_searched_block.html'); // collect the SQL parameters ; $aWhereParam = array(); $aWhereParam[] = $this->aParameters['sex'] ? '`Profiles`.`Sex` = "' . $this->aParameters['sex'] . '"' : null; if ($this->aParameters['age']) { $aAgeTemp = explode('-', $this->aParameters['age']); $iFrom = isset($aAgeTemp[0]) ? (int) $aAgeTemp[0] : 0; $iTo = isset($aAgeTemp[1]) ? (int) $aAgeTemp[1] : 0; unset($aAgeTemp); if ($iFrom) { $sSign = $iTo ? '>=' : '='; $aWhereParam[] = "\n ((YEAR(CURDATE())-YEAR(`Profiles`.`DateOfBirth`)) - (RIGHT(CURDATE(),5)<RIGHT(`Profiles`.`DateOfBirth`,5))) {$sSign} {$iFrom}\n "; } if ($iTo) { $sSign = $iFrom ? '<=' : '='; $aWhereParam[] = "\n ((YEAR(CURDATE())-YEAR(`Profiles`.`DateOfBirth`)) - (RIGHT(CURDATE(),5)<RIGHT(`Profiles`.`DateOfBirth`,5))) {$sSign} {$iTo}\n "; } } $aWhereParam[] = $this->aParameters['country'] ? '`Profiles`.`Country` = "' . $this->aParameters['country'] . '"' : null; if ($this->aAdditionalParameters['photos_only']) { $aWhereParam[] = '`Profiles`.`Avatar` <> 0'; } if ($this->aAdditionalParameters['online_only']) { $aWhereParam[] = "(`Profiles`.`DateLastNav` > SUBDATE(NOW(), INTERVAL " . $this->iMemberOnlineTime . " MINUTE)) "; } $sWhereParam = null; foreach ($aWhereParam as $sValue) { if ($sValue) { $sWhereParam .= ' AND ' . $sValue; } } // make search ; $sQuery = "SELECT COUNT(*) AS `Cnt` FROM `Profiles` WHERE {$this->_sSqlActive} {$sWhereParam}"; $iTotalNum = db_value($sQuery); if (!$iTotalNum) { $sOutputHtml = MsgBox(_t('_Empty')); } // init some pagination parameters ; $iPerPage = $this->aDisplaySettings['per_page']; $iCurPage = $this->aDisplaySettings['page']; if ($iCurPage < 1) { $iCurPage = 1; } $sLimitFrom = ($iCurPage - 1) * $iPerPage; $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}"; // switch template for `simle` and `advanced` mode ; $sTemplateName = $this->aDisplaySettings['mode'] == 'extended' ? 'search_profiles_ext.html' : 'search_profiles_sim.html'; // select sorting parameters ; $sSortParam = '`Profiles`.`DateLastNav` DESC'; if (isset($this->aDisplaySettings['sort'])) { switch ($this->aDisplaySettings['sort']) { case 'date_reg': $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); }
/** * 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++; } // 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 oCommunicatorPage != 'undefined' ) oCommunicatorPage.sendAction('communicator_container', 'accept_friends_request', 'getProcessingRows')")), 1 => array('type' => 'button', 'value' => $aLanguageKeys['reject'], 'attrs' => array('onclick' => "if ( typeof oCommunicatorPage != 'undefined' ) oCommunicatorPage.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 oCommunicatorPage != 'undefined' ) oCommunicatorPage.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['hotlist_add'], 'attrs' => array('onclick' => "if ( typeof oCommunicatorPage != 'undefined' ) oCommunicatorPage.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 oCommunicatorPage != 'undefined' ) oCommunicatorPage.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 oCommunicatorPage != 'undefined' ) oCommunicatorPage.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 oCommunicatorPage != 'undefined' ) oCommunicatorPage.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 oCommunicatorPage != 'undefined' ) oCommunicatorPage.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 oCommunicatorPage != 'undefined' ) oCommunicatorPage.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('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, 'per_page_block' => $sPerPageBlock, '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, 'page_pagination' => $sPagination); $sPageContent = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['communicator_page'], $aTemplateKeys); } else { $sPageContent = MsgBox(_t('_Empty')); } // ** Process the final template ; if ($sShowSettings) { // generate the page settings ; $aTemplateKeys = array('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('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, 'per_page_block' => $sPerPageBlock, 'page_content' => $sPageContent); // construct the final template ; $sOutputHtml = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['communicator_settings_page'], $aTemplateKeys); return $sOutputHtml; }
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); }