/** * Performs the box view * * @return null */ function showThreeBoxes() { global $_ARRAYLANG; $objEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager($this->startDate, $this->endDate, $this->categoryId, $this->searchTerm, true, $this->needAuth, true, 0, 'n', $this->sortDirection, true, $this->author); $objEventManager->getEventList(); $this->_objTpl->setTemplate($this->pageContent); if ($_REQUEST['cmd'] == 'boxes') { $objEventManager->calendarBoxUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', 'boxes')->toString() . "?act=list"; $objEventManager->calendarBoxMonthNavUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', 'boxes')->toString(); } else { $objEventManager->calendarBoxUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', '')->toString() . "?act=list"; $objEventManager->calendarBoxMonthNavUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', '')->toString(); } if (empty($_GET['catid'])) { $catid = 0; } else { $catid = $_GET['catid']; } if (isset($_GET['yearID']) && isset($_GET['monthID']) && isset($_GET['dayID'])) { $day = $_GET['dayID']; $month = $_GET['monthID']; $year = $_GET['yearID']; } elseif (isset($_GET['yearID']) && isset($_GET['monthID']) && !isset($_GET['dayID'])) { $day = 0; $month = $_GET['monthID']; $year = $_GET['yearID']; } elseif (isset($_GET['yearID']) && !isset($_GET['monthID']) && !isset($_GET['dayID'])) { $day = 0; $month = 0; $year = $_GET['yearID']; } else { $day = date("d"); $month = date("m"); $year = date("Y"); } $calendarbox = $objEventManager->getBoxes($this->boxCount, $year, $month, $day, $catid); $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true); $objCategoryManager->getCategoryList(); $this->_objTpl->setVariable(array("TXT_{$this->moduleLangVar}_ALL_CAT" => $_ARRAYLANG['TXT_CALENDAR_ALL_CAT'], "{$this->moduleLangVar}_BOX" => $calendarbox, "{$this->moduleLangVar}_JAVA_SCRIPT" => $objEventManager->getCalendarBoxJS(), "{$this->moduleLangVar}_CATEGORIES" => $objCategoryManager->getCategoryDropdown($catid, 1))); }
/** * Return's settings element html by given properties * * @param integer $id Field id * @param string $name Html input name of the field * @param string $title Name/Title of the field * @param string $value Value of the field * @param string $info Info about the field * @param integer $type Type of the settings field * @param string $options options array * @param string $special integer value of special field * * @return string Html of the setting field */ function _getSettingProperties($id, $name, $title, $value, $info, $type, $options, $special) { global $_ARRAYLANG, $_CORELANG; $arrSetting = array(); switch (intval($type)) { case 1: //input text $output = '<input type="text" style="width: 250px;" name="settings[' . $name . ']" value="' . $value . '" />'; break; case 2: //textarea $output = '<textarea style="width: 250px; height: 60px;" name="settings[' . $name . ']">' . $value . '"</textarea>'; break; case 3: //radio switch ($name) { case 'placeData': case 'placeDataHost': $addBreak = true; break; default: $addBreak = false; break; } $arrOptions = array(); if (!empty($options)) { $arrOptions = explode(",", $options); $first = true; foreach ($arrOptions as $key => $label) { $checked = $key + 1 == $value ? 'checked="checked"' : ''; $output .= !$first && $addBreak ? "<br />" : ''; $output .= '<label><input type="radio" ' . $checked . ' value="' . ($key + 1) . '" name="settings[' . $name . ']" /> ' . $_ARRAYLANG[$label] . '</label>'; $first = false; } } break; case 4: //checkbox $arrOptions = array(); if (!empty($options)) { $arrOptions = explode(",", $options); foreach ($arrOptions as $key => $label) { $checked = $key == $value ? 'checked="checked"' : ''; $output .= '<label><input type="checkbox" ' . $checked . ' value="' . $key . '" name="settings[' . $name . ']" /> ' . $_ARRAYLANG[$label] . '</label>'; } } else { $checked = $value == '1' ? 'checked="checked"' : ''; $value = '<input type="checkbox" ' . $checked . ' value="1" name="settings[' . $name . ']" />'; } break; case 5: //dropdown if (!empty($options)) { $options = explode(",", $options); $output = '<select style="width: 252px;" name="settings[' . $name . ']" >'; foreach ($options as $key => $title) { $checked = $key == $value ? 'selected="selected"' : ''; $output .= '<option ' . $checked . ' value="' . $key . '" />' . $_ARRAYLANG[$title] . '</option>'; } $output .= '</select>'; } if (!empty($special)) { switch ($special) { case 'getCategoryDorpdown': $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true); $objCategoryManager->getCategoryList(); $output = '<select style="width: 252px;" name="settings[' . $name . ']" >'; $output .= $objCategoryManager->getCategoryDropdown(intval($value), 1); $output .= '</select>'; break; case 'getPlaceDataDorpdown': $objMediadirForms = new \Cx\Modules\MediaDir\Controller\MediaDirectoryForm(null, 'MediaDir'); $objMediadirForms->getForms(); $objMediadirForms->listForms($objTpl, 4); $output = $_ARRAYLANG['TXT_CALENDAR_SELECT_FORM_MEDIADIR'] . ": <br />"; $output .= '<select style="width: 252px;" name="settings[' . $name . ']" >'; $output .= $objMediadirForms->listForms($objTpl, 4, intval($value)); $output .= '</select>'; break; } } break; case 6: //checkbox multi-select $arrOptions = array(); if (!empty($options)) { $arrOptions = explode(",", $options); $arrValue = explode(',', $value); foreach ($arrOptions as $key => $label) { $checked = in_array($key, $arrValue) ? 'checked="checked"' : ''; $output .= '<label><input type="checkbox" ' . $checked . ' value="' . $key . '" name="settings[' . $name . '][]" /> ' . $_ARRAYLANG[$label] . '</label>'; } } else { $checked = $value == '1' ? 'checked="checked"' : ''; $value = '<input type="checkbox" ' . $checked . ' value="1" name="settings[' . $name . '][]" />'; } break; case 7: if ($special == 'listPreview') { $output = "<div id='listPreview'></div>"; } elseif ($special == 'detailPreview') { $output = "<div id='detailPreview'></div>"; } break; } if (!empty($info)) { $infobox = ' <span class="icon-info tooltip-trigger"></span><span class="tooltip-message">' . $_ARRAYLANG[$info] . '</span>'; } else { $infobox = ''; } $arrSetting['output'] = $output; $arrSetting['infobox'] = $infobox; return $arrSetting; }
/** * Category overview * * @return null */ function showCategories() { global $objDatabase, $_ARRAYLANG, $_CORELANG; if (isset($_GET['tpl'])) { switch ($_GET['tpl']) { case 'modify_category': $this->modifyCategory(intval($_GET['id'])); break; } return; } if (isset($_POST['submitModifyCategory'])) { $objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory(intval($_POST['id'])); if ($objCategory->save($_POST)) { $this->okMessage = intval($_POST['id']) == 0 ? $_ARRAYLANG['TXT_CALENDAR_CATEGORY_SUCCESSFULLY_ADDED'] : $_ARRAYLANG['TXT_CALENDAR_CATEGORY_SUCCESSFULLY_EDITED']; } else { $this->errMessage = intval($_POST['id']) == 0 ? $_ARRAYLANG['TXT_CALENDAR_CATEGORY_CORRUPT_ADDED'] : $_ARRAYLANG['TXT_CALENDAR_CATEGORY_CORRUPT_EDITED']; } } if (isset($_GET['delete'])) { $objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory(intval($_GET['delete'])); if ($objCategory->delete()) { $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_CATEGORY_SUCCESSFULLY_DELETED']; } else { $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_CATEGORY_CORRUPT_DELETED']; } } if (isset($_GET['multi'])) { $status = true; $messageVar = 'EDITED'; foreach ($_POST['selectedCategoryId'] as $key => $catId) { $objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory(intval($catId)); switch ($_GET['multi']) { case 'delete': $status = $objCategory->delete() ? true : false; $messageVar = 'DELETED'; break; case 'activate': $objCategory->status = 0; $status = $objCategory->switchStatus() ? true : false; $messageVar = 'EDITED'; break; case 'deactivate': $objCategory->status = 1; $status = $objCategory->switchStatus() ? true : false; $messageVar = 'EDITED'; break; } } if ($status) { $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_CATEGORY_SUCCESSFULLY_' . $messageVar]; } else { $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_CATEGORY_CORRUPT_' . $messageVar]; } } if (isset($_GET['switch_status'])) { $objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory(intval($_GET['switch_status'])); if ($objCategory->switchStatus()) { $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_CATEGORY_SUCCESSFULLY_EDITED']; } else { $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_CATEGORY_CORRUPT_EDITED']; } } if (isset($_POST['submitCategoryList'])) { $status = true; foreach ($_POST['categoryOrder'] as $catId => $order) { $objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory(intval($catId)); if (!$objCategory->saveOrder(intval($order))) { $status = false; } } if ($status) { $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_CATEGORY_SUCCESSFULLY_EDITED']; } else { $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_CATEGORY_CORRUPT_EDITED']; } } $this->_objTpl->loadTemplateFile('module_calendar_categories.html'); $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_CATEGORIES']; $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_CATEGORIES' => $this->_pageTitle, 'TXT_' . $this->moduleLangVar . '_STATUS' => $_ARRAYLANG['TXT_CALENDAR_STATUS'], 'TXT_' . $this->moduleLangVar . '_SORT' => $_ARRAYLANG['TXT_CALENDAR_SORTING'], 'TXT_' . $this->moduleLangVar . '_TITLE' => $_ARRAYLANG['TXT_CALENDAR_TITLE'], 'TXT_' . $this->moduleLangVar . '_EVENTS' => $_ARRAYLANG['TXT_CALENDAR_EVENTS'], 'TXT_' . $this->moduleLangVar . '_EDIT' => $_ARRAYLANG['TXT_CALENDAR_EDIT'], 'TXT_' . $this->moduleLangVar . '_SAVE' => $_ARRAYLANG['TXT_CALENDAR_SAVE'], 'TXT_' . $this->moduleLangVar . '_ACTION' => $_ARRAYLANG['TXT_CALENDAR_ACTION'], 'TXT_' . $this->moduleLangVar . '_EDIT' => $_ARRAYLANG['TXT_CALENDAR_EDIT'], 'TXT_' . $this->moduleLangVar . '_DELETE' => $_ARRAYLANG['TXT_CALENDAR_DELETE'], 'TXT_SELECT_ALL' => $_ARRAYLANG['TXT_CALENDAR_MARK_ALL'], 'TXT_DESELECT_ALL' => $_ARRAYLANG['TXT_CALENDAR_REMOVE_CHOICE'], 'TXT_SUBMIT_SELECT' => $_ARRAYLANG['TXT_SUBMIT_SELECT'], 'TXT_SUBMIT_ACTIVATE' => $_ARRAYLANG['TXT_SUBMIT_ACTIVATE'], 'TXT_SUBMIT_DEACTIVATE' => $_ARRAYLANG['TXT_SUBMIT_DEACTIVATE'], 'TXT_SUBMIT_DELETE' => $_ARRAYLANG['TXT_SUBMIT_DELETE'], 'TXT_' . $this->moduleLangVar . '_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_CALENDAR_CONFIRM_DELETE_DATA'], 'TXT_' . $this->moduleLangVar . '_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_CALENDAR_ACTION_IS_IRREVERSIBLE'], 'TXT_' . $this->moduleLangVar . '_INSERT_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_INSERT_CATEGORY'], 'TXT_' . $this->moduleLangVar . '_MAKE_SELECTION' => $_ARRAYLANG['TXT_CALENDAR_MAKE_SELECTION'])); $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(); $objCategoryManager->getCategoryList(); $objCategoryManager->showCategoryList($this->_objTpl); }