8 define(
'CH_CATEG_ACTION_ALL',
'all');
9 define(
'CH_CATEG_ACTION_COMMON',
'common');
10 define(
'CH_CATEG_ACTION_USERS',
'users');
11 define(
'CH_CATEG_ACTION_CALENDAR',
'calendar');
12 define(
'CH_CATEG_ACTION_SEARCH',
'search');
14 require_once(
'inc/header.inc.php' );
15 require_once( CH_DIRECTORY_PATH_INC .
'design.inc.php' );
21 $bAjaxMode = isset($_SERVER[
'HTTP_X_REQUESTED_WITH'])
and $_SERVER[
'HTTP_X_REQUESTED_WITH'] ==
'XMLHttpRequest' ?
true :
false;
27 $oCateg->getTagObjectConfig($aParam);
29 if (
empty($oCateg->aTagObjects)) {
36 $aParam[
'type'] = isset(
$_GET[
'tags_mode']) && isset($oCateg->aTagObjects[
$_GET[
'tags_mode']]) ?
$_GET[
'tags_mode'] : $oCateg->getFirstObject();
41 $aCaptionMenu = $oCateg->getCategTopMenuHtml($aParam, $iBoxId,
$sAction);
43 $sCode =
'<div id="page_block_' . $iBoxId .
'">' .
$sCode .
'<div class="clear_both"></div></div>';
48 $oCateg->getCategTopMenu($aParam,
$sAction),
50 ($sDate ?
_t(
'_categ_by_day') . $sDate :
'')
63 $sTopControls =
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'calendar_top_controls.html', array(
64 'month_prev_url' => $this->
getBaseUri () .
"&year={$this->iPrevYear}&month={$this->iPrevMonth}",
65 'month_next_url' => $this->
getBaseUri () .
"&year={$this->iNextYear}&month={$this->iNextMonth}",
66 'month_current' => $this->
getTitle(),
69 $sHtml =
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'calendar.html', array (
70 'top_controls' => $sTopControls,
73 'bottom_controls' => $sTopControls,
75 $sHtml = preg_replace (
'#<ch_repeat:events>.*?</ch_repeat:events>#s',
'', $sHtml);
76 $GLOBALS[
'oSysTemplate']->addCss(
'calendar.css');
84 return $oDb->getAll(
"SELECT *, DAYOFMONTH(`Date`) AS `Day`
86 WHERE `Date` >= TIMESTAMP(?)
87 AND `Date` < TIMESTAMP(?)
88 AND `Owner` <> 0 AND `Status` = 'active'",
90 "{$this->iYear}-{$this->iMonth}-1",
91 "{$this->iNextYear}-{$this->iNextMonth}-1",
98 return CH_WSB_URL_ROOT .
'categories.php?action=calendar';
103 return CH_WSB_URL_ROOT .
'categories.php?action=calendar';
108 return array(
_t(
'_categ_single'),
_t(
'_categ_plural'));
118 for ($i = 0; $i < 6; $i++) {
120 $aRow = array (
'ch_repeat:cell');
127 if ($aCalendarGrid[$i][$j][
'today']) {
128 $aCell[
'class'] =
'sys_cal_cell sys_cal_today';
129 $aCell[
'day'] = $aCalendarGrid[$i][$j][
'day'];
130 $aCell[
'ch_if:num'] = array (
'condition' => $aCalendarGrid[$i][$j][
'num'],
'content' => array(
131 'num' => $aCalendarGrid[$i][$j][
'num'],
132 'href' => $sBrowseUri .
'&year=' . $this->iYear .
'&month=' . $this->iMonth .
'&day=' . $aCell[
'day'],
133 'entries' => 1 == $aCalendarGrid[$i][$j][
'num'] ? $sEntriesSingle : $sEntriesMul,
136 } elseif (isset($aCalendarGrid[$i][$j][
'day'])) {
137 $aCell[
'class'] =
'sys_cal_cell';
138 $aCell[
'day'] = $aCalendarGrid[$i][$j][
'day'];
139 $aCell[
'ch_if:num'] = array (
'condition' => $aCalendarGrid[$i][$j][
'num'],
'content' => array(
140 'num' => $aCalendarGrid[$i][$j][
'num'],
141 'href' => $sBrowseUri .
'&year=' . $this->iYear .
'&month=' . $this->iMonth .
'&day=' . $aCell[
'day'],
142 'entries' => 1 == $aCalendarGrid[$i][$j][
'num'] ? $sEntriesSingle : $sEntriesMul,
146 $aCell[
'class'] =
'sys_cal_cell_blank';
148 $aCell[
'ch_if:num'] = array (
'condition' =>
false,
'content' => array(
156 $aRow[
'ch_repeat:cell'][] = $aCell;
159 if ($aRow[
'ch_repeat:cell'] && !$isRowEmpty) {
174 $this->sPage =
'categ_calendar';
175 parent::__construct($this->sPage);
180 $sYear = isset(
$_GET[
'year']) ? (int)
$_GET[
'year'] :
'';
181 $sMonth = isset(
$_GET[
'month']) ? (int)
$_GET[
'month'] :
'';
184 return $oCalendar->display();
189 if (isset(
$_GET[
'year']) && isset(
$_GET[
'month']) && isset(
$_GET[
'day'])) {
191 'pagination' =>
getParam(
'categ_perpage_browse'),
193 'year' => (
int)
$_GET[
'year'],
194 'month' => (
int)
$_GET[
'month'],
195 'day' => (
int)
$_GET[
'day']
213 $this->sPage =
'categ_search';
214 parent::__construct($this->sPage);
217 $this->aSearchForm = array(
218 'form_attrs' => array(
219 'name' =>
'form_search_categories',
226 'submit_name' =>
'submit_form',
234 'caption' =>
_t(
'_categ_caption_keyword'),
238 'params' => array(1, 100),
239 'error' =>
_t (
'_categ_err_keyword'),
247 'name' =>
'submit_form',
248 'value' =>
_t(
'_Submit'),
255 $this->oForm->initChecker();
260 return $GLOBALS[
'oSysTemplate']->parseHtmlByName(
'search_tags_box.html', array(
'form' => $this->oForm->getCode()));
266 'pagination' =>
getParam(
'categ_perpage_browse')
268 $sFilter =
ch_get(
'filter');
269 if ($sFilter !==
false)
271 else if ($this->oForm->isSubmittedAndValid())
272 $aParam[
'filter'] = $this->oForm->getCleanValue(
'Keyword');
274 if (isset($aParam[
'filter']))
284 'pagination' =>
getParam(
'categ_perpage_browse')
293 'pagination' =>
getParam(
'categ_perpage_browse'),
303 'pagination' =>
getParam(
'categ_perpage_browse'),
314 return $oCalendarPage->getCode();
321 return $oSearchPage->getCode();
352 $_page[
'css_name'] =
'tags.css';
354 $_page[
'header'] =
_t(
'_Categories');
355 $_page[
'header_text'] =
_t(
'_Categories');