1 | <?php
|
---|
2 |
|
---|
3 | /***************************************************************************
|
---|
4 | * Dolphin Smart Community Builder
|
---|
5 | * -----------------
|
---|
6 | * begin : Mon Mar 23 2006
|
---|
7 | * copyright : (C) 2006 BoonEx Group
|
---|
8 | * website : http://www.boonex.com/
|
---|
9 | * This file is part of Dolphin - Smart Community Builder
|
---|
10 | *
|
---|
11 | * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
|
---|
12 | * http://creativecommons.org/licenses/by/3.0/
|
---|
13 | *
|
---|
14 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
---|
15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
16 | * See the Creative Commons Attribution 3.0 License for more details.
|
---|
17 | * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
|
---|
18 | * see license.txt file; if not, write to marketing@boonex.com
|
---|
19 | ***************************************************************************/
|
---|
20 |
|
---|
21 | require_once( 'inc/header.inc.php' );
|
---|
22 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
|
---|
23 | require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolPageView.php' );
|
---|
24 | require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolPaginate.php');
|
---|
25 | require_once( BX_DIRECTORY_PATH_ROOT . 'templates/tmpl_' . $tmpl . '/scripts/BxTemplProfileView.php' );
|
---|
26 | require_once( BX_DIRECTORY_PATH_ROOT . 'templates/tmpl_' . $tmpl . '/scripts/BxTemplBrowse.php' );
|
---|
27 | require_once( BX_DIRECTORY_PATH_ROOT . 'templates/tmpl_'.$tmpl.'/scripts/BxTemplSearchProfile.php');
|
---|
28 |
|
---|
29 | check_logged();
|
---|
30 |
|
---|
31 | $sPageCaption = _t( '_All members' );
|
---|
32 |
|
---|
33 | $_page['name_index'] = 7;
|
---|
34 | $_page['header'] = $sPageCaption;
|
---|
35 | $_page['header_text'] = $sPageCaption;
|
---|
36 | $_page['css_name'] = 'all_members.css';
|
---|
37 | $_page['js_name'] = 'browse_members.js';
|
---|
38 |
|
---|
39 | class BxDolAllMembersPageView extends BxDolPageView
|
---|
40 | {
|
---|
41 | // consit all necessary data for display members list ;
|
---|
42 | var $aDisplayParameters;
|
---|
43 |
|
---|
44 | // contains the path to the current page ;
|
---|
45 | var $sCurrentPage ;
|
---|
46 |
|
---|
47 | // link on search profile ;
|
---|
48 | var $oSearchProfileTmpl;
|
---|
49 |
|
---|
50 | // need for page builder ;
|
---|
51 | var $sPageName;
|
---|
52 | /**
|
---|
53 | * @description : class constructor ;
|
---|
54 | * @param : $sPageName (string) - set page composer ;
|
---|
55 | * @param : $aDisplayParameters (array);
|
---|
56 | per_page (integer) - number of elements for per page ;
|
---|
57 | page (integer) - current page ;
|
---|
58 | mode (string) - will swith member view mode ;
|
---|
59 | ext_tmpl (string) - path to extended member's template ;
|
---|
60 | sim_tmpl (string) - path to simple member's template ;
|
---|
61 | */
|
---|
62 |
|
---|
63 | function BxDolAllMembersPageView( $sPageName, &$aDisplayParameters )
|
---|
64 | {
|
---|
65 | parent::BxDolPageView($sPageName);
|
---|
66 |
|
---|
67 | $this -> aDisplayParameters = &$aDisplayParameters;
|
---|
68 | $this -> sCurrentPage = $_SERVER['PHP_SELF'];
|
---|
69 |
|
---|
70 | $this -> oSearchProfileTmpl = new BxTemplSearchProfile();
|
---|
71 | $this -> sPageName = $sPageName;
|
---|
72 | }
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * @description : function will draw block with featured members list;
|
---|
76 | * @return : Html presentation data ;
|
---|
77 | */
|
---|
78 |
|
---|
79 | function getBlockCode_FeaturedMembers()
|
---|
80 | {
|
---|
81 | // init some variables ;
|
---|
82 |
|
---|
83 | $sOutputHtml = null;
|
---|
84 | $iIndex = null;
|
---|
85 |
|
---|
86 | $sQuery = 'SELECT COUNT(*) FROM `Profiles` WHERE `Featured` = 1';
|
---|
87 | $iTotalNum = db_value($sQuery);
|
---|
88 |
|
---|
89 | if( !$iTotalNum )
|
---|
90 | $sOutputHtml = MsgBox( _t('_Empty') );
|
---|
91 |
|
---|
92 | $iPerPage = $this -> aDisplayParameters['per_page'];
|
---|
93 | $iCurPage = $this -> aDisplayParameters['page'];
|
---|
94 |
|
---|
95 | $sLimitFrom = ( $iCurPage - 1 ) * $iPerPage;
|
---|
96 | $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
|
---|
97 |
|
---|
98 | // switch member's template ;
|
---|
99 |
|
---|
100 | $sTemplateName = ($this->aDisplayParameters['mode'] == 'extended') ? 'search_profiles_ext.html' : 'search_profiles_sim.html';
|
---|
101 |
|
---|
102 | $sQuery = "SELECT * FROM `Profiles` WHERE `Featured` = 1 {$sqlLimit}";
|
---|
103 | $rResult = db_res($sQuery);
|
---|
104 |
|
---|
105 | // need for block devider ;
|
---|
106 |
|
---|
107 | $aExtendedCss = array( 'ext_css_class' => 'search_filled_block');
|
---|
108 |
|
---|
109 | while( $aRow = mysql_fetch_assoc($rResult) )
|
---|
110 | {
|
---|
111 | if ( $aRow['Couple'])
|
---|
112 | {
|
---|
113 | $aCoupleInfo = getProfileInfo( $Row['Couple'] );
|
---|
114 | if ( !($iIndex % 2) )
|
---|
115 | {
|
---|
116 | $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, $aCoupleInfo, null, $sTemplateName);
|
---|
117 | }
|
---|
118 | else
|
---|
119 | {
|
---|
120 | // generate filled block ;
|
---|
121 | $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, $aCoupleInfo, $aExtendedCss, $sTemplateName);
|
---|
122 | }
|
---|
123 | }
|
---|
124 | else
|
---|
125 | {
|
---|
126 | if ( !($iIndex % 2) )
|
---|
127 | {
|
---|
128 | $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, '', null, $sTemplateName);
|
---|
129 | }
|
---|
130 | else
|
---|
131 | {
|
---|
132 | // generate filled block ;
|
---|
133 | $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, null, $aExtendedCss, $sTemplateName);
|
---|
134 | }
|
---|
135 | }
|
---|
136 |
|
---|
137 | $iIndex++;
|
---|
138 | }
|
---|
139 |
|
---|
140 | $sOutputHtml .= '<div class="clear_both"></div>';
|
---|
141 |
|
---|
142 | // work with link pagination ;
|
---|
143 |
|
---|
144 | $sRequest = $_SERVER['PHP_SELF'] . '?';
|
---|
145 | $aGetParams = array('mode');
|
---|
146 | if ( is_array($aGetParams) and !empty($aGetParams) )
|
---|
147 | foreach($aGetParams AS $sValue )
|
---|
148 | if ( isset($_GET[$sValue]) )
|
---|
149 | {
|
---|
150 | $sRequest .= '&' . $sValue . '=' . $_GET[$sValue];
|
---|
151 | }
|
---|
152 |
|
---|
153 | // gen pagination block ;
|
---|
154 | $sRequest = $sRequest . '&featured_members_page={page}&per_page={per_page}';
|
---|
155 | $oPaginate = new BxDolPaginate
|
---|
156 | (
|
---|
157 | array
|
---|
158 | (
|
---|
159 | 'page_url' => $sRequest,
|
---|
160 | 'count' => $iTotalNum,
|
---|
161 | 'per_page' => $iPerPage,
|
---|
162 | 'page' => $iCurPage,
|
---|
163 | 'per_page_changer' => false,
|
---|
164 | 'page_reloader' => true,
|
---|
165 | 'on_change_page' => null,
|
---|
166 | 'on_change_per_page' => null,
|
---|
167 | )
|
---|
168 | );
|
---|
169 |
|
---|
170 | $sPagination = $oPaginate -> getPaginate();
|
---|
171 |
|
---|
172 | // return builded block;
|
---|
173 | return DesignBoxContent( _t( '_featured members' ) . $this -> genToggleBlock(), $sOutputHtml . $sPagination, 1 );
|
---|
174 | }
|
---|
175 |
|
---|
176 | /**
|
---|
177 | * @description : function will generate all members list ;
|
---|
178 | */
|
---|
179 |
|
---|
180 | function getBlockCode_AllMembers()
|
---|
181 | {
|
---|
182 | // init some variables ;
|
---|
183 |
|
---|
184 | $sOutputHtml = null;
|
---|
185 | $iIndex = null;
|
---|
186 |
|
---|
187 | $sQuery = 'SELECT COUNT(*) FROM `Profiles`';
|
---|
188 | $iTotalNum = db_value($sQuery);
|
---|
189 |
|
---|
190 | if( !$iTotalNum )
|
---|
191 | return MsgBox( _t('_Empty') );
|
---|
192 |
|
---|
193 | $iPerPage = $this -> aDisplayParameters['per_page'];
|
---|
194 | $iCurPage = $this -> aDisplayParameters['page2'];
|
---|
195 |
|
---|
196 | $sLimitFrom = ( $iCurPage - 1 ) * $iPerPage;
|
---|
197 | $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
|
---|
198 |
|
---|
199 | // select the members template
|
---|
200 |
|
---|
201 | if ( $this -> aDisplayParameters['mode'] == 'extended' ) {
|
---|
202 | $sTemplateName = 'search_profiles_ext.html';
|
---|
203 | }
|
---|
204 |
|
---|
205 | $sQuery = "SELECT * FROM `Profiles` {$sqlLimit}";
|
---|
206 | $rResult = db_res($sQuery);
|
---|
207 |
|
---|
208 | // need for the block devider ;
|
---|
209 |
|
---|
210 | $aExtendedCss = array( 'ext_css_class' => 'search_filled_block');
|
---|
211 |
|
---|
212 | while( $aRow = mysql_fetch_assoc($rResult) )
|
---|
213 | {
|
---|
214 | if ( $aRow['Couple'])
|
---|
215 | {
|
---|
216 | $aCoupleInfo = getProfileInfo( $Row['Couple'] );
|
---|
217 | if ( !($iIndex % 2) )
|
---|
218 | {
|
---|
219 | $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, $aCoupleInfo, null, $sTemplateName);
|
---|
220 | }
|
---|
221 | else
|
---|
222 | {
|
---|
223 | // generate filled block ;
|
---|
224 | $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, $aCoupleInfo, $aExtendedCss, $sTemplateName);
|
---|
225 | }
|
---|
226 | }
|
---|
227 | else
|
---|
228 | {
|
---|
229 | if ( !($iIndex % 2) )
|
---|
230 | {
|
---|
231 | $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, '', null, $sTemplateName);
|
---|
232 | }
|
---|
233 | else
|
---|
234 | {
|
---|
235 | // generate filled block ;
|
---|
236 | $sOutputHtml .= $this -> oSearchProfileTmpl -> PrintSearhResult($aRow, null, $aExtendedCss, $sTemplateName);
|
---|
237 | }
|
---|
238 | }
|
---|
239 |
|
---|
240 | $iIndex++;
|
---|
241 | }
|
---|
242 |
|
---|
243 | $sOutputHtml .= '<div class="clear_both"></div>';
|
---|
244 |
|
---|
245 | // work with link pagination ;
|
---|
246 |
|
---|
247 | $sRequest = $_SERVER['PHP_SELF'] . '?';
|
---|
248 | $aGetParams = array('mode');
|
---|
249 | if ( is_array($aGetParams) and !empty($aGetParams) )
|
---|
250 | foreach($aGetParams AS $sValue )
|
---|
251 | if ( isset($_GET[$sValue]) )
|
---|
252 | {
|
---|
253 | $sRequest .= '&' . $sValue . '=' . $_GET[$sValue];
|
---|
254 | }
|
---|
255 |
|
---|
256 | // gen pagination block ;
|
---|
257 | $sRequest = $sRequest . '&all_members_page={page}&per_page={per_page}';
|
---|
258 | $oPaginate = new BxDolPaginate
|
---|
259 | (
|
---|
260 | array
|
---|
261 | (
|
---|
262 | 'page_url' => $sRequest,
|
---|
263 | 'count' => $iTotalNum,
|
---|
264 | 'per_page' => $iPerPage,
|
---|
265 | 'page' => $iCurPage,
|
---|
266 | 'per_page_changer' => false,
|
---|
267 | 'page_reloader' => true,
|
---|
268 | 'on_change_page' => null,
|
---|
269 | 'on_change_per_page' => null,
|
---|
270 | )
|
---|
271 | );
|
---|
272 |
|
---|
273 | $sPagination = $oPaginate -> getPaginate();
|
---|
274 |
|
---|
275 | // return builded block;
|
---|
276 | return DesignBoxContent( _t( '_All Members' ) . $this -> genToggleBlock(), $sOutputHtml . $sPagination, 1 );
|
---|
277 | }
|
---|
278 |
|
---|
279 | /**
|
---|
280 | * @description : function will draw the browse settings block ;
|
---|
281 | * @return : Html presentation data ;
|
---|
282 | */
|
---|
283 |
|
---|
284 | function getBlockCode_BrowseBlock()
|
---|
285 | {
|
---|
286 | $aFilteredSettings = array(
|
---|
287 | 'sex' => null,
|
---|
288 | 'age' => null,
|
---|
289 | 'country' => null,
|
---|
290 | 'photos_only' => null,
|
---|
291 | 'online_only' => null,
|
---|
292 | 'mode' => null,
|
---|
293 | );
|
---|
294 |
|
---|
295 | $oBrowse = new BxTemplBrowse( $aFilteredSettings, $this -> aDisplayParameters, $this -> sPageName );
|
---|
296 | $sSettingsBlock = $oBrowse -> getBlockCode_SettingsBlock();
|
---|
297 |
|
---|
298 | return $sSettingsBlock ;
|
---|
299 | }
|
---|
300 |
|
---|
301 | /**
|
---|
302 | * @description : function will draw the 'quick search block' ;
|
---|
303 | * @return : Html presentation data ;
|
---|
304 | */
|
---|
305 |
|
---|
306 | function getBlockCode_QuickSearch()
|
---|
307 | {
|
---|
308 | $oPF = new BxDolProfileFields(10);
|
---|
309 | return $oPF->getFormCode();
|
---|
310 | }
|
---|
311 |
|
---|
312 | /**
|
---|
313 | * @description : function will generate mode toggle block ;
|
---|
314 | * @return Html presentation data ;
|
---|
315 | */
|
---|
316 |
|
---|
317 | function genToggleBlock()
|
---|
318 | {
|
---|
319 | // lang keys
|
---|
320 |
|
---|
321 | $sSimpleCaption = _t( '_Simple' );
|
---|
322 | $sExtendCaption = _t( '_Extended' );
|
---|
323 |
|
---|
324 | $sParamsToggle = '<div class="dbTopMenu">';
|
---|
325 | if ( $this -> aDisplayParameters['mode'] == 'extended' )
|
---|
326 | {
|
---|
327 | $sParamsToggle .=
|
---|
328 | '
|
---|
329 | <div class="notActive">
|
---|
330 | <span>
|
---|
331 | <a href="' . $this -> sCurrentPage . '">' . $sSimpleCaption . '</a>
|
---|
332 | </span>
|
---|
333 | </div>
|
---|
334 | <div class="active">
|
---|
335 | <span>
|
---|
336 | ' . $sExtendCaption . '
|
---|
337 | </span>
|
---|
338 | </div>
|
---|
339 | <div class="clear_both"></div>
|
---|
340 | ';
|
---|
341 | }
|
---|
342 | else
|
---|
343 | {
|
---|
344 | $sParamsToggle .=
|
---|
345 | '
|
---|
346 | <div class="active">
|
---|
347 | <span>
|
---|
348 | ' . $sSimpleCaption . '
|
---|
349 | </span>
|
---|
350 | </div>
|
---|
351 | <div class="notActive">
|
---|
352 | <span>
|
---|
353 | <a href="' . $this -> sCurrentPage . '?mode=extended">' . $sExtendCaption . '</a>
|
---|
354 | </span>
|
---|
355 | </div>
|
---|
356 | <div class="clear_both"></div>
|
---|
357 | ';
|
---|
358 | }
|
---|
359 | $sParamsToggle .= '</div>';
|
---|
360 |
|
---|
361 | return $sParamsToggle;
|
---|
362 | }
|
---|
363 |
|
---|
364 | }
|
---|
365 |
|
---|
366 | // init some needed varibales ;
|
---|
367 |
|
---|
368 | if ( isset($_GET['per_page']) )
|
---|
369 | {
|
---|
370 | $iPerPage = (int) $_GET['per_page'];
|
---|
371 | }
|
---|
372 | else
|
---|
373 | {
|
---|
374 | $iPerPage = ( isset($_GET['mode']) and $_GET['mode'] == 'extended' )
|
---|
375 | ? $iPerPage = 5
|
---|
376 | : $iPerPage = 32;
|
---|
377 | }
|
---|
378 |
|
---|
379 | if ( $iPerPage <= 0 )
|
---|
380 | $iPerPage = 32;
|
---|
381 |
|
---|
382 | if ( $iPerPage > 100 )
|
---|
383 | $iPerPage = 100;
|
---|
384 |
|
---|
385 | $iPage = ( isset($_GET['featured_members_page']) )
|
---|
386 | ? (int) $_GET['featured_members_page']
|
---|
387 | : 1;
|
---|
388 |
|
---|
389 | if ( $iPage <= 0 )
|
---|
390 | $iPage = 1;
|
---|
391 |
|
---|
392 | $iPage2 = ( isset($_GET['all_members_page']) )
|
---|
393 | ? (int) $_GET['all_members_page']
|
---|
394 | : 1;
|
---|
395 |
|
---|
396 | if ( $iPage2 <= 0 )
|
---|
397 | $iPage2 = 1;
|
---|
398 |
|
---|
399 | $aDisplayParameters = array
|
---|
400 | (
|
---|
401 | 'per_page' => $iPerPage,
|
---|
402 | 'page' => $iPage,
|
---|
403 | 'page2' => $iPage2,
|
---|
404 | 'mode' => isset($_GET['mode']) ? $_GET['mode'] : null,
|
---|
405 | 'ext_tmpl' => BX_DIRECTORY_PATH_ROOT . "templates/tmpl_{$tmpl}/search_profiles_ext.html",
|
---|
406 | 'sim_tmpl' => BX_DIRECTORY_PATH_ROOT . "templates/tmpl_{$tmpl}/search_profiles_sim.html",
|
---|
407 | );
|
---|
408 |
|
---|
409 | // generate page
|
---|
410 |
|
---|
411 | $_ni = $_page['name_index'];
|
---|
412 |
|
---|
413 | $oProfileInfo = &new BxDolAllMembersPageView( 'all_members', $aDisplayParameters );
|
---|
414 | $sOutputHtml = $oProfileInfo->getCode();
|
---|
415 |
|
---|
416 | $_page_cont[$_ni]['page_main_code'] = $sOutputHtml;
|
---|
417 |
|
---|
418 | PageCode();
|
---|
419 |
|
---|
420 | ?> |
---|