13 'name' =>
'ch_groups',
14 'title' =>
'_ch_groups_page_title_browse',
15 'table' =>
'ch_groups_main',
16 'ownFields' => array(
'id',
'title',
'uri',
'created',
'author_id',
'thumb',
'rate',
'fans_count',
'country',
'city',
'desc'),
17 'searchFields' => array(
'title',
'desc',
'tags',
'categories'),
21 'table' =>
'Profiles',
22 'mainField' =>
'author_id',
24 'joinFields' => array(
'NickName'),
27 'restriction' => array(
28 'activeStatus' => array(
'value' =>
'approved',
'field'=>
'status',
'operator'=>
'='),
29 'owner' => array(
'value' =>
'',
'field' =>
'author_id',
'operator' =>
'='),
30 'tag' => array(
'value' =>
'',
'field' =>
'tags',
'operator' =>
'against'),
31 'category' => array(
'value' =>
'',
'field' =>
'Category',
'operator' =>
'=',
'table' =>
'sys_categories'),
32 'category_type' => array(
'value' =>
'',
'field' =>
'Type',
'operator' =>
'=',
'table' =>
'sys_categories'),
33 'public' => array(
'value' =>
'',
'field' =>
'allow_view_group_to',
'operator' =>
'='),
35 'paginate' => array(
'perPage' => 14,
'page' => 1,
'totalNum' => 0,
'totalPages' => 1),
45 'DateTimeUTS' =>
'created',
58 if (
false !==
ch_get(
'ch_groups_filter'))
60 $this->aCurrent[
'restriction'][
'activeStatus'][
'value'] =
'pending';
61 $this->sBrowseUrl =
"administration";
62 $this->aCurrent[
'title'] =
_t(
'_ch_groups_page_title_pending_approval');
63 unset($this->aCurrent[
'rss']);
68 $this->aCurrent[
'restriction'][
'owner'][
'value'] = $oMain->_iProfileId;
69 $this->aCurrent[
'restriction'][
'activeStatus'][
'value'] =
'pending';
70 $this->sBrowseUrl =
"browse/user/" .
getNickName($oMain->_iProfileId);
71 $this->aCurrent[
'title'] =
_t(
'_ch_groups_page_title_pending_approval');
72 unset($this->aCurrent[
'rss']);
77 $this->aCurrent[
'restriction'][
'keyword'] = array(
'value' => $sValue,
'field' =>
'',
'operator' =>
'against');
81 $this->aCurrent[
'join'][
'category'] = array(
83 'table' =>
'sys_categories',
89 $this->aCurrent[
'restriction'][
'category_type'][
'value'] = $this->aCurrent[
'name'];
90 $this->aCurrent[
'restriction'][
'category'][
'value'] = $sValue2;
91 if (is_array($sValue2)) {
92 $this->aCurrent[
'restriction'][
'category'][
'operator'] =
'in';
96 $sValue =
$GLOBALS[
'MySQL']->unescape($sValue);
97 $sValue2 =
$GLOBALS[
'MySQL']->unescape($sValue2);
98 $this->sBrowseUrl =
"search/$sValue/" . (is_array($sValue2) ? implode(
',',$sValue2) : $sValue2);
99 $this->aCurrent[
'title'] =
_t(
'_ch_groups_page_title_search_results') .
' ' . (is_array($sValue2) ? implode(
', ',$sValue2) : $sValue2) .
' ' . $sValue;
100 unset($this->aCurrent[
'rss']);
107 $this->isError =
true;
109 $this->aCurrent[
'restriction'][
'owner'][
'value'] =
$iProfileId;
110 $sValue =
$GLOBALS[
'MySQL']->unescape($sValue);
111 $this->sBrowseUrl =
"browse/user/$sValue";
118 if ($aData[
'Avatar']) {
119 $a = array (
'ID' => $aData[
'author_id'],
'Avatar' => $aData[
'thumb']);
121 if (!$aImage[
'no_image'])
122 $this->aCurrent[
'rss'][
'image'] = $aImage[
'file'];
133 $this->isError =
true;
137 $this->aCurrent[
'join'][
'fans'] = array(
139 'table' =>
'ch_groups_fans',
141 'onField' =>
'id_entry',
142 'joinFields' => array(
'id_profile'),
144 $this->aCurrent[
'restriction'][
'fans'] = array(
146 'field' =>
'id_profile',
148 'table' =>
'ch_groups_fans',
150 $this->aCurrent[
'restriction'][
'confirmed_fans'] = array(
152 'field' =>
'confirmed',
154 'table' =>
'ch_groups_fans',
158 $sValue =
$GLOBALS[
'MySQL']->unescape($sValue);
159 $this->sBrowseUrl =
"browse/joined/$sValue";
166 if ($aData[
'Avatar']) {
167 $a = array (
'ID' => $aData[
'author_id'],
'Avatar' => $aData[
'thumb']);
169 if (!$aImage[
'no_image'])
170 $this->aCurrent[
'rss'][
'image'] = $aImage[
'file'];
176 if (
false !==
ch_get(
'ch_groups_filter'))
178 $this->aCurrent[
'restriction'][
'owner'][
'value'] = 0;
179 $this->sBrowseUrl =
"browse/admin";
180 $this->aCurrent[
'title'] =
_t(
'_ch_groups_page_title_admin_groups');
184 $this->aCurrent[
'join'][
'category'] = array(
186 'table' =>
'sys_categories',
191 $this->aCurrent[
'restriction'][
'category_type'][
'value'] = $this->aCurrent[
'name'];
192 $this->aCurrent[
'restriction'][
'category'][
'value'] = $sValue;
193 $sValue =
$GLOBALS[
'MySQL']->unescape($sValue);
194 $this->sBrowseUrl =
"browse/category/" .
title2uri($sValue);
195 $this->aCurrent[
'title'] =
_t(
'_ch_groups_page_title_browse_by_category', $sValue);
199 $this->aCurrent[
'restriction'][
'tag'][
'value'] = $sValue;
200 $sValue =
$GLOBALS[
'MySQL']->unescape($sValue);
201 $this->sBrowseUrl =
"browse/tag/" .
title2uri($sValue);
202 $this->aCurrent[
'title'] =
_t(
'_ch_groups_page_title_browse_by_tag', $sValue);
206 $this->sBrowseUrl =
'browse/recent';
207 $this->aCurrent[
'title'] =
_t(
'_ch_groups_page_title_browse_recent');
211 $this->sBrowseUrl =
'browse/top';
212 $this->aCurrent[
'sorting'] =
'top';
213 $this->aCurrent[
'title'] =
_t(
'_ch_groups_page_title_browse_top_rated');
217 $this->sBrowseUrl =
'browse/popular';
218 $this->aCurrent[
'sorting'] =
'popular';
219 $this->aCurrent[
'title'] =
_t(
'_ch_groups_page_title_browse_popular');
223 $this->aCurrent[
'restriction'][
'featured'] = array(
'value' => 1,
'field' =>
'featured',
'operator' =>
'=');
224 $this->sBrowseUrl =
'browse/featured';
225 $this->aCurrent[
'title'] =
_t(
'_ch_groups_page_title_browse_featured');
229 $this->aCurrent[
'restriction'][
'calendar-min'] = array(
'value' =>
"UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 00:00:00')",
'field' =>
'created',
'operator' =>
'>=',
'no_quote_value' =>
true);
230 $this->aCurrent[
'restriction'][
'calendar-max'] = array(
'value' =>
"UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 23:59:59')",
'field' =>
'created',
'operator' =>
'<=',
'no_quote_value' =>
true);
231 $this->sEventsBrowseUrl =
"browse/calendar/{$sValue}/{$sValue2}/{$sValue3}";
236 $this->sBrowseUrl =
'browse/';
237 $this->aCurrent[
'title'] =
_t(
'_ch_groups');
238 unset($this->aCurrent[
'rss']);
242 $this->isError =
true;
247 $this->aCurrent[
'paginate'][
'perPage'] = $oMain->_oDb->getParam(
'ch_groups_perpage_browse');
249 if (isset($this->aCurrent[
'rss']))
250 $this->aCurrent[
'rss'][
'link'] = CH_WSB_URL_ROOT . $oMain->_oConfig->getBaseUri() .
$this->sBrowseUrl;
253 $this->aCurrent[
'ownFields'][] =
'desc';
254 $this->aCurrent[
'ownFields'][] =
'created';
255 $this->aCurrent[
'paginate'][
'perPage'] = $oMain->_oDb->getParam(
'ch_groups_max_rss_num');
262 $this->sFilterName =
'ch_groups_filter';
264 parent::__construct();
269 if ($this->aCurrent[
'sorting'] ==
'last') {
271 $aSql[
'order'] =
" ORDER BY `ch_groups_main`.`created` DESC";
273 } elseif ($this->aCurrent[
'sorting'] ==
'top') {
275 $aSql[
'order'] =
" ORDER BY `ch_groups_main`.`rate` DESC, `ch_groups_main`.`rate_count` DESC";
277 } elseif ($this->aCurrent[
'sorting'] ==
'popular') {
279 $aSql[
'order'] =
" ORDER BY `ch_groups_main`.`fans_count` DESC, `ch_groups_main`.`views` DESC";
288 $s = parent::displayResultBlock ();
291 $GLOBALS[
'oSysTemplate']->addDynamicLocation($oMain->_oConfig->getHomePath(), $oMain->_oConfig->getHomeUrl());
292 $GLOBALS[
'oSysTemplate']->addCss(array(
'unit.css',
'twig.css'));
293 return $GLOBALS[
'oSysTemplate']->parseHtmlByName(
'default_padding.html', array(
'content' =>
$s));
306 return CH_WSB_URL_ROOT . $oMain->_oConfig->getBaseUri() .
'view/' . $a[
'uri'];
315 'created' =>
'created',
316 'author_id' =>
'author_id',
317 'NickName' =>
'NickName',
319 'price_range' =>
'price_range',