/**
  * Import Events
  * 
  * @return null
  */
 function _importEvents()
 {
     global $objDatabase, $objInit, $_LANGID, $_CONFIG;
     if ($objInit->mode == 'frontend') {
         parent::getSettings();
         $objHostManager = new \Cx\Modules\Calendar\Controller\CalendarHostManager($this->categoryId, true, true);
         $objHostManager->getHostList();
         foreach ($objHostManager->hostList as $key => $objHost) {
             $id = $objHost->id;
             $name = $objHost->title;
             $key = $objHost->key;
             if (substr($objHost->uri, -1) != '/') {
                 $uri = $objHost->uri . '/';
             } else {
                 $uri = $objHost->uri;
             }
             if (substr($objHost->uri, 0, 7) != 'http://') {
                 $protocol = 'http://';
             } else {
                 $protocol = '';
             }
             $location = $protocol . $uri . "modules/Calendar/Controller/CalendarWebserviceServer.class.php";
             if (self::urlfind($protocol . $uri)) {
                 $connection = true;
             } else {
                 $connection = false;
             }
             if ($connection) {
                 if ($objWebserviceClient = new \Cx\Modules\Calendar\Controller\CalendarWebserviceClient($location, $uri)) {
                     $myHost = $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET;
                     if (substr($myHost, -1) != '/') {
                         $myHost = $myHost . '/';
                     }
                     $catId = $objHost->catId;
                     $key = $objHost->key;
                     $foreignHostData = $objWebserviceClient->verifyHost($myHost, $key);
                     if ($foreignHostData != false) {
                         $arrEvents = $objWebserviceClient->getEventList($this->startDate, $this->endDate, $this->needAuth, $this->searchTerm, $_LANGID, $foreignHostData['id'], $id, $this->arrSettings['showEventsOnlyInActiveLanguage']);
                         if (!empty($arrEvents[0])) {
                             foreach ($arrEvents as $key => $objExternalEvent) {
                                 /*$objExternalEvent->showStartDateList = intval($this->arrSettings['showStartDateList']);
                                   $objExternalEvent->showEndDateList = intval($this->arrSettings['showEndDateList']);
                                   $objExternalEvent->showStartTimeList = intval($this->arrSettings['showStartTimeList']);
                                   $objExternalEvent->showEndTimeList = intval($this->arrSettings['showEndTimeList']);
                                   $objExternalEvent->showTimeTypeList = intval($this->arrSettings['showTimeTypeList']);
                                   $objExternalEvent->showStartDateDetail = intval($this->arrSettings['showStartDateDetail']);
                                   $objExternalEvent->showEndDateDetail = intval($this->arrSettings['showEndDateDetail']);
                                   $objExternalEvent->showStartTimeDetail = intval($this->arrSettings['showStartTimeDetail']);
                                   $objExternalEvent->showEndTimeDetail = intval($this->arrSettings['showEndTimeDetail']);
                                   $objExternalEvent->showTimeTypeDetail = intval($this->arrSettings['showTimeTypeDetail']);*/
                                 if ($objExternalEvent->seriesStatus == 1 && $_GET['cmd'] != 'my_events') {
                                     self::_setNextSeriesElement($objExternalEvent);
                                 }
                                 $this->eventList[] = $objExternalEvent;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 /**
  * Add / edit of Host settings
  *
  * @param object  $objTpl Template object
  * @param integer $hostId Host id
  *
  * @return null
  */
 function modifyHost($objTpl, $hostId)
 {
     global $_ARRAYLANG, $_CORELANG;
     $objTpl->addBlockfile('CALENDAR_SETTINGS_CONTENT', 'settings_content', 'module_calendar_settings_modify_host.html');
     if ($hostId != 0) {
         $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_HOST'] . " " . $_ARRAYLANG['TXT_CALENDAR_EDIT'];
     } else {
         $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_INSERT_HOST'];
     }
     $objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_HOST' => $this->_pageTitle, 'TXT_' . $this->moduleLangVar . '_HOST_TITLE' => $_ARRAYLANG['TXT_CALENDAR_TITLE'], 'TXT_' . $this->moduleLangVar . '_HOST_URI' => $_ARRAYLANG['TXT_CALENDAR_URI'], 'TXT_' . $this->moduleLangVar . '_HOST_KEY' => $_ARRAYLANG['TXT_CALENDAR_KEY'], 'TXT_' . $this->moduleLangVar . '_HOST_STATUS' => $_ARRAYLANG['TXT_STATUS'], 'TXT_' . $this->moduleLangVar . '_HOST_KEY_AUTOGEN_IF_EMPTY' => $_ARRAYLANG['TXT_CALENDAR_HOST_KEY_AUTOGEN_IF_EMPTY'], 'TXT_' . $this->moduleLangVar . '_HOST_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_CATEGORY']));
     if ($hostId != 0) {
         $objHostManager = new \Cx\Modules\Calendar\Controller\CalendarHostManager();
         $objHostManager->showHost($objTpl, $hostId);
         $objHost = $objHostManager->hostList[$hostId];
     }
     $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true);
     $objCategoryManager->getCategoryList();
     $category = '<select style="width: 252px;" name="category" >';
     $category .= $objCategoryManager->getCategoryDropdown(intval($objHost->catId), 2);
     $category .= '</select>';
     $objTpl->setVariable(array($this->moduleLangVar . '_HOST_CATEGORY' => $category));
 }
 /**
  * Add / Edit of the Event
  *
  * @param integer $eventId Event id
  *
  * @return null
  */
 function modifyEvent($eventId)
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG, $_LANGID;
     $this->_objTpl->loadTemplateFile('module_calendar_modify_event.html');
     \JS::registerJS("modules/{$this->moduleName}/View/Script/jquery.pagination.js");
     \ContrexxJavascript::getInstance()->setVariable(array('language_id' => \FWLanguage::getDefaultLangId(), 'active_lang' => implode(',', \FWLanguage::getIdArray())), 'calendar');
     $this->getSettings();
     $this->getFrontendLanguages();
     if (isset($_POST['submitModifyEvent']) || isset($_POST['save_and_publish'])) {
         $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent();
         if ($objEvent->save($_POST)) {
             $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_SUCCESSFULLY_SAVED'];
             if (isset($_POST['save_and_publish'])) {
                 \Permission::checkAccess(180, 'static');
                 if ($objEvent->confirm()) {
                     // do nothing
                 } else {
                     $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_CORRUPT_EDITED'];
                 }
             }
             $this->showOverview();
             return;
         } else {
             $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_CORRUPT_SAVED'];
         }
         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();
         }
     }
     $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true);
     $objCategoryManager->getCategoryList();
     $objFormManager = new \Cx\Modules\Calendar\Controller\CalendarFormManager(true);
     $objFormManager->getFormList();
     $objMail = new \Cx\Modules\Calendar\Controller\CalendarMail();
     $objMail->getTemplateList();
     $copy = isset($_REQUEST['copy']) && !empty($_REQUEST['copy']);
     $this->_pageTitle = $copy || empty($eventId) ? $_ARRAYLANG['TXT_CALENDAR_INSERT_EVENT'] : $_ARRAYLANG['TXT_CALENDAR_EVENT'] . " " . $_ARRAYLANG['TXT_CALENDAR_EDIT'];
     if ($eventId != 0) {
         $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent($eventId);
         $objEvent->getData();
     }
     //parse weekdays
     $arrWeekdays = array("1000000" => $_ARRAYLANG['TXT_CALENDAR_DAYS_MONDAY'], "0100000" => $_ARRAYLANG['TXT_CALENDAR_DAYS_TUESDAY'], "0010000" => $_ARRAYLANG['TXT_CALENDAR_DAYS_WEDNESDAY'], "0001000" => $_ARRAYLANG['TXT_CALENDAR_DAYS_THURSDAY'], "0000100" => $_ARRAYLANG['TXT_CALENDAR_DAYS_FRIDAY'], "0000010" => $_ARRAYLANG['TXT_CALENDAR_DAYS_SATURDAY'], "0000001" => $_ARRAYLANG['TXT_CALENDAR_DAYS_SUNDAY']);
     foreach ($arrWeekdays as $value => $name) {
         $selectedWeekday = $value == $objEvent->seriesData['seriesPatternWeekday'] ? 'selected="selected"' : '';
         $weekdays .= '<option value="' . $value . '" ' . $selectedWeekday . '>' . $name . '</option>';
     }
     //parse count
     $arrCount = array(1 => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_FIRST'], 2 => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_SECOND'], 3 => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_THIRD'], 4 => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_FOURTH'], 5 => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_LAST']);
     foreach ($arrCount as $value => $name) {
         $selectedCount = $value == $objEvent->seriesData['seriesPatternCount'] ? 'selected="selected"' : '';
         $count .= '<option value="' . $value . '" ' . $selectedCount . '>' . $name . '</option>';
     }
     if ($eventId) {
         $startDate = $objEvent->startDate;
         $endDate = $objEvent->endDate;
     } else {
         $startDate = new \DateTime();
         $startMin = (int) $startDate->format('i');
         // Adjust the time to next half hour
         if (!in_array($startMin, array(0, 30))) {
             $minAdj = 60 - $startMin > 30 ? 30 - $startMin : 60 - $startMin;
             $startDate->setTime($startDate->format('H'), $startDate->format('i') + $minAdj, 00);
         }
         $endDate = clone $startDate;
         $endDate->modify("+30 mins");
     }
     $eventStartDate = $this->format2userDateTime($startDate);
     $eventEndDate = $this->format2userDateTime($endDate);
     //parse globals
     $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_TITLE' => $this->_pageTitle, 'TXT_' . $this->moduleLangVar . '_EVENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT'], 'TXT_' . $this->moduleLangVar . '_SAVE' => $_ARRAYLANG['TXT_CALENDAR_SAVE'], 'TXT_' . $this->moduleLangVar . '_DELETE' => $_ARRAYLANG['TXT_CALENDAR_DELETE'], 'TXT_' . $this->moduleLangVar . '_CANCEL' => $_CORELANG['TXT_CANCEL'], 'TXT_' . $this->moduleLangVar . '_EXPAND' => $_ARRAYLANG['TXT_CALENDAR_EXPAND'], 'TXT_' . $this->moduleLangVar . '_MINIMIZE' => $_ARRAYLANG['TXT_CALENDAR_MINIMIZE'], 'TXT_' . $this->moduleLangVar . '_EVENT_DETAILS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DETAILS'], 'TXT_' . $this->moduleLangVar . '_EVENT_INVITE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_INVITE'], 'TXT_' . $this->moduleLangVar . '_EVENT_SERIES' => $_ARRAYLANG['TXT_CALENDAR_EVENT_SERIES'], 'TXT_' . $this->moduleLangVar . '_EVENT_SERIES_TYPE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_SERIES_TYPE'], 'TXT_' . $this->moduleLangVar . '_EVENT_SERIES_PATTERN' => $_ARRAYLANG['TXT_CALENDAR_EVENT_SERIES_PATTERN'], 'TXT_' . $this->moduleLangVar . '_EVENT_SERIES_EXCEPTIONS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_SERIES_EXCEPTIONS'], 'TXT_' . $this->moduleLangVar . '_EVENT_PUBLICATE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PUBLICATE'], 'TXT_' . $this->moduleLangVar . '_YES' => $_ARRAYLANG['TXT_CALENDAR_YES'], 'TXT_' . $this->moduleLangVar . '_NEXT' => $_ARRAYLANG['TXT_CALENDAR_NEXT'], 'TXT_' . $this->moduleLangVar . '_BACK' => $_ARRAYLANG['TXT_CALENDAR_STEP_BACK'], 'TXT_' . $this->moduleLangVar . '_EVENT_PRIORITY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PRIORITY'], 'TXT_' . $this->moduleLangVar . '_EVENT_START' => $_ARRAYLANG['TXT_CALENDAR_EVENT_START'], 'TXT_' . $this->moduleLangVar . '_EVENT_END' => $_ARRAYLANG['TXT_CALENDAR_EVENT_END'], 'TXT_' . $this->moduleLangVar . '_EVENT_ACCESS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ACCESS'], 'TXT_' . $this->moduleLangVar . '_EVENT_WHOLE_DAY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_WHOLE_DAY'], 'TXT_' . $this->moduleLangVar . '_BROWSE' => $_ARRAYLANG['TXT_CALENDAR_BROWSE'], 'TXT_' . $this->moduleLangVar . '_ACTIVATE' => $_ARRAYLANG['TXT_CALENDAR_ACTIVATE'], 'TXT_' . $this->moduleLangVar . '_EVENT_PRICE' => $_ARRAYLANG['TXT_CALENDAR_PRICE'], 'TXT_' . $this->moduleLangVar . '_EVENT_LINK' => $_ARRAYLANG['TXT_CALENDAR_EVENT_LINK'], 'TXT_' . $this->moduleLangVar . '_EVENT_PICTURE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PICTURE'], 'TXT_' . $this->moduleLangVar . '_EVENT_ATTACHMENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ATTACHMENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_CATEGORY'], 'TXT_' . $this->moduleLangVar . '_COMMUNITY_GROUPS' => $_ARRAYLANG['TXT_CALENDAR_COMMUNITY_GROUPS'], 'TXT_' . $this->moduleLangVar . '_PLEASE_CHECK_INPUT' => $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHECK_INPUT'], 'TXT_' . $this->moduleLangVar . '_EVENT_MORE_INVITATIONS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_MORE_INVITATIONS'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION' => $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION'], 'TXT_' . $this->moduleLangVar . '_EVENT_NUM_SUBSCRIBER' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NUM_SUBSCRIBER'], 'TXT_' . $this->moduleLangVar . '_EVENT_NOTIFICATION_TO' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NOTIFICATION_TO'], 'TXT_' . $this->moduleLangVar . '_EVENT_EMAIL_TEMPLATE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_EMAIL_TEMPLATE'], 'TXT_' . $this->moduleLangVar . '_EVENT_TICKET_SALES' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TICKET_SALES'], 'TXT_' . $this->moduleLangVar . '_EVENT_NUM_SEATING' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NUM_SEATING'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_DURANCE' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_DURANCE'], 'TXT_' . $this->moduleLangVar . '_SERIES_ACTIVATE' => $_ARRAYLANG['TXT_CALENDAR_SERIES_ACTIVATE'], 'TXT_' . $this->moduleLangVar . '_SERIES' => $_ARRAYLANG['TXT_CALENDAR_SERIES'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_DAILY' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_DAILY'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_WEEKLY'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_MONTHLY'], 'TXT_' . $this->moduleLangVar . '_DAYS' => $_ARRAYLANG['TXT_CALENDAR_DAYS'], 'TXT_' . $this->moduleLangVar . '_DAYS_DAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_DAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_MONDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_MONDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_TUESDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_TUESDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_WEDNESDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_WEDNESDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_THURSDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_THURSDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_FRIDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_FRIDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_SATURDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_SATURDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_SUNDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_SUNDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_WORKDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_WORKDAY'], 'TXT_' . $this->moduleLangVar . '_AT' => $_ARRAYLANG['TXT_CALENDAR_AT'], 'TXT_' . $this->moduleLangVar . '_EVERY_1' => $_ARRAYLANG['TXT_CALENDAR_EVERY_1'], 'TXT_' . $this->moduleLangVar . '_ALL' => $_ARRAYLANG['TXT_CALENDAR_ALL'], 'TXT_' . $this->moduleLangVar . '_EVERY_2' => $_ARRAYLANG['TXT_CALENDAR_EVERY_2'], 'TXT_' . $this->moduleLangVar . '_WEEKS' => $_ARRAYLANG['TXT_CALENDAR_WEEKS'], 'TXT_' . $this->moduleLangVar . '_MONTHS' => $_ARRAYLANG['TXT_CALENDAR_MONTHS'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_BEGINS' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_BEGINS'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_NO_ENDDATE' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_NO_ENDDATE'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_ENDS_AFTER' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_ENDS_AFTER'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_APPONTMENTS' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_APPONTMENTS'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_ENDS' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_ENDS'], 'TXT_' . $this->moduleLangVar . '_EVENT_SEND_INVITATION' => $objEvent->invitationSent == 0 ? $_ARRAYLANG['TXT_CALENDAR_EVENT_SEND_INVITATION'] : $_ARRAYLANG['TXT_CALENDAR_EVENT_SEND_AGAIN_INVITATION'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE_EVENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_EVENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE_REDIRECT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_REDIRECT'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION_FORM' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_FORM'], 'TXT_' . $this->moduleLangVar . '_EVENT_MORE_INVITATIONS_INFO' => $_ARRAYLANG['TXT_CALENDAR_EVENT_MORE_INVITATIONS_INFO'], 'TXT_' . $this->moduleLangVar . '_REGISTRATIONS_SUBSCRIBER_INFO' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATIONS_SUBSCRIBER_INFO'], 'TXT_' . $this->moduleLangVar . '_EVENT_NOTIFICATION_TO_INFO' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NOTIFICATION_TO_INFO'], 'TXT_' . $this->moduleLangVar . '_EVENT_EMAIL_TEMPLATE_INFO' => $_ARRAYLANG['TXT_CALENDAR_EVENT_EMAIL_TEMPLATE_INFO'], 'TXT_' . $this->moduleLangVar . '_EVENT_NUM_SEATING_INFO' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NUM_SEATING_INFO'], 'TXT_' . $this->moduleLangVar . '_SHOW_START_DATE' => $_ARRAYLANG['TXT_CALENDAR_SHOW_START_DATE'], 'TXT_' . $this->moduleLangVar . '_SHOW_END_DATE' => $_ARRAYLANG['TXT_CALENDAR_SHOW_END_DATE'], 'TXT_' . $this->moduleLangVar . '_SHOW_TIME_TYPE' => $_ARRAYLANG['TXT_CALENDAR_SHOW_TIME_TYPE'], 'TXT_' . $this->moduleLangVar . '_SHOW_START_TIME' => $_ARRAYLANG['TXT_CALENDAR_SHOW_START_TIME'], 'TXT_' . $this->moduleLangVar . '_SHOW_END_TIME' => $_ARRAYLANG['TXT_CALENDAR_SHOW_END_TIME'], 'TXT_' . $this->moduleLangVar . '_LIST' => $_ARRAYLANG['TXT_CALENDAR_LIST'], 'TXT_' . $this->moduleLangVar . '_DETAIL' => $_ARRAYLANG['TXT_CALENDAR_DETAIL'], 'TXT_' . $this->moduleLangVar . '_BASIC_DATA' => $_ARRAYLANG['TXT_CALENDAR_BASIC_DATA'], 'TXT_' . $this->moduleLangVar . '_LANGUAGE' => $_ARRAYLANG['TXT_CALENDAR_LANG'], 'TXT_' . $this->moduleLangVar . '_ADDITIONAL_OPTIONS' => $_ARRAYLANG['TXT_CALENDAR_ADDITIONAL_OPTIONS'], 'TXT_' . $this->moduleLangVar . '_EVENT_LOCATION' => $_ARRAYLANG['TXT_CALENDAR_EVENT_LOCATION'], 'TXT_' . $this->moduleLangVar . '_EVENT_ALL_DAY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ALL_DAY'], 'TXT_' . $this->moduleLangVar . '_EVENT_NAME' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NAME'], 'TXT_' . $this->moduleLangVar . '_EVENT_HOST' => $_ARRAYLANG['TXT_CALENDAR_EVENT_HOST'], 'TXT_' . $this->moduleLangVar . '_EVENT_EMAIL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_EMAIL'], 'TXT_' . $this->moduleLangVar . '_SELECT_EXCEPTION_DATE_INFO' => $_ARRAYLANG['TXT_CALENDAR_SELECT_EXCEPTION_DATE_INFO'], 'TXT_' . $this->moduleLangVar . '_OK' => $_ARRAYLANG['TXT_CALENDAR_OK'], 'TXT_' . $this->moduleLangVar . '_CANCEL' => $_ARRAYLANG['TXT_CALENDAR_CANCEL'], 'TXT_' . $this->moduleLangVar . '_MANAGE' => $_ARRAYLANG['TXT_CALENDAR_MANAGE'], 'TXT_' . $this->moduleLangVar . '_EVENT_SHOW_IN' => $_ARRAYLANG['TXT_CALENDAR_EVENT_SHOW_IN'], 'TXT_' . $this->moduleLangVar . '_EVENT_TITLE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TITLE'], 'TXT_' . $this->moduleLangVar . '_EVENT_TEASER' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TEASER'], 'TXT_' . $this->moduleLangVar . '_EVENT_PLACE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PLACE'], 'TXT_' . $this->moduleLangVar . '_EVENT_STREET' => $_ARRAYLANG['TXT_CALENDAR_EVENT_STREET'], 'TXT_' . $this->moduleLangVar . '_EVENT_ZIP' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ZIP'], 'TXT_' . $this->moduleLangVar . '_EVENT_CITY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_CITY'], 'TXT_' . $this->moduleLangVar . '_EVENT_COUNTRY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_COUNTRY'], 'TXT_' . $this->moduleLangVar . '_EVENT_WEBSITE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_WEBSITE'], 'TXT_' . $this->moduleLangVar . '_EVENT_PHONE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PHONE'], 'TXT_' . $this->moduleLangVar . '_EVENT_MAP' => $_ARRAYLANG['TXT_CALENDAR_EVENT_MAP'], 'TXT_' . $this->moduleLangVar . '_EVENT_USE_GOOGLEMAPS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_USE_GOOGLEMAPS'], 'TXT_' . $this->moduleLangVar . '_PLACE_DATA_DEFAULT' => $_ARRAYLANG['TXT_CALENDAR_PLACE_DATA_DEFAULT'], 'TXT_' . $this->moduleLangVar . '_PLACE_DATA_FROM_MEDIADIR' => $_ARRAYLANG['TXT_CALENDAR_PLACE_DATA_FROM_MEDIADIR'], 'TXT_' . $this->moduleLangVar . '_PREV' => $_ARRAYLANG['TXT_CALENDAR_PREV'], 'TXT_' . $this->moduleLangVar . '_NEXT' => $_ARRAYLANG['TXT_CALENDAR_NEXT'], 'TXT_' . $this->moduleLangVar . '_EVENT_DETAIL_VIEW' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DETAIL_VIEW'], 'TXT_' . $this->moduleLangVar . '_EVENT_DETAIL_VIEW_LABEL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DETAIL_VIEW_LABEL'], 'TXT_' . $this->moduleLangVar . '_EVENT_TREAT_AS_INDEPENDENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TREAT_AS_INDEPENDENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION_NONE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION_NONE'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION_INTERNAL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION_INTERNAL'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION_EXTERNAL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION_EXTERNAL'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION_FULL_BOOKED' => $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION_FULL_BOOKED'], 'TXT_' . $this->moduleLangVar . '_MORE' => $_ARRAYLANG['TXT_CALENDAR_MORE'], 'TXT_' . $this->moduleLangVar . '_MINIMIZE' => $_ARRAYLANG['TXT_CALENDAR_MINIMIZE'], $this->moduleLangVar . '_EVENT_REDIRECT_BROWSE_BUTTON' => self::showMediaBrowserButton('eventRedirect', 'sitestructure'), $this->moduleLangVar . '_EVENT_PICTURE_BROWSE_BUTTON' => self::showMediaBrowserButton('eventPicture'), $this->moduleLangVar . '_EVENT_ATTACHMENT_BROWSE_BUTTON' => self::showMediaBrowserButton('eventAttachment'), $this->moduleLangVar . '_PLACE_MAP_SOURCE_BROWSE_BUTTON' => self::showMediaBrowserButton('inputPlaceMap'), $this->moduleLangVar . '_EVENT_ID' => $eventId, $this->moduleLangVar . '_EVENT_DEFAULT_LANG_ID' => $_LANGID, $this->moduleLangVar . '_EVENT_DATE_FORMAT' => $this->getDateFormat(1), $this->moduleLangVar . '_EVENT_CURRENCY' => $this->arrSettings['paymentCurrency'], $this->moduleLangVar . '_EVENT_CATEGORIES' => $objCategoryManager->getCategoryDropdown(intval($objEvent->catId), 2), $this->moduleLangVar . '_EVENT_SERIES_PATTERN_MONTHLY_COUNT' => $count, $this->moduleLangVar . '_EVENT_SERIES_PATTERN_MONTHLY_WEEKDAY' => $weekdays, $this->moduleLangVar . '_EVENT_REGISTRATION_FORMS' => $objFormManager->getFormDorpdown(intval($objEvent->registrationForm)), $this->moduleLangVar . '_EVENT_SHOW_DETAIL_VIEW' => $eventId != 0 ? $objEvent->showDetailView == 1 ? 'checked="checked"' : '' : 'checked="checked"', $this->moduleLangVar . '_EVENT_TYPE_EVENT' => $eventId != 0 ? $objEvent->type == 0 ? 'selected="selected"' : '' : '', $this->moduleLangVar . '_EVENT_TYPE_REDIRECT' => $eventId != 0 ? $objEvent->type == 1 ? 'selected="selected"' : '' : '', $this->moduleLangVar . '_EVENT_START_DATE' => $eventStartDate, $this->moduleLangVar . '_EVENT_END_DATE' => $eventEndDate, $this->moduleLangVar . '_EVENT_PRICE' => $eventId != 0 ? $objEvent->price : '', $this->moduleLangVar . '_EVENT_LINK' => $eventId != 0 ? $objEvent->link : '', $this->moduleLangVar . '_EVENT_PICTURE' => $eventId != 0 ? $objEvent->pic : '', $this->moduleLangVar . '_EVENT_ATTACHMENT' => $eventId != 0 ? $objEvent->attach : '', $this->moduleLangVar . '_EVENT_MORE_INVITATIONS' => $eventId != 0 ? $objEvent->invitedMails : '', $this->moduleLangVar . '_EVENT_NUM_SUBSCRIBER' => $eventId != 0 ? $objEvent->numSubscriber : '', $this->moduleLangVar . '_EVENT_NOTIFICATION_TO' => $eventId != 0 ? $objEvent->notificationTo : '', $this->moduleLangVar . '_EVENT_TICKET_SALES' => $eventId != 0 ? $objEvent->ticketSales ? 'checked="checked"' : '' : '', $this->moduleLangVar . '_EVENT_NUM_SEATING' => $eventId != 0 ? $objEvent->numSeating : '', $this->moduleLangVar . '_EVENT_ALL_DAY' => $eventId != 0 && $objEvent->all_day ? 'checked="checked"' : '', $this->moduleLangVar . '_HIDE_ON_SINGLE_LANG' => count($this->arrFrontendLanguages) == 1 ? "display: none;" : "", $this->moduleLangVar . '_LOCATION_TYPE' => $this->arrSettings['placeData'] == 3 ? $eventId != 0 ? $objEvent->locationType : 1 : $this->arrSettings['placeData'], $this->moduleLangVar . '_EVENT_LOCATION_TYPE_MANUAL' => $eventId != 0 ? $objEvent->locationType == 1 ? "checked='checked'" : '' : "checked='checked'", $this->moduleLangVar . '_EVENT_LOCATION_TYPE_MEDIADIR' => $eventId != 0 ? $objEvent->locationType == 2 ? "checked='checked'" : '' : "", $this->moduleLangVar . '_EVENT_PLACE' => $eventId != 0 ? $objEvent->place : '', $this->moduleLangVar . '_EVENT_STREET' => $eventId != 0 ? $objEvent->place_street : '', $this->moduleLangVar . '_EVENT_ZIP' => $eventId != 0 ? $objEvent->place_zip : '', $this->moduleLangVar . '_EVENT_CITY' => $eventId != 0 ? $objEvent->place_city : '', $this->moduleLangVar . '_EVENT_COUNTRY' => $eventId != 0 ? $objEvent->place_country : '', $this->moduleLangVar . '_EVENT_PLACE_WEBSITE' => $eventId != 0 ? $objEvent->place_website : '', $this->moduleLangVar . '_EVENT_PLACE_LINK' => $eventId != 0 ? $objEvent->place_link : '', $this->moduleLangVar . '_EVENT_PLACE_PHONE' => $eventId != 0 ? $objEvent->place_phone : '', $this->moduleLangVar . '_PLACE_MAP_SOURCE' => $eventId != 0 ? $objEvent->place_map : '', $this->moduleLangVar . '_EVENT_MAP' => $objEvent->google == 1 ? 'checked="checked"' : '', $this->moduleLangVar . '_EVENT_HOST_TYPE' => $this->arrSettings['placeDataHost'] == 3 ? $eventId != 0 ? $objEvent->hostType : 1 : $this->arrSettings['placeDataHost'], $this->moduleLangVar . '_EVENT_HOST' => $eventId != 0 ? $objEvent->org_name : '', $this->moduleLangVar . '_EVENT_HOST_ADDRESS' => $eventId != 0 ? $objEvent->org_street : '', $this->moduleLangVar . '_EVENT_HOST_ZIP' => $eventId != 0 ? $objEvent->org_zip : '', $this->moduleLangVar . '_EVENT_HOST_CITY' => $eventId != 0 ? $objEvent->org_city : '', $this->moduleLangVar . '_EVENT_HOST_COUNTRY' => $eventId != 0 ? $objEvent->org_country : '', $this->moduleLangVar . '_EVENT_HOST_WEBSITE' => $eventId != 0 ? $objEvent->org_website : '', $this->moduleLangVar . '_EVENT_HOST_LINK' => $eventId != 0 ? $objEvent->org_link : '', $this->moduleLangVar . '_EVENT_HOST_PHONE' => $eventId != 0 ? $objEvent->org_phone : '', $this->moduleLangVar . '_EVENT_HOST_EMAIL' => $eventId != 0 ? $objEvent->org_email : '', $this->moduleLangVar . '_EVENT_HOST_TYPE_MANUAL' => $eventId != 0 ? $objEvent->hostType == 1 ? "checked='checked'" : '' : "checked='checked'", $this->moduleLangVar . '_EVENT_HOST_TYPE_MEDIADIR' => $eventId != 0 ? $objEvent->hostType == 2 ? "checked='checked'" : '' : "", $this->moduleLangVar . '_EVENT_COPY' => $copy ? 1 : 0, $this->moduleLangVar . '_EVENT_REGISTRATION_NONE_SELECTED' => !empty($eventId) ? $objEvent->registration == CalendarEvent::EVENT_REGISTRATION_NONE ? 'selected="selected"' : '' : 'selected="selected"', $this->moduleLangVar . '_EVENT_REGISTRATION_INTERNAL_SELECTED' => !empty($eventId) && $objEvent->registration == CalendarEvent::EVENT_REGISTRATION_INTERNAL ? 'selected="selected"' : '', $this->moduleLangVar . '_EVENT_REGISTRATION_EXTERNAL_SELECTED' => !empty($eventId) && $objEvent->registration == CalendarEvent::EVENT_REGISTRATION_EXTERNAL ? 'selected="selected"' : '', $this->moduleLangVar . '_EVENT_REGISTRATION_EXTERNAL_LINK' => !empty($eventId) ? $objEvent->registrationExternalLink : '', $this->moduleLangVar . '_EVENT_REGISTRATION_EXTERNAL_FULL_BOOKED' => !empty($eventId) ? $objEvent->registrationExternalFullyBooked ? 'checked="checked"' : '' : ''));
     // parse invitation E-mail template
     foreach ($this->arrFrontendLanguages as $language) {
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_INVITATION_EMAIL_LANG' => \Html::getLanguageIcon($language['id'], 'active', 'javascript:void()'), $this->moduleLangVar . '_EVENT_INVITATION_EMAIL_LANG_ID' => (int) $language['id'], $this->moduleLangVar . '_EVENT_INVITATION_EMAIL_TEMPLATE' => $objMail->getTemplateDropdown(intval($objEvent->invitationTemplate[$language['id']]), \Cx\Modules\Calendar\Controller\CalendarMailManager::MAIL_INVITATION, $language['id'])));
         $this->_objTpl->parse('invitation_email_template');
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_REGISTRATION_EMAIL_LANG' => \Html::getLanguageIcon($language['id'], 'active', 'javascript:void()'), $this->moduleLangVar . '_EVENT_REGISTRATION_EMAIL_LANG_ID' => (int) $language['id'], $this->moduleLangVar . '_EVENT_REGISTRATION_EMAIL_TEMPLATE' => $objMail->getTemplateDropdown(intval($objEvent->emailTemplate[$language['id']]), \Cx\Modules\Calendar\Controller\CalendarMailManager::MAIL_CONFIRM_REG, $language['id'])));
         $this->_objTpl->parse('registration_email_template');
     }
     //parse access
     for ($i = 0; $i < 2; $i++) {
         $selectedAccess = $eventId == 0 && $i == 0 ? 'selected="selected"' : $objEvent->access == $i ? 'selected="selected"' : '';
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_ACCESS' => $i, $this->moduleLangVar . '_EVENT_ACCESS_SELECT' => $selectedAccess, $this->moduleLangVar . '_EVENT_ACCESS_NAME' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ACCESS_' . $i]));
         $this->_objTpl->parse('eventAccess');
     }
     //parse priority
     for ($i = 1; $i <= 5; $i++) {
         $selectedPriority = $eventId == 0 && $i == 3 ? 'selected="selected"' : $objEvent->priority == $i ? 'selected="selected"' : '';
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PRIORITY' => $i, $this->moduleLangVar . '_EVENT_PRIORITY_SELECT' => $selectedPriority, $this->moduleLangVar . '_EVENT_PRIORITY_NAME' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PRIORITY_' . $i]));
         $this->_objTpl->parse('eventPriority');
     }
     //parse timetypes
     if ($eventId != 0) {
         // list view
         $showStartDateList = $objEvent->showStartDateList;
         $showEndDateList = $objEvent->showEndDateList;
         $showStartTimeList = $objEvent->showStartTimeList;
         $showEndTimeList = $objEvent->showEndTimeList;
         $showTimeTypeList = $objEvent->showTimeTypeList;
         // detail view
         $showStartDateDetail = $objEvent->showStartDateDetail;
         $showEndDateDetail = $objEvent->showEndDateDetail;
         $showStartTimeDetail = $objEvent->showStartTimeDetail;
         $showEndTimeDetail = $objEvent->showEndTimeDetail;
         $showTimeTypeDetail = $objEvent->showTimeTypeDetail;
     } else {
         // list view
         $showStartDateList = $this->arrSettings['showStartDateList'] == 1;
         $showEndDateList = $this->arrSettings['showEndDateList'] == 1;
         $showStartTimeList = $this->arrSettings['showStartTimeList'] == 1;
         $showEndTimeList = $this->arrSettings['showEndTimeList'] == 1;
         // check if start- or endtime is selected in settings to set type "show time" by default
         if (!$_POST['showTimeTypeList'] && ($showStartTimeList == 1 || $showEndTimeList == 1)) {
             $showTimeTypeList = 1;
         } else {
             $showTimeTypeList = $_POST['showTimeTypeList'];
         }
         // detail view
         $showStartDateDetail = $this->arrSettings['showStartDateDetail'] == 1;
         $showEndDateDetail = $this->arrSettings['showEndDateDetail'] == 1;
         $showStartTimeDetail = $this->arrSettings['showStartTimeDetail'] == 1;
         $showEndTimeDetail = $this->arrSettings['showEndTimeDetail'] == 1;
         // check if start- or endtime is selected in settings to set type "show time" by default
         if (!$_POST['showTimeTypeDetail'] && ($showStartTimeDetail == 1 || $showEndTimeDetail == 1)) {
             $showTimeTypeDetail = 1;
         } else {
             $showTimeTypeDetail = $_POST['showTimeTypeDetail'];
         }
     }
     //time type dropdown for list
     $c = 0;
     $arrListOptions = array($_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_NOTHING'], $_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_TIME'], $_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_FULLTIME']);
     $strTimeTypeListDropdown = '<select id="showTimeTypeList" name="showTimeTypeList" onchange="showTimeListSelection();" >';
     foreach ($arrListOptions as $key => $option) {
         $c == $showTimeTypeList ? $selected = 'selected="selected"' : ($selected = '');
         $strTimeTypeListDropdown .= '<option value="' . $c . '" ' . $selected . '  >' . $arrListOptions[$c] . '</option>';
         $c++;
     }
     $strTimeTypeListDropdown .= '</select>';
     //time type dropdown for detail
     $c = 0;
     $arrDetailOptions = array($_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_NOTHING'], $_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_TIME'], $_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_FULLTIME']);
     $strTimeTypeDetailDropdown = '<select id="showTimeTypeDetail" name="showTimeTypeDetail" onchange="showTimeDetailSelection();" >';
     foreach ($arrDetailOptions as $key => $option) {
         $c == $showTimeTypeDetail ? $selected = 'selected="selected"' : ($selected = '');
         $strTimeTypeDetailDropdown .= '<option value="' . $c . '" ' . $selected . '  >' . $arrDetailOptions[$c] . '</option>';
         $c++;
     }
     $strTimeTypeDetailDropdown .= '</select>';
     //time type placeholders
     $this->_objTpl->setVariable(array($this->moduleLangVar . '_USE_CUSTOM_DATE_DISPLAY' => $objEvent->useCustomDateDisplay ? 'checked="checked"' : '', $this->moduleLangVar . '_START_DATE_CHECKED_LIST' => $showStartDateList ? 'checked="checked"' : '', $this->moduleLangVar . '_START_DATE_VALUE_LIST' => 1, $this->moduleLangVar . '_END_DATE_CHECKED_LIST' => $showEndDateList ? 'checked="checked"' : '', $this->moduleLangVar . '_END_DATE_VALUE_LIST' => 1, $this->moduleLangVar . '_SHOW_TIME_TYPE_DROPDOWN_LIST' => $strTimeTypeListDropdown, $this->moduleLangVar . '_START_TIME_CHECKED_LIST' => $showStartTimeList ? 'checked="checked"' : '', $this->moduleLangVar . '_START_TIME_VALUE_LIST' => 1, $this->moduleLangVar . '_END_TIME_CHECKED_LIST' => $showEndTimeList ? 'checked="checked"' : '', $this->moduleLangVar . '_END_TIME_VALUE_LIST' => 1, $this->moduleLangVar . '_START_DATE_CHECKED_DETAIL' => $showStartDateDetail ? 'checked="checked"' : '', $this->moduleLangVar . '_START_DATE_VALUE_DETAIL' => 1, $this->moduleLangVar . '_END_DATE_CHECKED_DETAIL' => $showEndDateDetail ? 'checked="checked"' : '', $this->moduleLangVar . '_END_DATE_VALUE_DETAIL' => 1, $this->moduleLangVar . '_SHOW_TIME_TYPE_DROPDOWN_DETAIL' => $strTimeTypeDetailDropdown, $this->moduleLangVar . '_START_TIME_CHECKED_DETAIL' => $showStartTimeDetail ? 'checked="checked"' : '', $this->moduleLangVar . '_START_TIME_VALUE_DETAIL' => 1, $this->moduleLangVar . '_END_TIME_CHECKED_DETAIL' => $showEndTimeDetail ? 'checked="checked"' : '', $this->moduleLangVar . '_END_TIME_VALUE_DETAIL' => 1));
     //parse series
     $lastExeptionId = 4;
     $seriesStatus = $objEvent->seriesStatus == 1 ? 'checked="checked"' : '';
     $seriesIndependent = empty($eventId) || $objEvent->independentSeries == 1 ? 'checked="checked"' : '';
     $seriesPatternDailyDays = 1;
     $seriesPatternWeeklyWeeks = 1;
     $seriesPatternMonthlyDay = 1;
     $seriesPatternMonthl1 = 1;
     $seriesPatternMonthl2 = 1;
     $seriesPatternEndsEvents = 5;
     if ($eventId != 0 && $objEvent->seriesStatus == 1) {
         $seriesPatternDaily = $objEvent->seriesData['seriesType'] == 1 ? 'selected="selected"' : '';
         $seriesPatternWeekly = $objEvent->seriesData['seriesType'] == 2 ? 'selected="selected"' : '';
         $seriesPatternMonthly = $objEvent->seriesData['seriesType'] == 3 ? 'selected="selected"' : '';
         //daily
         if ($objEvent->seriesData['seriesType'] == 1) {
             $seriesPatternDaily1 = $objEvent->seriesData['seriesPatternType'] == 1 ? 'checked="checked"' : '';
             $seriesPatternDaily2 = $objEvent->seriesData['seriesPatternType'] == 2 ? 'checked="checked"' : '';
             $seriesPatternDailyDays = $objEvent->seriesData['seriesPatternType'] == 1 ? $objEvent->seriesData['seriesPatternDay'] : 1;
         }
         //weekly
         if ($objEvent->seriesData['seriesType'] == 2) {
             $seriesPatternWeeklyWeeks = $objEvent->seriesData['seriesPatternWeek'];
             $seriesPatternWeeklyMon = substr($objEvent->seriesData['seriesPatternWeekday'], 0, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklyTue = substr($objEvent->seriesData['seriesPatternWeekday'], 1, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklyWed = substr($objEvent->seriesData['seriesPatternWeekday'], 2, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklyThu = substr($objEvent->seriesData['seriesPatternWeekday'], 3, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklyFri = substr($objEvent->seriesData['seriesPatternWeekday'], 4, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklySat = substr($objEvent->seriesData['seriesPatternWeekday'], 5, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklySun = substr($objEvent->seriesData['seriesPatternWeekday'], 6, 1) == 1 ? 'checked="checked"' : '';
         }
         //monthly
         if ($objEvent->seriesData['seriesType'] == 3) {
             $seriesPatternMonthly1 = $objEvent->seriesData['seriesPatternType'] == 1 ? 'checked="checked"' : '';
             $seriesPatternMonthly2 = $objEvent->seriesData['seriesPatternType'] == 2 ? 'checked="checked"' : '';
             if ($objEvent->seriesData['seriesPatternType'] == 1) {
                 $seriesPatternMonthlyDay = $objEvent->seriesData['seriesPatternDay'];
                 $seriesPatternMonthl1 = $objEvent->seriesData['seriesPatternMonth'];
             }
             if ($objEvent->seriesData['seriesPatternType'] == 2) {
                 $seriesPatternMonthl2 = $objEvent->seriesData['seriesPatternMonth'];
             }
         }
         //douration
         $seriesPatternDourance1 = $objEvent->seriesData['seriesPatternDouranceType'] == 1 ? 'checked="checked"' : '';
         $seriesPatternDourance2 = $objEvent->seriesData['seriesPatternDouranceType'] == 2 ? 'checked="checked"' : '';
         $seriesPatternDourance3 = $objEvent->seriesData['seriesPatternDouranceType'] == 3 ? 'checked="checked"' : '';
         $seriesPatternEndsEvents = $objEvent->seriesData['seriesPatternDouranceType'] == 2 ? $objEvent->seriesData['seriesPatternEnd'] : 5;
         $seriesPatternEndsDate = $objEvent->seriesData['seriesPatternDouranceType'] == 3 ? $this->format2userDate($objEvent->seriesData['seriesPatternEndDate']) : '';
         foreach ($objEvent->seriesData['seriesPatternExceptions'] as $key => $seriesExceptionDate) {
             if ($seriesExceptionDate != null) {
                 $this->_objTpl->setVariable(array($this->moduleLangVar . '_SERIES_EXEPTION_DATE' => $this->format2userDate($seriesExceptionDate)));
                 $this->_objTpl->parse('eventExeptions');
             }
         }
     } else {
         $seriesPatternDaily = 'checked="checked"';
         $seriesPatternDaily1 = 'checked="checked"';
         $seriesPatternMonthly1 = 'checked="checked"';
         $seriesPatternDourance1 = 'checked="checked"';
         $this->_objTpl->hideBlock('eventExeptions');
     }
     $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_SERIES_STATUS' => $seriesStatus, $this->moduleLangVar . '_EVENT_SERIES_INDEPENDENT' => $seriesIndependent, $this->moduleLangVar . '_SERIES_PATTERN_DAILY' => $seriesPatternDaily, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY' => $seriesPatternWeekly, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY' => $seriesPatternMonthly, $this->moduleLangVar . '_SERIES_PATTERN_DAILY_1' => $seriesPatternDaily1, $this->moduleLangVar . '_SERIES_PATTERN_DAILY_2' => $seriesPatternDaily2, $this->moduleLangVar . '_SERIES_PATTERN_DAILY_DAYS' => $seriesPatternDailyDays, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY_1' => $seriesPatternMonthly1, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY_DAY' => $seriesPatternMonthlyDay, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY_MONTH_1' => $seriesPatternMonthl1, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY_MONTH_2' => $seriesPatternMonthl2, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY_2' => $seriesPatternMonthly2, $this->moduleLangVar . '_SERIES_PATTERN_DOURANCE_1' => $seriesPatternDourance1, $this->moduleLangVar . '_SERIES_PATTERN_DOURANCE_2' => $seriesPatternDourance2, $this->moduleLangVar . '_SERIES_PATTERN_DOURANCE_3' => $seriesPatternDourance3, $this->moduleLangVar . '_SERIES_PATTERN_ENDS_EVENTS' => $seriesPatternEndsEvents, $this->moduleLangVar . '_SERIES_PATTERN_ENDS_DATE' => $seriesPatternEndsDate, $this->moduleLangVar . '_SERIES_PATTERN_ENDS_INPUT_ID' => $seriesPatternEndsInputId, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_WEEKS' => $seriesPatternWeeklyWeeks, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_MONDAY' => $seriesPatternWeeklyMon, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_TUESDAY' => $seriesPatternWeeklyTue, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_WEDNESDAY' => $seriesPatternWeeklyWed, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_THURSDAY' => $seriesPatternWeeklyThu, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_FRIDAY' => $seriesPatternWeeklyFri, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_SATURDAY' => $seriesPatternWeeklySat, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_SUNDAY' => $seriesPatternWeeklySun));
     //parse publicate
     $objHostManager = new \Cx\Modules\Calendar\Controller\CalendarHostManager(null, true);
     $objHostManager->getHostList();
     foreach ($objHostManager->hostList as $key => $objHost) {
         if (in_array($objHost->id, $objEvent->relatedHosts)) {
             $selectetHosts .= '<option value="' . $objHost->id . '">' . $objHost->title . '</option>';
         } else {
             $deselectetHosts .= '<option value="' . $objHost->id . '">' . $objHost->title . '</option>';
         }
     }
     $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_DESELECTED_HOSTS' => $deselectetHosts, $this->moduleLangVar . '_EVENT_SELECTED_HOSTS' => $selectetHosts));
     if ($this->arrSettings['publicationStatus'] == 1 && !empty($objHostManager->hostList)) {
         $onsubmitPublications = "selectAll(document.formModifyEvent.elements['selectedHosts[]']);";
         $this->_objTpl->touchBlock('eventPublicateMenu');
         $this->_objTpl->touchBlock('eventPublicateTab');
     } else {
         $onsubmitPublications = "";
         $this->_objTpl->hideBlock('eventPublicateMenu');
         $this->_objTpl->hideBlock('eventPublicateTab');
     }
     //parse ivited groups
     $this->getCommunityGroups();
     foreach ($this->arrCommunityGroups as $key => $arrGroup) {
         if (in_array($arrGroup['id'], $objEvent->invitedGroups)) {
             $selectedGroups .= '<option value="' . $arrGroup['id'] . '">' . htmlentities($arrGroup['name'], ENT_QUOTES, CONTREXX_CHARSET) . '</option>';
         } else {
             $deselectedGroups .= '<option value="' . $arrGroup['id'] . '">' . htmlentities($arrGroup['name'], ENT_QUOTES, CONTREXX_CHARSET) . '</option>';
         }
     }
     $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_DESELECTED_GROUPS' => $deselectedGroups, $this->moduleLangVar . '_EVENT_SELECTED_GROUPS' => $selectedGroups, $this->moduleLangVar . '_EVENT_ONSUBMIT_PUBLICATIONS' => $onsubmitPublications));
     $forcedLanguage = null;
     if (isset($_GET['langId']) && in_array(contrexx_input2raw($_GET['langId']), \FWLanguage::getIdArray())) {
         $forcedLanguage = contrexx_input2raw($_GET['langId']);
     }
     //parse placeSelect
     if ((int) $this->arrSettings['placeData'] > 1) {
         $objMediadirEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry('MediaDir');
         $objMediadirEntries->getEntries(null, null, null, null, null, null, true, 0, 'n', null, null, intval($this->arrSettings['placeDataForm']));
         $placeOptions = '<option value="">' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>';
         foreach ($objMediadirEntries->arrEntries as $key => $arrEntry) {
             $selectedPlace = $arrEntry['entryId'] == $objEvent->place_mediadir_id ? 'selected="selected"' : '';
             $placeOptions .= '<option ' . $selectedPlace . ' value="' . $arrEntry['entryId'] . '">' . $arrEntry['entryFields'][0] . '</option>';
         }
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PLACE_OPTIONS' => $placeOptions));
         $this->_objTpl->parse('eventPlaceSelect');
         if ((int) $this->arrSettings['placeData'] == 2) {
             $this->_objTpl->hideBlock('eventPlaceInput');
             $this->_objTpl->hideBlock('eventPlaceTypeRadio');
         } else {
             $this->_objTpl->touchBlock('eventPlaceInput');
             $this->_objTpl->touchBlock('eventPlaceTypeRadio');
         }
     } else {
         $this->_objTpl->touchBlock('eventPlaceInput');
         $this->_objTpl->hideBlock('eventPlaceSelect');
         $this->_objTpl->hideBlock('eventPlaceTypeRadio');
     }
     //parse placeHostSelect
     if ((int) $this->arrSettings['placeDataHost'] > 1) {
         $objMediadirEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry('MediaDir');
         $objMediadirEntries->getEntries(null, null, null, null, null, null, true, 0, 'n', null, null, intval($this->arrSettings['placeDataHostForm']));
         $placeOptions = '<option value="">' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>';
         foreach ($objMediadirEntries->arrEntries as $key => $arrEntry) {
             $selectedPlace = $arrEntry['entryId'] == $objEvent->host_mediadir_id ? 'selected="selected"' : '';
             $placeOptions .= '<option ' . $selectedPlace . ' value="' . $arrEntry['entryId'] . '">' . $arrEntry['entryFields'][0] . '</option>';
         }
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PLACE_OPTIONS' => $placeOptions));
         $this->_objTpl->parse('eventHostSelect');
         if ((int) $this->arrSettings['placeDataHost'] == 2) {
             $this->_objTpl->hideBlock('eventHostInput');
             $this->_objTpl->hideBlock('eventHostTypeRadio');
         } else {
             $this->_objTpl->touchBlock('eventHostInput');
             $this->_objTpl->touchBlock('eventHostTypeRadio');
         }
     } else {
         $this->_objTpl->touchBlock('eventHostInput');
         $this->_objTpl->hideBlock('eventHostSelect');
         $this->_objTpl->hideBlock('eventHostTypeRadio');
     }
     $multiLingualFields = array('place', 'place_city', 'place_country', 'org_name', 'org_city', 'org_country');
     $isOneActiveLanguage = count($this->arrFrontendLanguages) == 1;
     foreach ($multiLingualFields as $inputField) {
         if ($isOneActiveLanguage) {
             $this->_objTpl->hideBlock('calendar_event_' . $inputField . '_expand');
         } else {
             $this->_objTpl->touchBlock('calendar_event_' . $inputField . '_expand');
         }
     }
     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
         //parse globals
         $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_EVENT_LANG_SHORTCUT' => $arrLang['lang'], $this->moduleLangVar . '_EVENT_LANG_ID' => $arrLang['id'], 'TXT_' . $this->moduleLangVar . '_EVENT_LANG_NAME' => $arrLang['name']));
         //parse "show in" checkboxes
         $arrShowIn = explode(",", $objEvent->showIn);
         $langChecked = false;
         if ($eventId != 0) {
             $langChecked = in_array($arrLang['id'], $arrShowIn);
             if ($forcedLanguage && !$langChecked) {
                 $langChecked = $forcedLanguage == $arrLang['id'];
             }
         } else {
             $langChecked = $arrLang['is_default'] == 'true';
         }
         if ($langChecked) {
             $langChecked = 'checked="checked"';
         } else {
             $langChecked = '';
         }
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_LANG_CHECKED' => $langChecked));
         $this->_objTpl->parse('eventShowIn');
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_TAB_DISPLAY' => $arrLang['is_default'] == 'true' ? 'block' : 'none', $this->moduleLangVar . '_EVENT_TITLE' => !empty($objEvent->arrData['title'][$arrLang['id']]) ? $objEvent->arrData['title'][$arrLang['id']] : $objEvent->title, $this->moduleLangVar . '_EVENT_TEASER' => !empty($objEvent->arrData['teaser'][$arrLang['id']]) ? $objEvent->arrData['teaser'][$arrLang['id']] : $objEvent->teaser));
         //parse eventTabMenuDescTab
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_TAB_CLASS' => $defaultLang ? 'active' : ''));
         $this->_objTpl->parse('eventTabMenuDescTab');
         //parse eventDescTab
         $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_EVENT_DESCRIPTION' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DESCRIPTION'], 'TXT_' . $this->moduleLangVar . '_EVENT_REDIRECT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_REDIRECT'], $this->moduleLangVar . '_EVENT_TAB_DISPLAY' => $arrLang['is_default'] == 'true' ? 'block' : 'none', $this->moduleLangVar . '_EVENT_DESCRIPTION' => new \Cx\Core\Wysiwyg\Wysiwyg('description[' . $arrLang['id'] . ']', !empty($objEvent->arrData['description'][$arrLang['id']]) ? contrexx_raw2xhtml($objEvent->arrData['description'][$arrLang['id']]) : contrexx_raw2xhtml($objEvent->description), 'full'), $this->moduleLangVar . '_EVENT_REDIRECT' => !empty($objEvent->arrData['redirect'][$arrLang['id']]) ? $objEvent->arrData['redirect'][$arrLang['id']] : $objEvent->arrData['redirect'][$_LANGID], $this->moduleLangVar . '_EVENT_TYPE_EVENT_DISPLAY' => $objEvent->type == 0 ? 'block' : 'none', $this->moduleLangVar . '_EVENT_TYPE_REDIRECT_DISPLAY' => $objEvent->type == 1 ? 'block' : 'none', $this->moduleLangVar . '_ONSUBMIT_PUBLICATION' => $onsubmitPublications));
         $this->_objTpl->parse('eventDescTab');
         //parse eventLingualFields
         foreach ($multiLingualFields as $inputField) {
             $this->_objTpl->setVariable($this->moduleLangVar . '_EVENT_' . strtoupper($inputField) . '_DEFAULT', $eventId != 0 ? $objEvent->{$inputField} : '');
             $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_VALUE' => !empty($objEvent->arrData[$inputField][$arrLang['id']]) ? $objEvent->arrData[$inputField][$arrLang['id']] : ($eventId != 0 ? $objEvent->{$inputField} : '')));
             $this->_objTpl->parse('calendar_event_' . $inputField);
         }
     }
     if (isset($_GET['confirm']) && $_GET['confirm']) {
         $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_SAVE_PUBLISH' => "<input type='submit' name='save_and_publish' value='{$_ARRAYLANG['TXT_CALENDAR_SAVE_AND_PUBLISH']}'>", $this->moduleLangVar . '_EVENT_DELETE' => "<input type='button' name='delete' value='{$_ARRAYLANG['TXT_CALENDAR_DELETE']}' onClick='if (confirm(\"{$_ARRAYLANG['TXT_CALENDAR_CONFIRM_DELETE_DATA']}\\n{$_ARRAYLANG['TXT_CALENDAR_ACTION_IS_IRREVERSIBLE']}\")) { window.location.href = \"index.php?cmd={$this->moduleName}&delete={$eventId}&" . \Cx\Core\Csrf\Controller\Csrf::param() . "\"} return false;'>"));
     }
     \Cx\Core\Core\Controller\Cx::instanciate()->getComponent('Cache')->deleteComponentFiles('Calendar');
 }