コード例 #1
0
 /**
  * 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');
 }
コード例 #2
0
ファイル: Calendar.class.php プロジェクト: Niggu/cloudrexx
 /**
  * performs the registratio page
  * 
  * @return null
  */
 function showRegistrationForm()
 {
     global $_ARRAYLANG, $_CORELANG;
     $this->_objTpl->setTemplate($this->pageContent, true, true);
     $objFWUser = \FWUser::getFWUserObject();
     $objUser = $objFWUser->objUser;
     $userId = intval($objUser->getId());
     $userLogin = $objUser->login();
     $captchaCheck = true;
     if (!$userLogin && isset($_POST['submitRegistration'])) {
         $captchaCheck = \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check();
         if (!$captchaCheck) {
             $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_ERROR' => '<span class="text-danger">' . $_ARRAYLANG['TXT_CALENDAR_INVALID_CAPTCHA_CODE'] . '</span>'));
         }
     }
     $objEvent = $this->objEventManager->eventList[0];
     if (empty($objEvent)) {
         \Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd($this->moduleName, ''));
         return;
     }
     if (!$objEvent->status) {
         \Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd($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::redirect(CONTREXX_SCRIPT_PATH . "?section=Login&redirect=" . $link);
         return;
     }
     $dateForPageTitle = $objEvent->startDate;
     $this->pageTitle = $this->format2userDate($dateForPageTitle) . ": " . html_entity_decode($objEvent->title, ENT_QUOTES, CONTREXX_CHARSET);
     // Only show registration form if event lies in the future
     if (time() <= $objEvent->startDate->getTimestamp()) {
         // Only show registration form if event accepts registrations.
         // Event accepts registrations, if registration is set up and
         //     - no attendee limit is set
         //     - or if there are still free places available
         if ($objEvent->registration == CalendarEvent::EVENT_REGISTRATION_INTERNAL && (empty($objEvent->numSubscriber) || !\FWValidator::isEmpty($objEvent->getFreePlaces()))) {
             $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_ID' => intval($_REQUEST['id']), $this->moduleLangVar . '_FORM_ID' => intval($objEvent->registrationForm), $this->moduleLangVar . '_EVENT_DATE' => intval($_REQUEST['date']), $this->moduleLangVar . '_USER_ID' => $userId, 'TXT_' . $this->moduleLangVar . '_REGISTRATION_SUBMIT' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUBMIT']));
             $objFormManager = new \Cx\Modules\Calendar\Controller\CalendarFormManager();
             $objFormManager->setEvent($objEvent);
             $objFormManager->getFormList();
             //$objFormManager->showForm($this->_objTpl,intval($objEvent->registrationForm), 2, $objEvent->ticketSales);
             // Made the ticket sales always true, because ticket functionality currently not implemented
             $objFormManager->showForm($this->_objTpl, intval($objEvent->registrationForm), 2, true);
             /* if ($this->arrSettings['paymentStatus'] == '1' && $objEvent->ticketSales && ($this->arrSettings['paymentBillStatus'] == '1' || $this->arrSettings['paymentYellowpayStatus'] == '1')) {
                                 $paymentMethods  = '<select class="calendarSelect" name="paymentMethod">';
                                 $paymentMethods .= $this->arrSettings['paymentBillStatus'] == '1' || $objEvent->price == 0 ? '<option value="1">'.$_ARRAYLANG['TXT_CALENDAR_PAYMENT_BILL'].'</option>'  : '';
                                 $paymentMethods .= $this->arrSettings['paymentYellowpayStatus'] == '1' && $objEvent->price > 0 ? '<option value="2">'.$_ARRAYLANG['TXT_CALENDAR_PAYMENT_YELLOWPAY'].'</option>' : '';
                                 $paymentMethods .= '</select>';
             
                                 $this->_objTpl->setVariable(array(
                                     'TXT_'.$this->moduleLangVar.'_PAYMENT_METHOD' => $_ARRAYLANG['TXT_CALENDAR_PAYMENT_METHOD'],
                                     $this->moduleLangVar.'_PAYMENT_METHODS'       => $paymentMethods,
                                 ));
                                 $this->_objTpl->parse('calendarRegistrationPayment');
                             } else {
                                 $this->_objTpl->hideBlock('calendarRegistrationPayment');
                             } */
             if (!$userLogin) {
                 $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], $this->moduleLangVar . '_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode()));
                 $this->_objTpl->parse('calendarRegistrationCaptcha');
             } else {
                 $this->_objTpl->hideBlock('calendarRegistrationCaptcha');
             }
             if (isset($_POST['submitRegistration']) && $captchaCheck) {
                 $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration(intval($_POST['form']));
                 if ($objRegistration->save($_POST)) {
                     if ($objRegistration->saveIn == 2) {
                         $status = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUCCESSFULLY_ADDED_WAITLIST'];
                     } else {
                         if ($objRegistration->saveIn == 0) {
                             $status = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUCCESSFULLY_ADDED_SIGNOFF'];
                         } else {
                             $status = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUCCESSFULLY_ADDED'];
                             /* if($_POST["paymentMethod"] == 2) {
                                    $objRegistration->get($objRegistration->id);
                                    $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent($objRegistration->eventId);                                
                                    $this->getSettings();
                                    $amount  = (int) $objEvent->price * 100;
                                    $status .= \Cx\Modules\Calendar\Controller\CalendarPayment::_yellowpay(array("orderID" => $objRegistration->id, "amount" => $amount, "currency" => $this->arrSettings["paymentCurrency"], "language" => "DE"));
                                } */
                         }
                     }
                     $this->_objTpl->setVariable(array($this->moduleLangVar . '_LINK_BACK' => '<a href="' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '">' . $_ARRAYLANG['TXT_CALENDAR_BACK'] . '</a>', $this->moduleLangVar . '_REGISTRATION_STATUS' => $status));
                     $this->_objTpl->touchBlock('calendarRegistrationStatus');
                     $this->_objTpl->hideBlock('calendarRegistrationForm');
                 } else {
                     $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_ERROR' => '<span class="text-danger">' . $_ARRAYLANG['TXT_CALENDAR_CHECK_REQUIRED'] . '</span>'));
                     $this->_objTpl->parse('calendarRegistrationForm');
                     $this->_objTpl->hideBlock('calendarRegistrationStatus');
                 }
             } else {
                 $this->_objTpl->parse('calendarRegistrationForm');
                 $this->_objTpl->hideBlock('calendarRegistrationStatus');
             }
         } else {
             $this->_objTpl->setVariable(array($this->moduleLangVar . '_LINK_BACK' => '<a href="' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '">' . $_ARRAYLANG['TXT_CALENDAR_BACK'] . '</a>', $this->moduleLangVar . '_REGISTRATION_STATUS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_FULLY_BLOCKED']));
             $this->_objTpl->touchBlock('calendarRegistrationStatus');
             $this->_objTpl->hideBlock('calendarRegistrationForm');
         }
     } else {
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_LINK_BACK' => '<a href="' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '">' . $_ARRAYLANG['TXT_CALENDAR_BACK'] . '</a>', $this->moduleLangVar . '_REGISTRATION_STATUS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_IN_PAST']));
         $this->_objTpl->touchBlock('calendarRegistrationStatus');
         $this->_objTpl->hideBlock('calendarRegistrationForm');
     }
 }
