Ejemplo n.º 1
0
 /**
  * Perform the event registration
  *
  * @param integer $eventId Event id
  *
  * @return null
  */
 function showEventRegistrations($eventId)
 {
     global $_ARRAYLANG;
     $this->_objTpl->loadTemplateFile('module_calendar_registrations.html');
     $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent(intval($eventId));
     $getTpl = isset($_GET['tpl']) ? $_GET['tpl'] : 'r';
     if (isset($_GET['delete'])) {
         $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration($objEvent->registrationForm, $_GET['delete']);
         $status = $objRegistration->delete($_GET['delete']) ? true : false;
         $messageVar = 'DELETED';
     }
     if (isset($_GET['multi'])) {
         \Permission::checkAccess(180, 'static');
         foreach ($_POST['selectedRegistrationId'] as $regId) {
             $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration($objEvent->registrationForm, $regId);
             switch ($_GET['multi']) {
                 case 'r':
                     $status = $objRegistration->move($regId, 1) ? true : false;
                     $messageVar = 'MOVED';
                     break;
                 case 'd':
                     $status = $objRegistration->move($regId, 0) ? true : false;
                     $messageVar = 'MOVED';
                     break;
                 case 'w':
                     $status = $objRegistration->move($regId, 2) ? true : false;
                     $messageVar = 'MOVED';
                     break;
                 case 'delete':
                     $status = $objRegistration->delete($regId) ? true : false;
                     $messageVar = 'DELETED';
                     break;
             }
         }
     }
     if ($status) {
         $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_SUCCESSFULLY_' . $messageVar];
     } else {
         $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_CORRUPT_' . $messageVar];
     }
     $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_REGISTRATIONS' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATIONS'], 'TXT_' . $this->moduleLangVar . '_DEREGISTRATIONS' => $_ARRAYLANG['TXT_CALENDAR_DEREGISTRATIONS'], 'TXT_' . $this->moduleLangVar . '_WAITLIST' => $_ARRAYLANG['TXT_CALENDAR_WAITLIST'], '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 . '_MAKE_SELECTION' => $_ARRAYLANG['TXT_CALENDAR_MAKE_SELECTION'], 'TXT_' . $this->moduleLangVar . '_BACK' => $_ARRAYLANG['TXT_CALENDAR_BACK'], 'TXT_' . $this->moduleLangVar . '_NO_REGISTRATIONS' => $_ARRAYLANG['TXT_CALENDAR_NO_REGISTRATIONS'], 'TXT_' . $this->moduleLangVar . '_SUBSCRIPTIONS' => $_ARRAYLANG['TXT_CALENDAR_SUBSCRIPTIONS'], 'TXT_' . $this->moduleLangVar . '_ADD' => $_ARRAYLANG['TXT_CALENDAR_ADD'], 'TXT_' . $this->moduleLangVar . '_EXPORT' => $_ARRAYLANG['TXT_CALENDAR_EXPORT'], 'TXT_SUBMIT_SELECT' => $_ARRAYLANG['TXT_SUBMIT_SELECT'], 'TXT_SUBMIT_MOVE' => $_ARRAYLANG['TXT_SUBMIT_MOVE'], 'TXT_SELECT_ALL' => $_ARRAYLANG['TXT_SELECT_ALL'], 'TXT_DESELECT_ALL' => $_ARRAYLANG['TXT_DESELECT_ALL'], 'TXT_SUBMIT_DELETE' => $_ARRAYLANG['TXT_SUBMIT_DELETE'], $this->moduleLangVar . '_EVENT_ID' => $eventId, $this->moduleLangVar . '_REGISTRATION_ID' => $regId, $this->moduleLangVar . '_REGISTRATION_' . strtoupper($getTpl) . '_CONTAINER_CLASS' => 'active'));
     $tplArr = array('r', 'd', 'w');
     foreach ($tplArr as $tpl) {
         $r = $d = $w = false;
         switch ($tpl) {
             case 'r':
                 $r = true;
                 $title = $_ARRAYLANG['TXT_CALENDAR_REGISTRATIONS'];
                 $containerId = 'registration';
                 $containerDisplay = $getTpl == 'r';
                 break;
             case 'd':
                 $d = true;
                 $title = $_ARRAYLANG['TXT_CALENDAR_DEREGISTRATIONS'];
                 $containerId = 'deregistration';
                 $containerDisplay = $getTpl == 'd';
                 break;
             case 'w':
                 $w = true;
                 $title = $_ARRAYLANG['TXT_CALENDAR_WAITLIST'];
                 $containerId = 'waitlist';
                 $containerDisplay = $getTpl == 'w';
                 break;
             default:
                 break;
         }
         $filterStartTimeStamp = $filterEndTimeStamp = false;
         if (isset($_GET['date']) && $containerDisplay) {
             $filterYear = $filterMonth = $filterDate = 0;
             list($filterYear, $filterMonth, $filterDate) = explode('-', $_GET['date']);
             $filterStartYear = !empty($filterYear) ? $filterYear : date('Y');
             $filterStartMonth = !empty($filterMonth) ? $filterMonth : 1;
             $filterStartDay = !empty($filterDate) ? $filterDate : 1;
             $filterStartDateTime = new \DateTime();
             $filterStartDateTime->setDate($filterStartYear, $filterStartMonth, $filterStartDay);
             $filterStartDateTime->setTime(0, 0, 0);
             $filterEndYear = !empty($filterYear) ? $filterYear : date('Y');
             $filterEndMonth = !empty($filterMonth) ? $filterMonth : 12;
             $filterEndDay = !empty($filterDate) ? $filterDate : 1;
             $filterEndDateTime = new \DateTime();
             $filterEndDateTime->setDate($filterEndYear, $filterEndMonth, $filterEndDay);
             if (empty($filterDate)) {
                 $filterEndDateTime->modify('last day of this month');
             }
             $filterEndDateTime->setTime(23, 59, 59);
             $filterStartTimeStamp = $filterStartDateTime->getTimestamp();
             $filterEndTimeStamp = $filterEndDateTime->getTimestamp();
         }
         $objRegistrationManager = new \Cx\Modules\Calendar\Controller\CalendarRegistrationManager($objEvent, $r, $d, $w, $filterStartTimeStamp, $filterEndTimeStamp, $containerDisplay);
         $objRegistrationManager->getRegistrationList();
         $objRegistrationManager->showRegistrationList($this->_objTpl, $tpl);
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_TPL' => $tpl, 'TXT_' . $this->moduleLangVar . '_REGISTRATIONS_TITLE' => $title, $this->moduleLangVar . '_REGISTRATION_LIST_CONTAINER_ID' => $containerId, $this->moduleLangVar . '_REGISTRATION_LIST_CONTAINER_DISPLAY' => $containerDisplay ? 'block' : 'none'));
         $this->_objTpl->parse("calendar_registration_lists");
     }
 }
Ejemplo n.º 2
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::header('Location: 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($eventId, true, true, true);
     $objRegistrationManager->getRegistrationList();
     $objRegistrationManager->showRegistrationInputfields($objEvent->registrationForm, $regId, $this->_objTpl);
     parent::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, $this->moduleLangVar . '_USER_ID' => $userId));
 }