<?php

$default_button_css = "a.epl_button, input.epl_button,.epl_button_small  {\n    background-image:none !important;\n    backround-repeat:no-repeat;\n    border-radius: 0 !important;\n    display: inline-block;\n    margin: 0;\n    padding: 4px 14px !important;\n    border: 1px solid transparent;\n    color: #ffffff !important;\n    vertical-align: middle;\n    text-align: center;\n    font-weight: normal !important;\n    font-size: 13px !important;\n    line-height: 1.5384615384615385 !important;\n    cursor: pointer;\n    outline: none;\n    background-color: #3bafda !important;\n    border-color: #3bafda !important;\n    -webkit-transition: all 0.15s ease-in-out;\n    -moz-transition: all 0.15s ease-in-out;\n    -o-transition: all 0.15s ease-in-out;\n    transition: all 0.15s ease-in-out;\n    -webkit-box-sizing: border-box;\n    -moz-box-sizing: border-box;\n    box-sizing: border-box;\n    text-decoration:none;\n}\n\n.epl_button_small {\n    padding: 2px 15px !important;\n    font-size: 0.8em !important;\n    margin-top:10px !important;\n}\n.epl_button:hover, .epl_button_small:hover, input[type=submit].epl_button_small:hover {\n    background-color: #66c1e2 !important;\n    border-color: #66c1e2 !important;\n}\n.epl_button:active, .epl_button_small:active, input[type=submit].epl_button_small:active {\n    position:relative;\n    top:1px;\n}\n";
global $epl_fields;
$epl_fields['epl_general_options'] = array('epl_sort_event_list_by' => array('input_type' => 'select', 'input_name' => 'epl_sort_event_list_by', 'label' => epl__('Sort Events By'), 'options' => array('date' => epl__('Date Published'), 'title' => epl__('Event Name'), 'start_date' => epl__('Event Start Date')), 'default_value' => 'date'), 'epl_sort_event_list_order' => array('input_type' => 'select', 'input_name' => 'epl_sort_event_list_order', 'label' => epl__('Sort Order'), 'options' => array('ASC' => epl__('Ascending'), 'DESC' => epl__('Descending')), 'default_value' => 10), 'epl_currency_code' => array('input_type' => 'select', 'input_name' => 'epl_currency_code', 'label' => epl__('Currency Code'), 'help_text' => epl__('This will be used in payment gateways. '), 'options' => array('AUD' => 'AUD', 'CAD' => 'CAD', 'CHF' => 'CHF (Switzerland Franc)', 'EUR' => 'EUR', 'GBP' => 'GBP', 'HKD' => 'HKD', 'JPY' => 'JPY', 'NOK' => 'NOK', 'NZD' => 'NZD', 'PHP' => 'PHP', 'USD' => 'USD', 'SAR' => 'SAR', 'SGD' => 'SGD (Singapore Dollar)', 'SEK' => 'SEK')), 'epl_currency_symbol' => array('input_type' => 'text', 'input_name' => 'epl_currency_symbol', 'label' => epl__('Currency Symbol'), 'help_text' => epl__("This will appear next to all the currency figures on the website.  Ex. \$, USD... "), 'class' => 'epl_w50'), 'epl_currency_symbol_location' => array('input_type' => 'select', 'input_name' => 'epl_currency_symbol_location', 'label' => epl__('Currency Symbol Location'), 'options' => array('b' => epl__('Before'), 'a' => epl__('After')), 'default_value' => 'b'), 'epl_currency_display_format' => array('input_type' => 'select', 'input_name' => 'epl_currency_display_format', 'options' => array(1 => '1,234.56', 2 => '1,234', 3 => '1234', 4 => '1234.56', 5 => '1 234,00', 6 => '1 234.00'), 'default_value' => 1, 'label' => epl__('Currency display format'), 'help_text' => epl__('This determines how your currency is displayed.  Ex. 1,234.56 or 1,200 or 1200.  This is only used for display purposes.')), 'epl_shortcode_page_id' => array('input_type' => 'select', 'input_name' => 'epl_shortcode_page_id', 'label' => epl__('Shortcode Page'), 'help_text' => epl__('Required.  Please select the page that contains the [events_planner] shortcode. '), 'options' => epl_sortcode_pages()), 'epl_admin_date_format' => array('input_type' => 'select', 'input_name' => 'epl_admin_date_format', 'options' => array('m/d/Y' => 'm/d/Y', 'd/m/Y' => 'd/m/Y', 'Y-m-d' => 'Y-m-d'), 'default_value' => 'm/d/Y', 'label' => epl__('Admin Date Format'), 'help_text' => epl__('This date format is used for displaying dates on the Admin screens of Events Planner.  On the front end, the WordPress General settings date is used.')), 'epl_disable_defult_css' => array('input_type' => 'select', 'input_name' => 'epl_disable_defult_css', 'options' => epl_yes_no(), 'default_value' => 0, 'label' => epl__('Disable Default CSS?'), 'help_text' => epl__("ADVANCED: If disabled, the default css file (events-planner > css > events-planner-style1.css) will not be loaded.  <br />This way, you can copy the contents of that file into your theme's style.css and modify any way you would like.")), 'epl_button_css' => array('input_type' => 'textarea', 'input_name' => 'epl_button_css', 'options' => epl_yes_no(), 'style' => 'width:600px;height:250px;', 'default_value' => $default_button_css, 'label' => epl__('Custom CSS'), 'help_text' => epl__("You can add custom CSS in this box to override front end CSS rules.  This data is stored in the database and is safe from plugin updates.")));
$epl_fields['epl_general_options'] = apply_filters('epl_general_options_fields', $epl_fields['epl_general_options']);
$epl_fields['epl_registration_options'] = array('epl_regis_id_length' => array('weight' => 10, 'input_type' => 'select', 'input_name' => 'epl_regis_id_length', 'label' => epl__('Registration ID length?'), 'help_text' => epl__('This will be an alphanumeric string.'), 'options' => epl_make_array(10, 26), 'default_value' => 10), 'epl_regis_enable_ssl' => array('weight' => 15, 'input_type' => 'select', 'input_name' => 'epl_regis_enable_ssl', 'label' => epl__('Enable SSL for registrations?'), 'help_text' => sprintf(epl__('%sIf you plan on accepting Credit Cards on your website, this must be set to Yes for PCI Compliance.  You need to have a SSL Certificate installed for this domain.%s'), '<span class=""><strong>', '</strong></span>'), 'options' => epl_yes_no(), 'default_value' => 0), 'epl_regis_add_url_token' => array('weight' => 11, 'input_type' => 'select', 'input_name' => 'epl_regis_add_url_token', 'label' => epl__('Add security token to registration confirmation url?'), 'description' => epl__("This will add a token to the registration url so that others can't accidentally stumble upon the registration details.  The registration confirmation url will change from ...registration/ASDFREWTR to ...registration/ASDFREWTR?epl_token=adlkfalsdfjl0ufj0923r."), 'options' => epl_yes_no(), 'default_value' => 10), 'epl_surcharge_section' => array('weight' => 19, 'input_type' => 'section', 'label' => '', 'class' => 'epl_font_555 epl_font_bold', 'content' => epl__('Default Surcharge Settings'), 'help_text' => epl__('You can override these settings for each event.')), 'epl_surcharge_global' => array('weight' => 21, 'input_type' => 'select', 'input_name' => 'epl_surcharge_global', 'label' => epl__('Apply Surcharge To'), 'options' => array(5 => epl__('All current and future events'), 10 => epl__('Let me choose for each event')), 'default_value' => 5), 'epl_surcharge_label' => array('weight' => 23, 'input_type' => 'text', 'input_name' => 'epl_surcharge_label', 'label' => epl__('Surcharge Label (default)'), 'help_text' => epl__('Label that will be displayed to the user.'), 'default_value' => epl__('Surcharge')), 'epl_surcharge_amount' => array('weight' => 25, 'input_type' => 'text', 'input_name' => 'epl_surcharge_amount', 'label' => epl__('Surcharge Amount (default)'), 'help_text' => epl__('This surcharge amount will apply by default to each event.  You will have the option to adjust this number for each event.'), 'data_type' => 'float', 'default_value' => '0.00'), 'epl_surcharge_type' => array('weight' => 30, 'input_type' => 'select', 'input_name' => 'epl_surcharge_type', 'label' => epl__('Surcharge Type (default)'), 'options' => array(5 => epl__('Fixed'), 10 => epl__('Percent')), 'default_value' => 10), 'epl_surcharge_before_discount' => array('weight' => 35, 'input_type' => 'select', 'input_name' => 'epl_surcharge_before_discount', 'label' => epl__('Apply surcharge (default)'), 'options' => array(10 => epl__('Before discount'), 0 => epl__('After discount')), 'default_value' => 10), 'epl_conv_section' => array('weight' => 39, 'input_type' => 'section', 'label' => '', 'class' => 'epl_font_555 epl_font_bold', 'content' => ''), 'epl_tracking_code' => array('weight' => 45, 'input_type' => 'textarea', 'input_name' => 'epl_tracking_code', 'label' => epl__('Conversion Tracking Code'), 'help_text' => epl__('You can paste javascript code in this box if you would like to track registration conversions (e.g. from Google Adwords).  This code will be included in the final page when the registration is succressfully completed, and only once.  The code must be wrapped in "script" tags.'), 'style' => 'width:90%;height:120px;', '_save_func' => 'wp_kses_post'), 'epl_enable_admin_override' => array('weight' => 55, 'input_type' => 'select', 'input_name' => 'epl_enable_admin_override', 'label' => epl__('Enable Admin Override?'), 'options' => epl_yes_no(), 'default_value' => 0, 'help_text' => epl__('When an admin user goes through the registration on the front end of the website, the user can override the total amount.')), 'epl_enable_admin_override_cal' => array('weight' => 57, 'input_type' => 'select', 'input_name' => 'epl_enable_admin_override_cal', 'label' => epl__('Enable Admin Override Calendar?'), 'options' => epl_yes_no(), 'default_value' => 0, 'help_text' => epl__('When an admin user goes through the registration on the front end of the website, a date selector calendar will be visible instead of the list of dates.')), 'epl_enable_donation' => array('weight' => 60, 'input_type' => 'select', 'input_name' => 'epl_enable_donation', 'label' => epl__('Enable Donations?'), 'options' => epl_yes_no(), 'default_value' => 0, 'help_text' => epl__('This will allow the registrants to make donations during the registration.')), 'epl_show_event_details_on_conf' => array('weight' => 62, 'input_type' => 'select', 'input_name' => 'epl_show_event_details_on_conf', 'label' => epl__('Display event details on confirmation page?'), 'options' => epl_yes_no(), 'default_value' => 0), 'epl_send_customer_confirm_message_to' => array('weight' => 64, 'input_type' => 'select', 'input_name' => 'epl_send_customer_confirm_message_to', 'options' => array(1 => epl__('Only the primary registrant'), 2 => epl__('All email addresses in all forms')), 'label' => epl__('Send confirmtion message to'), 'default_value' => 1));
$epl_fields['epl_registration_options'] = apply_filters('epl_registration_options_fields', $epl_fields['epl_registration_options']);
uasort($epl_fields['epl_registration_options'], 'epl_sort_by_weight');
$epl_fields['epl_event_options'] = array('epl_register_button_text' => array('input_type' => 'text', 'input_name' => 'epl_register_button_text', 'label' => epl__('Registration Button Text '), 'help_text' => epl__('Register, Sign Up, Buy Tickets...')), 'epl_date_location' => array('input_type' => 'select', 'input_name' => 'epl_date_location', 'options' => epl_yes_no(), 'label' => epl__('Enable Date Specific Location'), 'help_text' => epl__('This setting will let you indicate a specific location for each date.')), 'epl_date_note_enable' => array('input_type' => 'select', 'input_name' => 'epl_date_note_enable', 'options' => epl_yes_no(), 'label' => epl__('Enable Date Specific Notes'), 'help_text' => epl__('This setting will let you indicate a specific note for each date.')), 'epl_default_notification_email' => array('input_type' => 'text', 'input_name' => 'epl_default_notification_email', 'label' => epl__('Default Notification Email'), 'help_text' => epl__('Registration Notifications will be sent to this email, unless Alternate Notification Emails are indicated for the an event.'), 'default_value' => get_bloginfo('admin_email')), 'epl_admin_event_list_version' => array('input_type' => 'select', 'input_name' => 'epl_admin_event_list_version', 'options' => array(1 => epl__('Version') . " 1", 2 => epl__('Version') . " 2"), 'label' => epl__('Manage Event page version'), 'default_value' => 2));
$epl_fields['epl_event_options'] = apply_filters('epl_event_options_fields', $epl_fields['epl_event_options']);
$home_url = trailingslashit(home_url());
$epl_fields['epl_fullcalendar_options'] = array('epl_fullcalendar_theme' => array('input_type' => 'select', 'input_name' => 'epl_fullcalendar_theme', 'options' => array('' => epl__('Default'), 'base' => 'Base', 'black-tie' => 'Black Tie', 'blitzer' => 'Blitzer', 'cupertino' => 'Cupertino', 'dark-hive' => 'Dark Hive', 'dot-luv' => 'Dot Luv', 'eggplant' => 'Eggplant', 'excite-bike' => 'Excite Bike', 'hot-sneaks' => 'Hot Sneaks', 'humanity' => 'Humanity', 'le-frog' => 'Le Frog', 'mint-choc' => 'Mint Choc', 'overcast' => 'Overcast', 'pepper-grinder' => 'Pepper Grinder', 'redmond' => 'Redmond', 'smoothness' => 'Smoothness', 'south-street' => 'South Street', 'start' => 'Start', 'sunny' => 'Sunny', 'swanky-purse' => 'Swantky Purse', 'trontastic' => 'Trontastic', 'ui-darkness' => 'UI Darkness', 'ui-lightness' => 'UI Lightness', 'vader' => 'Vader'), 'default_value' => '', 'label' => epl__('FullCalendar Theme'), 'description' => epl__("These styles are loaded from the Google CDN.") . ' ' . epl_anchor('http://jqueryui.com/themeroller/', 'jQuery UI Styles')), 'epl_fullcalendar_enable_tooltip' => array('input_type' => 'select', 'input_name' => 'epl_fullcalendar_enable_tooltip', 'options' => epl_yes_no(), 'label' => epl__('Enable Tooltip'), 'default_value' => 10), 'epl_fullcalendar_show_legend' => array('input_type' => 'select', 'input_name' => 'epl_fullcalendar_show_legend', 'options' => array(0 => epl__('No'), 1 => epl__('Above Calendar'), 10 => epl__('Below Calendar')), 'label' => epl__('Display Category Legends'), 'default_value' => 10), 'epl_fullcalendar_show_att_count' => array('input_type' => 'select', 'input_name' => 'epl_fullcalendar_show_att_count', 'options' => array(0 => epl__('No'), 1 => epl__('Admin Only'), 2 => epl__('Logged-in Users'), 3 => epl__('All Users')), 'label' => epl__('Display Attendee Counts on Calendar?'), 'default_value' => 0), 'epl_fullcalendar_enable_cache' => array('input_type' => 'select', 'input_name' => 'epl_fullcalendar_enable_cache', 'options' => epl_yes_no(), 'label' => epl__('Enable Caching?'), 'help_text' => epl__('When this is enabled, the calendar generation query is refreshed every 4 hours or when an event is updated.  Caching will make the calendar load much faster.'), 'default_value' => 10), 'epl_fullcalendar_iCal' => array('input_type' => 'section', 'label' => '', 'class' => '', 'style' => 'font-size:12px;', 'content' => epl__("iCal Feeds") . "<div style='font-size:12px'>" . epl__('Regular iCal Feed') . ': ' . epl_anchor(add_query_arg(array('epl_action' => 'ical'), $home_url), add_query_arg(array('epl_action' => 'ical'), $home_url), '_blank') . "</div> " . "<div style='font-size:12px'>" . epl__('iCal Feed With Attendee Counts') . ': ' . epl_anchor(add_query_arg(array('epl_action' => 'ical', 'ical_token' => md5(NONCE_KEY)), $home_url), add_query_arg(array('epl_action' => 'ical', 'ical_token' => md5(NONCE_KEY)), $home_url), '_blank') . "</div> "), 'epl_fullcalendar_tax_bcg_color' => array('input_type' => 'text', 'input_name' => 'epl_fullcalendar_tax_bcg_color[]', 'label' => epl__('Event Taxonomy color')), 'epl_fullcalendar_tax_font_color' => array('input_type' => 'text', 'input_name' => 'epl_fullcalendar_tax_font_color[]', 'label' => epl__('Event Taxonomy font color')));
$epl_fields['epl_fullcalendar_options'] = apply_filters('epl_fullcalendar_options_fields', $epl_fields['epl_fullcalendar_options']);
do_action('epl_settings_fields');
        function epl_column_data($column_name, $post_ID)
        {
            global $epl_fields, $event_details, $event_snapshot;
            $this->ecm->setup_event_details($post_ID);
            $this->erm->event_snapshot($post_ID);
            switch ($column_name) {
                case 'id':
                    echo $post_ID;
                    break;
                case 'location':
                    echo get_the_location_name();
                    break;
                case 'status':
                    $s = epl_get_event_status(true);
                    $class = 'status_' . key($s);
                    echo "<span class='status {$class}'>" . current($s) . '</span>';
                    break;
                    /*  case 'epl_categories':
                    
                                      foreach ( wp_get_object_terms( $id, 'epl_categories' ) as $tax )
                                      $r[] = $tax->name;
                    
                                      echo!is_array( $r ) ? '' : implode( ", ", $r );
                    
                                      break; */
                /*  case 'epl_categories':
                
                                  foreach ( wp_get_object_terms( $id, 'epl_categories' ) as $tax )
                                  $r[] = $tax->name;
                
                                  echo!is_array( $r ) ? '' : implode( ", ", $r );
                
                                  break; */
                case 'start_date':
                    $base_url = epl_get_url();
                    $event_regis_data = current($event_snapshot);
                    $table_link_arr = array('epl_action' => 'view_names', 'epl_download_trigger' => 1, 'table_view' => 1, 'epl_controller' => 'epl_report_manager', 'event_id' => $event_id);
                    $csv_link_arr = array('epl_action' => 'epl_attendee_list', 'epl_download_trigger' => 1, 'epl_controller' => 'epl_registration', 'event_id' => $event_id);
                    if (epl_is_empty_array($event_regis_data)) {
                        break;
                    }
                    $counter = 1;
                    foreach ($event_regis_data as $date_id => $date_data) {
                        $last_day = end($event_details['_epl_start_date']);
                        if ($last_day > EPL_DATE && ($event_details['_epl_event_status'] == 1 && $date_data['date']['timestamp'] < EPL_DATE) || $counter > 1) {
                            continue;
                        }
                        $counter++;
                        $date = $date_data['date']['disp'];
                        $date_capacity = epl_get_element_m($date_id, '_epl_date_capacity', $event_details);
                        $times = $date_data['time'];
                        ?>

                        <table id="event_snapshot_table" class="event_snapshot_sorting">
                            <thead>
                                <tr>
                                    <th><?php 
                        epl_e('Date');
                        ?>
</th>
                                    <th><?php 
                        epl_e('Time');
                        ?>
</th>
                                    <th><?php 
                        epl_e('Attendees');
                        ?>
</th>
                                    <th></th>
                                </tr>

                            </thead>

                            <?php 
                        foreach ($times as $time_id => $time_data) {
                            if (epl_is_date_level_time() && !epl_is_empty_array($date_specifc_time) && (!isset($date_specifc_time[$time_id]) || !isset($date_specifc_time[$time_id][$date_id]))) {
                                continue;
                            }
                            $time_capacity = epl_get_element_m($time_id, '_epl_time_capacity', $event_details);
                            $capacity = $time_capacity ? $time_capacity : ($date_capacity ? $date_capacity : epl_get_element_m($date_id, '_epl_date_per_time_capacity', $event_details));
                            $dt_array = array('date_id' => $date_id, 'time_id' => $time_id, 'event_id' => $post_ID);
                            $table_link_arr = array_merge($table_link_arr, $dt_array);
                            $csv_link_arr += $dt_array;
                            ?>

                                <tr class="epl_date_time">

                                    <td><?php 
                            echo date_i18n('D M d, Y', epl_get_date_timestamp(epl_get_element($date_id, $event_details['_epl_start_date'])));
                            ?>
</td>

                                    <?php 
                            if (epl_is_time_optonal()) {
                                ?>
                                        <td colspan="1"> - </td>
                                    <?php 
                            } else {
                                ?>
                                        <td><?php 
                                echo $time_data['disp'];
                                ?>
</td>

                                    <?php 
                            }
                            ?>

                                    <td><?php 
                            echo $time_data['regis'];
                            ?>
 / <?php 
                            echo $capacity ? $capacity : '&#8734;';
                            ?>
</td>


                                    <td>
                                        <?php 
                            echo epl_anchor(add_query_arg(array_merge($table_link_arr, $dt_array) + array('names_only' => 1), $base_url), epl__('View Attendees'), null, 'class="epl_view_attendee_list_table button-secondary"');
                            $table_link_arr['epl_action'] = 'epl_attendee_list';
                            $table_link_arr['epl_controller'] = 'epl_registration';
                            echo epl_anchor(add_query_arg($table_link_arr, $base_url), epl__('View Full Data'), null, 'class="epl_view_attendee_list_table button-secondary"');
                            echo epl_anchor(add_query_arg(array_merge($csv_link_arr, $dt_array), $base_url), epl__('Export CSV'), null, 'class="button-secondary"');
                            //echo  epl_anchor( $_SERVER['PHP_SELF'] . '&epl_action=epl_event_snapshot&event_id=' . $post->ID, epl__( 'Snapshot' ), '_blank', "class='epl_event_snapshot' data-event_id = '" . $post->ID . "'" );
                            ?>


                                    </td>

                                </tr>

                                <?php 
                        }
                    }
                    ?>


                    </table>
                    <?php 
                    break;
                default:
                    break;
                case 'actions':
                    $url_vars = array('epl_action' => 'duplicate_event', 'event_id' => $post_ID);
                    $url = add_query_arg($url_vars, epl_get_url());
                    echo " <a href='epl_action=duplicate_event&event_id={$post_ID}'><img src='" . EPL_FULL_URL . "images/status_online.png' title='" . epl__('Attendees') . "' alt='" . epl__('Attendees') . "' /></a>";
                    echo " <a href='epl_action=duplicate_event&event_id={$post_ID}'><img src='" . EPL_FULL_URL . "images/doc_excel_csv.png' title='" . epl__('Attendees') . "' alt='" . epl__('Attendees') . "' /></a>";
                    break;
            }
            // end switch
        }
 /**
  * This function will create a global variable called $event_snapshot, which holds all the following information about the event
  * -Availability for each date, each time inside each date, each price inside each date and time.
  * -Availability errors
  *
  * Uses global vars $event_details, $current_att_count
  *
  * @since 1.0.0
  * @param event_id
  * @param refresh
  * @return  Sets the global $event_snapshot variable
  */
 function event_snapshot($event_id = null, $refresh = false)
 {
     global $event_details, $capacity, $current_att_count, $event_snapshot, $epl_error, $event_totals;
     $event_id = is_null($event_id) ? $this->get_current_event_id() : $event_id;
     setup_event_details($event_id);
     $meta = $this->current_data[$this->regis_id];
     $cart_selected_dates = epl_get_element($event_id, epl_get_element('_epl_start_date', $this->get_cart_values('_dates')));
     $cart_selected_times = (array) epl_get_element($event_id, epl_get_element('_epl_start_time', $this->get_cart_values('_dates')));
     $cart_selected_quantities = (array) epl_get_element($event_id, epl_get_element('_att_quantity', $this->get_cart_values('_dates')));
     static $_cache = array();
     $_is_cached = epl_get_element($event_id, $_cache);
     if ($_is_cached) {
         return $_cache[$event_id];
     }
     if (empty($cart_selected_dates) && epl_get_element('cart_action', $_REQUEST) != 'add') {
         $epl_error[] = array('', epl__('Please select at least one date.'));
     }
     $current_att_count = EPL_report_model::get_instance()->get_attendee_counts($event_id, true);
     $sold_out_text = apply_filters('merm__event_snapshot__sold_out_text', epl__('Sold Out.'));
     //get the attendee and money totals
     //$_totals = $this->calculate_cart_totals();
     setup_event_details($event_id);
     $grand_total = epl_get_element_m('grand_total', 'money_totals', $event_totals);
     $grand_total_key = "_grand_total";
     //this will hold the snapshot
     $event_snapshot = array();
     $qty_meta_key = "_total_att_" . $event_id;
     //$total_att = array_sum( ( array ) $meta[$this->regis_id]['_dates']['_att_quantity'][$event_details['ID']] );
     $total_att = epl_get_element_m($event_id, 'total', epl_get_element('_att_quantity', $event_totals));
     //event dates, times and prices
     $dates = epl_get_element('_epl_start_date', $event_details);
     $times = epl_get_element('_epl_start_time', $event_details);
     $prices = epl_get_element('_epl_price_name', $event_details);
     $rolling_regis = epl_get_element('_epl_rolling_regis', $event_details) == 10;
     if (epl_is_empty_array($dates)) {
         return;
     }
     //foreach event date
     foreach ($dates as $_date_key => $date_timestamp) {
         $date_timestamp = epl_get_date_timestamp($date_timestamp);
         //number registered for the date
         $date_total_att = 0;
         $_date = epl_formatted_date($event_details['_epl_start_date'][$_date_key], 'Y-m-d', 'date');
         //the date to display
         $_displ_date = epl_formatted_date($_date);
         $qty_meta_key = "_total_att_" . $event_details['ID'] . '_date_' . $_date_key;
         //find the capacity for this date.
         $cap = $event_details['_epl_date_capacity'][$_date_key];
         //find the number of people regitered for this date
         $num_att = epl_get_element($qty_meta_key, $current_att_count, 0);
         //find the available spcaes.  If there is no capacity, always available
         $date_avail = $this->avail_spaces($cap, $num_att);
         $_past = epl_compare_dates(EPL_TIME, $_date . ' 23:59:59', ">");
         $_date_avail_display = epl_is_ok_to_register($event_details, $_date_key);
         $_date_avail_display = $_date_avail_display === true ? epl__('Available') : $_date_avail_display;
         //snapshot template
         $_t = array('timestamp' => $date_timestamp, 'disp' => $_displ_date, 'avail' => $date_avail, 'avail_display' => $_date_avail_display, 'regis' => $num_att, 'db_key' => $qty_meta_key, 'cart' => 0, 'past' => $_past, 'hide' => $date_avail != '' && $date_avail <= 0);
         //Set the snapshot for this date
         $event_snapshot[$event_id][$_date_key]['date'] = $_t;
         $rolling_regis_time_avail = 0;
         //foreach time available for the event
         foreach ($times as $_time_key => $_time_id) {
             $time_total_att = 0;
             $_time = $event_details['_epl_start_time'][$_time_key];
             $qty_meta_key = "_total_att_" . $event_details['ID'] . '_time_' . $_date_key . '_' . $_time_key;
             //$cap = $capacity['time'][$_time_key];
             $cap = epl_get_element($_time_key, epl_get_element('_epl_time_capacity', $event_details), '');
             if ($rolling_regis && $cap == '') {
                 $cap = epl_get_element_m($_date_key, '_epl_date_per_time_capacity', $event_details);
             }
             $num_att = epl_nz(epl_get_element($qty_meta_key, $current_att_count), 0);
             $time_avail = $this->avail_spaces($cap, $num_att);
             $rolling_regis_time_avail += $cap == '' ? 999 : epl_nz($time_avail, 0);
             $_comp_time = epl_get_element($_time_key, $event_details['_epl_regis_endtime']);
             $_comp_time = !$_comp_time ? $_time : $_comp_time;
             //Is this time for this date in the past and not available any more?
             $_past = epl_compare_dates(EPL_TIME, $_date . ' ' . $_comp_time, ">");
             if ($rolling_regis && $_past) {
                 $event_snapshot[$event_id][$_date_key]['date']['hide'] = true;
             }
             $_t = array('timestamp' => strtotime($times[$_time_key], $date_timestamp), 'disp' => $times[$_time_key], 'avail' => $time_avail, 'avail_display' => $_date_avail_display, 'regis' => $num_att, 'db_key' => $qty_meta_key, 'past' => $_past);
             //Set the snapsot for this time for this date
             $event_snapshot[$event_id][$_date_key]['time'][$_time_key] = $_t;
             foreach ($prices as $_price_key => $_price_id) {
                 $_price = $event_details['_epl_price_name'][$_price_key];
                 $price_avail = 0;
                 $do_count = true;
                 $price_att = 0;
                 $price_type = epl_get_element($_price_key, epl_get_element('_epl_price_type', $event_details), 'att');
                 if (isset($meta['_dates']['_att_quantity'][$event_details['ID']])) {
                     if (is_array(epl_get_element($_price_key, $meta['_dates']['_att_quantity'][$event_details['ID']]))) {
                         $price_att = array_sum((array) epl_get_element($_price_key, $meta['_dates']['_att_quantity'][$event_details['ID']]));
                     } else {
                         $price_att = epl_get_element($_price_key, $meta['_dates']['_att_quantity'][$event_details['ID']]);
                     }
                 }
                 $qty_meta_key = "_total_att_" . $event_details['ID'] . '_price_' . $_date_key . '_' . $_time_key . '_' . $_price_key;
                 if (epl_is_date_level_price()) {
                     $price_att = epl_get_element_m($_date_key, $_price_key, $cart_selected_quantities);
                 }
                 $cap = epl_get_element($_price_key, epl_get_element('_epl_price_capacity', $event_details), '');
                 $num_att = epl_nz(epl_get_element($qty_meta_key, $current_att_count), 0);
                 $price_avail = $this->avail_spaces($cap, $num_att);
                 if (!epl_is_empty_array($offset = $this->is_offsetter_price($_price_key)) && $cap !== '' && $price_avail > 0) {
                     //check to make sure users are not using the price as offset against itself
                     if ($offset['offset_key'] != $_price_key) {
                         // see if available count of the offseter is > capacity for this price
                         $offset_avail = $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$offset['offset_key']]['avail'];
                         $offset_count = $offset['offset_count'];
                         if ((int) $offset_count > (int) $offset_avail) {
                             $price_avail = 0;
                         } elseif ($offset_avail >= $offset_count) {
                             $price_avail = intval($offset_avail / $offset_count);
                         }
                     }
                 }
                 //echo "<pre class='prettyprint'>" . __LINE__ . "> $event_id >>>> " . print_r($price_avail, true). "</pre>";
                 $time_total_att += $price_att;
                 $_t = array('disp' => $prices[$_price_key], 'avail' => $price_avail, 'avail_display' => $_date_avail_display, 'regis' => $num_att, 'db_key' => $qty_meta_key, 'cart' => $price_att, 'past' => $_past);
                 $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key] = $_t;
                 if (epl_is_date_level_time() && epl_get_element($_date_key, $cart_selected_times) != $_time_key) {
                     $do_count = false;
                 }
                 if (epl_is_date_level_price() && !in_array($_date_key, (array) $cart_selected_dates)) {
                     //if ( $_date_key != $_price_key ) {
                     $do_count = false;
                     //}
                 }
                 if (epl_is_time_specific_price($_price_key)) {
                     if ($event_details['_epl_price_parent_time_id'][$_price_key] != $_time_key) {
                         unset($event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]);
                         $do_count = false;
                     }
                 }
                 if (!epl_is_time_optonal() && !in_array($_time_key, $cart_selected_times) || !in_array($_date_key, (array) $cart_selected_dates)) {
                     $do_count = false;
                 }
                 if (!$do_count || $price_type != 'att') {
                     $time_total_att -= $price_att;
                     if (isset($event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]['cart'])) {
                         $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]['cart'] = 0;
                     }
                 } else {
                     //check for a price availability for each date/time
                     if ($price_att > 0 && $price_avail !== '') {
                         $_error = array();
                         if ($price_avail === 0 || $price_avail < 0) {
                             $_error = array($_displ_date . '<br />' . $_time . '<br />' . $_price, $sold_out_text);
                         } elseif ($price_att > epl_nz($price_avail, 1000)) {
                             $_error = array($_displ_date . '<br />' . $_time . '<br />' . $_price, sprintf(epl__(' Only %d spaces left.'), $price_avail));
                         }
                         if (!empty($_error)) {
                             $epl_error[] = $_error;
                             $event_snapshot[$event_id]['error'][] = $_error;
                         }
                         $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]['avail_display'] = epl_get_element(1, $_error);
                     }
                 }
                 /* if( $price_type != 'att' )
                    $time_total_att -= $price_att; */
             }
             $date_total_att += $time_total_att;
             $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['cart'] = $time_total_att;
             //echo "<pre class='prettyprint'>" . __LINE__ . "> $_date "  . print_r($time_total_att, true). "</pre>";
             //check for time availablility for each date
             if ($this->flow_mode == 'n' && !epl_is_time_optonal() && $time_total_att > 0 && ($time_avail !== '' || $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['past'] === true)) {
                 $_error = array();
                 if (!epl_is_ongoing_event() && $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['past'] == 1) {
                     $_error = array($_displ_date . '<br />' . $_time, epl__('This time has passed.'));
                 }
                 if ($time_avail === 0 || $time_avail < 0) {
                     $_error = array($_displ_date . '<br />' . $_time, $sold_out_text);
                 } elseif ($time_total_att > epl_nz($time_avail, 1000)) {
                     $_error = array($_displ_date . '<br />' . $_time, sprintf(epl__('Only %d spaces left.'), $time_avail));
                 }
                 if (!empty($_error)) {
                     $epl_error[] = $_error;
                     $event_snapshot[$event_id]['error'][] = $_error;
                 }
                 $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['avail_display'] = epl_get_element(1, $_error);
             }
         }
         if ($rolling_regis && $rolling_regis_time_avail == 0 && $event_snapshot[$event_id][$_date_key]['date'] == '') {
             $event_snapshot[$event_id][$_date_key]['date']['hide'] = true;
         }
         //check for the date availability
         $event_snapshot[$event_id][$_date_key]['date']['cart'] = $date_total_att;
         if ($date_total_att > 0 && ($date_avail !== '' || $event_snapshot[$event_id][$_date_key]['date']['past'] === true) && (!epl_is_waitlist_approved() && !epl_is_waitlist_session_approved())) {
             $_error = array();
             if ($this->flow_mode == 'n' && ($date_avail === 0 || $date_avail < 0)) {
                 $_error = array($_displ_date, $sold_out_text);
                 if (epl_is_ok_for_waitlist() && ($wl_spaces_left = epl_waitlist_spaces_open()) !== false) {
                     $_error[1] .= '<br />' . epl__('If you would like to be added to the waiting list, please click on the button below.  You will not be charged at this time.');
                     if ($wl_spaces_left !== true) {
                         $_error[1] .= '<br />' . sprintf('Spaces available on the waiting list: %d', $wl_spaces_left);
                     }
                     if (epl_waitlist_enough_spaces($event_id) == false) {
                         $_error[1] .= '<br />' . sprintf('To continue, please select only %d.', $wl_spaces_left);
                     } else {
                         $_error[1] .= '<br />' . epl_anchor('#', epl__('Click here to add your name to the waitlist'), null, " class='open_add_to_waitlist_form epl_button' data-event_id='{$event_id}'");
                     }
                     $this->epl->epl_util->set_response_param('waitlist_form', '');
                 }
             } elseif ($this->flow_mode == 'n' && !epl_is_ongoing_event() && $event_snapshot[$event_id][$_date_key]['date']['past'] == 1) {
                 $_error = array($_displ_date, epl__('This date has passed.'));
             } elseif ($this->flow_mode == 'n' && $date_total_att > epl_nz($date_avail, 1000)) {
                 $_error = array($_displ_date, sprintf(epl__('Only %d spaces left.'), $date_avail));
             }
             $event_snapshot[$event_id][$_date_key]['date']['avail_display'] = epl_get_element(1, $_error);
             if (!empty($_error)) {
                 $event_snapshot[$event_id]['error'][] = $_error;
                 $epl_error[] = $_error;
             }
         }
         //$this->epl_table->add_row( '', $event_details['_epl_start_date'][$_date_key], $avail );
     }
     $_cache[$event_id] = $event_snapshot;
     return $event_snapshot;
 }
