/**
  * Parse the registration related palceholders
  * $hostUri and $hostTarget should be set before calling this method
  *
  * @param \Cx\Core\Html\Sigma                           $objTpl         Template instance
  * @param \Cx\Modules\Calendar\Controller\CalendarEvent $event          Event instance
  * @param string                                        $hostUri        Host uri of the event(internal/external)
  * @param string                                        $hostTarget     Host uri target type (_blank/null)
  *
  * @return null
  */
 public function parseRegistrationPlaceholders(\Cx\Core\Html\Sigma $objTpl, CalendarEvent $event, $hostUri = '', $hostTarget = '')
 {
     global $_ARRAYLANG;
     $numRegistrations = contrexx_input2int($event->getRegistrationCount());
     $numDeregistration = contrexx_input2int($event->getCancellationCount());
     $objEscortManager = new \Cx\Modules\Calendar\Controller\CalendarRegistrationManager($event, true, false);
     $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_COUNT_REG' => $numRegistrations, $this->moduleLangVar . '_EVENT_COUNT_SIGNOFF' => $numDeregistration, $this->moduleLangVar . '_EVENT_COUNT_SUBSCRIBER' => $objEscortManager->getEscortData(), $this->moduleLangVar . '_REGISTRATIONS_SUBSCRIBER' => $event->numSubscriber));
     // Only link to registration form if event registration is set up and event lies in the future
     if (!$event->registration || time() > $event->startDate->getTimestamp()) {
         $objTpl->hideBlock('calendarEventRegistration');
         return;
     }
     // Only show registration form if event accepts registrations.
     // Event accepts registrations, if
     //     - no attendee limit is set
     //     - or if there are still free places available
     $registrationOpen = true;
     $regLinkTarget = '_self';
     if ($event->registration == CalendarEvent::EVENT_REGISTRATION_EXTERNAL && !$event->registrationExternalFullyBooked || $event->registration == CalendarEvent::EVENT_REGISTRATION_INTERNAL && (empty($event->numSubscriber) || !\FWValidator::isEmpty($event->getFreePlaces()))) {
         if ($event->registration == CalendarEvent::EVENT_REGISTRATION_EXTERNAL) {
             $regLinkSrc = \FWValidator::getUrl($event->registrationExternalLink);
             $regLinkTarget = '_blank';
         } elseif ($hostUri) {
             $regLinkSrc = $hostUri . '/' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '&cmd=register&id=' . $event->id . '&date=' . $event->startDate->getTimestamp();
         } else {
             $params = array('id' => $event->id, 'date' => $event->startDate->getTimestamp());
             $regLinkSrc = \Cx\Core\Routing\Url::fromModuleAndCmd($this->moduleName, 'register', FRONTEND_LANG_ID, $params)->toString();
         }
         $regLink = '<a href="' . $regLinkSrc . '" ' . $hostTarget . '>' . $_ARRAYLANG['TXT_CALENDAR_REGISTRATION'] . '</a>';
     } else {
         $regLink = '<i>' . $_ARRAYLANG['TXT_CALENDAR_EVENT_FULLY_BLOCKED'] . '</i>';
         $regLinkSrc = '';
         $registrationOpen = false;
     }
     $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_REGISTRATION_LINK' => $regLink, $this->moduleLangVar . '_EVENT_REGISTRATION_LINK_SRC' => $regLinkSrc, $this->moduleLangVar . '_EVENT_REGISTRATION_LINK_TARGET' => $regLinkTarget));
     if ($objTpl->blockExists('calendarEventRegistrationOpen')) {
         if ($registrationOpen) {
             $objTpl->touchBlock('calendarEventRegistrationOpen');
         } else {
             $objTpl->hideBlock('calendarEventRegistrationOpen');
         }
     }
     if ($objTpl->blockExists('calendarEventRegistrationClosed')) {
         if (!$registrationOpen) {
             $objTpl->touchBlock('calendarEventRegistrationClosed');
         } else {
             $objTpl->hideBlock('calendarEventRegistrationClosed');
         }
     }
     $objTpl->parse('calendarEventRegistration');
 }
 /**
  * Sets the placeholders used for the event
  * 
  * @param object  $objTpl         Template object
  * @param integer $eventId        Event Id
  * @param integer $eventStartDate Description
  * 
  * @return null
  */
 function showEvent($objTpl, $eventId, $eventStartDate)
 {
     global $objInit, $_ARRAYLANG, $_LANGID, $_CONFIG;
     parent::getSettings();
     if ($objInit->mode == 'frontend' && ($eventId != null && $eventStartDate != null)) {
         $objEvent = $this->eventList[0];
         if (empty($objEvent)) {
             \Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?section=" . $this->moduleName);
             return;
         }
         if ($objEvent->access == 1 && !\FWUser::getFWUserObject()->objUser->login()) {
             $link = base64_encode(CONTREXX_SCRIPT_PATH . '?' . $_SERVER['QUERY_STRING']);
             \Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_SCRIPT_PATH . "?section=Login&redirect=" . $link);
             return;
         }
         $objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory($objEvent->catId);
         list($priority, $priorityImg) = $this->getPriorityImage($objEvent);
         $plainDescription = contrexx_html2plaintext($objEvent->description);
         if (strlen($plainDescription) > 100) {
             $points = '...';
         } else {
             $points = '';
         }
         $parts = explode("\n", wordwrap($plainDescription, 100, "\n"));
         $attachNamePos = strrpos($objEvent->attach, '/');
         $attachNamelength = strlen($objEvent->attach);
         $attachName = substr($objEvent->attach, $attachNamePos + 1, $attachNamelength);
         $hostUri = '';
         $hostTarget = '';
         if ($objEvent->external) {
             $objHost = new \Cx\Modules\Calendar\Controller\CalendarHost($objEvent->hostId);
             if (substr($objHost->uri, -1) != '/') {
                 $hostUri = $objHost->uri . '/';
             } else {
                 $hostUri = $objHost->uri;
             }
             if (substr($hostUri, 0, 7) != 'http://') {
                 $hostUri = "http://" . $hostUri;
             }
             $hostTarget = 'target="_blank"';
         }
         if ($this->arrSettings['showEventsOnlyInActiveLanguage'] == 2) {
             $_LANGID = $objEvent->availableLang;
         }
         $picThumb = file_exists(\Env::get('cx')->getWebsitePath() . $objEvent->pic . ".thumb") ? $objEvent->pic . ".thumb" : $objEvent->pic;
         $numRegistrations = (int) $objEvent->registrationCount;
         $numDeregistration = (int) $objEvent->cancellationCount;
         $objEscortManager = new \Cx\Modules\Calendar\Controller\CalendarRegistrationManager($objEvent->id, true, false);
         $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_ID' => $objEvent->id, $this->moduleLangVar . '_EVENT_START' => date(parent::getDateFormat() . " H:i", $objEvent->startDate), $this->moduleLangVar . '_EVENT_END' => date(parent::getDateFormat() . " H:i", $objEvent->endDate), $this->moduleLangVar . '_EVENT_START_DATE' => date(parent::getDateFormat(), $objEvent->startDate), $this->moduleLangVar . '_EVENT_START_TIME' => date("H:i", $objEvent->startDate), $this->moduleLangVar . '_EVENT_END_DATE' => date(parent::getDateFormat(), $objEvent->endDate), $this->moduleLangVar . '_EVENT_END_TIME' => date("H:i", $objEvent->endDate), $this->moduleLangVar . '_EVENT_TITLE' => $objEvent->title, $this->moduleLangVar . '_EVENT_ATTACHMENT' => $objEvent->attach != '' ? '<a href="' . $hostUri . $objEvent->attach . '" target="_blank" >' . $attachName . '</a>' : '', $this->moduleLangVar . '_EVENT_ATTACHMENT_SOURCE' => $objEvent->attach, $this->moduleLangVar . '_EVENT_PICTURE' => $objEvent->pic != '' ? '<img src="' . $hostUri . $objEvent->pic . '" alt="' . $objEvent->title . '" title="' . $objEvent->title . '" />' : '', $this->moduleLangVar . '_EVENT_PICTURE_SOURCE' => $objEvent->pic, $this->moduleLangVar . '_EVENT_THUMBNAIL' => $picThumb != '' ? '<img src="' . $hostUri . $picThumb . '" alt="' . $objEvent->title . '" title="' . $objEvent->title . '" />' : '', $this->moduleLangVar . '_EVENT_DESCRIPTION' => $objEvent->description, $this->moduleLangVar . '_EVENT_SHORT_DESCRIPTION' => $parts[0] . $points, $this->moduleLangVar . '_EVENT_PRIORITY' => $priority, $this->moduleLangVar . '_EVENT_PRIORITY_IMG' => $priorityImg, $this->moduleLangVar . '_EVENT_CATEGORY' => $objCategory->name, $this->moduleLangVar . '_EVENT_EXPORT_LINK' => $hostUri . 'index.php?section=' . $this->moduleName . '&amp;export=' . $objEvent->id, $this->moduleLangVar . '_EVENT_EXPORT_ICON' => '<a href="' . $hostUri . 'index.php?section=' . $this->moduleName . '&amp;export=' . $objEvent->id . '"><img src="modules/Calendar/View/Media/ical_export.gif" border="0" title="' . $_ARRAYLANG['TXT_CALENDAR_EXPORT_ICAL_EVENT'] . '" alt="' . $_ARRAYLANG['TXT_CALENDAR_EXPORT_ICAL_EVENT'] . '" /></a>', $this->moduleLangVar . '_EVENT_PRICE' => $this->arrSettings['paymentCurrency'] . ' ' . $objEvent->price, $this->moduleLangVar . '_EVENT_FREE_PLACES' => $objEvent->freePlaces == 0 ? $objEvent->freePlaces . ' (' . $_ARRAYLANG['TXT_CALENDAR_SAVE_IN_WAITLIST'] . ')' : $objEvent->freePlaces, $this->moduleLangVar . '_EVENT_ACCESS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ACCESS_' . $objEvent->access], $this->moduleLangVar . '_EVENT_COUNT_REG' => $numRegistrations, $this->moduleLangVar . '_EVENT_COUNT_SIGNOFF' => $numDeregistration, $this->moduleLangVar . '_EVENT_COUNT_SUBSCRIBER' => $objEscortManager->getEscortData(), $this->moduleLangVar . '_REGISTRATIONS_SUBSCRIBER' => $objEvent->numSubscriber));
         //show date and time by user settings
         if ($objTpl->blockExists('calendarDateDetail')) {
             $showStartDateDetail = $objEvent->useCustomDateDisplay ? $objEvent->showStartDateDetail : $this->arrSettings['showStartDateDetail'] == 1;
             $showEndDateDetail = $objEvent->useCustomDateDisplay ? $objEvent->showEndDateDetail : $this->arrSettings['showEndDateDetail'] == 1;
             $showStartTimeDetail = $objEvent->all_day ? false : ($objEvent->useCustomDateDisplay ? $objEvent->showStartTimeDetail : $this->arrSettings['showStartTimeDetail'] == 1);
             $showEndTimeDetail = $objEvent->all_day ? false : ($objEvent->useCustomDateDisplay ? $objEvent->showEndTimeDetail : $this->arrSettings['showEndTimeDetail'] == 1);
             $showTimeTypeDetail = $objEvent->useCustomDateDisplay ? $objEvent->showTimeTypeDetail : 1;
             // get date for several days format > show starttime with startdate and endtime with enddate > only if several days event and all values (dates/times) are displayed
             if (date(parent::getDateFormat(), $objEvent->startDate) != date(parent::getDateFormat(), $objEvent->endDate) && ($showStartDateDetail && $showEndDateDetail && $showStartTimeDetail && $showEndTimeDetail)) {
                 //part 1
                 $part = 1;
                 $this->getMultiDateBlock($objEvent, $this->arrSettings['separatorDateTimeDetail'], $this->arrSettings['separatorSeveralDaysDetail'], $this->arrSettings['showClockDetail'] == 1, $part);
                 $objTpl->setVariable(array($this->moduleLangVar . '_DATE_DETAIL' => $this->date, $this->moduleLangVar . '_SEP_DATE_TIME_DETAIL' => $this->sepDateTime, $this->moduleLangVar . '_TIME_DETAIL' => $this->time, 'TXT_' . $this->moduleLangVar . '_CLOCK_DETAIL' => $this->clock));
                 $objTpl->parse('calendarDateDetail');
                 //part 2
                 $part = 2;
                 $this->getMultiDateBlock($objEvent, $this->arrSettings['separatorDateTimeDetail'], $this->arrSettings['separatorSeveralDaysDetail'], $this->arrSettings['showClockDetail'] == 1, $part);
                 $objTpl->setVariable(array($this->moduleLangVar . '_DATE_DETAIL' => $this->date, $this->moduleLangVar . '_SEP_DATE_TIME_DETAIL' => $this->sepDateTime, $this->moduleLangVar . '_TIME_DETAIL' => $this->time, 'TXT_' . $this->moduleLangVar . '_CLOCK_DETAIL' => $this->clock));
                 $objTpl->parse('calendarDateDetail');
             } else {
                 // get date for single day format
                 $this->getSingleDateBlock($objEvent, $showStartDateDetail, $showEndDateDetail, $this->arrSettings['separatorDateDetail'], $showTimeTypeDetail, $showStartTimeDetail, $showEndTimeDetail, $this->arrSettings['separatorDateTimeDetail'], $this->arrSettings['separatorTimeDetail'], $this->arrSettings['showClockDetail'] == 1);
                 $objTpl->setVariable(array($this->moduleLangVar . '_DATE_DETAIL' => $this->date, $this->moduleLangVar . '_SEP_DATE_TIME_DETAIL' => $this->sepDateTime, $this->moduleLangVar . '_TIME_DETAIL' => $this->time, 'TXT_' . $this->moduleLangVar . '_CLOCK_DETAIL' => $this->clock));
                 $objTpl->parse('calendarDateDetail');
             }
         }
         if ($this->arrSettings['placeData'] == 1 && $objEvent->place == '' && $objEvent->place_street == '' && $objEvent->place_zip == '' && $objEvent->place_city == '' && $objEvent->place_country == '') {
             $objTpl->hideBlock('calendarEventAddress');
         } else {
             /* if($objEvent->map == 1) { 
                    $googleCoordinates = self::_getCoorinates($objEvent->place_street, $objEvent->place_zip, $objEvent->place_city);
                    if($googleCoordinates != false) {
                        $lat = $googleCoordinates[0];
                        $lon = $googleCoordinates[1];  
                                             
                        $objGoogleMap = new googleMap();
                        $objGoogleMap->setMapId($this->moduleName.'GoogleMap');
                        $objGoogleMap->setMapStyleClass('mapLarge');
                        $objGoogleMap->setMapType(0);                                                          
                        $objGoogleMap->setMapZoom(12);
                        $objGoogleMap->setMapCenter($lon, $lat);   
                        
                        $strValueClick = 'marker'.$objEvent->id.'.openInfoWindowHtml(info'.$objEvent->id.');';   
                        $objGoogleMap->addMapMarker($objEvent->id, $lon, $lat, "<b>".$objEvent->place."</b><br />".$objEvent->place_street."<br />".$objEvent->place_zip." ".$objEvent->place_city."<br />".$objEvent->place_country,true, null, true, $strValueClick, null, null);   
                        
                        $googleMap = $objGoogleMap->getMap();
                    } else {
                        $googleMap = '<a href="http://maps.google.ch/maps?q='.$objEvent->place_street.'+'.$objEvent->place_zip.'+'.$objEvent->place_city.'&z=15" target="_blank">'.$_ARRAYLANG['TXT_CALENDAR_MAP'].'</a>';
                    }
                } else {
                    $googleMap = '';
                } */
             //place map
             $hasPlaceMap = !empty($objEvent->place_map) && file_exists(\Env::get('cx')->getWebsitePath() . $objEvent->place_map);
             if ($hasPlaceMap) {
                 $arrInfo = getimagesize(\Env::get('cx')->getWebsitePath() . $objEvent->place_map);
                 $picWidth = $arrInfo[0] + 20;
                 $picHeight = $arrInfo[1] + 20;
             }
             $map_thumb_name = file_exists(\Env::get('cx')->getWebsitePath() . $objEvent->place_map . ".thumb") ? $objEvent->place_map . ".thumb" : $objEvent->place_map;
             $placeLink = $objEvent->place_link != '' ? "<a href='" . $objEvent->place_link . "' target='_blank' >" . $objEvent->place_link . "</a>" : "";
             $placeLinkSource = $objEvent->place_link;
             if ($this->arrSettings['placeData'] > 1 && $objEvent->locationType == 2) {
                 $objEvent->loadPlaceFromMediadir($objEvent->place_mediadir_id, 'place');
                 list($placeLink, $placeLinkSource) = $objEvent->loadPlaceLinkFromMediadir($objEvent->place_mediadir_id, 'place');
             }
             $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PLACE' => $objEvent->place, $this->moduleLangVar . '_EVENT_LOCATION_ADDRESS' => $objEvent->place_street, $this->moduleLangVar . '_EVENT_LOCATION_ZIP' => $objEvent->place_zip, $this->moduleLangVar . '_EVENT_LOCATION_CITY' => $objEvent->place_city, $this->moduleLangVar . '_EVENT_LOCATION_COUNTRY' => $objEvent->place_country, $this->moduleLangVar . '_EVENT_LOCATION_LINK' => $placeLink, $this->moduleLangVar . '_EVENT_LOCATION_LINK_SOURCE' => $placeLinkSource, $this->moduleLangVar . '_EVENT_LOCATION_MAP_LINK' => $hasPlaceMap ? '<a href="' . $objEvent->place_map . '" onClick="window.open(this.href,\'\',\'resizable=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width=' . $picWidth . ',height=' . $picHeight . ',status\'); return false">' . $_ARRAYLANG['TXT_CALENDAR_MAP'] . '</a>' : "", $this->moduleLangVar . '_EVENT_LOCATION_MAP_THUMBNAIL' => $hasPlaceMap ? '<a href="' . $objEvent->place_map . '" onClick="window.open(this.href,\'\',\'resizable=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width=' . $picWidth . ',height=' . $picHeight . ',status\'); return false"><img src="' . $map_thumb_name . '" border="0" alt="' . $objEvent->place_map . '" /></a>' : "", $this->moduleLangVar . '_EVENT_LOCATION_MAP_SOURCE' => $hasPlaceMap ? $objEvent->place_map : ''));
             $objTpl->parse('calendarEventAddress');
         }
         $hostLink = $objEvent->org_link != '' ? "<a href='" . $objEvent->org_link . "' target='_blank' >" . $objEvent->org_link . "</a>" : "";
         $hostLinkSource = $objEvent->org_link;
         if ($this->arrSettings['placeDataHost'] > 1 && $objEvent->hostType == 2) {
             $objEvent->loadPlaceFromMediadir($objEvent->host_mediadir_id, 'host');
             list($hostLink, $hostLinkSource) = $objEvent->loadPlaceLinkFromMediadir($objEvent->host_mediadir_id, 'host');
         }
         if ($this->arrSettings['placeDataHost'] == 1 && $objEvent->org_name == '' && $objEvent->org_street == '' && $objEvent->org_zip == '' && $objEvent->org_city == '' && $objEvent->org_country == '') {
             $objTpl->hideBlock('calendarEventHost');
         } else {
             $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_HOST' => $objEvent->org_name, $this->moduleLangVar . '_EVENT_HOST_ADDRESS' => $objEvent->org_street, $this->moduleLangVar . '_EVENT_HOST_ZIP' => $objEvent->org_zip, $this->moduleLangVar . '_EVENT_HOST_CITY' => $objEvent->org_city, $this->moduleLangVar . '_EVENT_HOST_COUNTRY' => $objEvent->org_country, $this->moduleLangVar . '_EVENT_HOST_LINK' => $hostLink, $this->moduleLangVar . '_EVENT_HOST_LINK_SOURCE' => $hostLinkSource, $this->moduleLangVar . '_EVENT_HOST_EMAIL' => $objEvent->org_email != '' ? "<a href='mailto:" . $objEvent->org_email . "' >" . $objEvent->org_email . "</a>" : "", $this->moduleLangVar . '_EVENT_HOST_EMAIL_SOURCE' => $objEvent->org_email));
             $objTpl->parse('calendarEventHost');
         }
         if ($objEvent->registration == 1 && time() <= $objEvent->startDate) {
             if ($numRegistrations < $objEvent->numSubscriber || $objEvent->external == 1) {
                 $regLinkSrc = $hostUri . '/' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '&amp;cmd=register&amp;id=' . $objEvent->id . '&amp;date=' . $objEvent->startDate;
                 $regLink = '<a href="' . $regLinkSrc . '" ' . $hostTarget . '>' . $_ARRAYLANG['TXT_CALENDAR_REGISTRATION'] . '</a>';
                 $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_REGISTRATION_LINK' => $regLink, $this->moduleLangVar . '_EVENT_REGISTRATION_LINK_SRC' => $regLinkSrc));
                 if ($objTpl->blockExists('calendarEventRegistrationOpen')) {
                     $objTpl->parse('calendarEventRegistrationOpen');
                 }
                 if ($objTpl->blockExists('calendarEventRegistrationClosed')) {
                     $objTpl->hideBlock('calendarEventRegistrationClosed');
                 }
             } else {
                 $regLink = '<i>' . $_ARRAYLANG['TXT_CALENDAR_EVENT_FULLY_BLOCKED'] . '</i>';
                 $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_REGISTRATION_LINK' => $regLink));
                 if ($objTpl->blockExists('calendarEventRegistrationOpen')) {
                     $objTpl->hideBlock('calendarEventRegistrationOpen');
                 }
                 if ($objTpl->blockExists('calendarEventRegistrationClosed')) {
                     $objTpl->touchBlock('calendarEventRegistrationClosed');
                 }
             }
             $objTpl->parse('calendarEventRegistration');
         } else {
             $objTpl->hideBlock('calendarEventRegistration');
         }
     }
 }
 /**
  * Add / Edit registration
  *
  * @param integer $eventId Event id
  * @param integer $regId   Rgistration id
  */
 function modifyRegistration($eventId, $regId)
 {
     global $objDatabase, $_ARRAYLANG;
     $this->_objTpl->loadTemplateFile('module_calendar_modify_registration.html');
     if (isset($_POST['submitModifyRegistration'])) {
         $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration(intval($_POST['form']));
         if ($objRegistration->save($_POST)) {
             switch ($_POST['registrationType']) {
                 case 0:
                     $tpl = 'd';
                     break;
                 case 1:
                 default:
                     $tpl = 'r';
                     break;
                 case 2:
                     $tpl = 'w';
                     break;
             }
             $tpl = !empty($_POST['regtpl']) ? $_POST['regtpl'] : $tpl;
             $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUCCESSFULLY_SAVED'];
             \Cx\Core\Csrf\Controller\Csrf::redirect('index.php?cmd=' . $this->moduleName . '&act=event_registrations&tpl=' . $tpl . '&id=' . $eventId);
         } else {
             $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_CORRUPT_SAVED'];
         }
     }
     $objFWUser = \FWUser::getFWUserObject();
     $objUser = $objFWUser->objUser;
     $userId = intval($objUser->getId());
     $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent($eventId);
     if ($regId != 0) {
         $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_EVENT_EDIT_REGISTRATION'];
         $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration($objEvent->registrationForm, $regId);
     } else {
         $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_EVENT_INSERT_REGISTRATION'];
         $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration($objEvent->registrationForm);
     }
     $objRegistrationManager = new \Cx\Modules\Calendar\Controller\CalendarRegistrationManager($objEvent, true, true, true);
     $objRegistrationManager->showRegistrationInputfields($this->_objTpl, $regId);
     $this->getSettings();
     if ($this->arrSettings['paymentStatus'] == '1' && ($this->arrSettings['paymentBillStatus'] == '1' || $this->arrSettings['paymentYellowpayStatus'] == '1')) {
         $selectedBill = $objRegistration->paymentMethod == 1 ? 'selected="selected"' : '';
         $selectedYellowpay = $objRegistration->paymentMethod == 2 ? 'selected="selected"' : '';
         $paymentMethods = '<select style="width: 204px;" class="calendarSelect" name="paymentMethod">';
         $paymentMethods .= $this->arrSettings['paymentBillStatus'] == '1' ? '<option value="1" ' . $selectedBill . '>' . $_ARRAYLANG['TXT_CALENDAR_PAYMENT_BILL'] . '</option>' : '';
         $paymentMethods .= $this->arrSettings['paymentYellowpayStatus'] == '1' ? '<option value="2" ' . $selectedYellowpay . '>' . $_ARRAYLANG['TXT_CALENDAR_PAYMENT_YELLOWPAY'] . '</option>' : '';
         $paymentMethods .= '</select>';
         $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_PAYMENT_METHOD' => $_ARRAYLANG['TXT_CALENDAR_PAYMENT_METHOD'], 'TXT_' . $this->moduleLangVar . '_PAID' => $_ARRAYLANG['TXT_PAYMENT_COMPLETED'], $this->moduleLangVar . '_PAYMENT_METHODS' => $paymentMethods, $this->moduleLangVar . '_PAID' => $objRegistration->paid == true ? " checked='checked'" : ""));
         $this->_objTpl->parse('calendarRegistrationPayment');
     } else {
         $this->_objTpl->hideBlock('calendarRegistrationPayment');
     }
     $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_REGISTRATION_TITLE' => $this->_pageTitle, 'TXT_' . $this->moduleLangVar . '_SAVE' => $_ARRAYLANG['TXT_CALENDAR_SAVE'], 'TXT_' . $this->moduleLangVar . '_BACK' => $_ARRAYLANG['TXT_CALENDAR_BACK'], $this->moduleLangVar . '_EVENT_ID' => $eventId, $this->moduleLangVar . '_REGISTRATION_TPL' => $_GET['tpl'], $this->moduleLangVar . '_REGISTRATION_ID' => $regId, $this->moduleLangVar . '_REGISTRATION_TYPE' => $objRegistration->type, $this->moduleLangVar . '_FORM_ID' => $objEvent->registrationForm, $this->moduleLangVar . '_EVENT_DATE' => $objEvent->startDate->getTimestamp(), $this->moduleLangVar . '_USER_ID' => $userId));
     \Cx\Core\Core\Controller\Cx::instanciate()->getComponent('Cache')->deleteComponentFiles('Calendar');
 }