8 define(
'CH_TAGS_ACTION_HOME',
'home');
9 define(
'CH_TAGS_ACTION_ALL',
'all');
10 define(
'CH_TAGS_ACTION_POPULAR',
'popular');
11 define(
'CH_TAGS_ACTION_CALENDAR',
'calendar');
12 define(
'CH_TAGS_ACTION_SEARCH',
'search');
14 define(
'CH_TAGS_BOX_DISIGN', 1);
15 define(
'CH_TAGS_BOX_INT_MENU', 2);
17 require_once(
'inc/header.inc.php' );
18 require_once( CH_DIRECTORY_PATH_INC .
'design.inc.php' );
24 $bAjaxMode = isset($_SERVER[
'HTTP_X_REQUESTED_WITH'])
and $_SERVER[
'HTTP_X_REQUESTED_WITH'] ==
'XMLHttpRequest' ?
true :
false;
30 $oTags->getTagObjectConfig($aParam);
32 if (
empty($oTags->aTagObjects)) {
39 $aParam[
'type'] = isset(
$_GET[
'tags_mode']) && isset($oTags->aTagObjects[
$_GET[
'tags_mode']]) ?
$_GET[
'tags_mode'] : $oTags->getFirstObject();
43 $sCode .= $oTags->getTagsInternalMenuHtml($aParam, $iBoxId,
$sAction);
49 $sCode =
'<div id="page_block_' . $iBoxId .
'">' .
$sCode .
'<div class="clear_both"></div></div>';
56 ($sDate ?
_t(
'_tags_by_day') . $sDate :
'')
69 $sTopControls =
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'calendar_top_controls.html', array(
70 'month_prev_url' => $this->
getBaseUri () .
"&year={$this->iPrevYear}&month={$this->iPrevMonth}",
71 'month_next_url' => $this->
getBaseUri () .
"&year={$this->iNextYear}&month={$this->iNextMonth}",
72 'month_current' => $this->
getTitle(),
75 $sHtml =
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'calendar.html', array (
76 'top_controls' => $sTopControls,
79 'bottom_controls' => $sTopControls,
81 $sHtml = preg_replace (
'#<ch_repeat:events>.*?</ch_repeat:events>#s',
'', $sHtml);
82 $GLOBALS[
'oSysTemplate']->addCss(
'calendar.css');
90 return $oDb->getAll(
"SELECT *, DAYOFMONTH(`Date`) AS `Day`
92 WHERE `Date` >= TIMESTAMP(?) AND `Date` < TIMESTAMP(?)",
94 "{$this->iYear}-{$this->iMonth}-1",
95 "{$this->iNextYear}-{$this->iNextMonth}-1"
102 return CH_WSB_URL_ROOT .
'tags.php?action=calendar';
107 return CH_WSB_URL_ROOT .
'tags.php?action=calendar';
112 return array(
_t(
'_tags_single'),
_t(
'_tags_plural'));
122 for ($i = 0; $i < 6; $i++) {
124 $aRow = array (
'ch_repeat:cell');
131 if ($aCalendarGrid[$i][$j][
'today']) {
132 $aCell[
'class'] =
'sys_cal_cell sys_cal_today';
133 $aCell[
'day'] = $aCalendarGrid[$i][$j][
'day'];
134 $aCell[
'ch_if:num'] = array (
'condition' => $aCalendarGrid[$i][$j][
'num'],
'content' => array(
135 'num' => $aCalendarGrid[$i][$j][
'num'],
136 'href' => $sBrowseUri .
'&year=' . $this->iYear .
'&month=' . $this->iMonth .
'&day=' . $aCell[
'day'],
137 'entries' => 1 == $aCalendarGrid[$i][$j][
'num'] ? $sEntriesSingle : $sEntriesMul,
140 } elseif (isset($aCalendarGrid[$i][$j][
'day'])) {
141 $aCell[
'class'] =
'sys_cal_cell';
142 $aCell[
'day'] = $aCalendarGrid[$i][$j][
'day'];
143 $aCell[
'ch_if:num'] = array (
'condition' => $aCalendarGrid[$i][$j][
'num'],
'content' => array(
144 'num' => $aCalendarGrid[$i][$j][
'num'],
145 'href' => $sBrowseUri .
'&year=' . $this->iYear .
'&month=' . $this->iMonth .
'&day=' . $aCell[
'day'],
146 'entries' => 1 == $aCalendarGrid[$i][$j][
'num'] ? $sEntriesSingle : $sEntriesMul,
150 $aCell[
'class'] =
'sys_cal_cell_blank';
152 $aCell[
'ch_if:num'] = array (
'condition' =>
false,
'content' => array(
160 $aRow[
'ch_repeat:cell'][] = $aCell;
163 if ($aRow[
'ch_repeat:cell'] && !$isRowEmpty) {
178 $this->sPage =
'tags_home';
179 parent::__construct($this->sPage);
185 'orderby' =>
'recent',
186 'limit' =>
getParam(
'tags_show_limit'),
195 'orderby' =>
'popular',
196 'limit' =>
getParam(
'tags_show_limit')
209 $this->sPage =
'tags_calendar';
210 parent::__construct($this->sPage);
215 $sYear = isset(
$_GET[
'year']) ? (int)
$_GET[
'year'] :
'';
216 $sMonth = isset(
$_GET[
'month']) ? (int)
$_GET[
'month'] :
'';
219 return $oCalendar->display();
224 if (isset(
$_GET[
'year']) && isset(
$_GET[
'month']) && isset(
$_GET[
'day'])) {
226 'pagination' =>
getParam(
'tags_perpage_browse'),
228 'year' => (
int)
$_GET[
'year'],
229 'month' => (
int)
$_GET[
'month'],
230 'day' => (
int)
$_GET[
'day']
248 $this->sPage =
'tags_search';
249 parent::__construct($this->sPage);
252 $this->aSearchForm = array(
253 'form_attrs' => array(
254 'name' =>
'form_search_tags',
261 'submit_name' =>
'submit_form',
269 'caption' =>
_t(
'_tags_caption_keyword'),
273 'params' => array(1, 100),
274 'error' =>
_t (
'_tags_err_keyword'),
282 'name' =>
'submit_form',
283 'value' =>
_t(
'_Submit'),
290 $this->oForm->initChecker();
295 return $GLOBALS[
'oSysTemplate']->parseHtmlByName(
'search_tags_box.html', array(
'form' => $this->oForm->getCode()));
301 'pagination' =>
getParam(
'tags_perpage_browse')
304 $sFilter =
ch_get(
'filter');
305 if ($sFilter !==
false)
307 else if ($this->oForm->isSubmittedAndValid())
308 $aParam[
'filter'] = $this->oForm->getCleanValue(
'Keyword');
310 if (isset($aParam[
'filter']))
321 return $oHomePage->getCode();
327 'pagination' =>
getParam(
'tags_perpage_browse')
336 'orderby' =>
'popular',
337 'limit' =>
getParam(
'tags_show_limit')
347 return $oCalendarPage->getCode();
354 return $oSearchPage->getCode();
385 $_page[
'css_name'] =
'tags.css';
388 $_page[
'header_text'] =
_t(
'_Tags');