</td>


                                <td>


<?php 
        if ($time_data['regis']) {
            $dt_array = array('date_id' => $date_id, 'time_id' => $time_id);
            $table_link_arr = array_merge($table_link_arr, $dt_array);
            $csv_link_arr += $dt_array;
            $send_email_arr = array('epl_action' => 'get_the_email_form', 'epl_controller' => 'epl_registration', 'event_id' => $event_id, 'post_type' => false);
            echo epl_anchor(add_query_arg(array_merge($table_link_arr, $dt_array) + array('names_only' => 1), $base_url), epl__('View Names'), null, 'class="epl_view_attendee_list_table button-secondary"');
            echo epl_anchor(add_query_arg($table_link_arr, $base_url), epl__('View Full Data'), null, 'class="epl_view_attendee_list_table button-secondary"');
            echo epl_anchor(add_query_arg(array_merge($csv_link_arr, $dt_array), $base_url), epl__('Export CSV'), null, 'class="button-secondary"');
            echo epl_anchor(add_query_arg($send_email_arr + $dt_array, $base_url), epl__('Send Email'), null, "class='epl_send_email_form_link button-secondary' data-post_ID='{$post_ID}' data-event_id='{$event_id}'");
        }
        ?>
                            </td>
                        </tr>

<?php 
    }
    ?>



