示例#1
0
 /**
  * Performs the calendar page
  * 
  * @return null
  */
 function getCalendarPage()
 {
     $this->loadEventManager();
     $id = !empty($_GET['id']) ? $_GET['id'] : 0;
     if (isset($_GET['export'])) {
         $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent(intval($_GET['export']));
         $objEvent->export();
     }
     $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null;
     if ($this->simulateCategoryView) {
         $cmd = 'category';
     }
     switch ($cmd) {
         case 'detail':
             if ($id != null && $_GET['date'] != null) {
                 self::showEvent();
             } else {
                 \Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd($this->moduleName));
                 exit;
             }
             break;
         case 'register':
         case 'sign':
             self::showRegistrationForm();
             break;
         case 'boxes':
             if (isset($_GET['act']) && $_GET['act'] == "list") {
                 self::boxesEventList();
             } else {
                 self::showThreeBoxes();
             }
             break;
         case 'category':
             self::showCategoryView();
             break;
         case 'add':
             $this->checkAccess('add_event');
             self::modifyEvent();
             break;
         case 'edit':
             $this->checkAccess('edit_event');
             self::modifyEvent(intval($id));
             break;
         case 'my_events':
             $this->checkAccess('my_events');
             self::myEvents();
             break;
         case 'success':
             self::showSuccessPage();
             break;
         case 'list':
         case 'eventlist':
         case 'archive':
         default:
             self::overview();
             break;
     }
     return $this->_objTpl->get();
 }
 /**
  * Perform the overview page functionalities
  *
  * @return null
  */
 function showOverview()
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG;
     $this->_objTpl->loadTemplateFile('module_calendar_overview.html');
     $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_MENU_OVERVIEW'];
     $this->getSettings();
     if (isset($_GET['switch_status'])) {
         \Permission::checkAccess(180, 'static');
         $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent(intval($_GET['switch_status']));
         if ($objEvent->switchStatus()) {
             $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_SUCCESSFULLY_EDITED'];
         } else {
             $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_CORRUPT_EDITED'];
         }
     }
     if (isset($_GET['delete'])) {
         \Permission::checkAccess(180, 'static');
         $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent(intval($_GET['delete']));
         if ($objEvent->delete()) {
             $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_SUCCESSFULLY_DELETED'];
         } else {
             $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_CORRUPT_DELETED'];
         }
     }
     if (isset($_GET['confirm'])) {
         \Permission::checkAccess(180, 'static');
         $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent(intval($_GET['confirm']));
         if ($objEvent->confirm()) {
             $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_SUCCESSFULLY_EDITED'];
         } else {
             $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_CORRUPT_EDITED'];
         }
     }
     if (isset($_GET['export'])) {
         $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent(intval($_GET['export']));
         $objEvent->export();
     }
     if (isset($_GET['multi'])) {
         \Permission::checkAccess(180, 'static');
         $status = true;
         $messageVar = 'EDITED';
         foreach ($_POST['selectedEventId'] as $key => $eventId) {
             $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent(intval($eventId));
             switch ($_GET['multi']) {
                 case 'delete':
                     $status = $objEvent->delete() ? true : false;
                     $messageVar = 'DELETED';
                     break;
                 case 'activate':
                     $objEvent->status = 0;
                     $status = $objEvent->switchStatus() ? true : false;
                     $messageVar = 'EDITED';
                     break;
                 case 'deactivate':
                     $objEvent->status = 1;
                     $status = $objEvent->switchStatus() ? true : false;
                     $messageVar = 'EDITED';
                     break;
                 case 'export':
                     $objEvent->export();
                     break;
             }
         }
         if ($status) {
             $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_SUCCESSFULLY_' . $messageVar];
         } else {
             $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_CORRUPT_' . $messageVar];
         }
     }
     $categoryId = intval($_REQUEST['categoryId']) != 0 ? $categoryId = intval($_REQUEST['categoryId']) : ($categoryId = null);
     $searchTerm = isset($_REQUEST['term']) ? $_REQUEST['term'] : ($searchTerm = $_ARRAYLANG['TXT_CALENDAR_KEYWORD']);
     $startPos = isset($_REQUEST['pos']) ? $_REQUEST['pos'] : 0;
     $listType = 'all';
     if ($_GET['list'] == 'actual' || !isset($_GET['list'])) {
         $styleListActual = 'underline';
         $styleListAll = '';
         $startDate = new \DateTime();
         $listType = 'upcoming';
     } else {
         $styleListActual = '';
         $styleListAll = 'underline';
         $startDate = null;
     }
     $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_OVERVIEW' => $this->_pageTitle, 'TXT_' . $this->moduleLangVar . '_UPCOMING_EVENTS' => $_ARRAYLANG['TXT_CALENDAR_UPCOMING_EVENTS'], 'TXT_' . $this->moduleLangVar . '_ALL_EVENTS' => $_ARRAYLANG['TXT_CALENDAR_ALL_EVENTS'], 'TXT_' . $this->moduleLangVar . '_FILTER' => $_ARRAYLANG['TXT_CALENDAR_FILTER'], 'TXT_' . $this->moduleLangVar . '_CONFIRMLIST' => $_ARRAYLANG['TXT_CALENDAR_CONFIRMLIST'], 'TXT_SEARCH' => $_CORELANG['TXT_USER_SEARCH'], 'TXT_' . $this->moduleLangVar . '_SEARCH' => $_CORELANG['TXT_USER_SEARCH'], 'TXT_' . $this->moduleLangVar . '_KEYWORD' => $searchTerm, 'TXT_' . $this->moduleLangVar . '_EVENTS' => $_ARRAYLANG['TXT_CALENDAR_EVENTS'], 'TXT_' . $this->moduleLangVar . '_STATUS' => $_ARRAYLANG['TXT_CALENDAR_STATUS'], 'TXT_' . $this->moduleLangVar . '_DATE' => $_ARRAYLANG['TXT_CALENDAR_DATE'], 'TXT_' . $this->moduleLangVar . '_TITLE' => $_ARRAYLANG['TXT_CALENDAR_TITLE'], 'TXT_' . $this->moduleLangVar . '_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_CATEGORY'], 'TXT_' . $this->moduleLangVar . '_SERIES' => $_ARRAYLANG['TXT_CALENDAR_SERIES'], 'TXT_' . $this->moduleLangVar . '_RE_DEREGISTRATIONS' => $_ARRAYLANG['TXT_CALENDAR_RE_DEGISTRATIONS'], 'TXT_' . $this->moduleLangVar . '_REGISTRATIONS' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATIONS'], 'TXT_' . $this->moduleLangVar . '_WAITLIST' => $_ARRAYLANG['TXT_CALENDAR_WAITLIST'], 'TXT_' . $this->moduleLangVar . '_ACTION' => $_ARRAYLANG['TXT_CALENDAR_ACTION'], 'TXT_' . $this->moduleLangVar . '_EXPORT_ICAL_FORMAT' => $_ARRAYLANG['TXT_CALENDAR_EXPORT_ICAL_FORMAT'], 'TXT_' . $this->moduleLangVar . '_EDIT' => $_ARRAYLANG['TXT_CALENDAR_EDIT'], 'TXT_' . $this->moduleLangVar . '_COPY' => $_ARRAYLANG['TXT_CALENDAR_COPY'], 'TXT_' . $this->moduleLangVar . '_DELETE' => $_ARRAYLANG['TXT_CALENDAR_DELETE'], 'TXT_' . $this->moduleLangVar . '_LANGUAGES' => $_ARRAYLANG['TXT_CALENDAR_LANGUAGES'], '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_SUBMIT_EXPORT' => $_ARRAYLANG['TXT_SUBMIT_EXPORT'], '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 . '_MAKE_SELECTION' => $_ARRAYLANG['TXT_CALENDAR_MAKE_SELECTION'], 'TXT_' . $this->moduleLangVar . '_LIST_ACTUAL' => $_ARRAYLANG['TXT_CALENDAR_LIST_ACTUAL'], 'TXT_' . $this->moduleLangVar . '_LIST_ALL' => $_ARRAYLANG['TXT_CALENDAR_LIST_ALL'], $this->moduleLangVar . '_LINKSTYLE_LIST_ACTUAL' => $styleListActual, $this->moduleLangVar . '_LINKSTYLE_LIST_ALL' => $styleListAll));
     $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true);
     $objCategoryManager->getCategoryList();
     $this->_objTpl->setVariable(array('CALENDAR_CATEGORIES' => $objCategoryManager->getCategoryDropdown($categoryId, 1)));
     $objConfirmEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager(null, null, null, null, null, null, true, null, null, false, null);
     $objConfirmEventManager->getEventList();
     if (count($objConfirmEventManager->eventList) > 0) {
         $objConfirmEventManager->showEventList($this->_objTpl, 'confirm');
     } else {
         $this->_objTpl->hideBlock('showConfirmList');
     }
     if ($this->arrSettings['rssFeedStatus'] == 1) {
         $objFeedEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager(time(), null, null, null, true);
         $objFeed = new \Cx\Modules\Calendar\Controller\CalendarFeed($objFeedEventManager);
         $objFeed->creatFeed();
     }
     $showSeries = $listType == 'upcoming';
     $objEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager($startDate, null, $categoryId, $searchTerm, $showSeries, null, null, $startPos, $this->arrSettings['numPaging'], 'ASC', true, null, $listType);
     $objEventManager->getEventList();
     if ($objEventManager->countEvents > $this->arrSettings['numPaging']) {
         $pagingCategory = !empty($categoryId) ? '&categoryId=' . $categoryId : '';
         $pagingTerm = !empty($searchTerm) ? '&term=' . $searchTerm : '';
         $pagingList = !empty($_GET['list']) ? '&list=' . $_GET['list'] : '';
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_PAGING' => getPaging($objEventManager->countEvents, $startPos, "&cmd=" . $this->moduleName . $pagingCategory . $pagingTerm . $pagingList, "<b>" . $_ARRAYLANG['TXT_CALENDAR_EVENTS'] . "</b>", true, $this->arrSettings['numPaging'])));
     }
     $objEventManager->showEventList($this->_objTpl);
 }