/**
     * Display Admin page
     * @return NULL
     */
    public function displayPage()
    {
        $templateData = \CPFCMembers\TemplateData::getInstance();
        $atAGlanceData = $templateData->get('atAGlanceData');
        $filterResultsSample = $templateData->get('filterResultsSample');
        $whereConditionsFriendly = $templateData->get('whereConditionsFriendly');
        $columns = $templateData->get('dataType') == 'logins' ? $this->_loggedInColumns : $this->_memberColumns; ?>

<div class="wrap">
    <h2>Membership Reporting</h2>
    <div style="float:left;width:60%;min-width:700px;padding-right:50px;">

        <?php
        get_partial('partials/reporting/filter'); ?>

    </div>

    <div style="float:left;width:35%;min-width:250px;margin-bottom:20px;">
        <h3>At a glance</h3>
        <p>Registrations Today: <strong><?php echo $atAGlanceData['registrationCountToday']; ?></strong><br />
        Registrations in last 24 hours: <strong><?php echo $atAGlanceData['registrationCount24Hours']; ?></strong><br />
        Registrations in last 7 days: <strong><?php echo $atAGlanceData['registrationCount7Days']; ?></strong></p>

        <p>Logins Today: <strong><?php echo $atAGlanceData['loginCountToday']; ?></strong><br />
        Logins in last 24 hours: <strong><?php echo $atAGlanceData['loginCount24Hours']; ?></strong><br />
        Logins in last 7 days: <strong><?php echo $atAGlanceData['loginCount7Days']; ?></strong></p>

        <p>Data Capture Notifications (Displayed/Completed) Today: <strong><?php echo $atAGlanceData['notificationDisplayCountToday']; ?> / <?php echo $atAGlanceData['notificationCompletedCountToday']; ?></strong><br />
        Data Capture Notifications (Displayed/Completed) in last 24 hours: <strong><?php echo $atAGlanceData['notificationDisplayCount24Hours']; ?> / <?php echo $atAGlanceData['notificationCompletedCount24Hours']; ?></strong><br />
        Data Capture Notifications (Displayed/Completed) in last 7 days: <strong><?php echo $atAGlanceData['notificationCompletedCount7Days']; ?> / <?php echo $atAGlanceData['notificationCompletedCount7Days']; ?></strong></p>
    </div>

    <div style="clear:both;width:100%;">

        <?php
        if ($filterResultsSample !== false) { ?>
        <h3>Filtered Results</h3>
        <h4>Applied Filters</h4>
        <?php
        if ($whereConditionsFriendly) { ?>
            <p>- <?php echo implode('<br/>- ', $whereConditionsFriendly); ?></p>
        <?php
        } ?>
        <?php
            if ($filterResultsSample) {
                $rowCount = count($filterResultsSample); ?>
                <p><strong>This is a sample set of <?php echo $rowCount . ($rowCount == 1 ? ' row' : ' rows'); ?> of data that would be exported using the current filters.</strong></p>

        <table class="widefat fixed" cellspacing="0">
            <thead>
                <tr>
                    <?php
                    if ($columns['login_date']) { ?>
                    <th><?php echo $columns['login_date']; ?></th>
                    <?php
                    } ?>
                    <th><?php echo $columns['first_name']; ?></th>
                    <th><?php echo $columns['last_name']; ?></th>
                    <th><?php echo $columns['dob']; ?></th>
                    <th><?php echo $columns['email_address']; ?></th>
                    <th><?php echo $columns['registration_status']; ?></th>
                    <th><?php echo $columns['registered_date']; ?></th>
                </tr>
            </thead>
            <tbody>
                <?php
                foreach ($filterResultsSample as $filterResult) { ?>
                <tr>
                    <?php
                    if ($filterResult['login_date']) { ?>
                    <td><?php echo $filterResult['login_date']; ?></td>
                    <?php
                    } ?>
                    <td><?php echo $filterResult['first_name']; ?></td>
                    <td><?php echo $filterResult['last_name']; ?></td>
                    <td><?php echo $filterResult['dob']; ?></td>
                    <td><?php echo $filterResult['email_address']; ?></td>
                    <td><?php echo $filterResult['registration_status']; ?></td>
                    <td><?php echo $filterResult['registered_date']; ?></td>
                </tr>
                <?php
                } ?>
            </tbody>
        </table>

        <p><a href="<?php echo $templateData->get('exportLink'); ?>" class="button button-primary">Export all <?php echo $templateData->get('filterResultsCount'); ?> <?php echo $templateData->get('filterResultsCount') == 1 ? 'row' : 'rows'; ?> of data</a></p>
            <?php
            } else {
                ?><p><strong>No results were found with the current filters.</strong></p><?php
            }
        } ?>

    </div>

</div>

<?php
    }
Exemplo n.º 2
0
<?php
$form = \CPFCMembers\DataCapturePreferencesForm::getInstance();
$templateData = \CPFCMembers\TemplateData::getInstance(); ?>

<section class="datacapture-panel">
<?php
switch ($templateData->get('status')) {
    case 'SUCCESS': ?>
<h1><?php the_field('data_capture_preferences_success_heading'); ?></h1>

<?php the_field('data_capture_preferences_success_copy'); ?>
    <span id="datacapture-success" data-result="true"></span>
    <?php
        break;

    default: ?>
<h1><?php the_field('data_capture_preferences_heading'); ?></h1>

<?php the_field('data_capture_preferences_copy'); ?>

<form class="datacapture" method="POST" action="<?php echo \CPFCMembers\Input::uri(); ?>">
    <fieldset>
        <input type="hidden" name="details" value="preferences" />
        <?php echo $form->securityField(); ?>

        <?php
        $form->displayError('form'); ?>

        <div class="form-block-wrap form-group">
            <div class="check">
                <input class="form-control" type="checkbox" name="preference_regular_newsletter" id="preference-regular-newsletter" value="1" <?php echo $form->getValue('preference_regular_newsletter') ? 'checked="checked"' : ''; ?> />
Exemplo n.º 3
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);
    }