コード例 #3
0
 /**
  * performs the registratio page
  * 
  * @return null
  */
 function showRegistrationForm()
 {
     global $_ARRAYLANG, $_CORELANG;
     $this->_objTpl->setTemplate($this->pageContent, true, true);
     $objFWUser = \FWUser::getFWUserObject();
     $objUser = $objFWUser->objUser;
     $userId = intval($objUser->getId());
     $userLogin = $objUser->login();
     $captchaCheck = true;
     if (!$userLogin && isset($_POST['submitRegistration'])) {
         $captchaCheck = \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check();
         if (!$captchaCheck) {
             $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_ERROR' => '<span class="text-danger">' . $_ARRAYLANG['TXT_CALENDAR_INVALID_CAPTCHA_CODE'] . '</span>'));
         }
     }
     $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent(intval($_REQUEST['id']));
     $numRegistrations = (int) $objEvent->registrationCount;
     $this->pageTitle = date("d.m.Y", isset($_GET['date']) ? $_GET['date'] : $objEvent->startDate) . ": " . html_entity_decode($objEvent->title, ENT_QUOTES, CONTREXX_CHARSET);
     if (time() <= intval($_REQUEST['date'])) {
         if ($numRegistrations < $objEvent->numSubscriber) {
             $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_ID' => intval($_REQUEST['id']), $this->moduleLangVar . '_FORM_ID' => intval($objEvent->registrationForm), $this->moduleLangVar . '_EVENT_DATE' => intval($_REQUEST['date']), $this->moduleLangVar . '_USER_ID' => $userId, 'TXT_' . $this->moduleLangVar . '_REGISTRATION_SUBMIT' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUBMIT']));
             $objFormManager = new \Cx\Modules\Calendar\Controller\CalendarFormManager();
             $objFormManager->getFormList();
             //$objFormManager->showForm($this->_objTpl,intval($objEvent->registrationForm), 2, $objEvent->ticketSales);
             // Made the ticket sales always true, because ticket functionality currently not implemented
             $objFormManager->showForm($this->_objTpl, intval($objEvent->registrationForm), 2, true);
             /* if ($this->arrSettings['paymentStatus'] == '1' && $objEvent->ticketSales && ($this->arrSettings['paymentBillStatus'] == '1' || $this->arrSettings['paymentYellowpayStatus'] == '1')) {
                                 $paymentMethods  = '<select class="calendarSelect" name="paymentMethod">';
                                 $paymentMethods .= $this->arrSettings['paymentBillStatus'] == '1' || $objEvent->price == 0 ? '<option value="1">'.$_ARRAYLANG['TXT_CALENDAR_PAYMENT_BILL'].'</option>'  : '';
                                 $paymentMethods .= $this->arrSettings['paymentYellowpayStatus'] == '1' && $objEvent->price > 0 ? '<option value="2">'.$_ARRAYLANG['TXT_CALENDAR_PAYMENT_YELLOWPAY'].'</option>' : '';
                                 $paymentMethods .= '</select>';
             
                                 $this->_objTpl->setVariable(array(
                                     'TXT_'.$this->moduleLangVar.'_PAYMENT_METHOD' => $_ARRAYLANG['TXT_CALENDAR_PAYMENT_METHOD'],
                                     $this->moduleLangVar.'_PAYMENT_METHODS'       => $paymentMethods,
                                 ));
                                 $this->_objTpl->parse('calendarRegistrationPayment');
                             } else {
                                 $this->_objTpl->hideBlock('calendarRegistrationPayment');
                             } */
             if (!$userLogin) {
                 $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], $this->moduleLangVar . '_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode()));
                 $this->_objTpl->parse('calendarRegistrationCaptcha');
             } else {
                 $this->_objTpl->hideBlock('calendarRegistrationCaptcha');
             }
             if (isset($_POST['submitRegistration']) && $captchaCheck) {
                 $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration(intval($_POST['form']));
                 if ($objRegistration->save($_POST)) {
                     if ($objRegistration->saveIn == 2) {
                         $status = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUCCESSFULLY_ADDED_WAITLIST'];
                     } else {
                         if ($objRegistration->saveIn == 0) {
                             $status = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUCCESSFULLY_ADDED_SIGNOFF'];
                         } else {
                             $status = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUCCESSFULLY_ADDED'];
                             /* if($_POST["paymentMethod"] == 2) {
                                    $objRegistration->get($objRegistration->id);
                                    $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent($objRegistration->eventId);                                
                                    parent::getSettings();
                                    $amount  = (int) $objEvent->price * 100;
                                    $status .= \Cx\Modules\Calendar\Controller\CalendarPayment::_yellowpay(array("orderID" => $objRegistration->id, "amount" => $amount, "currency" => $this->arrSettings["paymentCurrency"], "language" => "DE"));
                                } */
                         }
                     }
                     $this->_objTpl->setVariable(array($this->moduleLangVar . '_LINK_BACK' => '<a href="' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '">' . $_ARRAYLANG['TXT_CALENDAR_BACK'] . '</a>', $this->moduleLangVar . '_REGISTRATION_STATUS' => $status));
                     $this->_objTpl->touchBlock('calendarRegistrationStatus');
                     $this->_objTpl->hideBlock('calendarRegistrationForm');
                 } else {
                     $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_ERROR' => '<span class="text-danger">' . $_ARRAYLANG['TXT_CALENDAR_CHECK_REQUIRED'] . '</span>'));
                     $this->_objTpl->parse('calendarRegistrationForm');
                     $this->_objTpl->hideBlock('calendarRegistrationStatus');
                 }
             } else {
                 $this->_objTpl->parse('calendarRegistrationForm');
                 $this->_objTpl->hideBlock('calendarRegistrationStatus');
             }
         } else {
             $this->_objTpl->setVariable(array($this->moduleLangVar . '_LINK_BACK' => '<a href="' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '">' . $_ARRAYLANG['TXT_CALENDAR_BACK'] . '</a>', $this->moduleLangVar . '_REGISTRATION_STATUS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_FULLY_BLOCKED']));
             $this->_objTpl->touchBlock('calendarRegistrationStatus');
             $this->_objTpl->hideBlock('calendarRegistrationForm');
         }
     } else {
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_LINK_BACK' => '<a href="' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '">' . $_ARRAYLANG['TXT_CALENDAR_BACK'] . '</a>', $this->moduleLangVar . '_REGISTRATION_STATUS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_IN_PAST']));
         $this->_objTpl->touchBlock('calendarRegistrationStatus');
         $this->_objTpl->hideBlock('calendarRegistrationForm');
     }
 }