23 'table' =>
'ch_sites_main',
24 'ownFields' => array(
'id',
'url',
'title',
'entryUri',
'description',
'photo',
'commentsCount',
25 'date',
'ownerid',
'categories',
'tags',
'rate'),
26 'searchFields' => array(
'title',
'description',
'tags',
'categories'),
27 'restriction' => array(
28 'activeStatus' => array(
'value' =>
'approved',
'field'=>
'status',
'operator'=>
'='),
29 'tag' => array(
'value' =>
'',
'field' =>
'tags',
'operator' =>
'like'),
30 'category' => array(
'value' =>
'',
'field' =>
'categories',
'operator' =>
'like'),
31 'featured' => array(
'value' =>
'',
'field' =>
'featured',
'operator' =>
'='),
32 'public' => array(
'value' =>
'',
'field' =>
'allowView',
'operator' =>
'in'),
34 'paginate' => array(
'perPage' => 10,
'page' => 1,
'totalNum' => 2,
'totalPages' => 1),
44 'DateTimeUTS' =>
'date',
45 'Desc' =>
'description',
55 $this->isError =
false;
56 $this->sUnitTemplate =
'unit';
57 $this->sUnitName =
'unit';
58 $this->sThumbSize =
'browse';
65 $this->aCurrent[
'title'] =
_t(
'_ch_sites');
66 $this->aCurrent[
'paginate'][
'perPage'] =
getParam(
'ch_sites_per_page');
70 unset($this->aCurrent[
'rss']);
74 unset($this->aCurrent[
'rss']);
75 $this->aCurrent[
'restriction'][
'activeStatus'][
'value'] =
'pending';
76 $this->sSitesBrowseUrl =
'administration';
80 $this->aCurrent[
'restriction'][
'owner'] = array(
81 'value' => $this->_oMain->iOwnerId,
85 $this->aCurrent[
'restriction'][
'activeStatus'][
'value'] =
'pending';
86 $this->sSitesBrowseUrl =
'browse/my';
87 unset($this->aCurrent[
'rss']);
92 $iProfileId = $this->_oMain->_oDb->getProfileIdByNickName($sValue);
94 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_browse_by_user') . $sValue;
96 $this->aCurrent[
'restriction'][
'owner'] = array(
101 $this->sSitesBrowseUrl =
'browse/user/' . $sValue;
103 $this->isError =
true;
105 $this->isError =
true;
110 $this->aCurrent[
'restriction'][
'category'][
'value'] = $sCategory;
111 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_browse_by_category') .
' ' . $sCategory;
112 $GLOBALS[
'oTopMenu']->setCustomSubHeader(
_t(
'_ch_sites_caption_browse_by_category') .
' ' . $sCategory);
113 $this->sSitesBrowseUrl =
'browse/category/' . $sValue .
'/';
118 $this->aCurrent[
'restriction'][
'tag'][
'value'] = $sTag;
119 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_browse_by_tag') .
' ' . $sTag;
120 $GLOBALS[
'oTopMenu']->setCustomSubHeader(
_t(
'_ch_sites_caption_browse_by_tag') .
' ' . $sTag);
121 $this->sSitesBrowseUrl =
'browse/all';
125 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_browse_all');
126 $this->sSitesBrowseUrl =
'browse/all';
130 $this->aCurrent[
'paginate'][
'perPage'] = 1;
131 $this->aCurrent[
'restriction'][
'public'][
'value'] =
CH_WSB_PG_ALL;
132 $this->sUnitTemplate =
'block_percent';
133 $this->sThumbSize =
'file';
137 $this->aCurrent[
'restriction'][
'featured'][
'value'] = 1;
138 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_browse_featured');
139 $this->sSitesBrowseUrl =
'browse/featured';
140 $this->sSitesBrowseAll =
'browse/featured';
144 $this->aCurrent[
'paginate'][
'perPage'] = 1;
145 $this->aCurrent[
'restriction'][
'featured'][
'value'] = 1;
146 $this->aCurrent[
'restriction'][
'public'][
'value'] =
CH_WSB_PG_ALL;
147 $this->sUnitTemplate =
'block_percent';
148 $this->sThumbSize =
'file';
151 case 'featuredshort':
152 $this->aCurrent[
'restriction'][
'featured'][
'value'] = 1;
153 $this->aCurrent[
'restriction'][
'public'][
'value'] =
CH_WSB_PG_ALL;
154 $this->sUnitTemplate =
'unit_short';
155 $this->sSitesBrowseUrl =
'browse/featuredshort';
156 $this->sSitesBrowseAll =
'browse/featured';
157 $this->aCurrent[
'paginate'][
'perPage'] = 5;
161 $this->aCurrent[
'sorting'] =
'top';
162 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_browse_top_rated');
163 $this->sSitesBrowseUrl =
'browse/top';
167 $this->aCurrent[
'sorting'] =
'popular';
168 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_browse_popular');
169 $this->sSitesBrowseUrl =
'browse/popular';
174 $this->aCurrent[
'restriction'][
'keyword'] = array(
'value' => $sValue,
'field' =>
'',
'operator' =>
'against');
175 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_search_results') .
' ' . $sValue;
176 $this->sSitesBrowseUrl =
'browse/search/' . $sValue;
177 unset($this->aCurrent[
'rss']);
182 $this->aCurrent[
'join'] = array(
185 'table' =>
'Profiles',
186 'mainField' =>
'ownerid',
188 'joinFields' => array(
'Role')
192 $this->aCurrent[
'restriction'] = array(
197 'table' =>
'Profiles'
201 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_browse_admin');
202 $this->sSitesBrowseUrl =
'browse/admin';
207 $this->aCurrent[
'join'] = array(
210 'table' =>
'Profiles',
211 'mainField' =>
'ownerid',
213 'joinFields' => array(
'Role')
217 $this->aCurrent[
'restriction'][
'role'] = array(
221 'table' =>
'Profiles'
223 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_browse_profile');
224 $this->sSitesBrowseUrl =
'browse/profile';
228 $this->aCurrent[
'restriction'][
'calendar-min'] = array(
'value' =>
"UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 00:00:00')",
'field' =>
'date',
'operator' =>
'>=',
'no_quote_value' =>
true);
229 $this->aCurrent[
'restriction'][
'calendar-max'] = array(
'value' =>
"UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 23:59:59')",
'field' =>
'date',
'operator' =>
'<=',
'no_quote_value' =>
true);
230 $this->sSitesBrowseUrl =
"browse/calendar/{$sValue}/{$sValue2}/{$sValue3}";
231 $this->aCurrent[
'title'] =
_t(
'_ch_sites_caption_browse_by_day')
234 $GLOBALS[
'oTopMenu']->setCustomSubHeader($this->aCurrent[
'title']);
242 foreach ($aVotedItems
as $iKey => $aVal)
243 $aList[$iKey] = $aVal[$sPrefix];
245 $this->aCurrent[
'restriction'][
'public'][
'value'] =
CH_WSB_PG_ALL;
246 $this->aCurrent[
'paginate'][
'perPage'] = 1;
247 $this->aCurrent[
'sorting'] =
'rand';
248 $this->aCurrent[
'restriction'][
'id'] = array(
251 'operator' =>
'not in'
256 case 'hon_prev_rate':
257 $this->aCurrent[
'join'][
'rateTrack'] = array(
259 'table' =>
'ch_sites_rating_track',
261 'onField' =>
'sites_id',
262 'joinFields' => array(
'sites_ip',
'sites_date')
264 $this->aCurrent[
'paginate'][
'perPage'] = 1;
265 $this->aCurrent[
'sorting'] =
'sites_date';
267 $this->aCurrent[
'restriction'][
'ip'] = array(
269 'field' =>
'sites_ip',
270 'table' =>
'ch_sites_rating_track',
276 $this->sSitesBrowseUrl =
'index';
277 $this->sSitesBrowseAll =
'browse/all';
278 $this->aCurrent[
'paginate'][
'perPage'] = 3;
282 $this->aCurrent[
'restriction'][
'public'][
'value'] = $aVis;
289 $this->aCurrent[
'restriction'][
'owner'] = array(
291 'field' =>
'ownerid',
294 $this->sSitesBrowseUrl =
'profile/' . $sValue;
295 $this->sSitesBrowseAll =
'browse/user/' . $sValue;
296 $this->aCurrent[
'paginate'][
'perPage'] = 3;
297 $this->aCurrent[
'restriction'][
'public'][
'value'] =
CH_WSB_PG_ALL;
299 $this->isError =
true;
301 $this->isError =
true;
306 $this->sSitesBrowseUrl =
'browse/home';
307 $this->sSitesBrowseAll =
'browse/all';
308 $this->aCurrent[
'paginate'][
'perPage'] = 5;
309 $this->aCurrent[
'restriction'][
'public'][
'value'] =
CH_WSB_PG_ALL;
313 $this->sSitesBrowseUrl =
'browse/';
314 $this->aCurrent[
'title'] =
_t(
'_ch_sites');
315 unset($this->aCurrent[
'rss']);
319 $this->isError =
true;
322 if (!$this->isError) {
323 if (isset($this->aCurrent[
'rss']))
324 $this->aCurrent[
'rss'][
'link'] = CH_WSB_URL_ROOT . $this->_oMain->_oConfig->getBaseUri() .
$this->sSitesBrowseUrl;
327 $this->aCurrent[
'ownFields'][] =
'description';
328 $this->aCurrent[
'ownFields'][] =
'date';
329 $this->aCurrent[
'paginate'][
'perPage'] = $this->_oMain->_oDb->getParam(
'ch_sites_max_rss_num');
333 parent::__construct();
338 $s = parent::displayResultBlock ();
340 $GLOBALS[
'oSysTemplate']->addDynamicLocation($this->_oMain->_oConfig->getHomePath(), $this->_oMain->_oConfig->getHomeUrl());
341 $GLOBALS[
'oSysTemplate']->addCss(array(
'main.css',
'twig.css'));
343 $s =
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'default_padding.html', array(
'content' =>
$s));
348 $s =
'<div id="search_result_block_' . $this->sMode .
'">' .
$s .
'</div>';
356 switch ($this->sUnitName) {
358 return $this->_oMain->_oTemplate->unit($aData, $this->sUnitTemplate, $this->oVotingView, $this->sThumbSize);
362 return $this->_oMain->_oTemplate->blockHon($aData);
370 $oConfig = $this->_oMain->_oConfig;
372 $sUrlStart .= (
false === strpos($sUrlStart,
'?') ?
'?' :
'&');
374 'page_url' => $sUrlStart .
'page={page}&per_page={per_page}',
375 'count' => $this->aCurrent[
'paginate'][
'totalNum'],
376 'per_page' => $this->aCurrent[
'paginate'][
'perPage'],
377 'page' => $this->aCurrent[
'paginate'][
'page'],
378 'on_change_page' =>
'',
379 'on_change_per_page' =>
'',
381 return '<div class="clear_both"></div>'.$oPaginate->getPaginate();
387 $oConfig = $this->_oMain->_oConfig;
389 $sUrlStart .= (
false === strpos($sUrlStart,
'?') ?
'?' :
'&');
390 $sUrlStart .=
'page={page}&per_page={per_page}';
392 'page_url' =>
'javascript:void(0);',
393 'count' => $this->aCurrent[
'paginate'][
'totalNum'],
394 'per_page' => $this->aCurrent[
'paginate'][
'perPage'],
395 'page' => $this->aCurrent[
'paginate'][
'page'],
396 'view_all_url' => CH_WSB_URL_ROOT . $oConfig->getBaseUri() . $this->sSitesBrowseAll,
399 'page_links' =>
false,
400 'on_change_page' =>
"getHtmlData('search_result_block_{$this->sMode}', '$sUrlStart')"
402 return '<div class="clear_both"></div>'.$oPaginate->getPaginate();
413 return CH_WSB_URL_ROOT . $oMain->_oConfig->getBaseUri() .
'view/' . $a[
'entryUri'];
418 $aImage = array (
'ID' => $a[
'author_id'],
'Avatar' => $a[$sField]);
419 $aImage =
ChWsbService::call(
'photos',
'get_image', array($aImage,
'browse'),
'Search');
421 return $aImage[
'no_image'] ?
'' : $aImage[
'file'];
426 if ($this->aCurrent[
'sorting'] ==
'sites_date')
427 return array(
'order' =>
" ORDER BY `sites_date` DESC");