Esempio n. 1
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 = $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');
     }
 }
 /**
  * Add / edit of settings -> form
  *
  * @param object  $objTpl Template object
  * @param integer $formId FormId
  *
  * @return null
  */
 function modifyForm($objTpl, $formId)
 {
     global $_ARRAYLANG, $_CORELANG;
     $objTpl->addBlockfile($this->moduleLangVar . '_SETTINGS_CONTENT', 'settings_content', 'module_calendar_settings_modify_form.html');
     if ($formId != 0) {
         $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_FORM'] . " " . $_ARRAYLANG['TXT_CALENDAR_EDIT'];
     } else {
         if (intval($_GET['copy']) != 0) {
             $objForm = new \Cx\Modules\Calendar\Controller\CalendarForm($_GET['copy']);
             $formId = $objForm->copy();
             if (intval($formId) == 0) {
                 $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_FORM_CORRUPT_ADDED'];
             }
             $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_FORM'] . " " . $_ARRAYLANG['TXT_CALENDAR_COPY'];
         } else {
             $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_INSERT_REGISTRATION_FORM'];
         }
     }
     $objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_REGISTRATION_FORM_TITLE' => $this->_pageTitle, 'TXT_' . $this->moduleLangVar . '_REGISTRATION_FORM' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_FORM'], 'TXT_' . $this->moduleLangVar . '_ACTION' => $_CORELANG['TXT_HISTORY_ACTION'], 'TXT_' . $this->moduleLangVar . '_TITLE' => $_ARRAYLANG['TXT_CALENDAR_TITLE'], 'TXT_' . $this->moduleLangVar . '_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_CALENDAR_CONFIRM_DELETE_DATA'], 'TXT_' . $this->moduleLangVar . '_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_CALENDAR_ACTION_IS_IRREVERSIBLE'], 'TXT_' . $this->moduleLangVar . '_SORT' => $_ARRAYLANG['TXT_CALENDAR_SORTING'], 'TXT_' . $this->moduleLangVar . '_FIELD_NAME' => $_ARRAYLANG['TXT_CALENDAR_FIELD_NAME'], 'TXT_' . $this->moduleLangVar . '_FIELD_TYPE' => $_ARRAYLANG['TXT_CALENDAR_FIELD_TYPE'], 'TXT_' . $this->moduleLangVar . '_DEFAULT_VALUES' => $_ARRAYLANG['TXT_CALENDAR_DEFAULT_VALUES'], 'TXT_' . $this->moduleLangVar . '_FIELD_REQUIRED' => $_ARRAYLANG['TXT_CALENDAR_FIELD_REQUIRED'], 'TXT_' . $this->moduleLangVar . '_FIELD_AFFILIATION' => $_ARRAYLANG['TXT_CALENDAR_FIELD_AFFILIATION'], 'TXT_' . $this->moduleLangVar . '_ACTIONS' => $_CORELANG['TXT_HISTORY_ACTION'], 'TXT_' . $this->moduleLangVar . '_DELETE' => $_ARRAYLANG['TXT_CALENDAR_DELETE'], 'TXT_' . $this->moduleLangVar . '_NEW_INPUTFIELD' => $_ARRAYLANG['TXT_CALENDAR_NEW_INPUTFIELD'], 'TXT_' . $this->moduleLangVar . '_EXPAND' => $_ARRAYLANG['TXT_CALENDAR_EXPAND'], 'TXT_' . $this->moduleLangVar . '_MINIMIZE' => $_ARRAYLANG['TXT_CALENDAR_MINIMIZE'], 'TXT_' . $this->moduleLangVar . '_FIELDS' => $_ARRAYLANG['TXT_CALENDAR_FIELDS'], 'TXT_' . $this->moduleLangVar . '_REGISTRATION_DATA' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_DATA']));
     $objFormManager = new \Cx\Modules\Calendar\Controller\CalendarFormManager();
     $objFormManager->showForm($objTpl, intval($formId), 1);
 }
Esempio n. 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');
     }
 }