49 if(!$this->bShowBothCoupleProfiles)
50 $this->_sSqlActive .=
" AND (`Profiles`.`Couple` = 0 or `Profiles`.`Couple` > `Profiles`.`ID`)";
61 $this -> aParameters = array
68 $this -> aAdditionalParameters = array
77 $this -> sKeyName .= ($this -> aParameters[
'sex']) ? $this -> aParameters[
'sex'] .
'|' :
'';
78 $this -> sKeyName .= ($this -> aParameters[
'age']) ? $this -> aParameters[
'age'] .
'|' :
'';
80 $this -> sKeyName .= ($this -> aParameters[
'country']) ? $this -> aParameters[
'country'] .
'|' :
'';
82 $this -> sKeyName .= ($this -> aAdditionalParameters[
'photos_only']) ?
'photo|' :
'';
83 $this -> sKeyName .= ($this -> aAdditionalParameters[
'online_only']) ?
'online|' :
'';
85 $this -> sKeyName = preg_replace(
"|\|$|",
'', $this -> sKeyName);
93 $this -> aParameters[
'sex'],
94 $this -> aParameters[
'age'],
95 $this -> aParameters[
'country'],
120 $sValue = ( $sValue ) ?
'<span>(' . $sValue .
')</span>' :
null;
123 <div class="linkSection">
127 <img src="' . $sIcon .
'" alt="' .
$sName .
'" />
130 <a href="' . $sLink .
'">' .
$sName .
'</a>
147 $sSexCaption =
_t(
'_By Sex' );
148 $sAgeCaption =
_t(
'_By Age' );
149 $sCountryCaption =
_t(
'_By Country' );
155 $sCountrySection =
'';
157 $sCurrentKey = ( $this -> sKeyName ) ? $this -> sKeyName :
'public';
168 function _genSexSection( &$oObject, $sCurrentKey )
177 $aUsedTemplates = array
179 'browse_settings_section.html'
184 if ( isset($oObject -> aMembersInfo[$sCurrentKey][
'sex']) ) {
185 $aCurrentArray = &$oObject -> aMembersInfo[$sCurrentKey][
'sex'];
186 } elseif ( $oObject -> aParameters[
'sex'] ) {
193 $oObject -> aParameters[
'age'],
194 $oObject -> aParameters[
'country'],
195 $oObject -> aAdditionalParameters[
'photos_only'],
196 $oObject -> aAdditionalParameters[
'online_only'],
203 if ( $oObject -> aParameters[
'sex'] ) {
204 $aCurrentArray[
'all'] =
_t(
'_All' );
205 $sExtendedCss =
'hidden_block';
208 $iArrayCount = count($aCurrentArray);
210 if ( is_array($aCurrentArray)
and !
empty($aCurrentArray) )
211 foreach( $aCurrentArray AS $sKey => $sValue ) {
214 if ( $sKey !=
'all' )
215 $sValue = ( $oObject -> aParameters[
'sex'] ) ? 0 : $sValue;
228 $sSexSection .= $oObject ->
genBrowseLink(
_t($aPreValues[
'Sex'][$sKey][
'LKey']), $sValue, $oObject ->
genLinkLocation(
'sex', $sKey),
'tux.png');
235 <div class="clear_both"></div>
243 <div class="devider"></div>
248 $sSexSection =
MsgBox(
_t(
'_Empty' ));
251 $aTemplateKeys = array
253 'section_id' =>
'sex_section',
254 'extended_css' => $sExtendedCss,
255 'section_data' => $sSexSection,
258 $sSexSection =
$GLOBALS[
'oSysTemplate'] -> parseHtmlByName( $aUsedTemplates[0], $aTemplateKeys );
271 function _genAgeSection( &$oObject, $sCurrentKey )
280 $aUsedTemplates = array
282 'browse_settings_section.html'
287 if ( isset($oObject -> aMembersInfo[$sCurrentKey][
'age']) ) {
288 $aCurrentArray = &$oObject -> aMembersInfo[$sCurrentKey][
'age'];
289 } elseif ( $oObject -> aParameters[
'age'] ) {
295 $oObject -> aParameters[
'sex'],
297 $oObject -> aParameters[
'country'],
298 $oObject -> aAdditionalParameters[
'photos_only'],
299 $oObject -> aAdditionalParameters[
'online_only'],
305 if ( $oObject -> aParameters[
'age'] ) {
306 $aCurrentArray[
'all'] =
_t(
'_All' );
307 $sExtendedCss =
'hidden_block';
310 $iArrayCount = count($aCurrentArray);
312 if ( is_array($aCurrentArray)
and $iArrayCount ) {
313 foreach( $aCurrentArray AS $sKey => $sValue ) {
317 $sValue = ( $sExtendedCss ) ? 0 : $sValue;
319 if ( $sKey ==
'all' )
327 <div class="clear_both"></div>
335 <div class="devider"></div>
341 $sAgeSection =
MsgBox(
_t(
'_Empty' ));
344 $aTemplateKeys = array
346 'section_id' =>
'age_section',
347 'extended_css' => $sExtendedCss,
348 'section_data' => $sAgeSection,
351 $sAgeSection =
$GLOBALS[
'oSysTemplate'] -> parseHtmlByName( $aUsedTemplates[0], $aTemplateKeys );
364 function _genCountrySection( &$oObject, $sCurrentKey )
369 $sCountrySection =
'';
371 $aCurrentArray = array();
373 $aUsedTemplates = array
375 'browse_settings_section.html'
380 if ( isset($oObject -> aMembersInfo[$sCurrentKey][
'country']) ) {
381 $aCurrentArray = &$oObject -> aMembersInfo[$sCurrentKey][
'country'];
382 } elseif ( $oObject -> aParameters[
'country'] ) {
388 $oObject -> aParameters[
'sex'],
389 $oObject -> aParameters[
'age'],
391 $oObject -> aAdditionalParameters[
'photos_only'],
392 $oObject -> aAdditionalParameters[
'online_only'],
398 if ( $oObject -> aParameters[
'country'] ) {
399 $aCurrentArray[
'all'] =
_t(
'_All' );
400 $sExtendedCss =
'hidden_block';
403 $iArrayCount = count($aCurrentArray);
405 if ( is_array($aCurrentArray)
and !
empty($aCurrentArray) ) {
406 foreach( $aCurrentArray AS $sKey => $sValue ) {
409 if ( $sKey !=
'all' )
410 $sValue = ( $sExtendedCss ) ? 0 : $sValue;
412 if ( $sKey ==
'all' )
415 $sCountryName = strtolower($sKey);
416 $sImagePath =
$site[
'flags'] . $sCountryName .
'.gif';
417 $sCountrySection .= $oObject ->
genBrowseLink( $sKey, $sValue, $oObject ->
genLinkLocation(
'country', $sCountryName), $sImagePath,
false );
423 <div class="clear_both"></div>
431 <div class="devider"></div>
436 if ( !$sCountrySection )
437 $sCountrySection =
MsgBox(
_t(
'_Empty' ));
440 $aTemplateKeys = array
442 'section_id' =>
'country_section',
443 'extended_css' => $sExtendedCss,
444 'section_data' => $sCountrySection,
447 $sCountrySection =
$GLOBALS[
'oSysTemplate'] -> parseHtmlByName( $aUsedTemplates[0], $aTemplateKeys );
450 return $sCountrySection;
461 function _genJsControlBox(
$sCaption, $sBlockID, $bIsHidden =
false )
464 $sToggleCaption =
_t(
'_Show' ) .
' / ' .
_t(
'_Hide' );
467 $sVisibleParam = ( !$bIsHidden ) ?
'closed_toggle_block' :
null;
471 <div class="caption_section">
474 <div class="js_control_section ' . $sVisibleParam .
'" bxchild="' . $sBlockID .
'" title="' . $sToggleCaption .
'">
477 <div class="clear_both"></div>
480 return $sJsControlBlock;
494 <div class="sub_design_box_head">
504 $sSexSection = _genSexSection( $this, $sCurrentKey );
505 if ( $sSexSection ) {
506 $sVisibleParam = ( $this -> aParameters[
'sex'] ) ?
false :
true;
508 $sSexSection = _genSubDesignBox(
509 _genJsControlBox($sSexCaption,
'sex_section', $sVisibleParam) ,
515 $sAgeSection = _genAgeSection( $this, $sCurrentKey );
516 if ( $sAgeSection ) {
517 $sVisibleParam = ( $this -> aParameters[
'age'] ) ?
false :
true;
519 $sAgeSection = _genSubDesignBox(
520 _genJsControlBox($sAgeCaption,
'age_section', $sVisibleParam),
526 $sCountrySection = _genCountrySection( $this, $sCurrentKey );
527 if ( $sCountrySection ) {
528 $sVisibleParam = ( $this -> aParameters[
'country'] ) ?
false :
true;
530 $sCountrySection = _genSubDesignBox(
531 _genJsControlBox($sCountryCaption,
'country_section', $sVisibleParam),
538 <script type="text/javascript">
539 $(".js_control_section").click( function() { oBrowsePage.ShowHideToggle(this) } );
545 <div class="main_settings ch-def-bc-margin">
546 <div class="devider"></div>
549 ' . $sCountrySection .
'
551 ' . $sJsEventInit .
'
567 foreach( $this -> aParameters AS $sKey => $sValue ) {
568 if ( $this -> bPermalinkMode ) {
570 $sLocation .=
'/' . $sTypeValue;
572 $sLocation .= ( $sValue ) ?
'/' . $sValue :
'/all';
575 $sLocation .=
'&' . $sKey .
'=' . $sTypeValue;
577 $sLocation .= ( $sValue ) ?
'&' . $sKey .
'=' . $sValue :
'&' . $sKey .
'=all';
581 $sLocation = (
$this->bPermalinkMode) ? CH_WSB_URL_ROOT .
'browse' . $sLocation :
'browse.php?' . $sLocation;
584 if ( isset($this -> aAdditionalParameters[
'photos_only']) && $this -> aAdditionalParameters[
'photos_only'])
585 $sLocation .=
"&photos_only=on";
587 if ( isset($this -> aAdditionalParameters[
'online_only']) && $this -> aAdditionalParameters[
'online_only'])
588 $sLocation .=
"&online_only=on";
590 if ( isset($this -> aDisplaySettings[
'mode']) && $this -> aDisplaySettings[
'mode'])
591 $sLocation .=
"&mode=" . $this -> aDisplaySettings[
'mode'];
606 $sPhotoCaption =
_t(
'_With photos only' );
607 $sOnlineCaption =
_t(
'_online only' );
608 $sSimpleCaption =
_t(
'_Simple' );
609 $sExtendCaption =
_t(
'_Extended' );
611 $aUsedTemplates = array
613 'browse_searched_block.html'
618 $aWhereParam = array();
619 $aWhereParam[] = ( $this -> aParameters[
'sex'] )
620 ?
'`Profiles`.`Sex` = "' . $this -> aParameters[
'sex'] .
'"'
623 if ( $this -> aParameters[
'age'] ) {
624 $aAgeTemp = explode(
'-', $this -> aParameters[
'age']);
625 $iFrom = ( isset($aAgeTemp[0]) )
629 $iTo = ( isset($aAgeTemp[1]) )
636 $sSign = $iTo ?
'>=' :
'=';
639 ((YEAR(CURDATE())-YEAR(`Profiles`.`DateOfBirth`)) - (RIGHT(CURDATE(),5)<RIGHT(`Profiles`.`DateOfBirth`,5))) {$sSign} {$iFrom}
644 $sSign = $iFrom ?
'<=' :
'=';
647 ((YEAR(CURDATE())-YEAR(`Profiles`.`DateOfBirth`)) - (RIGHT(CURDATE(),5)<RIGHT(`Profiles`.`DateOfBirth`,5))) {$sSign} {$iTo}
652 $aWhereParam[] = ( $this -> aParameters[
'country'] )
653 ?
'`Profiles`.`Country` = "' . $this -> aParameters[
'country'] .
'"'
656 if ( $this -> aAdditionalParameters[
'photos_only'] )
657 $aWhereParam[] =
'`Profiles`.`Avatar` <> 0';
659 if ( $this -> aAdditionalParameters[
'online_only'] )
660 $aWhereParam[] =
"(`Profiles`.`DateLastNav` > SUBDATE(NOW(), INTERVAL " . $this -> iMemberOnlineTime .
" MINUTE)) ";
663 foreach( $aWhereParam AS $sValue )
665 $sWhereParam .=
' AND ' . $sValue;
668 $sQuery =
"SELECT COUNT(*) AS `Cnt` FROM `Profiles` WHERE {$this->_sSqlActive} {$sWhereParam}";
676 $iPerPage = $this -> aDisplaySettings[
'per_page'];
677 $iCurPage = $this -> aDisplaySettings[
'page'];
683 $sqlLimit =
"LIMIT {$sLimitFrom}, {$iPerPage}";
687 $sTemplateName = ($this->aDisplaySettings[
'mode'] ==
'extended') ?
'search_profiles_ext.html' :
'search_profiles_sim.html';
690 $sSortParam =
'`Profiles`.`DateLastNav` DESC';
691 if ( isset($this -> aDisplaySettings[
'sort']) ) {
692 switch($this -> aDisplaySettings[
'sort']) {
694 $sSortParam =
' `Profiles`.`DateReg` DESC';
697 $sSortParam =
' `Profiles`.`Rate` DESC, `Profiles`.`RateCount` DESC';
700 $this -> aDisplaySettings[
'sort'] =
'activity';
702 $sSortParam =
' `Profiles`.`DateLastNav` DESC';
706 $this -> aDisplaySettings[
'sort'] =
'activity';
709 $iOnlineTime = (int)
getParam(
"member_online_time" );
710 $sIsOnlineSQL =
", if(`DateLastNav` > SUBDATE(NOW(), INTERVAL {$iOnlineTime} MINUTE ), 1, 0) AS `is_online`";
715 `Profiles`.* {$sIsOnlineSQL}
726 $rResult =
db_res($sQuery);
730 $aExtendedCss = array(
731 'ext_css_class' => $this->aDisplaySettings[
'mode'] ==
'extended' ?
'search_filled_block' :
''
733 while(
true == ($aRow = $rResult->fetch()) ) {
735 if ( $aRow[
'Couple']) {
737 $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, $aCoupleInfo, (
$iIndex % 2 ? $aExtendedCss : array()), $sTemplateName);
739 $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, array(), (
$iIndex % 2 ? $aExtendedCss : array()), $sTemplateName);
745 if ( $this -> bPermalinkMode ) {
746 preg_match(
"|([^\?\&]*)|", $_SERVER[
'REQUEST_URI'], $aMatches);
747 if ( isset( $aMatches[1] )
and $aMatches[1] )
748 $sRequest = $aMatches[1] .
'?';
751 $aGetParams = array(
'photos_only',
'online_only',
'sort',
'mode');
752 foreach($aGetParams AS $sValue )
753 if ( isset(
$_GET[$sValue]) ) {
754 $sRequest .=
'&' . $sValue .
'=' . rawurlencode(
$_GET[$sValue]);
757 $sRequest = CH_WSB_URL_ROOT .
'browse.php?';
760 $aGetParams = array(
'sex',
'age',
'country',
'photos_only',
'online_only',
'sort',
'mode');
761 foreach($aGetParams AS $sValue )
762 if ( isset(
$_GET[$sValue]) ) {
763 $sRequest .=
'&' . $sValue .
'=' . rawurlencode(
$_GET[$sValue]);
770 $sRequest = $sRequest .
'&page={page}&per_page={per_page}&sort={sorting}';
777 'page_url' => $sRequest,
780 'sorting' => $this -> aDisplaySettings[
'sort'],
785 $sPagination = $oPaginate -> getPaginate();
788 $sPerPageBlock = $oPaginate -> getPages(
$iPerPage );
793 <div class="clear_both"></div>
796 $sRequest = str_replace(
'{page}',
'1', $sRequest);
797 $sRequest = str_replace(
'{per_page}',
$iPerPage, $sRequest);
798 $sRequest = str_replace(
'{sorting}', $this -> aDisplaySettings[
'sort'], $sRequest);
801 $aSortingParam = array(
802 'activity' =>
_t(
'_Latest activity'),
803 'date_reg' =>
_t(
'_FieldCaption_DateReg_View'),
805 if (
getParam(
'votes')) $aSortingParam[
'rate'] =
_t(
'_Rate');
809 $sSortBlock = $oPaginate -> getSorting($aSortingParam);
813 $sPhotosChecked = ($this -> aAdditionalParameters[
'photos_only']) ?
'checked="checked"' :
null;
815 $sOnlineChecked = ($this -> aAdditionalParameters[
'online_only']) ?
'checked="checked"' :
null;
838 $sTopControls =
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'browse_sb_top_controls.html', array(
839 'sort_block' => $sSortBlock,
840 'ch_if:show_with_photos' => array(
841 'condition' => $oMemberInfo ? $oMemberInfo->isAvatarSearchAllowed() :
false,
843 'photo_checked' => $sPhotosChecked,
844 'photo_location' => $sPhotoLocation,
845 'photo_caption' => $sPhotoCaption,
848 'online_checked' => $sOnlineChecked,
849 'online_location' => $sOnlineLocation,
850 'online_caption' => $sOnlineCaption,
851 'per_page_block' => $sPerPageBlock,
856 'top_controls' => $sTopControls,
857 'ch_if:show_sim_css' => array (
858 'condition' => $this->aDisplaySettings[
'mode'] !=
'extended',
861 'ch_if:show_ext_css' => array (
862 'condition' => $this->aDisplaySettings[
'mode'] ==
'extended',
866 'pagination' => $sPagination,
870 $aToggleItems = array (
871 '' =>
_t(
'_Simple' ),
872 'extended' =>
_t(
'_Extended' ),
875 foreach( $aToggleItems AS $sKey => $sValue ) {
876 $aToggleEllements[$sValue] = array (
877 'href' => $sModeLocation .
'&mode=' . $sKey,
879 'active' => ($this -> aDisplaySettings[
'mode'] == $sKey ),
883 return array(
$sOutputHtml, $aToggleEllements, array(),
true);