Exemple #1
0
 /**
  * Display the success page
  * 
  * @return null
  */
 function showSuccessPage()
 {
     $this->_objTpl->setTemplate($this->pageContent, true, true);
     if ($_REQUEST["handler"] == "yellowpay") {
         $orderId = \Yellowpay::getOrderId();
         $this->getSettings();
         if (\Yellowpay::checkin($this->arrSettings["paymentYellowpayShaOut"])) {
             switch (abs($_REQUEST["result"])) {
                 case 2:
                     // fehler aufgetreten
                     $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration(null);
                     $objRegistration->delete($orderId);
                     $this->_objTpl->touchBlock("cancelMessage");
                     break;
                 case 1:
                     // erfolgreich
                     $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration(null);
                     $objRegistration->get($orderId);
                     $objRegistration->setPaid(1);
                     $this->_objTpl->touchBlock("successMessage");
                     break;
                 case 0:
                     // abgebrochen
                     $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration(null);
                     $objRegistration->delete($orderId);
                     $this->_objTpl->touchBlock("cancelMessage");
                     break;
                 default:
                     \Cx\Core\Csrf\Controller\Csrf::redirect("index.php?section=" . $this->moduleName);
                     break;
             }
         } else {
             \Cx\Core\Csrf\Controller\Csrf::redirect("index.php?section=" . $this->moduleName);
             return;
         }
     } else {
         \Cx\Core\Csrf\Controller\Csrf::redirect("index.php?section=" . $this->moduleName);
         return;
     }
 }
 /**
  * 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');
 }