aDisplayParameters = &$aDisplayParameters; $this -> sCurrentPage = $_SERVER['PHP_SELF']; $this -> oSearchProfileTmpl = new BxTemplSearchProfile(); $this -> sPageName = $sPageName; } /** * @description : function will draw block with featured members list; * @return : Html presentation data ; */ function getBlockCode_FeaturedMembers() { // init some variables ; $sOutputHtml = null; $iIndex = null; $sQuery = 'SELECT COUNT(*) FROM `Profiles` WHERE `Featured` = 1'; $iTotalNum = db_value($sQuery); if( !$iTotalNum ) $sOutputHtml = 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'; $sQuery = "SELECT * FROM `Profiles` WHERE `Featured` = 1 {$sqlLimit}"; $rResult = db_res($sQuery); // need for block devider ; $aExtendedCss = array( 'ext_css_class' => 'search_filled_block'); while( $aRow = mysql_fetch_assoc($rResult) ) { if ( $aRow['Couple']) { $aCoupleInfo = getProfileInfo( $Row['Couple'] ); if ( !($iIndex % 2) ) { $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, $aCoupleInfo, null, $sTemplateName); } else { // generate filled block ; $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, $aCoupleInfo, $aExtendedCss, $sTemplateName); } } else { if ( !($iIndex % 2) ) { $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, '', null, $sTemplateName); } else { // generate filled block ; $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, null, $aExtendedCss, $sTemplateName); } } $iIndex++; } $sOutputHtml .= '
'; // work with link pagination ; $sRequest = $_SERVER['PHP_SELF'] . '?'; $aGetParams = array('mode'); if ( is_array($aGetParams) and !empty($aGetParams) ) foreach($aGetParams AS $sValue ) if ( isset($_GET[$sValue]) ) { $sRequest .= '&' . $sValue . '=' . $_GET[$sValue]; } // gen pagination block ; $sRequest = $sRequest . '&featured_members_page={page}&per_page={per_page}'; $oPaginate = new BxDolPaginate ( array ( 'page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage, 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => null, 'on_change_per_page' => null, ) ); $sPagination = $oPaginate -> getPaginate(); // return builded block; return DesignBoxContent( _t( '_featured members' ) . $this -> genToggleBlock(), $sOutputHtml . $sPagination, 1 ); } /** * @description : function will generate all members list ; */ function getBlockCode_AllMembers() { // init some variables ; $sOutputHtml = null; $iIndex = null; $sQuery = 'SELECT COUNT(*) FROM `Profiles`'; $iTotalNum = db_value($sQuery); if( !$iTotalNum ) return MsgBox( _t('_Empty') ); $iPerPage = $this -> aDisplayParameters['per_page']; $iCurPage = $this -> aDisplayParameters['page2']; $sLimitFrom = ( $iCurPage - 1 ) * $iPerPage; $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}"; // select the members template if ( $this -> aDisplayParameters['mode'] == 'extended' ) { $sTemplateName = 'search_profiles_ext.html'; } $sQuery = "SELECT * FROM `Profiles` {$sqlLimit}"; $rResult = db_res($sQuery); // need for the block devider ; $aExtendedCss = array( 'ext_css_class' => 'search_filled_block'); while( $aRow = mysql_fetch_assoc($rResult) ) { if ( $aRow['Couple']) { $aCoupleInfo = getProfileInfo( $Row['Couple'] ); if ( !($iIndex % 2) ) { $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, $aCoupleInfo, null, $sTemplateName); } else { // generate filled block ; $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, $aCoupleInfo, $aExtendedCss, $sTemplateName); } } else { if ( !($iIndex % 2) ) { $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, '', null, $sTemplateName); } else { // generate filled block ; $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, null, $aExtendedCss, $sTemplateName); } } $iIndex++; } $sOutputHtml .= '
'; // work with link pagination ; $sRequest = $_SERVER['PHP_SELF'] . '?'; $aGetParams = array('mode'); if ( is_array($aGetParams) and !empty($aGetParams) ) foreach($aGetParams AS $sValue ) if ( isset($_GET[$sValue]) ) { $sRequest .= '&' . $sValue . '=' . $_GET[$sValue]; } // gen pagination block ; $sRequest = $sRequest . '&all_members_page={page}&per_page={per_page}'; $oPaginate = new BxDolPaginate ( array ( 'page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage, 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => null, 'on_change_per_page' => null, ) ); $sPagination = $oPaginate -> getPaginate(); // return builded block; return DesignBoxContent( _t( '_All Members' ) . $this -> genToggleBlock(), $sOutputHtml . $sPagination, 1 ); } /** * @description : function will draw the browse settings block ; * @return : Html presentation data ; */ function getBlockCode_BrowseBlock() { $aFilteredSettings = array( 'sex' => null, 'age' => null, 'country' => null, 'photos_only' => null, 'online_only' => null, 'mode' => null, ); $oBrowse = new BxTemplBrowse( $aFilteredSettings, $this -> aDisplayParameters, $this -> sPageName ); $sSettingsBlock = $oBrowse -> getBlockCode_SettingsBlock(); return $sSettingsBlock ; } /** * @description : function will draw the 'quick search block' ; * @return : Html presentation data ; */ function getBlockCode_QuickSearch() { $oPF = new BxDolProfileFields(10); return $oPF->getFormCode(); } /** * @description : function will generate mode toggle block ; * @return Html presentation data ; */ function genToggleBlock() { // lang keys $sSimpleCaption = _t( '_Simple' ); $sExtendCaption = _t( '_Extended' ); $sParamsToggle = '
'; if ( $this -> aDisplayParameters['mode'] == 'extended' ) { $sParamsToggle .= '
' . $sSimpleCaption . '
' . $sExtendCaption . '
'; } else { $sParamsToggle .= '
' . $sSimpleCaption . '
' . $sExtendCaption . '
'; } $sParamsToggle .= '
'; return $sParamsToggle; } } // init some needed varibales ; if ( isset($_GET['per_page']) ) { $iPerPage = (int) $_GET['per_page']; } else { $iPerPage = ( isset($_GET['mode']) and $_GET['mode'] == 'extended' ) ? $iPerPage = 5 : $iPerPage = 32; } if ( $iPerPage <= 0 ) $iPerPage = 32; if ( $iPerPage > 100 ) $iPerPage = 100; $iPage = ( isset($_GET['featured_members_page']) ) ? (int) $_GET['featured_members_page'] : 1; if ( $iPage <= 0 ) $iPage = 1; $iPage2 = ( isset($_GET['all_members_page']) ) ? (int) $_GET['all_members_page'] : 1; if ( $iPage2 <= 0 ) $iPage2 = 1; $aDisplayParameters = array ( 'per_page' => $iPerPage, 'page' => $iPage, 'page2' => $iPage2, 'mode' => isset($_GET['mode']) ? $_GET['mode'] : null, 'ext_tmpl' => BX_DIRECTORY_PATH_ROOT . "templates/tmpl_{$tmpl}/search_profiles_ext.html", 'sim_tmpl' => BX_DIRECTORY_PATH_ROOT . "templates/tmpl_{$tmpl}/search_profiles_sim.html", ); // generate page $_ni = $_page['name_index']; $oProfileInfo = &new BxDolAllMembersPageView( 'all_members', $aDisplayParameters ); $sOutputHtml = $oProfileInfo->getCode(); $_page_cont[$_ni]['page_main_code'] = $sOutputHtml; PageCode(); ?>