<?php 
}
?>
Exemplo n.º 5
0
 function notif_tags($email_body, $data)
 {
     global $event_details, $system_email_tags, $email_regis_form;
     if ($this->regis_id == '') {
         return null;
     }
     $email_body = nl2br(stripslashes_deep(html_entity_decode($email_body, ENT_QUOTES)));
     $regis_meta = $this->ecm->setup_regis_details($this->regis_id);
     $reigs_id = $regis_meta['__epl']['_regis_id'];
     $event_id = key($regis_meta['__epl'][$reigs_id]['_events']);
     //find the list of all forms
     $available_forms = $this->ecm->get_list_of_available_forms();
     $available_fields = $this->ecm->get_list_of_available_fields();
     $attendee_info = $regis_meta['__epl'][$reigs_id]['_attendee_info'];
     $_attendee_info = array();
     foreach ($attendee_info as $_f_id => $_att_data) {
         if (!isset($available_fields[$_f_id])) {
             continue;
         }
         //$_attendee_info[$_f_id] = epl_get_element( 0, epl_get_element( $event_id, $_att_data ) );
         $value = epl_get_element(0, $_att_data, false);
         if (!$value) {
             $value = epl_get_element(0, epl_get_element($event_id, $_att_data));
         }
         $input_type = epl_get_element('input_type', $available_fields[$_f_id]);
         if ($input_type == 'select' || $input_type == 'radio') {
             $field_choice_text = epl_get_element($value, $available_fields[$_f_id]['epl_field_choice_text'], null);
             $value = $field_choice_text && $field_choice_text != '' ? $field_choice_text : $value;
         } elseif ($input_type == 'checkbox') {
             $value = implode(',', (array) $value);
         } else {
             //TODO - eek, find a better way
             $value = html_entity_decode(htmlspecialchars_decode($value, ENT_QUOTES));
         }
         $_attendee_info[$_f_id] = $value;
     }
     $event_ticket_buyer_forms = array_flip((array) $event_details['_epl_primary_regis_forms']);
     $gateway_info = array();
     if (!epl_is_free_event()) {
         $gw_id = $this->erm->get_payment_profile_id();
         $gateway_info = $this->ecm->get_post_meta_all($gw_id);
     }
     $data['payment_instructions'] = $this->epl->load_view('front/registration/regis-payment-instr', array('gateway_info' => $gateway_info), true);
     $data['payment_details'] = $this->epl->load_view('front/registration/regis-payment-details', $data, true);
     $registration_detail_link = add_query_arg(array('epl_token' => epl_get_token()), get_permalink($this->regis_id));
     $_system_email_tags = array('registration_id' => get_the_regis_id(), 'registration_detail_link' => '<a href="' . $registration_detail_link . '" target="_blank" alt="' . epl__('Registration Detail Link') . '">' . epl__('Click here') . '</a>', 'event_name' => get_the_title($event_id), 'registration_details' => str_replace('class="epl_dates_times_prices_table"', 'style="clear:both;width:100%;margin:10px auto;border:1px solid #eee"', get_the_regis_dates_times_prices($data['post_ID'])), 'registration_form_data' => $email_regis_form, 'payment_details' => str_replace('class="epl_payment_details_table"', 'style="clear:both;width:100%;margin:10px auto;border:1px solid #eee"', $data['payment_details']), 'waitlist_approved_link' => epl_anchor(epl_get_waitlist_approved_url(), epl__('Register')), 'waitlist_approved_until' => epl_waitlist_approved_until(), 'event_details_link' => epl_anchor(get_permalink($event_details['ID']), get_the_title($event_details['ID'])), 'location_details' => !epl_is_multi_location() && epl_get_event_property('_epl_event_location', true) > 0 ? epl_suffix(', ', get_the_location_name()) . epl_suffix(', ', get_the_location_address() . ' ' . get_the_location_address2()) . get_the_location_city() . ' ' . get_the_location_state() . ' ' . get_the_location_zip() : '', 'location_map_link' => get_the_location_gmap_icon(epl__('Click here'), true));
     $_system_email_tags = apply_filters('epl_system_email_tags', $_system_email_tags);
     //isolate the forms that are selected inside the event
     // $ticket_buyer_forms = array_intersect_key( $available_forms, $event_ticket_buyer_forms );
     /*
      $tickey_buyer_fields = array( );
      foreach ( $ticket_buyer_forms as $_form_id => $_form_info )
      $tickey_buyer_fields += $_form_info['epl_form_fields'];
     */
     preg_match_all('/(?<=\\{)(.*?)(?=\\})/', $email_body, $matches);
     $_tags_in_body = array_flip(epl_get_element(0, $matches, array()));
     $_field_input_tags = array();
     foreach ($available_fields as $f_id => $f_data) {
         $_field_input_tags[$f_data['input_slug']] = $f_id;
     }
     $tagss = array_intersect_key($_field_input_tags, $_tags_in_body);
     $final_tags = array();
     foreach ($tagss as $k => $v) {
         $final_tags[$k] = epl_get_element($v, $_attendee_info);
     }
     $final_tags += $_system_email_tags;
     $find = array_keys($final_tags);
     array_walk($find, create_function('&$val', '$val = "{".$val."}";'));
     $replace = array_values($final_tags);
     return str_ireplace($find, $replace, $email_body);
 }
