/**
     * Should the User be shown a notification
     */
    public function displayNotification()
    {
        if ($this->notifyUser()) {
            $detail = $this->_thresholds[$this->_loginCount];

            $this->_notification->setUserId(\CPFCMembers\Auth::getUser()->getId())
                ->setDetail($detail)
                ->setStatus('incomplete');

            $this->_notification->save(true);

            get_partial('partials/notification_banner', array('detail' => $detail));
        }
    }
示例#2
0
$feedUrl = get_field('rss_feed_url', 'option');
$rssFeedItems = false;
if ($feedUrl) {
    $rss = new \CPFCMembers\Rss_Feed($feedUrl);
    $rssFeedItems = $rss->fetchFromCache(2);
}

$characterCount = (int) get_field('news_item_related_items_preview_character_count', 'option'); ?>

<div id="sb-site" class="bg-gradient">

    <?php
    get_partial('partials/cookie_policy');

    if (\CPFCMembers\Auth::isLoggedIn()) {
        get_partial('partials/header_logged_in');
    } else {
        get_partial('partials/header_logged_out', array('showLogin'=>false));
    } ?>

    <div class="content logged-in">

        <section class="fullwidth news-article">
            <div class="container">
                <div class="row">
                    <div class="col-sm-8">
                        <div class="header-left-contain">
                            <h1 class="heading header-right"><span><?php the_field('news_item_detail_page_heading_copy', 'option'); ?></span></h1>
                            <hr />
                        </div>
        $welcomeMessageCopy = get_field('homepage_logged_in_welcome_message_copy');
        $showWelcomeMessage = $welcomeMessageCopy && \CPFCMembers\Auth::getUser()->getLoginCount() > 1 && $welcomeMessageCopy;
        // Show section if a notification should be displated of if there is welcome copy
        if ($Notification->notifyUser() || $showWelcomeMessage) { ?>

        <section class="page-alert">

            <?php
            $Notification->displayNotification(); ?>

            <?php
            // Show at all times after the Member's first log in (only if welcome copy exists)
            if ($showWelcomeMessage) { ?>
            <div class="welcome">
                <div class="container">
                    <p><?php echo preg_replace(array('~#name~i'),array('<strong>' . \CPFCMembers\Auth::getUser()->getFirstName() . '</strong>'), $welcomeMessageCopy); ?></p>
                </div>
            </div>
            <?php
            } ?>

        </section>

        <?php
        } ?>

        <!-- Hero Video section -->
        <section class="fullwidth header-panel home-hero">

            <div class="container">
    <?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"' : ''; ?>/>
            <?php
            $form->displayError('see_tickets_account_number'); ?>
        </div>

        <div class="form-group">
            <input type="submit" class="btn" name="data_capture_see_tickets_submit" value="Save" />
        </div>
    </fieldset>
</form>
    <?php
} ?>
</section>
示例#5
0
    /**
     * 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);
    }
    /**
     * Validate the See Tickets Account Number field
     */
    public function validateSeeTicketsAccountNumber()
    {
        $value = $this->getValue('see_tickets_account_number');

        switch (true) {
            case $this->validateRequired('see_tickets_account_number'):
                $this->addError('see_tickets_account_number', 'Please enter your SEE Tickets Account Number');
                break;
            case $value && \CPFCMembers\Auth::getUser()->getSeeTicketsAccountNumber() != $value && is_null(\CPFCMembers\Auth::getUser()->getSeeTicketsAccountNumber()):
                $this->addError('see_tickets_account_number', 'You are not allowed to change your Account Number once it has been set');
                break;
        }


    }