<?php $form = \CPFCMembers\DataCaptureSeeTicketsForm::getInstance(); $templateData = \CPFCMembers\TemplateData::getInstance(); ?> <section class="datacapture-panel"> <?php switch ($templateData->get('status')) { case 'SUCCESS': ?> <h1><?php the_field('data_capture_see_tickets_success_heading'); ?></h1> <?php the_field('data_capture_see_tickets_success_copy'); ?> <span id="datacapture-success" data-result="true"></span> <?php break; default: ?> <h1><?php the_field('data_capture_see_tickets_heading'); ?></h1> <?php the_field('data_capture_see_tickets_copy'); ?> <form class="datacapture" method="POST" action="<?php echo \CPFCMembers\Input::uri(); ?>"> <fieldset> <input type="hidden" name="details" value="see_tickets" /> <?php echo $form->securityField(); ?> <?php $form->displayError('form'); ?> <div class="form-block-wrap form-group <?php echo $form->displayErrorIndicator('see_tickets_account_number'); ?>"> <label for="see-tickets-account-number" class="control-label accessibility">SEE Tickets Acc. No. <?php echo $form->indicateRequired('see_tickets_account_number'); ?></label> <input class="form-control" type="text" name="see_tickets_account_number" id="see-tickets-account-number" placeholder="Your SEE Tickets Account Number" data-bv-notempty="false" data-bv-notempty-message="SEE Tickets Account Number is required and cannot be empty" value="<?php echo $form->getValue('see_tickets_account_number'); ?>" <?php echo \CPFCMembers\Auth::getUser()->getSeeTicketsAccountNumber() ? 'disabled="disabled"' : ''; ?>/>
/** * Data Capture */ protected function _dataCapture() { $details = Input::request('details', false); $templateData = \CPFCMembers\TemplateData::getInstance(); $User = \CPFCMembers\Auth::getUser(); $template = ''; $status = ''; // Can't access if not logged in as Member if (\CPFCMembers\Auth::isLoggedIn()) { switch($details) { case 'address': $form = \CPFCMembers\DataCaptureAddressForm::getInstance(); $template = 'partials/data_capture/address_form'; break; case 'contact': $form = \CPFCMembers\DataCaptureContactForm::getInstance(); $template = 'partials/data_capture/contact_form'; break; case 'preferences': $form = \CPFCMembers\DataCapturePreferencesForm::getInstance(); $template = 'partials/data_capture/preferences_form'; break; case 'see_tickets': $form = \CPFCMembers\DataCaptureSeeTicketsForm::getInstance(); $template = 'partials/data_capture/see_tickets_form'; break; default: $status = 'INVALID_DETAIL'; $template = 'partials/data_capture/error'; $templateData->set('error_type', 'invalid_form_chosen'); } $notification = \CPFCMembers\MemberNotificationModel::loadByUserIdAndDetail($User->getId(), $details); if ($notification->getStatus() == 'complete') { $status = 'ALREADY_COMPLETED'; $template = 'partials/data_capture/error'; $templateData->set('error_type', 'already_completed'); } } else { $status = 'NOT_LOGGED_IN'; $template = 'partials/data_capture/error'; $templateData->set('error_type', 'not_logged_in'); } if ($status == '') { if (Input::isPost()) { $form->setValues(Input::post()); $form->validate(); if ($form->isValid()) { switch($details) { case 'address': $User->setHouseNameNumber(Input::post('house_name_number')); $User->setStreet(Input::post('street')); $User->setTown(Input::post('town')); $User->setCounty(Input::post('county')); $User->setPostcode(Input::post('postcode')); $User->setCountry(Input::post('country')); break; case 'contact': $User->setMobilePhone(Input::post('mobile_phone')); $User->setDaytimePhone(Input::post('daytime_phone')); break; case 'preferences': $User->setPreferenceRegularNewsletter(Input::post('preference_regular_newsletter')); $User->setPreferenceBreakingNews(Input::post('preference_breaking_news')); $User->setPreferencePartners(Input::post('preference_partners')); $User->setPreferenceSMS(Input::post('preference_sms')); break; case 'see_tickets': $User->setSeeTicketsAccountNumber(Input::post('see_tickets_account_number')); break; } if ($User->save(true)) { $status = 'SUCCESS'; $notification->setUserId($User->getId()) ->setDetail($details) ->setStatus('complete'); $notification->save(true); } else { $status = 'NOT_SAVED'; $template = 'partials/data_capture/error'; } } } else { $form->setValues($User->toArray(false, false)); } } $templateData->set('template', $template); $templateData->set('status', $status); $templateData->set('message', $message); }