<?php

global $epl_fields;
$epl_fields['epl_gateway_type'] = array('_epl_pay_types' => array('input_type' => 'select', 'input_name' => '_epl_pay_types', 'label' => epl__('Payment Type'), 'id' => 'epl_pay_type', 'empty_row' => true, 'options' => array('_pp_exp' => epl__('PayPal Express Checkout'))));
$epl_fields['_pp_exp_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('PayPal Express Checkout'), 'content' => sprintf(epl__('Visit %s for more information.'), epl_anchor('https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECGettingStarted', epl__('here')))), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_pp_exp'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Label'), 'description' => sprintf(epl__('What the customer will see as an option.  PayPal requires you to use one of their %s'), epl_anchor('https://www.paypal.com/express-checkout-buttons', epl__('buttons'))), 'class' => 'epl_w300'), '_epl_pre_checkout_message' => array('input_type' => 'textarea', 'input_name' => '_epl_pre_checkout_message', 'label' => epl__('Pre Redirect Message'), 'description' => epl__('This will be displayed before the user is redirected to PayPal'), 'class' => 'epl_w300'), '_epl_pp_exp_user' => array('input_type' => 'text', 'input_name' => '_epl_pp_exp_user', 'id' => '', 'label' => epl__('API Username'), 'description' => epl__('Ex: some_api1.youremailaddress.com'), 'class' => 'epl_w300', 'required' => true), '_epl_pp_exp_pwd' => array('input_type' => 'password', 'input_name' => '_epl_pp_exp_pwd', 'id' => '', 'label' => epl__('API Password'), 'description' => epl__('Ex: SDFE23D5SFD324'), 'class' => '_epl_w300', 'required' => true), '_epl_pp_exp_sig' => array('input_type' => 'password', 'input_name' => '_epl_pp_exp_sig', 'id' => '', 'label' => epl__('Signature'), 'description' => epl__('Will be a very long string. Ex. SRl31AbcSd9fIqew......'), 'class' => 'epl_w300', 'required' => true), '_epl_pp_landing_page' => array('input_type' => 'radio', 'input_name' => '_epl_pp_landing_page', 'id' => '', 'label' => epl__('PayPal Landing Page'), 'description' => epl__('If "PayPal Account Optional" is set to "on" inside your PayPal account, this option selects which section the users see by default when they reach PayPal.'), 'options' => array('Login' => epl__('PayPal account login'), 'Billing' => epl__('Non-PayPal account, for credit/debit cards')), 'default_value' => 'Billing', 'default_checked' => 1), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'description' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''));
$epl_fields['_check_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('Checks/Money Orders'), 'content' => epl__('You can use this to give your customers the ability to pay using a Check.')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_check'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Display Label'), 'description' => epl__('What the customer will see as an option.'), 'class' => 'epl_w300'), '_epl_check_payable_to' => array('input_type' => 'text', 'input_name' => '_epl_check_payable_to', 'id' => '_epl_form_label', 'label' => epl__('Make Payable To'), 'description' => epl__('Who will get this check?'), 'class' => 'epl_w300', 'required' => true), '_epl_check_address' => array('input_type' => 'textarea', 'input_name' => '_epl_check_address', 'label' => epl__('Send Payment To'), 'description' => epl__('The address.'), 'class' => 'epl_w300'), '_epl_check_instructions' => array('input_type' => 'textarea', 'input_name' => '_epl_check_instructions', 'id' => '', 'label' => epl__('Instructions'), 'description' => epl__('Special Instruction to the customer.'), 'class' => 'epl_w300'));
<?php

global $epl_sys_messages;
$epl_sys_messages = array('0' => epl__('Sorry but something must have gone wrong.'), '20' => epl__('Please select a quantity'), '21' => epl__('Please select a date'), '22' => epl__('Please select a time'), '23' => epl__('Sold Out'), '24' => epl__('Registration Closed'), '25' => epl__('The quantity selected exceeds the number of available spaces'), '40_5' => epl__('Please select a date.'), '90' => sprintf('Hi there.  If you are seeing this error, you need to enter a Support License Key or your key is invalid.
        If you have already purchased a Support License Key, please go %s (Events Planner > Settings > API Settings tab) and enter it in the API Settings tab.
        If you need to get one, please go to %s.  If at any point you are having issues, please contact Events Planner Helpdesk at help@wpeventsplanner.com.  Thank you. ', epl_anchor('edit.php?post_type=epl_event&page=epl_settings', "here"), epl_anchor('http://www.wpeventsplanner.com', "Events Planner Website")));
$epl_sys_messages = apply_filters('epl_sys_messages', $epl_sys_messages);
                if (epl_is_date_level_time() && !epl_is_empty_array($date_specifc_time) && (!isset($date_specifc_time[$time_id]) || !isset($date_specifc_time[$time_id][$date_id]))) {
                    continue;
                }
                $weekday_specific = epl_get_element_m($time_id, '_epl_weekday_specific_time', $event_details, array());
                if (!empty($weekday_specific) && !isset($weekday_specific[$weekday])) {
                    continue;
                }
                $start_time = strtotime($time, $start_date);
                $signed_in_key = "{$event_id}-{$date_id}-{$start_date}-{$time_id}";
                $signed_in_count = epl_get_element($signed_in_key, $session_signed_in_counts, 0);
                $time_cap = epl_get_element($time_id, $time, '-');
                $display_date = epl_formatted_date($start_date);
                //build the td rows
                $add_regis_link = add_query_arg(array('_date_id' => $date_id, '_time_id' => $time_id, 'event_id' => $event_id), admin_url('post-new.php?post_type=epl_registration'));
                $add_regis_link = '<a href="' . $add_regis_link . '" class="add_att_link" title="+ Att" data-no_action="1" target="_blank">Add Registration</a>';
                $temp_table_row = '<td>' . epl_anchor(admin_url("post.php?post=" . get_the_ID() . "&action=edit"), get_the_title()) . '</td>';
                $temp_table_row .= '<td>' . $display_date . '</td>';
                $temp_table_row .= '<td>' . $time . '-' . $event_details['_epl_end_time'][$time_id] . '</td>';
                $temp_table_row .= "<td class='singed_in_count'>" . $signed_in_count . '</td>';
                $temp_table_row .= '<td>' . $num_regis . '</td>';
                $temp_table_row .= "<td style='text-align:right;'>";
                if ($num_regis > 0) {
                    $temp_table_row .= "<a href='' class='sign_in_link' data-event_id='{$event_id}' data-date_id='{$date_id}' data-date_ts='{$start_date}' data-time_id='{$time_id}' data-ongoing='{$ongoing}'>" . epl__('Check In') . "</a>";
                }
                $temp_table_row .= " | {$add_regis_link}</td>";
                echo "<tr>" . $temp_table_row . "</tr>";
            }
        }
    }
    ?>
 function column_data($column_name, $post_ID)
 {
     global $epl_fields, $event_details, $regis_details;
     $this->regis_meta = $this->ecm->setup_regis_details($post_ID);
     $regis_id = $this->regis_meta['__epl']['_regis_id'];
     $event_id = '';
     $event_name = '';
     $num_attendees = '';
     if (isset($this->regis_meta['_epl_events']) && !empty($this->regis_meta['_epl_events'])) {
         $event_id = key($this->regis_meta['_epl_events']);
         $this->ecm->setup_event_details($event_id);
         //$event_name = get_post( $event_id )->post_title;
         $event_name = $event_details['post_title'];
         $href = add_query_arg(array('epl_action' => 'epl_attendee_list', 'epl_download_trigger' => 1, 'event_id' => $event_id), epl_get_url());
         $xl_href = add_query_arg(array('epl_action' => 'epl_excel_attendee_list', 'epl_download_trigger' => 1, 'post_ID' => $post_ID, 'event_id' => $event_id), epl_get_url());
         //$event_name = '<a href="' . $href . '"><img src="' . EPL_FULL_URL . 'images/doc_excel_csv.png" /></a> <a data-post_id = "' . $post_ID . '" data-event_id="' . $event_id . '" class="epl_event_snapshot" href="#"><img id = "' . $event_id . '"  src="' . EPL_FULL_URL . 'images/application_view_list.png" /> </a><span class="">' . $event_name . '</span>';
         //$xevent_name = '<a href="' . $xl_href . '"><img src="' . EPL_FULL_URL . 'images/doc_excel_csv.png" /></a>';
         //$event_name = $xevent_name . '<a href="' . $href . '"><img src="' . EPL_FULL_URL . 'images/doc_excel_csv.png" /></a><span class="event_name">' . $event_name . '</span>';
         $xevent_name = '<span class="event_name1">' . $event_name . '</span><br />';
         //<a href="' . $xl_href . '">Excel</a>, ';
         $event_name = $xevent_name . '<a href="' . $href . '">CSV</a>';
     }
     switch ($column_name) {
         case 'attendees':
             if (is_array($this->regis_meta['__epl'][$regis_id]['_attendee_info']) && is_array($this->personal_field_ids)) {
                 $d = array_intersect_key($this->regis_meta['__epl'][$regis_id]['_attendee_info'], $this->personal_field_ids);
                 $r = array();
                 $fn = epl_array_flatten(current($d));
                 $ln = epl_array_flatten(next($d));
                 foreach ((array) $fn as $k => $v) {
                     $r[] = $v . ' ' . stripslashes_deep(html_entity_decode(htmlspecialchars_decode(epl_get_element($k, $ln)), ENT_QUOTES, 'UTF-8'));
                 }
                 echo implode('<br>', array_unique($r));
             }
             break;
         case 'id':
             echo $post_ID;
             break;
         case 'event':
             //TODO move to view
             $data = array();
             echo '<table class="epl_regis_list_regis_details">';
             foreach ((array) $this->regis_meta['__epl'][$regis_id]['_events'] as $event_id => $totals) {
                 setup_event_details($event_id);
                 $data['event_name'] = $event_details['post_title'];
                 $data['quantity'] = epl_get_element($event_id, epl_get_element_m('total', '_att_quantity', $totals), 0);
                 if ($data['quantity'] == 0) {
                     //1.3 fix
                     foreach ($this->regis_meta['__epl'][$regis_id]['_dates']['_att_quantity'][$event_id] as $pr => $q) {
                         $data['quantity'] += array_sum($q);
                     }
                 }
                 $link = epl_anchor(admin_url('post.php?post=' . $event_details['ID'] . '&action=edit'), $event_details['post_title']);
                 echo "<tr><td>{$link}</td><td class='qty'>{$data['quantity']}</td></tr>";
             }
             echo '</table>';
             break;
         case 'num_attendees':
             /*
              $this->get_values( $post_ID );
              $data['event_id'] = $event_id;
             
              //events, dates, times, prices, quantities
              $data['cart_data'] = $this->earm->__in( $this->event_meta + $this->regis_meta )->show_cart();
              echo $this->epl->load_view( 'admin/registration/regis-list-cart-section', $data, true );
             */
             $num_attendees = $this->regis_meta['_total_att_' . $event_id];
             if (epl_is_waitlist_record()) {
                 foreach ($this->regis_meta as $key => $value) {
                     if (strpos($key, "_total_waitlist_att_") !== false) {
                         $num_attendees = $value . ' (' . epl__('waitlist') . ')';
                         break;
                     }
                 }
             }
             echo "<span class='num_attendees'>{$num_attendees}</span> ";
             if ($num_attendees > 0) {
                 $href = add_query_arg(array('epl_action' => 'epl_regis_snapshot', 'post_ID' => $post_ID, 'event_id' => $event_id), epl_get_url());
                 echo ' <a data-post_id = "' . $post_ID . '" data-event_id="' . $event_id . '" class="epl_regis_snapshot" href="#"><img src="' . EPL_FULL_URL . 'images/application_view_list.png" /> </a>';
             }
             echo epl_get_send_email_button($post_ID, $event_id, true);
             break;
         case 'payment_status':
             $payment_info = $this->payment_info_box($post_ID);
             echo $payment_info;
             $notes = epl_get_element('_epl_regis_note', $this->regis_meta, null);
             if ($notes) {
                 $notes = get_post_meta($post_ID, '_epl_regis_note', false);
                 foreach ($notes as $note) {
                     $d = date_i18n('Y-m-d H:i', $note['timestamp']);
                     echo "<p>{$note['action']}<span style='float:right'>{$d}</span></p>";
                 }
             }
             break;
         case 'payment':
             echo "Payment Info";
             break;
         default:
             break;
     }
     // end switch
 }
Exemplo n.º 10
0
 }
 $table_link_arr = array('epl_action' => 'view_names', 'epl_download_trigger' => 1, 'table_view' => 1, 'epl_controller' => 'epl_report_manager', 'event_id' => $event_id);
 $dt_array = array('date_id' => $date_id, 'time_id' => $time_id, 'event_id' => $event_id);
 $table_link_arr = array_merge($table_link_arr, $dt_array);
 $load_att_link = add_query_arg(array_merge($table_link_arr, $dt_array) + array('names_only' => 1), $base_url);
 $load_att_name_button = '<a href="' . $load_att_link . '" class="btn load_attendees list_action_button" title="Attendees" data-label="Att" href="#">Att</a>';
 $table_link_arr[''] = 'view_names';
 $load_att_link = add_query_arg(array_merge($table_link_arr, $dt_array), $base_url);
 $load_att_full_data_button = '<a href="' . $load_att_link . '" class="btn load_attendees list_action_button" title="Full Data" data-label="Full" href="#">Full</a>';
 $load_att_link = add_query_arg(array_merge($table_link_arr, $dt_array) + array('combined' => 1), $base_url);
 $load_att_comb_data_button = '<a href="' . $load_att_link . '" class="btn load_attendees list_action_button" title="Combined" data-label="Comb." href="#">Comb.</a>';
 $table_link_arr['epl_action'] = 'get_the_email_form';
 $load_att_link = add_query_arg(array_merge($table_link_arr, $dt_array) + array('names_only' => 1), $base_url);
 $email_form_link = '<a href="' . $load_att_link . '" class="btn load_attendees list_action_button" title="Email" data-label="Email" data-load_in="modal" href="#">Em</a>';
 $add_regis_link = add_query_arg(array('_date_id' => $date_id, '_time_id' => $time_id, 'event_id' => $event_id), admin_url('post-new.php?post_type=epl_registration'));
 $delete_link = epl_anchor(get_delete_post_link(), '<img src="' . EPL_FULL_URL . '/images/delete.png" class="epl_fr epl_del_event" />', '_self');
 $add_regis_link = '<a href="' . $add_regis_link . '" class="btn load_attendees list_action_button" title="+ Att" data-no_action="1" target="_blank">+ Att</a>';
 $temp_table_row = '';
 $temp_table_row .= '<td>' . $unix_time . '</td>';
 if ($no_date) {
     $temp_table_row .= '<td>' . $event_categories . '</td>';
     $temp_table_row .= '<td></td>';
     $temp_table_row .= '<td>NO DATE</td>';
     $temp_table_row .= '<td></td>';
     $temp_table_row .= '<td class="title"><input type="checkbox" name="event_ids[' . $event_id . ']" class="event_ids" value="' . $event_id . '">&nbsp;&nbsp;' . $event_edit_link . $date_note . $formatted_status . '</td>';
     $temp_table_row .= '<td></td>';
     $temp_table_row .= '<td></td>';
     $temp_table_row .= '<td></td>';
     $temp_table_row .= '<td>' . $status . '</td>';
     $temp_table_row .= '<td>' . $event_id . ' ' . $delete_link . '</td>';
 } else {
Exemplo n.º 11
0
echo '<img  src ="' . EPL_FULL_URL . 'images/email.png" alt="Send Feedback" />';
?>
, please click on it to send a feedback straight from this install of wordpress (if of course you can send emails out of this install).
                    </li>
                    <li>
                        Every place you see this icon <?php 
echo '<img  src ="' . EPL_FULL_URL . 'images/help.png" alt="Send Feedback" />';
?>
,
                        please click on it to get relevant help loaded from wpeventsplanner.com.
                        As it comes from our support website, it will be up to date.  We do not collect any information about your install.
                    </li>

                    <li>
                        Visit <?php 
echo epl_anchor('http://www.wpeventsplanner.com', 'Our Support Website');
?>
                    </li>
                    <li>
                        Email help@wpeventsplanner.com directly.  Please be as specific as possible when you are reporting bugs or have feature requests.
                    </li>

                </ol>
            </div>
        </div>



        <div class="epl_box">
            <div class="epl_box_content">
                <h4>After Initial Installation</h4>
Exemplo n.º 12
0
 }
 if (!$go) {
     continue;
 }
 foreach ($event_details['_epl_start_time'] as $time_id => $time) {
     if (epl_is_date_level_time() && !epl_is_empty_array($date_specifc_time) && (!isset($date_specifc_time[$time_id]) || !isset($date_specifc_time[$time_id][$date_id]))) {
         continue;
     }
     $regis_end_time = epl_get_element_m($time_id, '_epl_regis_endtime', $event_details, null);
     if ($regis_end_time && epl_compare_dates(strtotime($regis_end_time, $date), EPL_TIME, '<')) {
         continue;
     }
     $register_button = get_the_register_button(null, false, $register_button_url + array('_time_id' => $time_id));
     $event_link = '';
     if (isset($event_details['_epl_link']) && $event_details['_epl_link'] != '') {
         $event_link = epl_anchor($event_details['_epl_link'], 'Learn More', '_self', 'class="event_link"') . ' ' . $register_button;
     } else {
         $event_link = $register_button;
     }
     //removed per Jessi
     //if (!$regis_end_time && epl_compare_dates( strtotime($time, $date), EPL_TIME, '<' ))
     //continue;
     $event_id = get_the_ID();
     $event_excerpt = get_the_excerpt();
     $event_tooltip = '';
     if ($event_excerpt !== '') {
         $event_tooltip = " <span class='tip event_tooltip' title='" . $event_excerpt . "'>i</span>";
     }
     //$event_title = epl_anchor($event_details['_epl_link'],get_the_title(),'_self','class="event_link"');
     $event_title = get_the_title();
     $event_categories = strip_tags(get_the_term_list($event_id, 'epl_event_categories', '', ',', ''));
Exemplo n.º 13
0
function epl_get_api_fields()
{
    global $epl_fields;
    $epl_fields['epl_api_option_fields'] = array('epl_api_key' => array('input_type' => 'text', 'input_name' => 'epl_api_key', 'label' => epl__('Support License Key'), 'help_text' => 'The Support License Key will enable the pro version, allow automatic downloads of new versions of the plugin and modules that you have purchased.  The key can be obtained from ' . get_option('epl_help_url', true), 'class' => 'epl_w400', 'required' => true), 'epl_api_section' => array('input_type' => 'section', 'label' => '', 'class' => '', 'style' => 'font-size:12px', 'content' => "Custom Tables" . "<div style='font-size:12px;'>Version 2.0 introduces custom registration db tables.  They need to be populated with current registration data.  " . "WARNING. It is highly encouraged to do a backup of your database, just in case things go wrong (unlikely but we want to be safe).  If you have a large data set (>1000 registrations), this may take up to a few minutes. " . epl_anchor(admin_url('/edit.php?post_type=epl_event&epl_action=populate_db_tables&epl_controller=epl_registration&r=1&epl_download_trigger=1'), 'Click here', '_self', 'class="button-secondary"') . " to populate/repopulate the tables." . " Latest run was performed on: " . '<strong>' . get_option('_epl_last_table_refresh', 'Never') . '</strong>'));
    if (epl_is_addon_active('_epl_atp')) {
        $epl_fields['epl_api_option_fields'] += array('epl_atp_section' => array('input_type' => 'section', 'label' => '', 'class' => 'epl_font_555 epl_font_bold', 'content' => epl__('Advanced Time/Price Settings')), 'epl_atp_enable_date_specific_time' => array('input_type' => 'select', 'input_name' => 'epl_atp_enable_date_specific_time', 'options' => epl_yes_no(), 'default_value' => 10, 'label' => epl__('Enable date specific times?')), 'epl_atp_enable_date_specific_price' => array('input_type' => 'select', 'input_name' => 'epl_atp_enable_date_specific_price', 'options' => epl_yes_no(), 'default_value' => 10, 'label' => epl__('Enable date specific price?')), 'epl_atp_enable_price_specific_form' => array('input_type' => 'select', 'input_name' => 'epl_atp_enable_price_specific_form', 'options' => epl_yes_no(), 'default_value' => 10, 'label' => epl__('Enable price specific forms?')), 'epl_atp_enable_table_price_type' => array('input_type' => 'select', 'input_name' => 'epl_atp_enable_table_price_type', 'options' => epl_yes_no(), 'default_value' => 10, 'label' => epl__('Enable table price type?')));
    }
    if (!epl_is_addon_active('ASDFAWEEFADSF')) {
        return $epl_fields;
    }
    $epl_fields['epl_api_option_fields'] += array('epl_mc_section' => array('input_type' => 'section', 'label' => '', 'class' => 'epl_font_555 epl_font_bold', 'content' => epl__('MailChimp Settings.  Please enter your key and hit Save Changes to begin.')), 'epl_mc_key' => array('input_type' => 'password', 'input_name' => 'epl_mc_key', 'label' => epl__('Mailchimp API Key'), 'class' => 'epl_w400', 'required' => true));
    if (epl_get_setting('epl_api_option_fields', 'epl_mc_key') != '') {
        $epl_fields['epl_api_option_fields'] += array('epl_mc_action' => array('input_type' => 'select', 'input_name' => 'epl_mc_action', 'options' => array(0 => epl__('No'), 1 => epl__('Enable for all current and future events'), 2 => epl__('I will choose for each event')), 'help_text' => epl__('If you select No, this feature will be diabled at global and event level. If you select the second option, you can still override it for each event.'), 'id' => 'epl_mc_default_action', 'label' => epl__('Enable MailChimp Extension'), 'help_icon_type' => '-red', 'default_value' => 1, 'class' => 'epl_field_type', 'default_value' => ''), 'epl_mc_double_opt_in' => array('input_type' => 'select', 'input_name' => 'epl_mc_double_opt_in', 'options' => epl_yes_no(), 'id' => 'epl_mc_double_opt_in', 'label' => epl__('Double Opt In (global)'), 'help_text' => epl__('When this option is enabled, MailChimp will send a confirmation email to the user and will only add them to your MailChimp list upon confirmation.'), 'default_value' => 0), 'epl_mc_send_welcome_email' => array('input_type' => 'select', 'input_name' => 'epl_mc_send_welcome_email', 'id' => 'epl_mc_send_welcome_email', 'label' => epl__('Send Welcome Email (global)'), 'help_text' => epl__('When this option is enabled, users will receive an automatic welcome email from MailChimp upon being added to your MailChimp list.'), 'options' => epl_yes_no(), 'class' => 'epl_field_type', 'default_value' => ''), '_epl_mc_offer_notification_sign_up' => array('input_type' => 'select', 'input_name' => '_epl_mc_offer_notification_sign_up', 'options' => array(1 => epl__('Ask'), 3 => epl__('Automatically add')), 'default_value' => 1, 'label' => epl__('User Signup Method (default)')), 'epl_mc_permission_label' => array('input_type' => 'text', 'input_name' => 'epl_mc_permission_label', 'label' => epl__('Permission Label'), 'help_text' => epl__('This label will be displayed during the registration process if you choose to ask the users for permission to sign them up.'), 'class' => 'epl_w400', 'default_value' => epl__('Subscribe to our newsletter')), '_epl_mc_default_list' => array('input_type' => 'select', 'input_name' => '_epl_mc_default_list', 'options' => epl_get_mailchimp_lists(), 'empty_row' => true, 'default_value' => '', 'label' => epl__('Default Notification List')));
    }
    if (epl_um_is_active()) {
        $epl_fields['epl_api_option_fields'] += array('epl_um_section' => array('input_type' => 'section', 'label' => '', 'class' => 'epl_font_555 epl_font_bold', 'content' => epl__('User Manager Settings') . '<br/><span style="font-size:12px;"> - ' . epl__("Please note that this feature will only work if the Primary Registrant form is enabled.") . '</span>'), 'epl_um_enable_user_regis' => array('input_type' => 'select', 'input_name' => 'epl_um_enable_user_regis', 'label' => epl__('Enable User Registration?'), 'options' => array(0 => epl__('No'), 1 => epl__('Yes')), 'default_value' => 0), 'epl_um_user_regis_username' => array('input_type' => 'select', 'input_name' => 'epl_um_user_regis_username', 'label' => epl__('Username'), 'options' => array(1 => epl__('Email'), 2 => epl__('Let user choose')), 'default_value' => 1), 'epl_um_user_regis_password' => array('input_type' => 'select', 'input_name' => 'epl_um_user_regis_password', 'label' => epl__('Password'), 'options' => array(1 => epl__('Automatic'), 2 => epl__('Let user choose')), 'default_value' => 1), 'epl_um_user_regis_role' => array('input_type' => 'select', 'input_name' => 'epl_um_user_regis_role', 'label' => epl__('Role to assign'), 'options' => epl_get_roles_arr(), 'default_value' => 'subscriber'));
    }
    $epl_fields['epl_api_option_fields'] += array('epl_invoice_section' => array('input_type' => 'section', 'label' => '', 'class' => 'epl_font_555 epl_font_bold', 'content' => epl__('Invoice Settings')), 'epl_invoice_attach_to_conf' => array('input_type' => 'select', 'input_name' => 'epl_invoice_attach_to_conf', 'id' => 'epl_invoice_send_in_conf', 'label' => epl__('Attach invoice to confirmation emails?'), 'help_text' => epl__('If no, you can still attach invoices to emails that are sent manually.'), 'options' => epl_yes_no(), 'default_value' => 0), 'epl_invoice_logo' => array('input_type' => 'text', 'input_name' => 'epl_invoice_logo', 'id' => 'epl_invoice_logo', 'class' => 'epl_w400', 'label' => epl__('Invoice Logo'), 'description' => epl_anchor('#', epl__('Select File'), null, ' id="epl_invoice_logo_select"')), 'epl_invoice_display_id' => array('input_type' => 'select', 'input_name' => 'epl_invoice_display_id', 'id' => 'epl_invoice_display_id', 'label' => epl__('Invoice Id'), 'options' => array(1 => epl__('Registration Post ID'), 2 => epl__('Registration Title'), 3 => epl__('Incremental ID'))), 'epl_invoice_due' => array('input_type' => 'text', 'input_name' => 'epl_invoice_due', 'class' => 'epl_w40', 'label' => epl__('Invoice Payment Due'), 'help_text' => epl__('Number of days after issue date when the payment is due.')), 'epl_invoice_company_info' => array('input_type' => 'textarea', 'input_name' => 'epl_invoice_company_info', 'id' => 'epl_invoice_company_info', 'label' => epl__('Invoice Company Information'), 'help_text' => epl__('This will be posted on the top right cornerof the invoice.  Can use HTML'), 'style' => 'width:300px;height:120px;', '_save_func' => 'wp_kses_post'), 'epl_invoice_instruction' => array('input_type' => 'textarea', 'input_name' => 'epl_invoice_instruction', 'id' => 'epl_invoice_instruction', 'label' => epl__('Instructions'), 'help_text' => epl__('This will be posted on the bottom of the invoice.'), 'style' => 'width:90%;height:120px;', '_save_func' => 'wp_kses_post'));
    return $epl_fields;
}
 function run_report()
 {
     global $wpdb, $event_details;
     //if ( $_REQUEST['event_id'] != '' )
     //  $prefix = 'event-';
     $m = str_replace('-', '_', $_REQUEST['report_type']);
     if (method_exists(__CLASS__, $m)) {
         $r = $this->{$m}();
     } elseif ($_REQUEST['report_type'] == 'full') {
         $r = $this->erptm->attendee_list(true, false, null, true);
     } elseif ($_REQUEST['report_type'] == 'primary-form-data') {
         $r = $this->primary_form_data();
     } else {
         $this->regis_list = $this->edbm->get_the_data();
         $data['regis_list'] = $this->regis_list;
         $csv_link_arr = array('page' => 'epl_report_manager', 'epl_action' => 'attendee_list', 'epl_download_trigger' => 1, 'epl_controller' => 'epl_report_manager', 'event_id' => $event_id);
         $base_url = admin_url('edit.php?post_type=epl_event');
         $data['csv_link'] = epl_anchor(add_query_arg($csv_link_arr, $base_url), epl__('Export Full CSV'), null, 'class="button-primary"');
         $this->ecm->events_list();
         $r = $this->epl->load_view("admin/reports/{$_REQUEST['report_type']}", $data, true);
     }
     if ($GLOBALS['epl_ajax']) {
         return $r;
     }
     echo $r;
 }
?>
images/add.png" /></a>
            </td>
        </tr>


    </tfoot>
    <tbody class="">

        <?php 
$counter = 1;
foreach ($epl_discount_fields as $disc_code => $row) {
    $discount_used = '';
    if (epl_get_element($disc_code, $used_discount_codes)) {
        foreach ($used_discount_codes[$disc_code] as $used) {
            $this->epl->epl_table->add_row(epl_anchor(admin_url('post.php?post=' . $used['regis_id'] . '&action=edit'), $used['regis_key']), epl_formatted_date($used['regis_date']));
        }
        $discount_used = $this->epl->epl_table->generate();
        $this->epl->epl_table->clear();
    }
    ?>

            <tr class="copy_">


                <td>

                    <table cellspacing ="0" class="epl_standard_table" style="margin:0;">

                        <?php 
    if ($counter == 1) {
 function get_the_email_addresses($filter = null, $regis_id = null)
 {
     global $wpdb, $event_details;
     $this->WHERE = ' AND r.status between 2 and 5 ';
     $arr = array('regis_id' => !is_null($regis_id) ? $regis_id : epl_get_element('post_ID', $_REQUEST, false), 'event_id' => $_REQUEST['event_id'], 'date_id' => epl_get_element('date_id', $_REQUEST, null), 'time_id' => epl_get_element('time_id', $_REQUEST, null), 'names_only' => epl_get_element('names_only', $_REQUEST, 0));
     setup_event_details($arr['event_id']);
     $data['pack_regis'] = epl_get_element('_epl_pack_regis', $event_details, 0) == 10;
     $_filter = array();
     if ($data['pack_regis']) {
         //find all the registrations for this event
         //for each one, find out if package
         //for each one that is pack, find the pack * X days
         //contstruct array
         $event_date_keys = array_keys($event_details['_epl_start_date']);
         $pack_counts = epl_get_element('_epl_price_pack_size', $event_details, array());
         $registrations = $wpdb->get_results("SELECT * FROM {$wpdb->epl_regis_data} WHERE event_id = " . intval($event_details['ID']));
         if ($registrations) {
             foreach ($registrations as $regis) {
                 $regis_weekday = date('N', $event_details['_epl_start_date'][$regis->date_id]);
                 if (isset($pack_counts[$regis->price_id])) {
                     $pack_counter = epl_get_element($regis->price_id, $pack_counts, 1);
                     $start = false;
                     foreach ($event_details['_epl_start_date'] as $date_id => $date) {
                         if (!$start && $date_id != $regis->date_id) {
                             continue;
                         }
                         $start = true;
                         $_weekday = date('N', $date);
                         if ($regis_weekday != $_weekday || $pack_counter == 0) {
                             continue;
                         }
                         $pack_counter--;
                         $attendance_dates[$regis->id][$date_id] = $date;
                         $_filter[$regis->id] = $regis->id;
                     }
                     if ($arr['date_id'] && !isset($attendance_dates[$regis->id][$arr['date_id']]) || $arr['time_id'] && $arr['time_id'] != $regis->time_id) {
                         unset($_filter[$regis->id]);
                         unset($attendance_dates[$regis->id]);
                     }
                     //$offset = array_search( $regis->date_id, $event_date_keys );
                     //$attendance_dates[$regis->id] = array_slice( $event_details['_epl_start_date'], $offset, $pack_counts[$regis->price_id] );
                 }
             }
         }
     }
     $_filter = implode(',', $_filter);
     if ($_filter != '') {
         $_filter = " AND rd.id IN ({$_filter})";
     }
     if (($regis_id = epl_get_element('post_ID', $_REQUEST, $arr['regis_id'])) !== false) {
         $this->WHERE = ' AND r.status between 1 and 5 ';
         $this->WHERE .= ' AND r.regis_id =' . $wpdb->escape($regis_id);
     }
     if (($_event_id = epl_get_element('event_id', $_REQUEST, false)) !== false) {
         $this->WHERE .= ' AND rd.event_id =' . $wpdb->escape($_event_id);
     }
     if (!$_filter && ($_date_id = epl_get_element('date_id', $_REQUEST, false)) !== false) {
         $this->WHERE .= ' AND rd.date_id ="' . $wpdb->escape($_date_id) . '"';
     }
     if (!$_filter && ($_time_id = epl_get_element('time_id', $_REQUEST, false)) !== false) {
         $this->WHERE .= ' AND rd.time_id ="' . $wpdb->escape($_time_id) . '"';
     }
     $form_to_look_at = 'AND rf.form_no = 0';
     $who_to_email = epl_get_setting('epl_registration_options', 'epl_send_customer_confirm_message_to', 1);
     if ($who_to_email == 2 || !epl_has_primary_forms()) {
         $form_to_look_at = '';
     }
     $q = $wpdb->get_results("SELECT\r\n          r.regis_id, r.status, r.regis_key, rd.event_id, rf.field_id, rf.form_no, rf.input_slug, rf.value\r\n         \r\n          FROM {$wpdb->epl_regis_data} rd\r\n          INNER JOIN {$wpdb->epl_registration} r\r\n          ON r.regis_id = rd.regis_id\r\n          INNER JOIN {$wpdb->epl_regis_form_data} rf\r\n          ON (rd.regis_id = rf.regis_id AND rd.event_id = rf.event_id)\r\n          WHERE 1=1 \r\n          {$this->WHERE} {$form_to_look_at} {$_filter}\r\n          GROUP BY rf.value\r\n          ORDER BY  r.regis_date, rd.id\r\n          ");
     $email_list = array('raw_list' => array(), 'display_list' => '');
     $num_emails = 0;
     if ($q) {
         foreach ($q as $row) {
             setup_event_details($row->event_id);
             //Redundant.  But on line 280, from the registration list individual email, event id is not available.
             if ($who_to_email == 1 && (epl_has_primary_forms() && $row->form_no > 0)) {
                 continue;
             }
             $d = $this->get_form_data_array($row->input_slug, $row->value);
             if ($d['email'] == '') {
                 continue;
             }
             //if ( !is_array( $email_list['display_list'][$row->regis_id] ) )
             //  $email_list['display_list'][$row->regis_id] = array();
             $this->epl_table->add_row('<input type="checkbox" id="" name="to_emails[' . $row->regis_id . '][]" class="regis_status_' . $row->status . '" style="" value="' . $d['email'] . '" checked="checked">', $d['email'], $d['first_name'] . ' ' . $d['last_name'], epl_anchor(admin_url('post.php?post=' . $row->regis_id . '&action=edit'), $row->regis_key), get_the_regis_status($row->status));
             $num_emails++;
             //$email_list['display_list'][$row->regis_id] = $d['email'] . epl_prefix( ', ', $d['first_name'] . ' ' . $d['last_name'] ) . ', ' . epl_anchor( admin_url( 'post.php?post=' . $row->regis_id . '&action=edit' ), $row->regis_key ) . ', ' . get_the_regis_status( $row->status );
             $email_list['raw_list'][] = $d['email'];
         }
     }
     $tmpl = array('table_open' => '<table cellpadding="0" cellspacing="0" class="epl_email_to_list" style="">');
     $this->epl_table->set_template($tmpl);
     $email_list['display_list'] = $this->epl_table->generate();
     $email_list['display_list'] = $this->epl->load_view('admin/registration/regis-email-form-regis-list', $email_list, true);
     $email_list['num_emails'] = $num_emails;
     // echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " > " . print_r($email_list['display_list'], true) . "</pre>";
     return $email_list;
 }
function epl_get_send_email_button($regis_id = false, $event_id = false, $img = false)
{
    $send_email_arr = array('epl_action' => 'get_the_email_form', 'epl_controller' => 'epl_report_manager', 'event_id' => $event_id, 'post_ID' => $regis_id);
    $anchor = epl__('Send Email');
    $class = 'button-primary';
    if ($img) {
        $anchor = '<img src="' . EPL_FULL_URL . 'images/email.png" />';
        $class = '';
    }
    return epl_anchor(add_query_arg($send_email_arr, epl_get_url()), $anchor, null, "class='epl_send_email_form_link {$class}' data-post_ID='{$regis_id}' data-event_id='{$event_id}'");
}
                            <?php 
            echo get_the_organization_city();
            ?>
  <?php 
            echo get_the_organization_state();
            ?>
 <?php 
            echo get_the_organization_zip();
            ?>
<br />
                            <?php 
            echo get_the_organization_phone();
            ?>
<br />
                            <?php 
            echo get_the_organization_website() != '' ? epl_anchor(get_the_organization_website(), epl__('Visit Website')) : '';
            ?>
<br />
                        </div>

                    <?php 
        }
        ?>


                    <?php 
        echo get_the_instructor_name(true, false);
        ?>
                    <?php 
        echo get_the_attendee_list_link();
        ?>
</h3>
<?php 
global $event_details, $session_signed_in_counts, $user_session_signed_in_counts, $user_ticket_use_counts;
$erptm = EPL_report_model::get_instance();
$avail_fields = epl_get_list_of_available_fields();
$default_row = array_fill_keys(array_keys($avail_fields), null);
$tmpl = array('table_open' => '<table border="1" cellpadding="0" cellspacing="0" class="epl_standard_table" id="epl_daily_session_registrants">');
$this->epl->epl_table->set_template($tmpl);
$header = array(epl__('Regis ID'), epl__('Status'), epl__('Purchase'), epl__('Package'), epl__('Use Count'));
foreach ($registrants as $row) {
    setup_event_details($row->event_id);
    $time_optional = epl_is_time_optonal();
    $time_id = $time_optional ? '' : $row->time_id;
    $session_time_id = $time_optional ? epl_get_element('time_id', $_POST, '') : $row->time_id;
    $_r = array();
    $_r['regis_key'] = epl_anchor(admin_url('post.php?post=' . $row->regis_id . '&action=edit'), $row->regis_key);
    $_r['status'] = get_the_regis_status($row->status);
    $_r['ticket'] = $event_details['_epl_price_name'][$row->price_id];
    $_r['package'] = '-';
    $user_ticket_use_count_key = "{$row->regis_id}-{$row->event_id}-{$row->date_id}-{$time_id}-{$row->price_id}-{$row->user_id}";
    $_r['use_count'] = epl_get_element($user_ticket_use_count_key, $user_ticket_use_counts, 0);
    $user_session_use_count_key = "{$row->regis_id}-{$row->event_id}-{$row->date_id}-{$_POST['date_ts']}-{$_POST['time_id']}-{$row->price_id}-{$row->user_id}";
    $user_alredy_checked_in = epl_get_element($user_session_use_count_key, $user_session_signed_in_counts, false);
    if (epl_is_pack_regis()) {
        $pack_size = epl_get_element_m($row->price_id, '_epl_price_pack_size', $event_details, 1);
        $exp = '';
        if (epl_get_element_m($row->price_id, '_epl_price_pack_type', $event_details) == 'time') {
            $mem_l = epl_get_element_m($row->price_id, '_epl_price_pack_time_length', $event_details);
            $mem_lt = epl_get_element_m($row->price_id, '_epl_price_pack_time_length_type', $event_details);
            $start = strtotime($row->regis_date);
            $until = strtotime("+ {$mem_l} {$mem_lt}", $start);
        $date_capacity = epl_get_element_m($regis->date_id, '_epl_date_capacity', $event_details, '&infin;');
        //if there is time capacity, grab that or default to date capacity
        $capacity = epl_get_element_m($regis->time_id, '_epl_time_capacity', $event_details, $date_capacity);
        //get counts for this event, cached
        $counts = $erptm->get_attendee_counts($event_id);
        //count date specific key
        $counts_day_key = $event_id . "_time_{$regis->date_id}";
        //counts time specific key
        $counts_time_key = $event_id . "_time_{$regis->date_id}_{$regis->time_id}";
        //if count for that time exists, get num regis, defaults to 0
        $num_regis = epl_get_element('_total_att_' . $counts_time_key, $counts, 0);
        $url_params['epl_token'] = epl_get_token($regis->regis_id . $regis->regis_date);
        $regis_summary_url = add_query_arg($url_params, get_permalink($regis->regis_id));
        $pdf_url = array('epl_action' => 'invoice', 'regis_id' => $regis->regis_id, 'epl_token' => epl_get_token($regis->regis_id . $regis->regis_date));
        $pdf_url = add_query_arg($pdf_url, home_url());
        $arr = array($regis->regis_key, epl_formatted_date($regis->regis_date), epl_formatted_date($event_details['_epl_start_date'][$regis->date_id], 'D'), epl_formatted_date($event_details['_epl_start_date'][$regis->date_id]), $event_details['_epl_start_time'][$regis->time_id], $event_details['post_title'], $regis->ticket_count, get_the_regis_status($regis->status), epl_anchor($regis_summary_url, epl__('Details')) . ' ' . (!$attach_pdf || epl_get_element('_epl_attach_invoice', $event_details, 10) == 0 ? '' : epl_anchor($pdf_url, epl__('PDF'))));
        echo '<tr><td>' . implode('</td><td>', $arr) . '</td></tr>';
    }
    ?>
        </tbody>
    </table>
<?php 
} else {
    ?>

<div><?php 
    epl_e('No Registrations');
    ?>
</div>

<?php 
                <?php 
    echo get_the_organization_city();
    ?>
  <?php 
    echo get_the_organization_state();
    ?>
 <?php 
    echo get_the_organization_zip();
    ?>
<br />
                <?php 
    echo get_the_organization_phone();
    ?>
<br />
                <?php 
    echo epl_anchor(get_the_organization_website(), 'Visit Website');
    ?>
<br />
            </div>
        <?php 
}
?>
    </div>

    <div class ="register_button_wrapper" style="clear:both;">

        <?php 
echo get_the_register_button();
?>
    </div>
</div>
<?php 
$epl = EPL_Base::get_instance();
$delim = EPL_db_model::get_instance()->delim;
$tmpl = array('table_open' => '<table border="1" cellpadding="0" cellspacing="0" class="epl_lookup_result_table">');
$this->epl->epl_table->set_template($tmpl);
$header = epl_get_field_labels($avail_fields);
$_row = array_fill_keys(array_keys($avail_fields), null);
foreach ($lookup_list as $r) {
    if (strpos($r->field_id, $delim)) {
        $fields = explode($delim, $r->field_id);
        $values = explode($delim, $r->value);
    } else {
        $fields = $r->field_id;
        $values = $r->value;
    }
    $raw = array_combine($fields, $values);
    $row = array_merge($_row, $raw);
    $row = epl_process_fields_for_display($row, $avail_fields);
    $raw['user_id'] = $r->user_id;
    $regis_link = epl_anchor(admin_url('post.php?post=' . $r->regis_id . '&action=edit'), $r->regis_key);
    $select_link = '<a href="#" class="epl_lookup_row_select">Select</a><span class="form_data" style="display:none;">' . json_encode($raw) . '</span>' . ($r->user_id > 0 ? " ({$r->user_id})" : '');
    array_unshift($row, $select_link);
    array_unshift($row, $regis_link);
    $epl->epl_table->add_row($row);
}
array_unshift($header, '');
array_unshift($header, '');
$epl->epl_table->set_heading($header);
echo $epl->epl_table->generate();
<?php

global $epl_fields;
$epl_fields['epl_notification_fields'] = array('_epl_email_template' => array('input_type' => 'select', 'input_name' => '_epl_email_template', 'label' => epl__('Email Template'), 'options' => epl_get_email_template_list(), 'default_value' => 'default', 'description' => epl__('Many thanks to') . ' ' . epl_anchor('http://www.campaignmonitor.com/templates/', 'Campaign Monitor')), '_epl_email_from_name' => array('input_type' => 'text', 'input_name' => '_epl_email_from_name', 'label' => epl__('From Name'), 'default_value' => get_bloginfo('name'), 'class' => 'epl_w300 req'), '_epl_from_email' => array('input_type' => 'text', 'input_name' => '_epl_from_email', 'label' => epl__('From Email'), 'default_value' => get_bloginfo('admin_email'), 'class' => 'epl_w300'), '_epl_email_subject' => array('input_type' => 'text', 'input_name' => '_epl_email_subject', 'label' => epl__('Email Subject'), 'class' => 'epl_w300 req'));
$epl_fields['epl_notification_fields'] = apply_filters('epl_notification_fields', $epl_fields['epl_notification_fields']);
                </tr>
                <?php 
    $balance = get_the_regis_balance_due();
    ?>
                <tr class="balance" style="background-color: #fcf8e3;">
                    <td><?php 
    epl_e('Balance Due');
    ?>
</td>
                    <td>
                        <?php 
    echo epl_get_formatted_curr($balance, null, true);
    $show_pay_now = epl_get_setting('epl_registration_options', '_epl_enable_pay_now_link', 10) == 10;
    $show_pay_now = apply_filters('epl_show_pay_now_link', $show_pay_now);
    if ($balance > 0 && $show_pay_now) {
        echo '&nbsp;' . epl_anchor(epl_get_waitlist_approved_url(true, 'p'), epl__('Pay Now'), null);
    }
    ?>


                    </td>
                </tr>

                <?php 
    $payment_data = epl_get_regis_payments();
    if (!empty($payment_data) && !epl_is_zero_total()) {
        if (count($payment_data) > 0) {
            ?>
                        <tr>
                            <td colspan="2" style="text-align: center;font-weight: bold;"><?php 
            epl_e('Completed Payments');