function espresso_is_my_event($event_id) { global $wpdb; if (current_user_can('administrator') || espresso_member_data('role') == 'espresso_event_admin') { return true; } }
function edit_event_venue() { global $wpdb; $id = $_REQUEST['id']; $sql = "SELECT * FROM " . EVENTS_VENUE_TABLE . " v WHERE v.id ='" . $id . "' "; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_event_manager') { $sql .= " AND v.wp_user = '******'id') . "' "; } //echo $sql; $results = $wpdb->get_results($sql); if (!$wpdb->num_rows > 0) { return; } foreach ($results as $result) { $venue_id = $result->id; $name = stripslashes_deep($result->name); $address = stripslashes_deep($result->address); $address2 = stripslashes_deep($result->address2); $city = stripslashes_deep($result->city); $state = stripslashes_deep($result->state); $zip = stripslashes_deep($result->zip); $country = stripslashes_deep($result->country); $meta = unserialize($result->meta); $last_locale_id = $wpdb->get_var("SELECT locale_id FROM " . EVENTS_LOCALE_REL_TABLE . " WHERE venue_id='" . $id . "'"); } ?> <!--Add event display--> <div id="add-edit-venue" class="metabox-holder"> <div class="postbox"> <h3> <?php _e('Edit Venue:', 'event_espresso'); ?> <?php echo stripslashes($name); ?> </h3> <div class="inside"> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> "> <input type="hidden" name="venue_id" value="<?php echo $venue_id; ?> "> <input type="hidden" name="action" value="update"> <table width="100%" border="0"> <tr> <td align="left" valign="top"> <ul> <li> <label for="name"> <?php _e('Name', 'event_espresso'); ?> </label> <input type="text" id="name" name="name" size="25" value="<?php echo $name; ?> "> </li> <li> <label for="address"> <?php _e('Address', 'event_espresso'); ?> </label> <input type="text" id="address" name="address" size="25" value="<?php echo $address; ?> "> </li> <li> <label for="address2"> <?php _e('Address 2', 'event_espresso'); ?> </label> <input type="text" id="address2" name="address2" size="25" value="<?php echo $address2; ?> "> </li> <li> <label for="city"> <?php _e('City', 'event_espresso'); ?> </label> <input type="text" id="city" name="city" size="25" value="<?php echo $city; ?> "> </li> <li> <label for="state"> <?php _e('State', 'event_espresso'); ?> </label> <input type="text" id="state" name="state" size="25" value="<?php echo $state; ?> "> </li> <li> <label for="zip"> <?php _e('Zip', 'event_espresso'); ?> </label> <input type="text" id="zip" name="zip" size="25" value="<?php echo $zip; ?> "> </li> <li> <label for="country"> <?php _e('Country', 'event_espresso'); ?> </label> <input type="text" id="country" name="country" size="25" value="<?php echo $country; ?> "> </li> <?php if (function_exists('espresso_member_data')) { ?> <li> <label for="locale"> <?php _e('Locale/Region ', 'event_espresso'); ?> <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=venue_locale"><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/question-frame.png" width="16" height="16" /></a> </label> <?php $sql = "SELECT * FROM " . EVENTS_LOCALE_TABLE . " ORDER BY name ASC"; $results = $wpdb->get_results($sql); if ($wpdb->num_rows > 0) { ?> <select name="locale" id="local"> <?php foreach ($results as $result) { $locale_id = $result->id; $name = stripslashes($result->name); $sel = ""; if ($last_locale_id == $locale_id) { $sel = " SELECTED "; } ?> <option value="<?php echo $locale_id; ?> " <?php echo $sel; ?> ><?php echo $name; ?> </option> <?php } ?> </select> <?php } ?> <?php if (empty($local_id)) { ?> <p>You have not created any locales yet. To create Locales please visit <a href="admin.php?page=event_locales"> Manage Locales/Regions</a> page.</p> <?php } ?> </li> <?php } // end if function_exists('espresso_member_data' ?> </ul> </td> <td align="left" valign="top" class="b"><ul> <li> <label for="contact"> <?php _e('Contact', 'event_espresso'); ?> </label> <input type="text" id="contact" name="contact" size="25" value="<?php echo stripslashes_deep($meta['contact']); ?> "> </li> <li> <label for="phone"> <?php _e('Phone', 'event_espresso'); ?> </label> <input type="text" id="phone" name="phone" size="25" value="<?php echo stripslashes_deep($meta['phone']); ?> "> </li> <li> <label for="twitter"> <?php _e('Twitter', 'event_espresso'); ?> </label> <input type="text" id="twitter" name="twitter" size="25" value="<?php echo stripslashes_deep($meta['twitter']); ?> "> </li> <li> <label for="website"> <?php _e('Website', 'event_espresso'); ?> </label> <input type="text" id="website" name="website" size="25" value="<?php echo stripslashes_deep($meta['website']); ?> "> </li> <li> <label for="image"> <?php _e('Image/Logo URL', 'event_espresso'); ?> </label> <input type="text" id="image" name="image" size="25" value="<?php echo stripslashes_deep($meta['image']); ?> "> </li> </ul></td> </tr> </table> <div id="descriptiondivrich" class="postarea"> <label for="description" class="section-heading"> <?php _e('Description', 'event_espresso'); ?> </label> <div class="postbox"> <?php if (function_exists('wp_editor')) { $args = array("textarea_rows" => 5, "textarea_name" => "description", "editor_class" => "my_editor_custom"); wp_editor(espresso_admin_format_content($meta['description']), "description", $args); } else { the_editor(espresso_admin_format_content($meta['description']), $id = 'event_desc', $prev_id = 'title', $media_buttons = true, $tab_index = 3); } //the_editor(espresso_admin_format_content($meta['description']), $id = 'description', $prev_id = 'title', $media_buttons = true, $tab_index = 3); ?> <table id="venue-descr-add-form" cellspacing="0"> <tbody> <tr> <td class="aer-word-count"></td> <td class="autosave-info"> <span> <p></p> </span> </td> </tr> </tbody> </table> </div><!-- /.postbox --> <p> <input class="button-primary" type="submit" name="Submit" value="<?php _e('Update Venue'); ?> " id="update_venue" /> </p> </div><!-- /#descriptiondivrich --> </form> </div><!-- /.inside --> </div><!-- /.postbox --> </div><!-- /.metabox-holder --> <?php //espresso_tiny_mce(); }
function event_espresso_edit_list() { global $wpdb, $org_options; define('EVT_ADMIN_URL', admin_url('admin.php?page=events')); $max_rows = isset($_REQUEST['max_rows']) & !empty($_REQUEST['max_rows']) ? absint($_REQUEST['max_rows']) : 50; $start_rec = isset($_REQUEST['start_rec']) && !empty($_REQUEST['start_rec']) ? absint($_REQUEST['start_rec']) : 0; $records_to_show = " LIMIT {$max_rows} OFFSET {$start_rec} "; //Dates $curdate = date('Y-m-d'); $this_year_r = date('Y'); $this_month_r = date('m'); $days_this_month = date('t', strtotime($curdate)); $month_range = isset($_REQUEST['month_range']) && !empty($_REQUEST['month_range']) ? sanitize_text_field($_REQUEST['month_range']) : FALSE; $category_id = isset($_REQUEST['category_id']) && !empty($_REQUEST['category_id']) ? sanitize_text_field($_REQUEST['category_id']) : FALSE; $today_filter = isset($_REQUEST['today']) && $_REQUEST['today'] == 'true' ? TRUE : FALSE; $this_month_filter = isset($_REQUEST['this_month']) && $_REQUEST['this_month'] == 'true' ? TRUE : FALSE; $event_status = isset($_POST['event_status']) && !empty($_POST['event_status']) ? sanitize_text_field($_REQUEST['event_status']) : FALSE; if (isset($_POST['delete_event'])) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; event_espresso_delete_event($del_id); } } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Event(s) have been permanently deleted.', 'event_espresso'); ?> </strong></p> </div> <?php } if (isset($_POST['perm_delete_event'])) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; event_espresso_empty_event_trash($del_id); } } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Event(s) have been permanently deleted.', 'event_espresso'); ?> </strong></p> </div> <?php } $recurrence_icon = ''; if (defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE')) { $recurrence_icon = '<img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/arrow_rotate_clockwise.png" alt="Recurring Event" title="Recurring Event" class="re_fr" />'; } require_once 'queries.php'; if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php')) { require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php'; } else { echo '<p><strong>' . __('Advanced filters are now available in the premium versions.', 'event_espresso') . '</strong> <a href="http://eventespresso.com/download/" target="_blank">' . __('Upgrade Now!', 'event_espresso') . '</a></p>'; //$total_events = espresso_total_events(); } if ($month_range !== FALSE) { $pieces = explode('-', $month_range, 3); $year_r = $pieces[0]; $month_r = $pieces[1]; } $group = ''; $sql = ''; //Check if the venue manager is turned on $use_venue_manager = isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y' ? TRUE : FALSE; $is_regional_manager = FALSE; //This checks to see if the user is a regional manager and creates a union to join the events that are in the users region based on the venue/locale combination if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') { $is_regional_manager = TRUE; $group = get_user_meta(espresso_member_data('id'), "espresso_group", TRUE); if ($group != '0' && !empty($group)) { $sql = "(SELECT e.id event_id, e.event_name, e.event_identifier, e.reg_limit, e.registration_start, "; $sql .= " e.start_date, e.is_active, e.recurrence_id, e.registration_startT, e.wp_user "; //Get the venue information if ($use_venue_manager) { $sql .= ", v.name AS venue_title, v.address AS venue_address, v.address2 AS venue_address2, v.city AS venue_city, v.state AS venue_state, v.zip AS venue_zip, v.country AS venue_country "; } else { $sql .= ", e.venue_title, e.phone, e.address, e.address2, e.city, e.state, e.zip, e.country "; } //Get the locale fields if ($use_venue_manager) { $sql .= ", lc.name AS locale_name, e.wp_user "; } $sql .= " FROM " . EVENTS_DETAIL_TABLE . " e "; //Join the categories if ($today_filter) { $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " cr ON cr.event_id = e.id "; $sql .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = cr.cat_id "; } //Join the venues and locales if (!empty($group) && $use_venue_manager) { $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON vr.event_id = e.id "; $sql .= " LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = vr.venue_id "; $sql .= " LEFT JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = vr.venue_id "; $sql .= " LEFT JOIN " . EVENTS_LOCALE_TABLE . " lc ON lc.id = l.locale_id "; } //Event status filter $sql .= $event_status !== FALSE && $event_status != 'IA' ? " WHERE e.event_status = '" . $event_status . "' " : " WHERE e.event_status != 'D' "; //Category filter $sql .= $category_id !== FALSE ? " AND c.id = '" . $category_id . "' " : ''; //Find events in the locale $sql .= !empty($group) && $use_venue_manager == true ? " AND l.locale_id IN (" . implode(",", $group) . ") " : ''; //Month filter if ($month_range !== FALSE) { $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-31')) . "' "; } //Todays events filter if ($today_filter) { $sql .= " AND e.start_date = '" . $curdate . "' "; } //This months events filter if ($this_month_filter) { $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-' . $days_this_month)) . "' "; } $sql .= ") UNION "; } } //This is the standard query to retrieve the events $sql .= "(SELECT e.id event_id, e.event_name, e.event_identifier, e.reg_limit, e.registration_start, "; $sql .= " e.start_date, e.is_active, e.recurrence_id, e.registration_startT, e.wp_user "; //Get the venue information if ($use_venue_manager) { //If using the venue manager, we need to get those fields $sql .= ", v.name AS venue_title, v.address AS venue_address, v.address2 AS venue_address2, v.city AS venue_city, v.state AS venue_state, v.zip AS venue_zip, v.country AS venue_country "; } else { //Otherwise we need to get the address fields from the individual events $sql .= ", e.venue_title, e.phone, e.address, e.address2, e.city, e.state, e.zip, e.country "; } //get the locale fields if ($is_regional_manager && $use_venue_manager) { $sql .= ", lc.name AS locale_name, e.wp_user "; } $sql .= " FROM " . EVENTS_DETAIL_TABLE . " e "; //Join the categories if ($category_id != FALSE) { $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " cr ON cr.event_id = e.id "; $sql .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = cr.cat_id "; } //Join the venues if ($use_venue_manager == true) { $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON vr.event_id = e.id "; $sql .= " LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = vr.venue_id "; } //Join the locales if (isset($is_regional_manager) && $is_regional_manager == true && $use_venue_manager == true) { $sql .= " LEFT JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = vr.venue_id "; $sql .= " LEFT JOIN " . EVENTS_LOCALE_TABLE . " lc ON lc.id = l.locale_id "; } //Event status filter $sql .= isset($_POST['event_status']) && ($_POST['event_status'] != '' && $_POST['event_status'] != 'IA') ? " WHERE e.event_status = '" . $_POST['event_status'] . "' " : " WHERE e.event_status != 'D' "; //Category filter $sql .= $category_id !== FALSE ? " AND c.id = '" . $category_id . "' " : ''; //Month filter if ($_POST['month_range'] != '') { $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-31')) . "' "; } //Todays events filter if (isset($_REQUEST['today']) && $_REQUEST['today'] == 'true') { $sql .= " AND e.start_date = '" . $curdate . "' "; } //This months events filter if (isset($_REQUEST['this_month']) && $_REQUEST['this_month'] == 'true') { $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-' . $days_this_month)) . "' "; } //If user is an event manager, then show only their events if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql .= " AND e.wp_user = '******'id') . "' "; } $sql .= ") ORDER BY start_date DESC "; $sql .= $records_to_show; $events = $wpdb->get_results($sql); $total_events = $wpdb->num_rows; ?> <form id="event-admin-list-page-select-frm" name="event_admin_list_page_select_frm" method="post" action="<?php echo EVT_ADMIN_URL; ?> "> <div id="event-admin-list-page-select-dv" class="admin-list-page-select-dv"> <input name="navig" value="<?php _e('Retrieve', 'event_espresso'); ?> " type="submit" class="button-secondary"> <?php $rows = array(50 => 50, 100 => 100, 250 => 250, 500 => 500, 100000 => 'all'); ?> <select name="max_rows" size="1"> <?php foreach ($rows as $key => $value) { ?> <?php $selected = $key == $max_rows ? ' selected="selected"' : ''; ?> <option value="<?php echo $key; ?> "<?php echo $selected; ?> ><?php echo $value; ?> </option> <?php } ?> </select> <?php _e('rows from the db at a time', 'event_espresso'); ?> <input name="start_rec" value="<?php echo $start_rec; ?> " class="textfield" type="hidden"> <?php if ($start_rec > 0 && $max_rows < 100000) { $prev_rows = $start_rec > $max_rows ? $start_rec - $max_rows - 1 : 0; $prev_rows_url = add_query_arg(array('max_rows' => $max_rows, 'start_rec' => $prev_rows), EVT_ADMIN_URL); ?> <a id="event-admin-load-prev-rows-btn" href="<?php echo $prev_rows_url; ?> " title="load prev rows" class="button-secondary"> <?php echo __('Previous', 'event_espresso') . ' ' . $max_rows . ' ' . __('rows', 'event_espresso'); ?> </a> <?php } ?> <?php if ($total_events >= $max_rows && $max_rows < 100000) { $next_rows = $start_rec + $max_rows + 1; $next_rows_url = add_query_arg(array('max_rows' => $max_rows, 'start_rec' => $next_rows), EVT_ADMIN_URL); ?> <a id="event-admin-load-next-rows-btn" href="<?php echo $next_rows_url; ?> " title="load next rows" class="button-secondary"> <?php echo __('Next', 'event_espresso') . ' ' . $max_rows . ' ' . __('rows', 'event_espresso'); ?> </a> <?php } ?> </div> </form> <form id="form1" name="form1" method="post" action="admin.php?page=events<?php //echo $_SERVER["REQUEST_URI"] ?> "> <table id="table" class="widefat event-list" width="100%"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:28px;"><input type="checkbox"></th> <th class="manage-column column-comments num" id="id" style="padding-top:7px; width:3%;" scope="col" title="Click to Sort"> <span><?php _e('ID', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:26%;"> <span><?php _e('Name', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:12%;"> <span><?php _e('Venue', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:12%;"> <span><?php _e('Start Date', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:10%;"> <span><?php _e('Start Time', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="dow" scope="col" title="Click to Sort" style="width:6%;";> <span><?php _e('DoW', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="begins" scope="col" title="Click to Sort" style="width:12%;"> <span><?php _e('Reg Begins', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="status" scope="col" title="Click to Sort" style="width:10%;"> <span><?php _e('Status', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) { ?> <th class="manage-column column-date" id="status" scope="col" title="Click to Sort" style="width:10%;"> <span><?php _e('Creator', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <?php } ?> <th class="manage-column column-date" id="attendees" scope="col" title="Click to Sort" style="width:9%;"> <span><?php _e('Attendees', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-author" id="actions" scope="col" style="width:25%;"> <?php _e('Actions', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php if ($total_events > 0) { foreach ($events as $event) { //print_r ($event); $event_id = $event->event_id; $event_name = stripslashes_deep($event->event_name); $event_identifier = stripslashes_deep($event->event_identifier); $reg_limit = isset($event->reg_limit) ? $event->reg_limit : ''; $registration_start = isset($event->registration_start) ? $event->registration_start : ''; $start_date = isset($event->start_date) ? $event->start_date : ''; $end_date = isset($event->end_date) ? $event->end_date : ''; $is_active = isset($event->is_active) ? $event->is_active : ''; $status = array(); $status = event_espresso_get_is_active($event_id); $recurrence_id = isset($event->recurrence_id) ? $event->recurrence_id : ''; $registration_startT = isset($event->registration_startT) ? $event->registration_startT : ''; $event_address = isset($event->address) ? $event->address : ''; $event_address2 = isset($event->address2) ? $event->address2 : ''; $event_city = isset($event->city) ? $event->city : ''; $event_state = isset($event->state) ? $event->state : ''; $event_zip = isset($event->zip) ? $event->zip : ''; $event_country = isset($event->country) ? $event->country : ''; //added new $venue_title = isset($event->venue_title) ? $event->venue_title : ''; $venue_locale = isset($event->locale_name) ? $event->locale_name : ''; $wp_user = isset($event->wp_user) ? $event->wp_user : ''; $location = (!empty($event_address) ? $event_address : '') . (!empty($event_address2) ? '<br />' . $event_address2 : '') . (!empty($event_city) ? '<br />' . $event_city : '') . (!empty($event_state) ? ', ' . $event_state : '') . (!empty($event_zip) ? '<br />' . $event_zip : '') . (!empty($event_country) ? '<br />' . $event_country : ''); $dow = date("D", strtotime($start_date)); ob_start(); ?> <tr> <td class="check-column" style="padding:7px 0 22px 7px; vertical-align:top;"><!--Delete Events--> <?php echo '<input name="checkbox[' . $event_id . ']" type="checkbox" title="Delete Event ' . $event_name . '" />'; ?> </td> <td class="column-comments" style="padding-top:3px;"><?php echo $event_id; ?> </td> <td class="post-title page-title"><strong><a class="row-title" href="admin.php?page=events&action=edit&event_id=<?php echo $event_id; ?> "><?php echo $event_name; ?> </a> <?php echo $recurrence_id > 0 ? $recurrence_icon : ''; ?> </strong> <div class="row-actions"><span><a href="<?php echo espresso_reg_url($event_id); ?> " target="_blank"><?php _e('View', 'event_espresso'); ?> </a> | </span><span class='edit'><a href="admin.php?page=events&action=edit&event_id=<?php echo $event_id; ?> "><?php _e('Edit', 'event_espresso'); ?> </a> | </span><span class='delete'><a onclick="return confirmDelete();" href='admin.php?page=events&action=delete&event_id=<?php echo $event_id; ?> '><?php _e('Delete', 'event_espresso'); ?> </a></span> | <span><a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php echo $event_id; ?> "><?php _e('Attendees', 'event_espresso'); ?> </a> | </span><span><a href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&event_id=" . $event_id . "&export=report&action=payment&type=excel"; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "><?php _e('Export', 'event_espresso'); ?> </a></span></div></td> <td class="author"><?php echo $venue_title != '' ? $venue_title : ''; echo $venue_locale != '' ? '<br />[' . $venue_locale . ']' : ''; ?> </td> <td class="author"><?php echo event_date_display($start_date, get_option('date_format')); ?> </td> <td class="author"><?php echo event_espresso_get_time($event_id, 'start_time'); ?> </td> <td class="date"><?php echo $dow; ?> </td> <td class="date"><?php echo event_date_display($registration_start, get_option('date_format')); ?> <br /> <?php echo $registration_startT; ?> </td> <td class="date"><?php echo $status['display']; ?> </td> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) { $user_company = espresso_user_meta($wp_user, 'company') != '' ? espresso_user_meta($wp_user, 'company') : ''; $user_organization = espresso_user_meta($wp_user, 'organization') != '' ? espresso_user_meta($wp_user, 'organization') : ''; $user_co_org = $user_company != '' ? $user_company : $user_organization; ?> <td class="date"><?php echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)' : espresso_user_meta($wp_user, 'display_name') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)'; ?> <?php echo $user_co_org != '' ? '<br />[' . espresso_user_meta($wp_user, 'company') . ']' : ''; ?> </td> <?php } ?> <td class="author"><a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php echo $event_id; ?> "><?php echo get_number_of_attendees_reg_limit($event_id, 'num_attendees_slash_reg_limit'); ?> </a></td> <td class="date"><div style="width:180px;"><a href="<?php echo espresso_reg_url($event_id); ?> " title="<?php _e('View Event', 'event_espresso'); ?> " target="_blank"><div class="view_btn"></div></a> <a href="admin.php?page=events&action=edit&event_id=<?php echo $event_id; ?> " title="<?php _e('Edit Event', 'event_espresso'); ?> "><div class="edit_btn"></div></a> <a href="admin.php?page=events&event_id=<?php echo $event_id; ?> &event_admin_reports=list_attendee_payments" title="<?php _e('View Attendees', 'event_espresso'); ?> "><div class="complete_btn"></div></a> <a href="admin.php?page=events&event_admin_reports=charts&event_id=<?php echo $event_id; ?> " title="<?php _e('View Report', 'event_espresso'); ?> "><div class="reports_btn"></div></a> <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=unique_id_info_<?php echo $event_id; ?> " title="<?php _e('Get Short URL/Shortcode', 'event_espresso'); ?> "><div class="shortcode_btn"></div></a> <a href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&event_id=" . $event_id . "&export=report&action=payment&type=excel"; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "><div class="excel_exp_btn"></div></a> <a href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&event_id=" . $event_id . "&export=report&action=payment&type=csv"; ?> '" title="<?php _e('Export to CSV', 'event_espresso'); ?> "><div class="csv_exp_btn"></div></a> <a href="admin.php?page=events&event_admin_reports=event_newsletter&event_id=<?php echo $event_id; ?> " title="<?php _e('Email Attendees', 'event_espresso'); ?> "><div class="newsletter_btn"></div></a></div> <div id="unique_id_info_<?php echo $event_id; ?> " style="display:none"> <?php _e('<h2>Short URL/Shortcode</h2><p>This is the short URL to this event:</p><p><span class="updated fade">' . espresso_reg_url($event_id) . '</span></p><p>This will show the registration form for this event just about anywhere. Copy and paste the following shortcode into any page or post.</p><p><span class="updated fade">[SINGLEEVENT single_event_id="' . $event_identifier . '"]</span></p> <p class="red_text"> Do not use in place of the main events page that is set in the Organization Settings page.', 'event_espresso'); ?> </div></td> </tr> <?php //echo $_REQUEST['event_status']; if (!empty($_REQUEST['event_status'])) { $content = ob_get_contents(); ob_end_clean(); switch ($_REQUEST['event_status']) { case 'A': switch (event_espresso_get_status($event_id, empty($event_meta) ? '' : $event_meta)) { case 'NOT_ACTIVE': //Don't show the event if any of the above are true break; default: echo $content; break; } break; case 'IA': switch (event_espresso_get_status($event_id)) { case 'NOT_ACTIVE': echo $content; break; default: //Don't show the event if any of the above are true break; } break; default: echo $content; break; } } } //End foreach ($events as $event){ } ?> </tbody> </table> <div style="clear:both; margin-bottom:30px;"> <input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong> <?php _e('Check All', 'event_espresso'); ?> </strong><?php if (isset($_POST['event_status']) && $_POST['event_status'] == 'D') { ?> <input name="perm_delete_event" type="submit" class="button-secondary" id="perm_delete_event" value="<?php _e('Permanently Delete Events(s)', 'event_espresso'); ?> " style="margin:10px 0 0 10px;" onclick="return confirmDelete();" /> <?php } else { ?> <input name="delete_event" type="submit" class="button-secondary" id="delete_event" value="<?php _e('Delete Events(s)', 'event_espresso'); ?> " style="margin:10px 0 0 10px;" onclick="return confirmDelete();" /> <a style="margin-left:5px"class="button-secondary" href="admin.php?page=events&action=csv_import"><?php _e('Import Events', 'event_espresso'); ?> </a> <?php if (function_exists('espresso_attendee_import') && $espresso_premium == true) { ?> <a style="margin-left:5px" class="button-secondary" href="admin.php?page=espresso_attendee_import"><?php _e('Import Attendees', 'event_espresso'); ?> </a><?php } ?> <a style="margin-left:5px" class="button-secondary" href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&id=" . $event_id . "&export=report&action=payment&type=excel&all_events=true"; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "><?php _e('Export All Attendee Data', 'event_espresso'); ?> </a> <a class="button-secondary" href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&id=" . $event_id . "&export=report&action=event&type=excel&all_events=true"; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "><?php _e('Export All Event Data', 'event_espresso'); ?> </a> <a style="margin-left:5px" class="button-primary" href="admin.php?page=events&action=add_new_event"><?php _e('Add New Event', 'event_espresso'); ?> </a> <?php } ?> </div> </form> <h4 style="clear:both"><?php _e('Legend', 'event_espresso'); ?> </h4> <dl style="float:left; margin-left:10px; width:200px"> <?php echo defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE') ? '<dt><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/arrow_rotate_clockwise.png" alt="Recurring Event" title="Recurring Event" /> - ' . __('Recurring Event', 'event_espresso') . '</dt>' : ''; ?> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/magnifier.png" width="16" height="16" alt="<?php _e('View Event', 'event_espresso'); ?> " /> - <?php _e('View Event', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/calendar_edit.png" width="16" height="16" alt="<?php _e('Edit Event', 'event_espresso'); ?> " /> - <?php _e('Edit Event', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/group.png" width="16" height="16" alt="<?php _e('Event Attendees', 'event_espresso'); ?> " /> - <?php _e('Event Attendees', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/chart_bar.png" width="16" height="16" alt="<?php _e('Send Event Email', 'event_espresso'); ?> " /> - <?php _e('View Report', 'event_espresso'); ?> </dt> </dl> <dl style="float:left; margin-left:10px;"> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/tag.png" width="16" height="16" alt="<?php _e('Short Code', 'event_espresso'); ?> " /> - <?php _e('Short Code', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/excel_icon.png" width="16" height="16" alt="<?php _e('Excel Spreadsheet', 'event_espresso'); ?> " /> - <?php _e('Excel Export', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/csv_icon_sm.gif" width="16" height="16" alt="<?php _e('CSV Spreadsheet', 'event_espresso'); ?> " /> - <?php _e('CSV Export', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/email_go.png" width="16" height="16" alt="<?php _e('View Report', 'event_espresso'); ?> " /> - <?php _e('Event Newsletter', 'event_espresso'); ?> </dt> </dl> <script> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "sDom": 'Clfrtip', "aoColumns": [ { "bSortable": false }, null, null, null, null, null, null, null, null, <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : ''; ?> null, { "bSortable": false } ], "aoColumnDefs": [ { "bVisible": false, "aTargets": [ <?php echo $org_options['use_venue_manager'] == 'Y' ? '' : '3,'; ?> 6 ] } ], "oColVis": { "aiExclude": [ 0, 1, 2 ], "buttonText": "Filter: Show / Hide Columns", "bRestore": true }, "bAutoWidth": false, "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " } }); }); </script> <div id="coupon_code_info" style="display:none"> <h2><?php _e('Coupon/Promo Code', 'event_espresso'); ?> </h2><p><?php _e('This is used to apply discounts to events.', 'event_espresso'); ?> </p><p><?php _e('A coupon or promo code could can be anything you want. For example: Say you have an event that costs', 'event_espresso'); ?> <?php echo $org_options['currency_symbol']; ?> 200. <?php _e('If you supplied a promo like "PROMO50" and entered 50.00 into the "Discount w/Promo Code" field your event will be discounted', 'event_espresso'); ?> <?php echo $org_options['currency_symbol']; ?> 50.00, <?php _e('Bringing the cost of the event to', 'event_espresso'); ?> <?php echo $org_options['currency_symbol']; ?> 150.</p> </div> <div id="unique_id_info" style="display:none"> <h2><?php _e('Event Identifier', 'event_espresso'); ?> </h2><p><?php _e('This should be a unique identifier for the event. Example: "Event1" (without qoutes.)</p><p>The unique ID can also be used in individual pages using the', 'event_espresso'); ?> [SINGLEEVENT single_event_id="<?php _e('Unique Event ID', 'event_espresso'); ?> "] <?php _e('shortcode', 'event_espresso'); ?> .</p> </div> <?php echo event_espresso_custom_email_info(); }
function add_event_espresso_menus() { global $org_options, $espresso_premium; $espresso_manager = ''; //If the permissions manager is installed, then load the $espresso_manager global if (function_exists('espresso_permissions_config_mnu') && $espresso_premium == true) { global $espresso_manager; //echo "<pre>".print_r($espresso_manager,true)."</pre>"; } else { $espresso_manager = array('espresso_manager_events' => '', 'espresso_manager_categories' => '', 'espresso_manager_form_groups' => '', 'espresso_manager_form_builder' => '', 'espresso_manager_groupons' => '', 'espresso_manager_discounts' => '', 'espresso_manager_event_emails' => '', 'espresso_manager_personnel_manager' => '', 'espresso_manager_general' => '', 'espresso_manager_calendar' => '', 'espresso_manager_members' => '', 'espresso_manager_payment_gateways' => '', 'espresso_manager_social' => '', 'espresso_manager_addons' => '', 'espresso_manager_support' => '', 'espresso_manager_venue_manager' => '', 'espresso_manager_event_pricing' => '', 'espresso_manager_ticketing' => '', 'espresso_manager_seating' => ''); } //Main menu tab add_menu_page(__('Event Espresso', 'event_espresso'), '<span style=" font-size:12px">' . __('Event Espresso', 'event_espresso') . '</span>', apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_general']), 'event_espresso', 'organization_config_mnu', EVENT_ESPRESSO_PLUGINFULLURL . 'images/events_icon_16.png'); //General Settings add_submenu_page('event_espresso', __('Event Espresso - General Settings', 'event_espresso'), __('General Settings', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_general']), 'event_espresso', 'organization_config_mnu'); //Event Setup add_submenu_page('event_espresso', __('Event Espresso - Event Overview', 'event_espresso'), __('Event Overview', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_events']), 'events', 'event_espresso_manage_events'); //Seating chart management if (defined('ESPRESSO_SEATING_CHART')) { add_submenu_page('event_espresso', __('Event Espresso - Seating Chart', 'event_espresso'), __('Seating Chart', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_seating']), 'seating_chart', 'event_espresso_manage_seating_chart'); } //Venues if (isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y' && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Venue Manager', 'event_espresso'), __('Venue Manager', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_venue_manager']), 'event_venues', 'event_espresso_venue_config_mnu'); //add_submenu_page('event_espresso', __('Event Espresso - Locales/Regions Manager','event_espresso'), __('Locale Manager','event_espresso'), 'administrator', 'event_locales', 'event_espresso_locale_config_mnu'); } //Personnel if (isset($org_options['use_personnel_manager']) && $org_options['use_personnel_manager'] == 'Y' && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Staff Manager', 'event_espresso'), __('Staff Manager', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_personnel_manager']), 'event_staff', 'event_espresso_staff_config_mnu'); } //Form Questions add_submenu_page('event_espresso', __('Event Espresso - Questions', 'event_espresso'), __('Questions', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_form_builder']), 'form_builder', 'event_espresso_questions_config_mnu'); //Questions Groups add_submenu_page('event_espresso', __('Event Espresso - Question Groups', 'event_espresso'), __('Question Groups', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_form_groups']), 'form_groups', 'event_espresso_question_groups_config_mnu'); //EventCategories add_submenu_page('event_espresso', __('Event Espresso - Manage Event Categories', 'event_espresso'), __('Categories', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_categories']), 'event_categories', 'event_espresso_categories_config_mnu'); do_action('action_hook_espresso_add_new_ee_submenu'); //Discounts if (function_exists('event_espresso_discount_config_mnu') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Promotional Codes', 'event_espresso'), __('Promotional Codes', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_discounts']), 'discounts', 'event_espresso_discount_config_mnu'); } //Groupons if (function_exists('event_espresso_groupon_config_mnu') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Groupons', 'event_espresso'), __('Groupon Codes', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_groupons']), 'groupons', 'event_espresso_groupon_config_mnu'); } //Email Manager if (function_exists('event_espresso_email_config_mnu') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Email Manager', 'event_espresso'), __('Email Manager', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_event_emails']), 'event_emails', 'event_espresso_email_config_mnu'); } //Event styles & templates if (function_exists('event_espresso_manage_templates') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Template Settings', 'event_espresso'), __('Template Settings', 'event_espresso'), 'administrator', 'template_confg', 'event_espresso_manage_templates'); } //Calendar Settings if (function_exists('espresso_calendar_config_mnu') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Calendar Settings', 'event_espresso'), __('Calendar Settings', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_calendar']), 'espresso_calendar', 'espresso_calendar_config_mnu'); } //Payment Settings if (function_exists('event_espresso_gateways_options')) { add_submenu_page('event_espresso', __('Event Espresso - Payment Settings', 'event_espresso'), __('Payment Settings', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_payment_gateways']), 'payment_gateways', 'event_espresso_gateways_options'); } //Member Settings if (function_exists('event_espresso_member_config_mnu') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Member Settings', 'event_espresso'), __('Member Settings', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_members']), 'members', 'event_espresso_member_config_mnu'); } //MailChimp Integration Settings if (function_exists('event_espresso_mailchimp_settings') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - MailChimp Integration', 'event_espresso'), __('MailChimp Integration', 'event_espresso'), 'administrator', 'espresso-mailchimp', 'event_espresso_mailchimp_settings'); } //Ticketing Settings if (function_exists('espresso_ticket_config_mnu') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Ticket Customization', 'event_espresso'), __('Ticket Templates', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_ticketing']), 'event_tickets', 'espresso_ticket_config_mnu'); } //Facebook Event Integration Settings if (function_exists('espresso_fb_settings') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Facebook Settings', 'event_espresso'), __('Facebook Settings', 'event_espresso'), 'administrator', 'espresso_facebook', 'espresso_fb_settings'); } //Reports if (function_exists('espresso_reports') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Reports', 'event_espresso'), __('Reports', 'event_espresso'), 'administrator', 'espresso_reports', 'espresso_reports'); } //Attendee Import if (function_exists('espresso_attendee_import') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Attendee Import Tool', 'event_espresso'), __('Attendee Import', 'event_espresso'), 'administrator', 'espresso_attendee_import', 'espresso_attendee_import'); } //Voucher Import if (function_exists('espresso_voucher_import') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Voucher Import Tool', 'event_espresso'), __('Voucher Import', 'event_espresso'), 'administrator', 'espresso_voucher_import', 'espresso_voucher_import'); } //Social Media Settings if (function_exists('espresso_social_config_mnu') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Social Media Settings', 'event_espresso'), __('Social Media', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_social']), 'espresso_social', 'espresso_social_config_mnu'); } //Addons // add_submenu_page('event_espresso', __('Event Espresso - Addons', 'event_espresso'), __('Addons', 'event_espresso'), 'administrator', 'admin_addons', 'event_espresso_addons_mnu'); //Test Drive Pro if ($espresso_premium != true) { add_submenu_page('event_espresso', __('Event Espresso - Test Drive Pro', 'event_espresso'), __('Test Drive Pro', 'event_espresso'), 'administrator', 'test_drive', 'event_espresso_test_drive'); } //Help/Support add_submenu_page('event_espresso', __('Event Espresso - Help/Support', 'event_espresso'), __('<span style="color: red;">Help/Support</span>', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_support']), 'support', 'event_espresso_support'); add_submenu_page('events', __('Event Espresso - Permissions Settings', 'event_espresso'), '<span class="ee_menu_group" onclick="return false;">' . __('Permissions', 'event_espresso') . '</span>', 'administrator', 'espresso_permissions', 'espresso_permissions_config_mnu'); //Permissions settings if (function_exists('espresso_manager_version') && $espresso_premium == true) { add_submenu_page('event_espresso', __('Event Espresso - Event Manager Permissions', 'event_espresso'), __('User Permissions', 'event_espresso'), 'administrator', 'espresso_permissions', 'espresso_permissions_config_mnu'); add_submenu_page('event_espresso', __('Event Espresso - Event Manager Roles', 'event_espresso'), __('User Roles', 'event_espresso'), 'administrator', 'roles', 'espresso_permissions_roles_mnu'); if ($org_options['use_venue_manager'] == 'Y' && function_exists('espresso_permissions_user_groups')) { if (espresso_member_data('role') == "administrator") { add_submenu_page('event_espresso', __('Event Espresso - Locales/Regions', 'event_espresso'), __('Locales/Regions', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_venue_manager']), 'event_locales', 'event_espresso_locale_config_mnu'); } add_submenu_page('event_espresso', __('Event Espresso - Regional Managers', 'event_espresso'), __('Regional Managers', 'event_espresso'), 'administrator', 'event_groups', 'espresso_permissions_user_groups'); } } }
function espresso_edit_this($event_id) { global $espresso_premium; if ($espresso_premium != true) { return; } global $current_user; wp_get_current_user(); $curauth = wp_get_current_user(); $user_id = $curauth->ID; $user = new WP_User($user_id); foreach ($user->roles as $role) { //echo $role; //Build the edit event link $edit_link = '<a class="post-edit-link" href="' . site_url() . '/wp-admin/admin.php?page=events&action=edit&event_id=' . $event_id . '">' . __('Edit Event') . '</a>'; switch ($role) { case 'administrator': case 'espresso_event_admin': case 'espresso_event_manager': case 'espresso_group_admin': //If user is an event manager, then show the edit link for their events if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_eventmanager' && espresso_member_data('id') != espresso_is_my_event($event_id)) { return; } return $edit_link; break; } } }
function event_espresso_staff_config_mnu() { global $wpdb, $current_user, $espresso_premium; $_REQUEST['action'] = isset($_REQUEST['action']) ? $_REQUEST['action'] : NULL; ?> <div class="wrap"> <div id="icon-options-event" class="icon32"> </div> <h2><?php _e('Manage Staff Members', 'event_espresso'); ?> <?php if ($_REQUEST['action'] != 'edit' && $_REQUEST['action'] != 'add_new_staff') { echo '<a href="admin.php?page=event_staff&action=add_new_staff" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Staff Member', 'event_espresso') . '</a>'; } ?> </h2> <div id="poststuff" class="metabox-holder has-right-sidebar"> <?php event_espresso_display_right_column(); ?> <div id="post-body"> <div id="post-body-content"> <?php if (isset($_POST['delete_staff']) || $_REQUEST['action'] == 'delete_staff') { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; //Delete staff data $sql = "DELETE FROM " . EVENTS_PERSONNEL_TABLE . " WHERE id='{$del_id}'"; $wpdb->query($sql); $sql = "DELETE FROM " . EVENTS_PERSONNEL_REL_TABLE . " WHERE person_id='{$del_id}'"; $wpdb->query($sql); } } if ($_REQUEST['action'] == 'delete_staff') { //Delete discount data $sql = "DELETE FROM " . EVENTS_PERSONNEL_TABLE . " WHERE id='" . $_REQUEST['id'] . "'"; $wpdb->query($sql); $sql = "DELETE FROM " . EVENTS_PERSONNEL_REL_TABLE . " WHERE person_id='" . $_REQUEST['id'] . "'"; $wpdb->query($sql); } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Staff member(s) have been successfully deleted from the event.', 'event_espresso'); ?> </strong></p> </div> <?php } if ($_REQUEST['action'] == 'update') { require_once "update_staff.php"; update_event_staff(); } if ($_REQUEST['action'] == 'add') { require_once "add_staff_to_db.php"; add_staff_to_db(); } if ($_REQUEST['action'] == 'add_new_staff') { require_once "add_new_staff.php"; add_new_event_staff(); } if ($_REQUEST['action'] == 'edit') { require_once "edit_staff.php"; edit_event_staff(); } ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table" class="widefat manage-discounts"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:2.5%;"><input type="checkbox"></th> <th class="manage-column column-comments num" id="id" style="padding-top:7px; width:2.5%;" scope="col" title="Click to Sort"><?php _e('ID', 'event_espresso'); ?> </th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Name', 'event_espresso'); ?> </th> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:10%;"><?php _e('Creator', 'event_espresso'); ?> </th> <?php } ?> <th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Shortcode', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php $limitstaff = false; global $espresso_manager; if (function_exists('espresso_member_data')) { if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') { if ($espresso_manager['event_manager_staff'] == "Y") { $limitstaff = true; } } else { if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_event_manager') { $limitstaff = true; } } } $sql = "SELECT * FROM " . EVENTS_PERSONNEL_TABLE . " p"; if ($limitstaff) { $sql .= " JOIN {$wpdb->users} u on u.ID = p.wp_user WHERE p.wp_user = "******" ORDER BY p.id ASC"); foreach ($results as $result) { $staff_id = $result->id; $name = isset($result->name) ? stripslashes_deep($result->name) : ''; $staff_desc = isset($result->staff_desc) ? stripslashes_deep($result->staff_desc) : ''; $wp_user = isset($result->wp_user) ? $result->wp_user : ''; ?> <tr> <td class="check-column" style="padding:7px 0 22px 5px; vertical-align:top;"><input name="checkbox[<?php echo $staff_id; ?> ]" type="checkbox" title="Delete <?php echo stripslashes($name); ?> "></td> <td class="column-comments" style="padding-top:3px;"><?php echo $staff_id; ?> </td> <td class="post-title page-title column-title"><strong><a href="admin.php?page=event_staff&action=edit&id=<?php echo $staff_id; ?> "><?php echo $name; ?> </a></strong> <div class="row-actions"> <span class="edit"><a href="admin.php?page=event_staff&action=edit&id=<?php echo $staff_id; ?> "><?php _e('Edit', 'event_espresso'); ?> </a> | </span> <span class="delete"> <a onclick="return confirmDelete();" class="submitdelete" href="admin.php?page=event_staff&action=delete_staff&id=<?php echo $staff_id; ?> "><?php _e('Delete', 'event_espresso'); ?> </a> </span> </div> </td> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <td><?php echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') : espresso_user_meta($wp_user, 'display_name'); ?> </td> <?php } ?> <td>[ESPRESSO_STAFF id="<?php echo $staff_id; ?> "]</td> </tr> <?php } } ?> </tbody> </table> <div style="clear:both"> <p> <input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong> <?php _e('Check All', 'event_espresso'); ?> </strong> <input name="delete_staff" type="submit" class="button-secondary" id="delete_staff" value="<?php _e('Delete Staff Member(s)', 'event_espresso'); ?> " style="margin-left:10px 0 0 10px;" onclick="return confirmDelete();" /> <a style="margin-left:5px"class="button-primary" href="admin.php?page=event_staff&action=add_new_staff"><?php _e('Add New Staff Member', 'event_espresso'); ?> </a> </p> </div> </form> </div> </div> </div> </div> <script> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ { "bSortable": false }, null, null, <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : ''; ?> { "bSortable": false } ] } ); } ); // Add new staff form validation jQuery(function(){ jQuery('#add-staff').validate({ rules: { name: "required" }, messages: { name: "Please add a name for your new staff member" } }); }); </script> <?php }
/** * espresso_get_events_page_list_table_results * * @access public * @param boolean $count whether this query will return field data or COUNT events or SUM attendee quantity * @param boolean $attendees whether this query will return data from the events table or the attendee table * @param string $filters whether a particular filter is active or not; mostly used in conjunction with the $count parameter ie: COUNT events this_month * @param mixed boolean | array $group_admin_locales array og R&P member group IDs or FALSE if not used * @return string */ function espresso_generate_events_page_list_table_sql($count = FALSE, $attendees = FALSE, $filters = '', $group_admin_locales = FALSE) { global $org_options, $espresso_premium; if (!$group_admin_locales) { $member_id = FALSE; } $max_rows = isset($_REQUEST['max_rows']) & !empty($_REQUEST['max_rows']) ? absint($_REQUEST['max_rows']) : 50; $max_rows = min($max_rows, 100000); $start_rec = isset($_REQUEST['start_rec']) && !empty($_REQUEST['start_rec']) ? absint($_REQUEST['start_rec']) : 0; $records_to_show = ' LIMIT ' . $max_rows . ' OFFSET ' . $start_rec; //Dates $curdate = date('Y-m-d'); $this_year_r = date('Y'); $this_month_r = date('m'); $days_this_month = date('t', strtotime($curdate)); // event date filters $month_range = isset($_REQUEST['month_range']) && !empty($_REQUEST['month_range']) ? sanitize_text_field($_REQUEST['month_range']) : FALSE; $this_month_filter = isset($_REQUEST['this_month']) && $_REQUEST['this_month'] == 'true' ? TRUE : FALSE; $today_filter = isset($_REQUEST['today']) && $_REQUEST['today'] == 'true' ? TRUE : FALSE; // attendee date filters $this_month_filter = isset($_REQUEST['this_month_a']) && $_REQUEST['this_month_a'] == 'true' ? TRUE : $this_month_filter; $today_filter = isset($_REQUEST['today_a']) && $_REQUEST['today_a'] == 'true' ? TRUE : $today_filter; // toggle filters based on value passed from "count functions" (date filters) switch ($filters) { case 'this_month': $month_range = FALSE; $this_month_filter = TRUE; $today_filter = FALSE; break; case 'today': $month_range = FALSE; $this_month_filter = FALSE; $today_filter = TRUE; break; case 'none': $month_range = FALSE; $this_month_filter = FALSE; $today_filter = FALSE; break; } $event_id = isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '' ? absint($_REQUEST['event_id']) : FALSE; $category_id = isset($_REQUEST['category_id']) && !empty($_REQUEST['category_id']) ? absint($_REQUEST['category_id']) : FALSE; $event_status = isset($_REQUEST['event_status']) && !empty($_REQUEST['event_status']) ? sanitize_text_field($_REQUEST['event_status']) : FALSE; $payment_status = isset($_REQUEST['payment_status']) ? wp_strip_all_tags($_REQUEST['payment_status']) : FALSE; if ($month_range) { $pieces = explode('-', $month_range, 3); $year_r = $pieces[0]; $month_r = $pieces[1]; } //Check if the venue manager is turned on $use_venue_manager = isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y' ? TRUE : FALSE; $SQL = ''; $close_union = FALSE; //Roles & Permissions //This checks to see if the user is a regional manager and creates a union to join the events that are in the users region based on the venue/locale combination if (!$group_admin_locales && function_exists('espresso_member_data') && current_user_can('espresso_group_admin') && !current_user_can('administrator')) { $member_id = espresso_member_data('id'); $group_admin_locales = get_user_meta($member_id, 'espresso_group', TRUE); $group_admin_locales = is_array($group_admin_locales) ? implode(',', $group_admin_locales) : FALSE; if ($group_admin_locales) { $SQL .= '( '; $SQL .= espresso_generate_events_page_list_table_sql($count, $attendees, $filters, $group_admin_locales); $SQL .= ' ) UNION ( '; $close_union = TRUE; } } //If this is an event manager $event_manager = function_exists('espresso_member_data') && (current_user_can('espresso_event_manager') && !current_user_can('administrator')) ? true : false; $event_admin = function_exists('espresso_member_data') && current_user_can('espresso_event_admin') ? true : false; $SQL .= 'SELECT '; if ($count && $attendees) { // count attendees $SQL .= 'SUM(a.quantity) quantity'; } else { if (!$count && $attendees) { // get attendees $SQL .= 'a.*, e.id event_id, e.event_name, checked_in'; } else { if ($count && !$attendees) { // count events $SQL .= 'COUNT(e.id) events'; //, t.start_time } else { if (!$count && !$attendees) { // get events $SQL .= 'e.id event_id, e.event_name, e.event_identifier, e.registration_start, e.registration_startT, e.registration_end, e.registration_endT, e.start_date, e.end_date, e.is_active, e.recurrence_id, e.wp_user, e.event_status, e.reg_limit'; //, t.start_time } } } } //get the venue if (!$count && !$attendees && $use_venue_manager) { $SQL .= ', v.name AS venue_title, v.address AS venue_address, v.address2 AS venue_address2, v.city AS venue_city, v.state AS venue_state, v.zip AS venue_zip, v.country AS venue_country'; } else { if (!$count && !$attendees) { $SQL .= ', e.venue_title, e.phone, e.address, e.address2, e.city, e.state, e.zip, e.country'; } } // get the locale for R&P $SQL .= !$count && !$attendees && $group_admin_locales && $use_venue_manager ? ', lc.name AS locale_name' : ''; // this might be needed $SQL .= $attendees ? ' FROM ' . EVENTS_ATTENDEE_TABLE . ' a ' : ' FROM ' . EVENTS_DETAIL_TABLE . ' e '; // join event table for attendee queries $SQL .= $attendees ? 'JOIN ' . EVENTS_DETAIL_TABLE . ' e ON e.id=a.event_id ' : ''; // join categories if ($category_id) { $SQL .= 'JOIN ' . EVENTS_CATEGORY_REL_TABLE . ' cr ON cr.event_id = e.id '; $SQL .= 'JOIN ' . EVENTS_CATEGORY_TABLE . ' c ON c.id = cr.cat_id '; } // join venues if (!$count && !$attendees && $use_venue_manager) { $SQL .= 'LEFT JOIN ' . EVENTS_VENUE_REL_TABLE . ' vr ON vr.event_id = e.id '; $SQL .= 'LEFT JOIN ' . EVENTS_VENUE_TABLE . ' v ON v.id = vr.venue_id '; } // join locales for R&P if (!$count && !$attendees && $use_venue_manager && $group_admin_locales) { $SQL .= 'JOIN ' . EVENTS_LOCALE_REL_TABLE . ' l ON l.venue_id = vr.venue_id '; $SQL .= 'JOIN ' . EVENTS_LOCALE_TABLE . ' lc ON lc.id = l.locale_id '; } //Event status filter if (!$event_id) { if ($event_status) { switch ($event_status) { case 'X': // Denied // Denied case 'D': // Deleted $SQL .= 'WHERE e.event_status = "' . $event_status . '"'; break; case 'IA': // Inactive $SQL .= 'WHERE ( e.is_active = "N" AND e.event_status != "D" ) OR ( e.end_date < "' . $curdate . '" AND e.event_status != "O" )'; // and if we are NOT filtering the date in any other way, then only retreive currently running events //$SQL .= ! $month_range && ! $today_filter ? ' OR e.end_date < "' . $curdate . '" )' : ' )'; break; case 'A': // Active $SQL .= 'WHERE e.is_active = "Y" AND ( e.event_status = "' . $event_status . '" OR e.event_status = "O" )'; // and if we are NOT filtering the date in any other way, then only retreive currently running events $SQL .= !$month_range && !$today_filter ? ' AND ( e.end_date >= "' . $curdate . '" OR e.event_status = "O" )' : ''; break; case 'P': // Pending // Pending case 'R': // Draft // Draft case 'S': // Waitlist $SQL .= 'WHERE e.is_active = "Y" AND e.event_status = "' . $event_status . '"'; // and if we are NOT filtering the date in any other way, then only retreive currently running events $SQL .= !$month_range && !$today_filter ? ' AND ( e.end_date >= "' . $curdate . '" OR e.event_status = "O" )' : ''; break; case 'O': // Ongoing $SQL .= 'WHERE e.is_active = "Y" AND e.event_status = "' . $event_status . '"'; break; case 'L': // ALL // ALL default: $SQL .= 'WHERE e.event_status != "D"'; break; } } else { // show ACTIVE events $SQL .= 'WHERE e.is_active = "Y" AND ( e.event_status = "A" OR e.event_status = "O" )'; // and if we are NOT filtering the date in any other way, then only retreive currently running events if ($espresso_premium == TRUE) { $SQL .= !$month_range && !$today_filter ? ' AND ( e.end_date >= "' . $curdate . '" OR e.event_status = "O" )' : ''; } } // specific event? $SQL .= !$count && $event_id ? ' AND e.id = ' . $event_id : ''; } else { // we want a specific event and don't care about status filters $SQL .= 'WHERE e.id = ' . $event_id; } //Category filter $SQL .= $category_id ? ' AND c.id = "' . $category_id . '" ' : ''; // for R&P : Find events in the locale $SQL .= !$count && !$attendees && $use_venue_manager && $group_admin_locales ? ' AND l.locale_id IN (' . $group_admin_locales . ') ' : ''; // Attendee Payment Status $SQL .= !$count && $attendees && $payment_status ? ' AND a.payment_status = "' . $payment_status . '"' : ''; //Month filter $SQL .= $month_range && $attendees && !$event_id ? ' AND a.date BETWEEN "' . $year_r . '-' . $month_r . '-01" AND "' . $year_r . '-' . $month_r . '-' . $days_this_month . '"' : ''; $SQL .= $month_range && !$attendees && !$event_id ? ' AND e.start_date BETWEEN "' . $year_r . '-' . $month_r . '-01" AND "' . $year_r . '-' . $month_r . '-' . $days_this_month . '"' : ''; // Today events filter $SQL .= $today_filter && $attendees && !$event_id ? " AND date BETWEEN '" . $curdate . " 00:00:00' AND '" . $curdate . " 23:59:59' " : ''; $SQL .= $today_filter && !$attendees && !$event_id ? ' AND e.start_date = "' . $curdate . '"' : ''; //This months events filter $SQL .= $this_month_filter && $attendees && !$event_id ? " AND date BETWEEN '" . $this_year_r . "-" . $this_month_r . "-01' AND '" . $this_year_r . "-" . $this_month_r . "-" . $days_this_month . "' " : ''; $SQL .= $this_month_filter && !$attendees && !$event_id ? ' AND e.start_date BETWEEN "' . $this_year_r . '-' . $this_month_r . '-01" AND "' . $this_year_r . '-' . $this_month_r . '-' . $days_this_month . '"' : ''; // for R&P : If user is an event manager, then show only their events $SQL .= $member_id && !$event_manager && !$event_admin ? ' AND e.wp_user = "******"' : ''; $SQL .= $event_manager && !$member_id && !$event_admin ? " AND e.wp_user = '******'id') . "'" : ''; // group data queries by event $SQL .= !$count && !$attendees ? ' GROUP BY e.id' : ''; // for R&P : close the UNION $SQL .= $close_union ? ' )' : ''; // order by $SQL .= !$count && $attendees && !$group_admin_locales ? ' ORDER BY date DESC, id ASC' : ''; $SQL .= !$count && !$attendees && !$group_admin_locales ? ' ORDER BY e.start_date ASC, e.event_name ASC' : ''; // limit and offset $SQL .= !$count && !$group_admin_locales ? $records_to_show : ''; // send 'er back return $SQL; }
function add_event_to_db($recurrence_arr = array()) { global $wpdb, $org_options, $current_user, $espresso_premium; //Security check using nonce if (empty($_POST['nonce_verify_insert_event']) || !wp_verify_nonce($_POST['nonce_verify_insert_event'], 'espresso_verify_insert_event_nonce')) { if (!isset($recurrence_arr['bypass_nonce'])) { print '<h3 class="error">' . __('Sorry, there was a security error and your event was not saved.', 'event_espresso') . '</h3>'; return; } } //Set FEM to false $use_fem = FALSE; $is_espresso_event_manager = false; //If using FEM if (isset($_REQUEST['ee_fem_action']) && $_REQUEST['ee_fem_action'] == 'ee_fem_add') { $use_fem = TRUE; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_event_manager') { global $espresso_manager; $event_manager_approval = isset($espresso_manager['event_manager_approval']) && $espresso_manager['event_manager_approval'] == 'Y' ? true : false; $is_espresso_event_manager = TRUE; } } //Don't show sql errors if using the FEM if ($use_fem === FALSE) { $wpdb->show_errors(); } static $recurrence_id = null; if (defined('EVENT_ESPRESSO_RECURRENCE_TABLE')) { require_once EVENT_ESPRESSO_RECURRENCE_FULL_PATH . "functions/re_functions.php"; $recurrence_id = array_key_exists('recurrence_id', $recurrence_arr) ? $recurrence_arr['recurrence_id'] : Null; if ($_POST['recurrence'] == 'Y' && count($recurrence_arr) < 2) { if (is_null($recurrence_id)) { $recurrence_id = add_recurrence_master_record(); } $re_params = array('start_date' => $_POST['recurrence_type'] == 'a' ? sanitize_text_field($_POST['recurrence_start_date']) : sanitize_text_field($_POST['recurrence_manual_dates']), 'event_end_date' => $_POST['recurrence_type'] == 'a' ? sanitize_text_field($_POST['recurrence_event_end_date']) : sanitize_text_field($_POST['recurrence_manual_end_dates']), 'end_date' => $_POST['recurrence_type'] == 'a' ? sanitize_text_field($_POST['recurrence_end_date']) : sanitize_text_field($_POST['end_date']), 'registration_start' => sanitize_text_field($_POST['recurrence_regis_start_date']), 'registration_end' => sanitize_text_field($_POST['recurrence_regis_end_date']), 'frequency' => sanitize_text_field($_POST['recurrence_frequency']), 'interval' => sanitize_text_field($_POST['recurrence_interval']), 'type' => sanitize_text_field($_POST['recurrence_type']), 'weekdays' => isset($_POST['recurrence_weekday']) ? $_POST['recurrence_weekday'] : '', 'repeat_by' => $_POST['recurrence_repeat_by'], 'recurrence_regis_date_increment' => $_POST['recurrence_regis_date_increment'], 'recurrence_manual_dates' => $_POST['recurrence_manual_dates'], 'recurrence_manual_end_dates' => $_POST['recurrence_manual_end_dates'], 'recurrence_id' => $recurrence_id, 'adding_to_db' => 'Y'); $recurrence_dates = $_POST['recurrence_type'] == 'm' ? find_recurrence_manual_dates($re_params) : find_recurrence_dates($re_params); } } //echo_f('re array', $recurrence_dates); if (defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE') && $_POST['recurrence'] == 'Y' && count($recurrence_arr) == 0) { //skip the first insert because we do not have the start dates } else { $event_meta = array(); //will be used to hold event meta data //Filters the event description based on user level $user_access = apply_filters('filter_hook_espresso_event_unfiltered_description', current_user_can('administrator')); $_REQUEST['event_desc'] = is_admin() || $user_access ? $_REQUEST['event_desc'] : apply_filters('filter_hook_espresso_event_wp_kses_post_description', wp_kses_post($_REQUEST['event_desc'])); $event_code = uniqid($current_user->ID . '-'); $event_name = !empty($_REQUEST['event']) ? sanitize_text_field($_REQUEST['event']) : $event_code; if (!isset($_REQUEST['event_identifier']) || $_REQUEST['event_identifier'] == '') { $event_identifier = sanitize_title_with_dashes($event_name . '-' . $event_code); } else { $event_identifier = sanitize_title_with_dashes($_REQUEST['event_identifier']) . $event_code; } $event_desc = !empty($_REQUEST['event_desc']) ? $_REQUEST['event_desc'] : ''; $display_desc = !empty($_REQUEST['display_desc']) ? sanitize_text_field($_REQUEST['display_desc']) : 'Y'; $display_reg_form = !empty($_REQUEST['display_reg_form']) ? sanitize_text_field($_REQUEST['display_reg_form']) : 'Y'; $externalURL = isset($_REQUEST['externalURL']) ? sanitize_text_field($_REQUEST['externalURL']) : ''; $post_type = !empty($_REQUEST['espresso_post_type']) ? sanitize_text_field($_REQUEST['espresso_post_type']) : ''; $reg_limit = !empty($_REQUEST['reg_limit']) ? sanitize_text_field($_REQUEST['reg_limit']) : '999999'; $_REQUEST['reg_limit'] = $reg_limit; $allow_multiple = !empty($_REQUEST['allow_multiple']) ? sanitize_text_field($_REQUEST['allow_multiple']) : 'N'; $additional_limit = !empty($_REQUEST['additional_limit']) && $_REQUEST['additional_limit'] > 0 ? sanitize_text_field($_REQUEST['additional_limit']) : '5'; $_REQUEST['additional_limit'] = $additional_limit; $member_only = !empty($_REQUEST['member_only']) ? sanitize_text_field($_REQUEST['member_only']) : 'N'; $is_active = !empty($_REQUEST['is_active']) ? sanitize_text_field($_REQUEST['is_active']) : 'Y'; $event_status = !empty($_REQUEST['event_status']) ? sanitize_text_field($_REQUEST['event_status']) : 'A'; $use_coupon_code = !empty($_REQUEST['use_coupon_code']) ? sanitize_text_field($_REQUEST['use_coupon_code']) : 'N'; $ticket_id = empty($_REQUEST['ticket_id']) ? 0 : sanitize_text_field($_REQUEST['ticket_id']); //Get the first instance of the start and end times $start_time = !empty($_REQUEST['start_time'][0]) ? sanitize_text_field($_REQUEST['start_time'][0]) : '8:00 AM'; $_REQUEST['event_start_time'] = $start_time; $end_time = !empty($_REQUEST['end_time'][0]) ? sanitize_text_field($_REQUEST['end_time'][0]) : '5:00 PM'; $_REQUEST['event_end_time'] = $end_time; // Add Timezone $timezone_string = isset($_REQUEST['timezone_string']) ? sanitize_text_field($_REQUEST['timezone_string']) : ''; //Early discounts $early_disc = !empty($_REQUEST['early_disc']) ? sanitize_text_field($_REQUEST['early_disc']) : ''; $early_disc_date = !empty($_REQUEST['early_disc_date']) ? sanitize_text_field($_REQUEST['early_disc_date']) : ''; $early_disc_percentage = !empty($_REQUEST['early_disc_percentage']) ? sanitize_text_field($_REQUEST['early_disc_percentage']) : ''; //Alternate email address field $alt_email = !empty($_REQUEST['alt_email']) ? sanitize_text_field($_REQUEST['alt_email']) : ''; //Send a custom emal $send_mail = !empty($_REQUEST['send_mail']) ? sanitize_text_field($_REQUEST['send_mail']) : 'N'; //Custom email content $conf_mail = !empty($_REQUEST['conf_mail']) ? esc_html($_REQUEST['conf_mail']) : ''; //Use a premade custom email $email_id = isset($_REQUEST['email_name']) ? (int) $_REQUEST['email_name'] : '0'; //Venue Information $venue_title = isset($_REQUEST['venue_title']) ? sanitize_text_field($_REQUEST['venue_title']) : ''; $venue_url = isset($_REQUEST['venue_url']) ? sanitize_text_field($_REQUEST['venue_url']) : ''; $venue_phone = isset($_REQUEST['venue_phone']) ? sanitize_text_field($_REQUEST['venue_phone']) : ''; $venue_image = isset($_REQUEST['venue_image']) ? sanitize_text_field($_REQUEST['venue_image']) : ''; //Virtual location $virtual_url = !empty($_REQUEST['virtual_url']) ? sanitize_text_field($_REQUEST['virtual_url']) : ''; $virtual_phone = !empty($_REQUEST['virtual_phone']) ? sanitize_text_field($_REQUEST['virtual_phone']) : ''; //Address/venue information $address = isset($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : ''; $address2 = isset($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : ''; $city = isset($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : ''; $state = isset($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; $zip = isset($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : ''; $country = isset($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; $phone = isset($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : ''; $event_location = ''; if (!empty($address)) { $event_location .= $address . ' '; } if (!empty($address2)) { $event_location .= '<br />' . $address2; } if (!empty($city)) { $event_location .= '<br />' . $city; } if (!empty($state)) { $event_location .= ', ' . $state; } if (!empty($zip)) { $event_location .= ', ' . $state; } if (!empty($country)) { $event_location .= '<br />' . $country; } if ($is_espresso_event_manager == true && $use_fem == true && $event_manager_approval == true) { $event_status = 'P'; } //Get the registration start and end times $_REQUEST['registration_startT'] = !empty($_REQUEST['registration_startT']) ? sanitize_text_field($_REQUEST['registration_startT']) : '12:01 AM'; $_REQUEST['registration_endT'] = !empty($_REQUEST['registration_endT']) ? sanitize_text_field($_REQUEST['registration_endT']) : '11:59 PM'; // Add registration times $registration_startT = event_date_display($_REQUEST['registration_startT'], 'H:i'); $registration_endT = event_date_display($_REQUEST['registration_endT'], 'H:i'); $_REQUEST['registration_start'] = !empty($_REQUEST['registration_start']) ? sanitize_text_field($_REQUEST['registration_start']) : date('Y-m-d'); $_REQUEST['registration_end'] = !empty($_REQUEST['registration_end']) ? sanitize_text_field($_REQUEST['registration_end']) : date('Y-m-d', time() + 60 * 60 * 24 * 29); $registration_start = array_key_exists('registration_start', $recurrence_arr) ? $recurrence_arr['registration_start'] : $_REQUEST['registration_start']; $registration_end = array_key_exists('registration_end', $recurrence_arr) ? $recurrence_arr['registration_end'] : $_REQUEST['registration_end']; //Check which start/end date to use. Will be determined by recurring events addon, if installed. if (array_key_exists('recurrence_start_date', $recurrence_arr)) { //Recurring event $start_date = $recurrence_arr['recurrence_start_date']; } elseif (!empty($_REQUEST['start_date']) && !empty($_REQUEST['recurrence_start_date'])) { //If they leave the Event Start Date empty, the First Event Date in the recurrence module is selected $start_date = sanitize_text_field($_REQUEST['recurrence_start_date']); } elseif (isset($_POST['recurrence']) && $_POST['recurrence'] == 'Y' && !empty($_REQUEST['start_date'])) { $start_date = sanitize_text_field($_REQUEST['recurrence_manual_dates'][0]); } else { $start_date = !empty($_REQUEST['start_date']) ? sanitize_text_field($_REQUEST['start_date']) : date('Y-m-d', time() + 60 * 60 * 24 * 30); } $_REQUEST['start_date'] = $start_date; if (array_key_exists('recurrence_event_end_date', $recurrence_arr)) { //If this is a Recurring event $end_date = $recurrence_arr['recurrence_event_end_date']; } elseif (!empty($_REQUEST['end_date']) && !empty($_REQUEST['recurrence_event_end_date'])) { //If they leave the Event Start Date empty, the First Event Date in the recurrence module is selected $end_date = $_REQUEST['recurrence_event_end_date']; } elseif (isset($_POST['recurrence']) && $_POST['recurrence'] == 'Y' && !empty($_REQUEST['end_date'])) { $end_date = $_REQUEST['recurrence_manual_end_dates'][count($_REQUEST['recurrence_manual_end_dates']) - 1]; } else { $end_date = !empty($_REQUEST['end_date']) ? $_REQUEST['end_date'] : date('Y-m-d', time() + 60 * 60 * 24 * 30); } $_REQUEST['end_date'] = $end_date; if (array_key_exists('visible_on', $recurrence_arr)) { //If this is a Recurring event $visible_on = $recurrence_arr['visible_on']; } elseif (isset($_REQUEST['visible_on']) && $_REQUEST['visible_on'] != '') { $visible_on = $_REQUEST['visible_on']; } elseif (isset($_REQUEST['visible_on']) && $_REQUEST['visible_on'] == '' && count($recurrence_dates) > 0) { $visible_on = $recurrence_dates[$start_date]['visible_on']; } else { $visible_on = date("Y-m-d"); } //Questions/question groups $question_groups = empty($_REQUEST['question_groups']) ? serialize(array(1)) : serialize($_REQUEST['question_groups']); $add_attendee_question_groups = empty($_REQUEST['add_attendee_question_groups']) ? '' : $_REQUEST['add_attendee_question_groups']; //Process event meta data $event_meta['venue_id'] = isset($_REQUEST['venue_id']) ? $_REQUEST['venue_id'][0] : 0; $event_meta['additional_attendee_reg_info'] = !empty($_REQUEST['additional_attendee_reg_info']) ? sanitize_text_field($_REQUEST['additional_attendee_reg_info']) : '2'; $event_meta['add_attendee_question_groups'] = $add_attendee_question_groups; $event_meta['date_submitted'] = date("Y-m-d H:i:s"); $event_meta['default_payment_status'] = !empty($_REQUEST['default_payment_status']) ? sanitize_text_field($_REQUEST['default_payment_status']) : ''; //Process thumbnail uploads $event_thumbnail_url = ''; if (isset($_REQUEST['upload_image']) && !empty($_REQUEST['upload_image'])) { $event_meta['event_thumbnail_url'] = sanitize_text_field($_REQUEST['upload_image']); $event_thumbnail_url = sanitize_text_field($event_meta['event_thumbnail_url']); } if (isset($_REQUEST['emeta']) && !empty($_REQUEST['emeta'])) { foreach ($_REQUEST['emeta'] as $k => $v) { $event_meta[$v] = strlen(trim($_REQUEST['emetad'][$k])) > 0 ? sanitize_text_field($_REQUEST['emetad'][$k]) : ''; } } $event_meta = serialize($event_meta); //echo strlen(trim($_REQUEST['emetad'][$k])); //print_r($_REQUEST['emeta'] ); ############ Added by wp-developers ###################### $require_pre_approval = 0; if (isset($_REQUEST['require_pre_approval'])) { $require_pre_approval = sanitize_text_field($_REQUEST['require_pre_approval']); } ################# END ################# //When adding colums to the following arrays, be sure both arrays have equal values. $sql = array('event_code' => $event_code, 'event_name' => $event_name, 'event_desc' => $event_desc, 'display_desc' => $display_desc, 'display_reg_form' => $display_reg_form, 'event_identifier' => $event_identifier, 'address' => $address, 'address2' => $address2, 'city' => $city, 'state' => $state, 'zip' => $zip, 'country' => $country, 'phone' => $phone, 'virtual_url' => $virtual_url, 'virtual_phone' => $virtual_phone, 'venue_title' => $venue_title, 'venue_url' => $venue_url, 'venue_phone' => $venue_phone, 'venue_image' => $venue_image, 'registration_start' => $registration_start, 'registration_end' => $registration_end, 'start_date' => $start_date, 'end_date' => $end_date, 'allow_multiple' => $allow_multiple, 'send_mail' => $send_mail, 'is_active' => $is_active, 'event_status' => $event_status, 'conf_mail' => $conf_mail, 'use_coupon_code' => $use_coupon_code, 'member_only' => $member_only, 'externalURL' => $externalURL, 'early_disc' => $early_disc, 'early_disc_date' => $early_disc_date, 'early_disc_percentage' => $early_disc_percentage, 'alt_email' => $alt_email, 'question_groups' => $question_groups, 'registration_startT' => $registration_startT, 'registration_endT' => $registration_endT, 'reg_limit' => (int) $reg_limit, 'additional_limit' => (int) $additional_limit, 'recurrence_id' => $recurrence_id, 'email_id' => (int) $email_id, 'wp_user' => (int) $current_user->ID, 'event_meta' => $event_meta, 'require_pre_approval' => $require_pre_approval, 'timezone_string' => $timezone_string, 'submitted' => date('Y-m-d H:i:s', time()), 'ticket_id' => (int) $ticket_id); $sql_data = array('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%d'); /* echo 'Debug: <br />'; print_r($sql); echo '<br />'; print 'Number of vars: ' . count ($sql); echo '<br />'; print 'Number of cols: ' . count($sql_data); */ //Add groupon reference if installed if (function_exists('event_espresso_add_event_to_db_groupon')) { $sql = event_espresso_add_event_to_db_groupon($sql, sanitize_text_field($_REQUEST['use_groupon_code'])); //print count ($sql); $sql_data = array_merge((array) $sql_data, (array) '%s'); //print count($sql_data); if (!$wpdb->insert(EVENTS_DETAIL_TABLE, $sql, $sql_data)) { $error = true; } } else { if (!$wpdb->insert(EVENTS_DETAIL_TABLE, $sql, $sql_data)) { $error = true; } } $last_event_id = $wpdb->insert_id; ############# MailChimp Integration ############## if (defined('EVENTS_MAILCHIMP_ATTENDEE_REL_TABLE') && $espresso_premium == true) { MailChimpController::add_event_list_rel($last_event_id); } if (function_exists('espresso_fb_createevent') == 'true' && $espresso_premium == true) { espresso_fb_createevent($last_event_id); } //Added for seating chart addon if (isset($_REQUEST['seating_chart_id'])) { $cls_seating_chart = new seating_chart(); $cls_seating_chart->associate_event_seating_chart($_REQUEST['seating_chart_id'], $last_event_id); } //Add event to a category $string_cat = ''; if (isset($_REQUEST['event_category']) && $_REQUEST['event_category'] != '') { foreach ($_REQUEST['event_category'] as $k => $v) { if ($v != '') { $sql_cat = "INSERT INTO " . EVENTS_CATEGORY_REL_TABLE . " (event_id, cat_id) VALUES ('" . $last_event_id . "', '" . (int) $v . "')"; if (!$wpdb->query($wpdb->prepare($sql_cat, NULL))) { $error = true; } //We get the category id's of the event and put them in events_detail_table.category_id as a well-formatted string (id,n id) $string_cat .= $v . ","; } } if ($string_cat != "" && $string_cat != ",") { $cleaned_string_cat = substr($string_cat, 0, -1); $tmp = explode(",", $cleaned_string_cat); sort($tmp); $cleaned_string_cat = implode(",", $tmp); trim($cleaned_string_cat); $sql_insert_event_detail_category_id = "UPDATE " . EVENTS_DETAIL_TABLE . " SET category_id = '" . $cleaned_string_cat . "' WHERE id='" . $last_event_id . "'"; $wpdb->query($wpdb->prepare($sql_insert_event_detail_category_id, NULL)); } } //Process staff assignments if (isset($_REQUEST['event_person']) && !empty($_REQUEST['event_person'])) { foreach ($_REQUEST['event_person'] as $k => $v) { if ($v != '') { $sql_ppl = "INSERT INTO " . EVENTS_PERSONNEL_REL_TABLE . " (event_id, person_id) VALUES ('" . $last_event_id . "', '" . $v . "')"; //echo "$sql_ppl <br>"; $wpdb->query($wpdb->prepare($sql_ppl, NULL)); } } } //Process dynamic adding of venues //If we are adding an venue from within the event editor. //Then we need to add it to the venue database and add the id to the event. if (isset($_REQUEST['add_new_venue_dynamic']) && $_REQUEST['add_new_venue_dynamic'] == 'true' && $_REQUEST['venue_id'][0] == '0') { require_once EVENT_ESPRESSO_INCLUDES_DIR . 'admin-files/venue-management/add_venue_to_db.php'; $_REQUEST['venue_id'][0] = add_venue_to_db(); } //Process venues if (isset($_REQUEST['venue_id']) && !empty($_REQUEST['venue_id'])) { foreach ($_REQUEST['venue_id'] as $k => $v) { if ($v != '' && $v != 0) { $sql_venues = "INSERT INTO " . EVENTS_VENUE_REL_TABLE . " (event_id, venue_id) VALUES ('" . $last_event_id . "', '" . $v . "')"; $wpdb->query($wpdb->prepare($sql_venues, NULL)); } } } //Process the discounts if (isset($_REQUEST['event_discount']) && !empty($_REQUEST['event_discount']) && $_REQUEST['use_coupon_code'] == 'Y') { //if they have specified to use specific coupon codes, THEN we add entries ot teh discount rel table //otherwise we shouldn't foreach ($_REQUEST['event_discount'] as $k => $v) { if ($v != '') { $sql_cat = "INSERT INTO " . EVENTS_DISCOUNT_REL_TABLE . " (event_id, discount_id) VALUES ('" . $last_event_id . "', '" . $v . "')"; if (!$wpdb->query($wpdb->prepare($sql_cat, NULL))) { $error = true; } } } } //Process event times if (isset($_REQUEST['start_time']) && !empty($_REQUEST['start_time'])) { foreach ($_REQUEST['start_time'] as $k => $v) { $time_qty = isset($_REQUEST['time_qty']) && strlen(trim($_REQUEST['time_qty'][$k])) > 0 ? "'" . $_REQUEST['time_qty'][$k] . "'" : '0'; $v = !empty($v) ? $v : $start_time; $_REQUEST['end_time'][$k] = !empty($_REQUEST['end_time'][$k]) ? $_REQUEST['end_time'][$k] : $end_time; $sql3 = "INSERT INTO " . EVENTS_START_END_TABLE . " (event_id, start_time, end_time, reg_limit) VALUES ('" . $last_event_id . "', '" . event_date_display($v, 'H:i') . "', '" . event_date_display($_REQUEST['end_time'][$k], 'H:i') . "', " . $time_qty . ")"; if (!$wpdb->query($wpdb->prepare($sql3, NULL))) { $error = true; } } } //Process event costs if (isset($_REQUEST['event_cost']) && !empty($_REQUEST['event_cost'])) { foreach ($_REQUEST['event_cost'] as $k => $v) { if ($v != '') { $v = (double) preg_replace('/[^0-9\\.]/ui', '', $v); //Removes non-integer characters $price_type = !empty($_REQUEST['price_type'][$k]) ? sanitize_text_field(stripslashes_deep($_REQUEST['price_type'][$k])) : __('General Admission', 'event_espresso'); $member_price_type = !empty($_REQUEST['member_price_type'][$k]) ? sanitize_text_field(stripslashes_deep($_REQUEST['member_price_type'][$k])) : __('Members Admission', 'event_espresso'); $member_price = !empty($_REQUEST['member_price'][$k]) ? $_REQUEST['member_price'][$k] : $v; //$sql_price = "INSERT INTO " . EVENTS_PRICES_TABLE . " (event_id, event_cost, surcharge, surcharge_type, price_type, member_price, member_price_type) VALUES ('" . $last_event_id . "', '" . $v . "', '" . $_REQUEST['surcharge'][$k] . "', '" . $_REQUEST['surcharge_type'][$k] . "', '" . $price_type . "', '" . $member_price . "', '" . $member_price_type . "')"; //echo "$sql3 <br>"; $sql_price = array('event_id' => $last_event_id, 'event_cost' => $v, 'surcharge' => $_REQUEST['surcharge'][$k], 'surcharge_type' => $_REQUEST['surcharge_type'][$k], 'price_type' => $price_type, 'member_price' => $member_price, 'member_price_type' => $member_price_type); $sql_price_data = array('%d', '%s', '%s', '%s', '%s', '%s', '%s'); if (!$wpdb->insert(EVENTS_PRICES_TABLE, $sql_price, $sql_price_data)) { $error = true; } } } } elseif (isset($_REQUEST['event_cost']) && $_REQUEST['event_cost'][0] == 0) { $sql_price = "INSERT INTO " . EVENTS_PRICES_TABLE . " (event_id, event_cost, surcharge, price_type, member_price, member_price_type) VALUES ('" . $last_event_id . "', '0.00', '0.00', '" . __('Free', 'event_espresso') . "', '0.00', '" . __('Free', 'event_espresso') . "')"; if (!$wpdb->query($wpdb->prepare($sql_price, NULL))) { $error = true; } } //Process blog or custom post if (isset($_REQUEST['create_post']) && $_REQUEST['create_post'] == 'Y') { $post_type = !empty($_REQUEST['espresso_post_type']) ? $_REQUEST['espresso_post_type'] : 'post'; if ($post_type == 'post') { if (file_exists(EVENT_ESPRESSO_TEMPLATE_DIR . "event_post.php") || file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . "templates/event_post.php")) { // Load message from template into message post variable ob_start(); if (file_exists(EVENT_ESPRESSO_TEMPLATE_DIR . "event_post.php")) { require_once EVENT_ESPRESSO_TEMPLATE_DIR . "event_post.php"; } else { require_once EVENT_ESPRESSO_PLUGINFULLPATH . "templates/event_post.php"; } $post_content = ob_get_contents(); ob_end_clean(); } else { _e('There was error finding a post template. Please verify your post templates are available.', 'event_espresso'); } } elseif ($post_type == 'espresso_event') { ob_start(); echo $event_desc; $post_content = ob_get_contents(); ob_end_clean(); // if there's a cart link shortcode in the post, replace the shortcode with one that includes the event_id if (preg_match("/ESPRESSO_CART_LINK/", $post_content)) { $post_content = preg_replace('/ESPRESSO_CART_LINK/', 'ESPRESSO_CART_LINK event_id=' . $event_id, $post_content); } } $my_post = array(); $my_post['post_title'] = sanitize_text_field($_REQUEST['event']); $my_post['post_content'] = $post_content; $my_post['post_status'] = 'publish'; $my_post['post_author'] = !empty($_REQUEST['user']) ? $_REQUEST['user'] : ''; $my_post['post_category'] = !empty($_REQUEST['post_category']) ? $_REQUEST['post_category'] : ''; $my_post['tags_input'] = !empty($_REQUEST['post_tags']) ? $_REQUEST['post_tags'] : ''; $my_post['post_type'] = !empty($post_type) ? $post_type : 'post'; //print_r($my_post); // Insert the post into the database $post_id = wp_insert_post($my_post); // Store the POST ID so it can be displayed on the edit page $sql = array('post_id' => $post_id, 'post_type' => $post_type); add_post_meta($post_id, 'event_id', $last_event_id); add_post_meta($post_id, 'event_meta', $event_meta); add_post_meta($post_id, 'event_identifier', $event_identifier); add_post_meta($post_id, 'event_start_date', $start_date); add_post_meta($post_id, 'event_end_date', $end_date); add_post_meta($post_id, 'event_location', $event_location); add_post_meta($post_id, 'event_thumbnail_url', $event_thumbnail_url); add_post_meta($post_id, 'virtual_url', $virtual_url); add_post_meta($post_id, 'virtual_phone', $virtual_phone); add_post_meta($post_id, 'event_address', $address); add_post_meta($post_id, 'event_address2', $address2); add_post_meta($post_id, 'event_city', $city); add_post_meta($post_id, 'event_state', $state); add_post_meta($post_id, 'event_country', $country); add_post_meta($post_id, 'event_phone', $phone); add_post_meta($post_id, 'venue_title', $venue_title); add_post_meta($post_id, 'venue_url', $venue_url); add_post_meta($post_id, 'venue_phone', $venue_phone); add_post_meta($post_id, 'venue_image', $venue_image); add_post_meta($post_id, 'event_externalURL', $externalURL); add_post_meta($post_id, 'event_reg_limit', $reg_limit); add_post_meta($post_id, 'event_start_time', time_to_24hr($start_time)); add_post_meta($post_id, 'event_end_time', time_to_24hr($end_time)); add_post_meta($post_id, 'event_registration_start', $registration_start); add_post_meta($post_id, 'event_registration_end', $registration_end); add_post_meta($post_id, 'event_registration_startT', $registration_startT); add_post_meta($post_id, 'event_registration_endT', $registration_endT); //add_post_meta( $post_id, 'timezone_string', $_REQUEST['timezone_string'] ); $sql_data = array('%d', '%s'); $update_id = array('id' => $last_event_id); $wpdb->update(EVENTS_DETAIL_TABLE, $sql, $update_id, $sql_data, array('%d')); } if (empty($error)) { ?> <div id="message" class="updated fade"><p><strong><?php _e('The event', 'event_espresso'); ?> <a href="<?php echo espresso_reg_url($last_event_id); ?> " target="_blank"> <?php echo htmlentities(stripslashes(sanitize_text_field($_REQUEST['event'])), ENT_QUOTES, 'UTF-8'); ?> </a> <?php _e('has been added for ', 'event_espresso'); echo date("m/d/Y", strtotime($start_date)); ?> <a href="<?php echo admin_url(); ?> admin.php?page=events&action=edit&event_id=<?php echo $last_event_id; ?> "><?php _e('Edit this event?', 'event_espresso'); ?> </a></strong></p></div> <?php } else { ?> <div id="message" class="error"><p><strong><?php _e('There was an error in your submission. The event was not saved! Please try again.', 'event_espresso'); ?> <?php print $wpdb->print_error(); ?> </strong></p></div> <?php } } //With the recursion of this function, additional recurring events will be added if (isset($recurrence_dates) && count($recurrence_dates) > 0) { foreach ($recurrence_dates as $k => $v) { add_event_to_db(array('recurrence_id' => $recurrence_id, 'recurrence_start_date' => $v['start_date'], 'recurrence_event_end_date' => $v['event_end_date'], 'registration_start' => $v['registration_start'], 'registration_end' => $v['registration_end'])); } } $_REQUEST['event_id'] = !empty($last_event_id) ? $last_event_id : ''; do_action('action_hook_espresso_insert_event_success', $_REQUEST); //If not using the FEM addon, then we return the event id if (!$use_fem === TRUE) { return @$last_event_id; } }
function event_espresso_discount_config_mnu() { global $wpdb; ?> <div class="wrap"> <div id="icon-options-event" class="icon32"> </div> <h2><?php echo _e('Manage Event Promotional Codes', 'event_espresso'); ?> <?php if (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'edit' && $_REQUEST['action'] != 'new') { echo '<a href="admin.php?page=discounts&action=new" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Code', 'event_espresso') . '</a>'; } ?> </h2> <?php ob_start(); if (isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'add': require_once "add_discount.php"; add_discount_to_db(); //Add the discount to the DB break; case 'new': require_once "new_discount.php"; add_new_event_discount(); //Add new discount form break; case 'edit': require_once "edit_discount.php"; edit_event_discount(); //Edit discount form break; case 'update': require_once "update_discount.php"; update_event_discount(); //Update discount in DB break; case 'delete_discount': require_once "delete_discount.php"; delete_event_discount(); //Delete discount in DB break; } } if (!empty($_REQUEST['delete_discount'])) { //This is for the delete checkboxes require_once "delete_discount.php"; delete_event_discount(); } ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table" class="widefat manage-discounts"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:2.5%;"><input type="checkbox"></th> <th class="manage-column column-comments num" id="id" style="padding-top:7px; width:2.5%;" scope="col" title="Click to Sort"><?php _e('ID', 'event_espresso'); ?> </th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Name', 'event_espresso'); ?> </th> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:10%;"><?php _e('Creator', 'event_espresso'); ?> </th> <?php } ?> <th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Amount', 'event_espresso'); ?> </th> <th class="manage-column column-date" id="begins" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Percentage', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM " . EVENTS_DISCOUNT_CODES_TABLE; if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql .= " WHERE wp_user = '******'id') . "' "; } $event_discounts = $wpdb->get_results($sql); if ($wpdb->num_rows > 0) { foreach ($event_discounts as $event_discount) { $discount_id = $event_discount->id; $coupon_code = $event_discount->coupon_code; $coupon_code_price = $event_discount->coupon_code_price; $coupon_code_description = $event_discount->coupon_code_description; $use_percentage = $event_discount->use_percentage; $wp_user = $event_discount->wp_user; ?> <tr> <td class="check-column" style="padding:7px 0 22px 5px; vertical-align:top;"><input name="checkbox[<?php echo $discount_id; ?> ]" type="checkbox" title="Delete <?php echo $coupon_code; ?> "></td> <td class="column-comments" style="padding-top:3px;"><?php echo $discount_id; ?> </td> <td class="post-title page-title column-title"><strong><a href="admin.php?page=discounts&action=edit&discount_id=<?php echo $discount_id; ?> "><?php echo $coupon_code; ?> </a></strong> <div class="row-actions"><span class="edit"><a href="admin.php?page=discounts&action=edit&discount_id=<?php echo $discount_id; ?> "><?php _e('Edit', 'event_espresso'); ?> </a> | </span><span class="delete"><a onclick="return confirmDelete();" class="delete submitdelete" href="admin.php?page=discounts&action=delete_discount&discount_id=<?php echo $discount_id; ?> "><?php _e('Delete', 'event_espresso'); ?> </a></span></div></td> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <td><?php echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') : espresso_user_meta($wp_user, 'display_name'); ?> </td> <?php } ?> <td class="author column-author"><?php echo $coupon_code_price; ?> </td> <td class="author column-author"><?php echo $use_percentage; ?> </td> </tr> <?php } } ?> </tbody> </table> <div style="clear:both"> <p><input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong> <?php _e('Check All', 'event_espresso'); ?> </strong> <input name="delete_discount" type="submit" class="button-secondary" id="delete_discount" value="<?php _e('Delete Promotional Code', 'event_espresso'); ?> " style="margin:10 0 0 10px;" onclick="return confirmDelete();"> <a style="margin-left:5px"class="button-primary" href="admin.php?page=discounts&action=new"><?php _e('Add New Promotional Code', 'event_espresso'); ?> </a></p> </div> </form> <?php $main_post_content = ob_get_clean(); espresso_choose_layout($main_post_content, event_espresso_display_right_column()); ?> </div> <script type="text/javascript"> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ { "bSortable": false }, null, null, null, <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : ''; ?> null ] } ); } ); // Add new promo code form validation jQuery(function(){ jQuery("#new-promo-code").validate( { rules: { coupon_code: "required" }, messages: { coupon_code: "Please add your promotional code" } }); }); </script> <?php }
function event_espresso_venue_config_mnu() { global $wpdb, $current_user, $espresso_premium; $_REQUEST['action'] = isset($_REQUEST['action']) ? $_REQUEST['action'] : NULL; ?> <div class="wrap"> <div id="icon-options-event" class="icon32"> </div> <h2> <?php _e('Manage Venues', 'event_espresso'); ?> <?php if ($_REQUEST['action'] != 'edit' && $_REQUEST['action'] != 'add_new_venue') { echo '<a href="admin.php?page=event_venues&action=add_new_venue" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Venue', 'event_espresso') . '</a>'; } ?> </h2> <?php ob_start(); if (isset($_POST['delete_venue']) || isset($_REQUEST['action']) && 'delete_venue' == $_REQUEST['action']) { $venue_deleted = 0; if (isset($_POST['checkbox']) && is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; $flag = true; if (function_exists('espresso_user_has_venue_permission')) { $flag = espresso_user_has_venue_permission($del_id); } if ($flag) { //Delete venue data $sql = "DELETE FROM " . EVENTS_VENUE_TABLE . " WHERE id='{$del_id}'"; $wpdb->query($sql); if ($wpdb->rows_affected > 0) { $venue_deleted++; } $sql = "DELETE FROM " . EVENTS_VENUE_REL_TABLE . " WHERE venue_id='{$del_id}'"; $wpdb->query($sql); $sql = "DELETE FROM " . EVENTS_LOCALE_REL_TABLE . " WHERE venue_id='{$del_id}'"; $wpdb->query($sql); } } } if (isset($_REQUEST['id']) && 'delete_venue' == $_REQUEST['action']) { $flag = true; $del_id = $_REQUEST['id']; if (function_exists('espresso_user_has_venue_permission')) { $flag = espresso_user_has_venue_permission($del_id); } if ($flag) { //Delete discount data $sql = "DELETE FROM " . EVENTS_VENUE_TABLE . " WHERE id='" . $del_id . "'"; $wpdb->query($sql); if ($wpdb->rows_affected > 0) { $venue_deleted++; } $sql = "DELETE FROM " . EVENTS_VENUE_REL_TABLE . " WHERE venue_id='" . $del_id . "'"; $wpdb->query($sql); $sql = "DELETE FROM " . EVENTS_LOCALE_REL_TABLE . " WHERE venue_id='" . $del_id . "'"; $wpdb->query($sql); } } if ($venue_deleted > 0) { ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Venues have been successfully deleted from the event.', 'event_espresso'); ?> </strong></p> </div> <?php } } if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'update') { require_once "update_venue.php"; update_event_venue(); } if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') { require_once "add_venue_to_db.php"; add_venue_to_db(); } if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add_new_venue') { require_once "add_new_venue.php"; add_new_event_venue(); } if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') { require_once "edit_venue.php"; edit_event_venue(); } ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table" class="widefat manage-discounts"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:2.5%;"><input type="checkbox"></th> <th class="manage-column column-comments num" id="id" style="padding-top:7px; width:2.5%;" scope="col" title="Click to Sort"><?php _e('ID', 'event_espresso'); ?> </th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Name', 'event_espresso'); ?> </th> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) { ?> <th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Locale', 'event_espresso'); ?> </th> <?php } ?> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) { ?> <th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Creator', 'event_espresso'); ?> </th> <?php } ?> <th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Shortcode', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php global $espresso_manager; // If user is an event manager, then show only their venues $sql = "( SELECT v.* FROM " . EVENTS_VENUE_TABLE . " v "; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') { if ($espresso_manager['event_manager_venue'] == "Y") { // show only venues inside their assigned locales. $group = get_user_meta(espresso_member_data('id'), "espresso_group", true); $sql .= " LEFT JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = v.id "; $sql .= " WHERE l.locale_id IN (" . implode(",", $group) . ")"; $sql .= ") UNION ( "; $sql .= "SELECT v.* FROM " . EVENTS_VENUE_TABLE . " v "; } } if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql .= " WHERE v.wp_user = "******")"; #echo $sql; #exit("TEST"); $wpdb->query($sql); if ($wpdb->num_rows > 0) { $results = $wpdb->get_results($sql . " ORDER BY id ASC"); foreach ($results as $result) { $venue_id = $result->id; $name = isset($result->name) ? stripslashes_deep($result->name) : ''; $venue_desc = isset($result->venue_desc) ? stripslashes_deep($result->venue_desc) : ''; $wp_user = isset($result->wp_user) ? $result->wp_user : ''; ?> <tr> <td class="check-column" style="padding:7px 0 22px 5px; vertical-align:top;"><input name="checkbox[<?php echo $venue_id; ?> ]" type="checkbox" title="Delete <?php echo stripslashes($name); ?> "></td> <td class="column-comments" style="padding-top:3px;"><?php echo $venue_id; ?> </td> <td class="post-title page-title column-title"><strong><a href="admin.php?page=event_venues&action=edit&id=<?php echo $venue_id; ?> "><?php echo $name; ?> </a></strong> <div class="row-actions"> <span class="edit"><a href="admin.php?page=event_venues&action=edit&id=<?php echo $venue_id; ?> "> <?php _e('Edit', 'event_espresso'); ?> </a> | </span> <span class="delete"><a onclick="return confirmDelete();" class="submitdelete" href="admin.php?page=event_venues&action=delete_venue&id=<?php echo $venue_id; ?> "> <?php _e('Delete', 'event_espresso'); ?> </a></span> </div></td> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) { ?> <td><?php $last_locale_id = $wpdb->get_var("SELECT locale_id FROM " . EVENTS_LOCALE_REL_TABLE . " WHERE venue_id='" . $venue_id . "'"); $locales = $wpdb->get_results("SELECT * FROM " . EVENTS_LOCALE_TABLE . " WHERE id = '" . $last_locale_id . "'"); if (count($locales) > 0) { foreach ($locales as $locale) { $locale_id = $locale->id; $name = stripslashes($locale->name); echo $name; } } ?> </td> <?php } ?> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) { ?> <td><?php echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') : espresso_user_meta($wp_user, 'display_name'); ?> </td> <?php } ?> <td>[ESPRESSO_VENUE id="<?php echo $venue_id; ?> "]</td> </tr> <?php } } ?> </tbody> </table> <div style="clear:both"> <p> <input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong> <?php _e('Check All', 'event_espresso'); ?> </strong> <input name="delete_venue" type="submit" class="button-secondary" id="delete_venue" value="<?php _e('Delete Venue', 'event_espresso'); ?> " style="margin-left:10px 0 0 10px;" onclick="return confirmDelete();"> <a style="margin-left:5px"class="button-primary" href="admin.php?page=event_venues&action=add_new_venue"> <?php _e('Add New Venue', 'event_espresso'); ?> </a> </p> </div> </form> <?php $main_post_content = ob_get_clean(); espresso_choose_layout($main_post_content, event_espresso_display_right_column()); ?> </div> <?php #### help dialogue box #### ?> <div id="venue_locale" style="display:none"> <div class="TB-ee-frame"> <h2> <?php _e('Venue Locale/Region', 'event_espresso'); ?> </h2> <p> <?php _e('This can be used to group venues together by locales/regions.', 'event_espresso'); ?> </p> <p> <?php _e('Once you have created a locale in the <a href="admin.php?page=event_locales"> Manage Locales/Regions</a> page it will be available to select on the \'Add a Venue\' page', 'event_espresso'); ?> </p> </div> </div> <?php #### end help #### ?> <script> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ { "bSortable": false }, null, <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : ''; ?> null, <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : ''; ?> { "bSortable": false } ] } ); } ); // Add new venue form validation jQuery(function(){ jQuery('#venues-form').validate({ rules: { name: "required" }, messages: { name: "please add a name for your venue" } }); }); </script> <?php }
function event_espresso_categories_config_mnu() { global $wpdb, $current_user; ?> <div class="wrap"> <div id="icon-options-event" class="icon32"> </div> <h2><?php _e('Manage Event Categories', 'event_espresso'); ?> <?php if (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'edit' && $_REQUEST['action'] != 'add_new_category') { echo '<a href="admin.php?page=event_categories&action=add_new_category" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Category', 'event_espresso') . '</a>'; } ?> </h2> <div id="poststuff" class="metabox-holder has-right-sidebar"> <?php event_espresso_display_right_column(); ?> <div id="post-body"> <div id="post-body-content"> <?php if (!empty($_POST['delete_category']) || isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete_category') { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; //Delete category data $sql = "DELETE FROM " . EVENTS_CATEGORY_TABLE . " WHERE id='{$del_id}'"; $wpdb->query($sql); $sql = "DELETE FROM " . EVENTS_CATEGORY_REL_TABLE . " WHERE cat_id='{$del_id}'"; $wpdb->query($sql); } } if ($_REQUEST['action'] == 'delete_category') { //Delete discount data $sql = "DELETE FROM " . EVENTS_CATEGORY_TABLE . " WHERE id='" . $_REQUEST['id'] . "'"; $wpdb->query($sql); $sql = "DELETE FROM " . EVENTS_CATEGORY_REL_TABLE . " WHERE cat_id='" . $_REQUEST['id'] . "'"; $wpdb->query($sql); } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Categories have been successfully deleted from the event.', 'event_espresso'); ?> </strong></p> </div> <?php } if (isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'update': update_event_category(); break; case 'add': add_cat_to_db(); break; case 'add_new_category': add_new_event_category(); break; case 'edit': edit_event_category(); break; } } ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table" class="widefat manage-categories"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:2.5%;"><input type="checkbox"></th> <th class="manage-column column-comments num" id="id" style="padding-top:7px; width:2.5%;" scope="col" title="Click to Sort"><?php _e('ID', 'event_espresso'); ?> </th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Name', 'event_espresso'); ?> </th> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:10%;"><?php _e('Creator', 'event_espresso'); ?> </th> <?php } ?> <th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:20%;"><?php _e('Shortcode', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM " . EVENTS_CATEGORY_TABLE . " c"; if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql .= " JOIN {$wpdb->users} u on u.ID = c.wp_user WHERE c.wp_user = "******" ORDER BY c.id ASC"); foreach ($results as $result) { $category_id = $result->id; $category_name = stripslashes($result->category_name); $category_identifier = stripslashes($result->category_identifier); $category_desc = stripslashes($result->category_desc); $display_category_desc = stripslashes($result->display_desc); $wp_user = $result->wp_user; ?> <tr> <td class="check-column" style="padding:7px 0 22px 5px; vertical-align:top;"><input name="checkbox[<?php echo $category_id; ?> ]" type="checkbox" title="Delete <?php echo stripslashes($category_name); ?> "></td> <td class="column-comments" style="padding-top:3px;"><?php echo $category_id; ?> </td> <td class="post-title page-title column-title"><strong><a href="admin.php?page=event_categories&action=edit&id=<?php echo $category_id; ?> "><?php echo $category_name; ?> </a></strong> <div class="row-actions"> <span class="edit"><a href="admin.php?page=event_categories&action=edit&id=<?php echo $category_id; ?> "><?php _e('Edit', 'event_espresso'); ?> </a> | </span> <span class="delete"><a onclick="return confirmDelete();" class="submitdelete" href="admin.php?page=event_categories&action=delete_category&id=<?php echo $category_id; ?> "><?php _e('Delete', 'event_espresso'); ?> </a></span></div> </td> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <td><?php echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') : espresso_user_meta($wp_user, 'display_name'); ?> </td> <?php } ?> <td>[EVENT_ESPRESSO_CATEGORY event_category_id="<?php echo $category_identifier; ?> "]</td> </tr> <?php } } ?> </tbody> </table> <div style="clear:both"> <p> <input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong> <?php _e('Check All', 'event_espresso'); ?> </strong> <input name="delete_category" type="submit" class="button-secondary" id="delete_category" value="<?php _e('Delete Category', 'event_espresso'); ?> " style="margin-left:10px 0 0 10px;" onclick="return confirmDelete();"> <a style="margin-left:5px"class="button-primary" href="admin.php?page=event_categories&action=add_new_category"><?php _e('Add New Category', 'event_espresso'); ?> </a> </p> </div> </form> </div> </div> </div> </div> <div id="unique_id_info" style="display:none"> <h2><?php _e('Unique Category Identifier', 'event_espresso'); ?> </h2> <p><?php _e('This should be a unique identifier for the category. Example: "category1" (without qoutes.)', 'event_espresso'); ?> </p> <p>The<?php _e(' unique ID can also be used in individual pages using the', 'event_espresso'); ?> [EVENT_ESPRESSO_CATEGORY event_category_id="category_identifier"] <?php _e('shortcode', 'event_espresso'); ?> .</p> </div> <script> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ { "bSortable": false }, null, null, <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : ''; ?> { "bSortable": false } ] } ); } ); // Add new category form validation jQuery(function(){ jQuery("#add-new-cat").validate({ rules: { category_name: "required" }, messages: { category_name: "please add a category name" } }); }); </script> <?php }
function espresso_event_question_groups($question_groups = array(), $add_attendee_question_groups = array(), $event_id = 0) { global $wpdb, $org_options, $espresso_premium; ?> <div id="event-questions" class="postbox event-questions-lists"> <div class="handlediv" title="Click to toggle"><br /> </div> <h3 class="hndle"><span> <?php echo sprintf(__('Event Questions for Primary Attendee', 'event_espresso'), ''); ?> </span></h3> <div class="inside"> <p><strong> <?php _e('Question Groups', 'event_espresso'); ?> </strong><br /> <?php _e('Add a pre-populated', 'event_espresso'); ?> <a href="admin.php?page=form_groups" target="_blank"> <?php _e('group', 'event_espresso'); ?> </a> <?php _e('of', 'event_espresso'); ?> <a href="admin.php?page=form_builder" target="_blank"> <?php _e('questions', 'event_espresso'); ?> </a> <?php _e('to your event. The personal information group is required for all events.', 'event_espresso'); ?> </p> <?php $g_limit = $espresso_premium != true ? 'LIMIT 0,2' : ''; $sql = "SELECT qg.* FROM " . EVENTS_QST_GROUP_TABLE . " qg JOIN " . EVENTS_QST_GROUP_REL_TABLE . " qgr ON qg.id = qgr.group_id "; if (function_exists('espresso_member_data')) { $wpdb->get_results("SELECT wp_user FROM " . EVENTS_DETAIL_TABLE . " WHERE id = '" . $event_id . "'"); $wp_user = $wpdb->last_result[0]->wp_user != '' ? $wpdb->last_result[0]->wp_user : espresso_member_data('id'); $sql .= " WHERE "; if ($wp_user == 0 || $wp_user == 1) { $sql .= " (wp_user = '******' OR wp_user = '******') "; } else { //$sql .= " wp_user = '******' "; $sql .= " (wp_user = '******' OR wp_user = '******' OR wp_user = '******')"; } } else { $sql .= " WHERE wp_user = '******' OR wp_user = '******' "; } $sql .= " GROUP BY qg.id ORDER BY qg.group_order {$g_limit} "; $q_groups = $wpdb->get_results($sql); $num_rows = $wpdb->num_rows; $html = ''; if ($num_rows > 0) { foreach ($q_groups as $question_group) { $question_group_id = $question_group->id; $question_group_description = $question_group->group_description; $group_name = $question_group->group_name; //$checked = $question_group->system_group == 1 ? ' checked="checked" ' : ''; $checked = is_array($question_groups) && array_key_exists($question_group_id, $question_groups) || $question_group->system_group == 1 ? ' checked="checked" ' : ''; $visibility = $question_group->system_group == 1 ? 'style="visibility:hidden"' : ''; $group_id = isset($group_id) ? $group_id : ''; $html .= '<p id="event-question-group-' . $question_group_id . '"><input value="' . $question_group_id . '" type="checkbox" ' . $checked . $visibility . ' name="question_groups[' . $question_group_id . ']" ' . $checked . ' /> <a href="admin.php?page=form_groups&action=edit_group&group_id=' . $question_group_id . '" title="edit" target="_blank">' . $group_name . '</a></p>'; } if ($num_rows > 10) { $top_div = '<div style="height:250px;overflow:auto;">'; $bottom_div = '</div>'; } else { $top_div = ''; $bottom_div = ''; } $html = $top_div . $html . $bottom_div; echo $html; } else { echo __('There seems to be a problem with your questions. Please contact support@eventespresso.com', 'event_espresso'); } if ($espresso_premium != true) { echo __('Need more questions?', 'event_espresso') . ' <a href="http://eventespresso.com/download/" target="_blank">' . __('Upgrade Now!', 'event_espresso') . '</a>'; } ?> </div> </div> <?php if ($espresso_premium == true) { ?> <div id="event-questions-additional" class="postbox event-questions-lists"> <div class="handlediv" title="Click to toggle"><br> </div> <h3 class="hndle"><span> <?php _e('Event Questions for Additional Attendees', 'event_espresso'); ?> </span></h3> <div class="inside"> <p><strong> <?php _e('Question Groups', 'event_espresso'); ?> </strong><br /> <?php _e('Add a pre-populated', 'event_espresso'); ?> <a href="admin.php?page=form_groups" target="_blank"> <?php _e('group', 'event_espresso'); ?> </a> <?php _e('of', 'event_espresso'); ?> <a href="admin.php?page=form_builder" target="_blank"> <?php _e('questions', 'event_espresso'); ?> </a> <?php _e('to your event. The personal information group is required for all events.', 'event_espresso'); ?> </p> <?php // $add_attendee_question_groups = isset($add_attendee_question_groups) ? $add_attendee_question_groups : ''; reset($q_groups); $html = ''; if ($num_rows > 0) { foreach ($q_groups as $question_group) { $question_group_id = $question_group->id; $question_group_description = $question_group->group_description; $group_name = $question_group->group_name; $checked = is_array($add_attendee_question_groups) && array_key_exists($question_group_id, $add_attendee_question_groups) || $question_group->system_group == 1 ? ' checked="checked" ' : ''; $visibility = $question_group->system_group == 1 ? 'style="visibility:hidden"' : ''; $html .= '<p id="event-question-group-' . $question_group_id . '"><input value="' . $question_group_id . '" type="checkbox" ' . $visibility . ' name="add_attendee_question_groups[' . $question_group_id . ']" ' . $checked . ' /> <a href="admin.php?page=form_groups&action=edit_group&group_id=' . $question_group_id . '" title="edit" target="_blank">' . $group_name . "</a></p>"; } if ($num_rows > 10) { $top_div = '<div style="height:250px;overflow:auto;">'; $bottom_div = '</div>'; } $html = $top_div . $html . $bottom_div; echo $html; } else { echo __('There seems to be a problem with your questions. Please contact support@eventespresso.com', 'event_espresso'); } if ($espresso_premium != true) { echo __('Need more questions?', 'event_espresso') . ' <a href="http://eventespresso.com/download/" target="_blank">' . __('Upgrade Now!', 'event_espresso') . '</a>'; } ?> </div> </div> <?php } }
function espresso_total_attendees_this_month() { //Get total attendees this month global $wpdb; //Dates $curdate = date("Y-m-d"); $pieces = explode('-', $curdate, 3); $this_year_r = $pieces[0]; $this_month_r = $pieces[1]; $days_this_month = date('t', strtotime($curdate)); $asql3 = "("; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') { $group = get_user_meta(espresso_member_data('id'), "espresso_group", true); $asql3 .= "SELECT SUM(a.quantity) quantity FROM " . EVENTS_ATTENDEE_TABLE . " a "; $asql3 .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id "; if (!empty($group)) { $asql3 .= " JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id "; $asql3 .= " JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = r.venue_id "; } $asql3 .= " WHERE date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' "; $asql3 .= !empty($group) ? " AND l.locale_id IN (" . implode(",", $group) . ") " : ''; $asql3 .= " AND a.quantity >= 1 "; //AND (a.payment_status='Completed' OR a.payment_status='Pending') "; $asql3 .= " AND e.event_status != 'D' "; $asql3 .= ") UNION ("; } $asql3 .= "SELECT SUM(a.quantity) quantity FROM " . EVENTS_ATTENDEE_TABLE . " a "; $asql3 .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id "; $asql3 .= " WHERE a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' "; if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $asql3 .= " AND e.wp_user = '******'id') . "' "; } $asql3 .= " AND a.quantity >= 1 "; //AND (a.payment_status='Completed' OR a.payment_status='Pending') "; $asql3 .= " AND e.event_status != 'D' "; $asql3 .= ")"; //echo $asql3; $total_a_this_month = 0; $wpdb->query($asql3); if ($wpdb->num_rows > 0 && $wpdb->last_result[0]->quantity != NULL) { $total_a_this_month = $wpdb->last_result[0]->quantity + (isset($wpdb->last_result[1]->quantity) ? $wpdb->last_result[1]->quantity : 0); } return $total_a_this_month; }
function event_espresso_form_group_new() { global $wpdb; ?> <div id="add-edit-new-group" class="metabox-holder"> <div class="postbox"> <div title="Click to toggle" class="handlediv"><br /></div> <h3 class="hndle"><?php _e('Add New Group', 'event_espresso'); ?> </h3> <div class="inside"> <form id="add-new-group" name="newgroup" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <p class="intro"><?php _e('Add new group using the form below.', 'event_espresso'); ?> </p> <table id="table-add-group" class="ee-tables" border="0"> <tr> <td class="a" valign="top"> <fieldset id="general-group-info"> <legend><?php _e('Group Information', 'event_espresso'); ?> </legend> <ul> <li> <label for="group_name"><?php _e('Group Name:', 'event_espresso'); ?> <em title="<?php _e('This field is required', 'event_espresso'); ?> "> *</em></label> <input class="group-name" name="group_name" id="group_name" size="50" value="" type="text" /> </li> <li> <label for="group_order"><?php _e('Group Order:', 'event_espresso'); ?> </label> <input name="group_order" id="group_order" size="6" value="" type="text" /> </li> <li> <label for="group_description"><?php _e('Description:', 'event_espresso'); ?> </label> <textarea name="group_description" cols="40" rows="5"></textarea> </li> <li> <label for="show_group_name"><?php _e('Show group name on registration page?', 'event_espresso'); ?> </label> <input type="checkbox" name="show_group_name" id="show_group_name" value="1" checked="checked" /> </li> <li> <label for="show_group_description"><?php _e('Show group description on registration page?', 'event_espresso'); ?> </label> <input type="checkbox" name="show_group_description" id="show_group_description" value="1" checked="checked" /> </li> </ul> </fieldset> </td> <td class="b" valign="top"> <fieldset id="questions-for-group"> <legend><?php _e('Add questions', 'event_espresso'); ?> </legend> <ul id="add-quest"> <li><p><?php _e('Select questions to add to group:', 'event_espresso'); ?> </p></li> <?php $sql = "SELECT * FROM " . EVENTS_QUESTION_TABLE; $sql .= " WHERE "; if (function_exists('espresso_member_data')) { if (espresso_member_data('id') == 0 || espresso_member_data('id') == 1) { $sql .= " (wp_user = '******' OR wp_user = '******') "; } else { $sql .= " wp_user = '******'id') . "' "; } } else { $sql .= " (wp_user = '******' OR wp_user = '******') "; } $sql .= " ORDER BY sequence, id ASC "; $questions = $wpdb->get_results($sql); if ($wpdb->num_rows > 0) { foreach ($questions as $question) { echo '<li><label><input type="checkbox" name="question_id[]" value="' . $question->id . '" id="question_id_' . $question->id . '" />' . stripslashes($question->question) . '</label></li>'; } } ?> </ul> </fieldset> </td> </tr> </table> <p class="submit-footer"> <input name="action" value="insert_group" type="hidden"> <input name="Submit" value="Add Group" type="submit"> </p> </form> </div> </div> </div> <?php }
function event_espresso_questions_config_mnu() { global $wpdb; //Update the questions when re-ordering if (!empty($_REQUEST['update_sequence'])) { $rows = explode(",", $_POST['row_ids']); for ($i = 0; $i < count($rows); $i++) { $wpdb->query("UPDATE " . EVENTS_QUESTION_TABLE . " SET sequence=" . $i . " WHERE id='" . $rows[$i] . "'"); } die; } // get counts $sql = "SELECT id FROM " . EVENTS_QUESTION_TABLE; $wpdb->get_results($sql); $total_questions = $wpdb->num_rows; if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { $sql .= " WHERE "; if (espresso_member_data('id') == 0 || espresso_member_data('id') == 1) { $sql .= " (wp_user = '******' OR wp_user = '******') "; } else { $sql .= " wp_user = '******'id') . "' "; } } $wpdb->get_results($sql); $total_self_questions = $wpdb->num_rows; ?> <div class="wrap"> <div id="icon-options-event" class="icon32"> </div> <h2><?php echo _e('Manage Questions', 'event_espresso'); ?> <?php if (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'edit_question' && $_REQUEST['action'] != 'new_question') { echo '<a href="admin.php?page=form_builder&action=new_question" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Question', 'event_espresso') . '</a>'; } ?> </h2> <div id="poststuff" class="metabox-holder has-right-sidebar"> <?php event_espresso_display_right_column(); ?> <div id="post-body"> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <div style="margin-bottom: 10px;"> <ul class="subsubsub" style="margin-bottom: 0;clear:both;"> <li><strong><?php _e('Questions', 'event_espresso'); ?> : </strong> </li> <li><a <?php echo !isset($_REQUEST['self']) && !isset($_REQUEST['all']) || isset($_REQUEST['self']) && $_REQUEST['self'] == 'true' ? ' class="current" ' : ''; ?> href="admin.php?page=form_builder&self=true"><?php _e('My Questions', 'event_espresso'); ?> <span class="count">(<?php echo $total_self_questions; ?> )</span> </a> | </li> <li><a <?php echo isset($_REQUEST['all']) && $_REQUEST['all'] == 'true' ? ' class="current" ' : ''; ?> href="admin.php?page=form_builder&all=true"><?php _e('All Questions', 'event_espresso'); ?> <span class="count">(<?php echo $total_questions; ?> )</span> </a></li> </ul> <div class="clear"></div> </div> <?php } ?> <div id="post-body-content"> <div class="meta-box-sortables ui-sortables"> <?php //Update the question if (isset($_REQUEST['edit_action']) && $_REQUEST['edit_action'] == 'update') { require_once "questions/update_question.php"; event_espresso_form_builder_update(); } //Figure out which view to display if (isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'insert': if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/form-builder/questions/insert_question.php')) { require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/form-builder/questions/insert_question.php'; event_espresso_form_builder_insert(); } else { require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/pricing_table.php'; } break; case 'new_question': if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/form-builder/questions/new_question.php')) { require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/form-builder/questions/new_question.php'; event_espresso_form_builder_new(); } else { require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/pricing_table.php'; } break; case 'edit_question': require_once "questions/edit_question.php"; event_espresso_form_builder_edit(); break; case 'delete_question': if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/form-builder/questions/delete_question.php')) { require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/form-builder/questions/delete_question.php'; event_espresso_form_builder_delete(); } else { ?> <div id="message" class="updated fade"> <p><strong> <?php _e('This function is not available in the free version of Event Espresso.', 'event_espresso'); ?> </strong></p> </div> <?php } break; } } ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table" class="widefat manage-questions"> <thead> <tr> <th class="manage-column" id="cb" scope="col" ><input type="checkbox"></th> <th class="manage-column column-title" id="values" scope="col" title="Click to Sort" style="width:25%;"> <?php _e('Question', 'event_espresso'); ?> </th> <th class="manage-column column-title" id="values" scope="col" title="Click to Sort" style="width:20%;"> <?php _e('Values', 'event_espresso'); ?> </th> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:10%;"> <?php _e('Creator', 'event_espresso'); ?> </th> <?php } ?> <th class="manage-column column-title" id="values" scope="col" title="Click to Sort" style="width:10%;"> <?php _e('Type', 'event_espresso'); ?> </th> <th class="manage-column column-title" id="values" scope="col" title="Click to Sort" style="width:10%;"> <?php _e('Required', 'event_espresso'); ?> </th> <th class="manage-column column-title" id="values" scope="col" title="Click to Sort" style="width:10%;"> <?php _e('Admin Only', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM " . EVENTS_QUESTION_TABLE; $sql .= " WHERE "; if (function_exists('espresso_member_data') && !isset($_REQUEST['all'])) { if (espresso_member_data('id') == 0 || espresso_member_data('id') == 1) { $sql .= " (wp_user = '******' OR wp_user = '******') "; } else { $sql .= " wp_user = '******'id') . "' "; } } else { $sql .= " (wp_user = '******' OR wp_user = '******') "; } $sql .= " ORDER BY sequence"; $questions = $wpdb->get_results($sql); if ($wpdb->num_rows > 0) { foreach ($questions as $question) { $question_id = $question->id; $question_name = stripslashes($question->question); $values = stripslashes($question->response); $question_type = stripslashes($question->question_type); $required = stripslashes($question->required); $system_name = $question->system_name; $sequence = $question->sequence; $admin_only = $question->admin_only; $wp_user = $question->wp_user == 0 ? 1 : $question->wp_user; ?> <tr style="cursor: move" id="<?php echo $question_id; ?> "> <td class="checkboxcol"><input name="row_id" type="hidden" value="<?php echo $question_id; ?> " /> <?php if ($system_name == '') { ?> <input style="margin:7px 0 22px 8px; vertical-align:top;" name="checkbox[<?php echo $question_id; ?> ]" type="checkbox" title="Delete <?php echo $question_name; ?> "> <?php } else { ?> <span><?php echo '<img style="margin:7px 0 22px 8px; vertical-align:top;" src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/icons/lock.png" alt="System Questions" title="System Questions" />'; ?> </span> <?php } ?> </td> <td class="post-title page-title column-title"><strong><a href="admin.php?page=form_builder&action=edit_question&question_id=<?php echo $question_id; ?> "><?php echo $question_name; ?> </a></strong> <div class="row-actions"> <span class="edit"><a href="admin.php?page=form_builder&action=edit_question&question_id=<?php echo $question_id; ?> "><?php _e('Edit', 'event_espresso'); ?> </a> | </span> <?php if ($system_name == '') { ?> <span class="delete"><a onclick="return confirmDelete();" class="submitdelete" href="admin.php?page=form_builder&action=delete_question&question_id=<?php echo $question_id; ?> "><?php _e('Delete', 'event_espresso'); ?> </a></span><?php } ?> </div> </td> <td class="author column-author"><?php echo $values; ?> </td> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <td><?php echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') : espresso_user_meta($wp_user, 'display_name'); ?> </td> <?php } ?> <td class="author column-author"><?php echo $question_type; ?> </td> <td class="author column-author"><?php echo $required; ?> </td> <td class="author column-author"><?php echo $admin_only; ?> </td> </tr> <?php } } ?> </tbody> </table> <div> <p><input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong> <?php _e('Check All', 'event_espresso'); ?> </strong> <input type="hidden" name="action" value="delete_question" /> <input name="delete_question" type="submit" class="button-secondary" id="delete_question" value="<?php _e('Delete Question', 'event_espresso'); ?> " style="margin-left:10px 0 0 10px;" onclick="return confirmDelete();"> <a style="margin-left:5px"class="button-primary" href="admin.php?page=form_builder&action=new_question"><?php _e('Add New Question', 'event_espresso'); ?> </a> <a style="margin-left:5px"class="button-primary" href="admin.php?page=form_groups"><?php _e('Question Groups', 'event_espresso'); ?> </a> <a style="color:#FFF; text-decoration:none; margin-left:5px"class="button-primary thickbox" href="#TB_inline?height=400&width=500&inlineId=question_info">Help</a> </p> </div> </form> </div> </div> </div> </div> </div> <div id="question_info" class="pop-help" style="display:none"> <div class="TB-ee-frame"> <h2><?php _e('Manage Questions Overview', 'event_espresso'); ?> </h2> <p><?php _e('The <code>Questions</code> page shows your list of available questions to add to your registration forms for events', 'event_espresso'); ?> <p><?php _e('Use the add new question button at the top of the page to create a new question to add to the list ', 'event_espresso'); ?> <a href="admin.php?page=form_builder&action=new_question"><?php _e('Add New Question', 'event_espresso'); ?> </a></p> <p><?php _e('Once you have a built a list of questions you may further organize your questions into <code>Groups.</code> These', 'event_espresso'); ?> <a href="admin.php?page=form_groups"><?php _e('Question Groups ', 'event_espresso'); ?> </a><?php _e('allow you to easily and conveniently add a group to a registration that will have a pre populated set of questions, this is especially handy when creating many registration forms, saving time, by being able to re-use specific groups of questions repetedly.', 'event_espresso'); ?> </p> </div> </div> <script type="text/javascript"> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ { "bSortable": true }, null, null, null, null, <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : ''; ?> null ] } ); var startPosition; var endPosition; $("#table tbody").sortable({ cursor: "move", start:function(event, ui){ startPosition = ui.item.prevAll().length + 1; }, update: function(event, ui) { endPosition = ui.item.prevAll().length + 1; //alert('Start Position: ' + startPosition + ' End Position: ' + endPosition); var row_ids=""; $('#table tbody input[name="row_id"]').each(function(i){ row_ids= row_ids + ',' + $(this).val(); }); $.post(EEGlobals.ajaxurl, { action: "update_sequence", row_ids: row_ids, update_sequence: "true"} ); } }); postboxes.add_postbox_toggles('form_builder'); } ); // Remove li parent for input 'values' from page if 'text' box or 'textarea' are selected var selectValue = jQuery('select#question_type option:selected').val(); //alert(selectValue + ' - this is initial value'); // hide values field on initial page view if(selectValue == 'TEXT' || selectValue == 'TEXTAREA' || selectValue == 'DATE'){ jQuery('#add-question-values').hide(); // we don't want the values field trying to validate if not displayed, remove its name jQuery('#add-question-values td input').attr("name","notrequired") } jQuery('select#question_type').bind('change', function() { var selectValue = jQuery('select#question_type option:selected').val(); if (selectValue == 'TEXT' || selectValue == 'TEXTAREA' || selectValue == 'DATE') { jQuery('#add-question-values').fadeOut('slow'); // we don't want the values field trying to validate if not displayed, remove its name jQuery('#add-question-values td input').attr("name","notrequired") //alert(selectValue); } else{ //alert(selectValue); jQuery('#add-question-values').fadeIn('slow'); // add the correct name value back in so we can run validation check. jQuery('#add-question-values td input').attr("name","values"); } }); // Add new question or question group form validation jQuery(function(){ jQuery('#new-question-form').validate({ rules: { question: "required", values: "required" }, messages: { question: "Please add a title for your question", values: "Please add a list of values for your question" } }); }); </script> <?php }
function espresso_export_stuff() { //Export data to Excel file if (isset($_REQUEST['export'])) { switch ($_REQUEST['export']) { case "report": global $wpdb; $event_id = $_REQUEST['event_id']; $today = date("Y-m-d-Hi", time()); $sql_x = "SELECT id, event_name, event_desc, event_identifier, question_groups, event_meta FROM " . EVENTS_DETAIL_TABLE; $sql_x .= $_REQUEST['all_events'] == "true" ? '' : " WHERE id = '" . $event_id . "' "; //echo $sql_x; $results = $wpdb->get_row($sql_x, ARRAY_N); list($event_id, $event_name, $event_description, $event_identifier, $question_groups, $event_meta) = $results; $basic_header = array(__('Group', 'event_espresso'), __('Reg ID', 'event_espresso'), __('Last Name', 'event_espresso'), __('First Name', 'event_espresso'), __('Email', 'event_espresso'), __('Address', 'event_espresso'), __('Address 2', 'event_espresso'), __('City', 'event_espresso'), __('State', 'event_espresso'), __('Zip', 'event_espresso'), __('Phone', 'event_espresso'), __('Payment Method', 'event_espresso'), __('Reg Date', 'event_espresso'), __('Pay Status', 'event_espresso'), __('Type of Payment', 'event_espresso'), __('Transaction ID', 'event_espresso'), __('Payment', 'event_espresso'), __('Coupon Code', 'event_espresso'), __('# Attendees', 'event_espresso'), __('Date Paid', 'event_espresso'), __('Event Name', 'event_espresso'), __('Price Option', 'event_espresso'), __('Event Date', 'event_espresso'), __('Event Time', 'event_espresso'), __('Website Check-in', 'event_espresso'), __('Tickets Scanned', 'event_espresso')); $question_groups = unserialize($question_groups); $event_meta = unserialize($event_meta); if (isset($event_meta['add_attendee_question_groups'])) { $add_attendee_question_groups = $event_meta['add_attendee_question_groups']; if (!empty($add_attendee_question_groups)) { $question_groups = array_unique(array_merge((array) $question_groups, (array) $add_attendee_question_groups)); } } switch ($_REQUEST['action']) { case "event": espresso_event_export($event_name); break; case "payment": $question_list = array(); //will be used to associate questions with correct answers $question_filter = array(); //will be used to keep track of newly added and deleted questions if (count($question_groups) > 0) { $questions_in = ''; $question_sequence = array(); /*foreach ($question_groups as $g_id) { $questions_in .= $g_id . ','; }*/ $questions_in = implode(",", $question_groups); /*$questions_in = substr($questions_in,0,-1);*/ $group_name = ''; $counter = 0; $quest_sql = "SELECT q.id, q.question FROM " . EVENTS_QUESTION_TABLE . " q "; $quest_sql .= " JOIN " . EVENTS_QST_GROUP_REL_TABLE . " qgr on q.id = qgr.question_id "; $quest_sql .= " JOIN " . EVENTS_QST_GROUP_TABLE . " qg on qg.id = qgr.group_id "; $quest_sql .= " WHERE qgr.group_id in ( " . $questions_in . ") "; if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $quest_sql .= " AND qg.wp_user = '******'id') . "' "; } //Fix from Jesse in the forums (http://eventespresso.com/forums/2010/10/form-questions-appearing-in-wrong-columns-in-excel-export/) //$quest_sql .= " AND q.system_name is null ORDER BY qg.id, q.id ASC "; $quest_sql .= " AND q.system_name is null ORDER BY q.sequence, q.id ASC "; $questions = $wpdb->get_results($quest_sql); $num_rows = $wpdb->num_rows; if ($num_rows > 0) { foreach ($questions as $question) { $question_list[$question->id] = $question->question; $question_filter[$question->id] = $question->id; array_push($basic_header, escape_csv_val($question->question, $_REQUEST['type'])); //array_push($question_sequence, $question->sequence); } } } if (count($question_filter) > 0) { $question_filter = implode(",", $question_filter); } //$participants = $wpdb->get_results("SELECT * FROM ".EVENTS_ATTENDEE_TABLE." WHERE event_id = '$event_id'"); //$participants = $wpdb->get_results("SELECT ed.event_name, ed.start_date, a.id, a.lname, a.fname, a.email, a.address, a.city, a.state, a.zip, a.phone, a.payment, a.date, a.payment_status, a.txn_type, a.txn_id, a.amount_pd, a.quantity, a.coupon_code, a.payment_date, a.event_time, a.price_option FROM " . EVENTS_ATTENDEE_TABLE . " a JOIN " . EVENTS_DETAIL_TABLE . " ed ON ed.id=a.event_id WHERE ed.id = '" . $event_id . "'"); $sql = "("; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') { $group = get_user_meta(espresso_member_data('id'), "espresso_group", true); $group = unserialize($group); $group = implode(",", $group); $sql .= "SELECT ed.event_name, ed.start_date, a.id, a.registration_id, a.lname, a.fname, a.email, a.address, a.address2, a.city"; $sql .= ", a.state, a.zip, a.phone, a.payment, a.date, a.payment_status, a.txn_type, a.txn_id"; $sql .= ", a.amount_pd, a.quantity, a.coupon_code, a.checked_in, a.checked_in_quantity"; $sql .= ", a.payment_date, a.event_time, a.price_option"; $sql .= " FROM " . EVENTS_ATTENDEE_TABLE . " a "; $sql .= " JOIN " . EVENTS_DETAIL_TABLE . " ed ON ed.id=a.event_id "; if ($group != '') { $sql .= " JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = ed.id "; $sql .= " JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = r.venue_id "; } $sql .= $_REQUEST['all_events'] == "true" ? '' : " WHERE ed.id = '" . $event_id . "' "; $sql .= $group != '' ? " AND l.locale_id IN (" . $group . ") " : ''; $sql .= ") UNION ("; } $sql .= "SELECT ed.event_name, ed.start_date, a.id, a.registration_id, a.lname, a.fname, a.email, a.address, a.address2, a.city"; $sql .= ", a.state, a.zip, a.phone, a.payment, a.date, a.payment_status, a.txn_type, a.txn_id"; $sql .= ", a.amount_pd, a.quantity, a.coupon_code, a.checked_in, a.checked_in_quantity"; $sql .= ", a.payment_date, a.event_time, a.price_option"; $sql .= " FROM " . EVENTS_ATTENDEE_TABLE . " a "; $sql .= " JOIN " . EVENTS_DETAIL_TABLE . " ed ON ed.id=a.event_id "; $sql .= $_REQUEST['all_events'] == "true" ? '' : " WHERE ed.id = '" . $event_id . "' "; if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql .= " AND ed.wp_user = '******'id') . "' "; } $sql .= ") ORDER BY id "; $participants = $wpdb->get_results($sql); $filename = $_REQUEST['all_events'] == "true" ? __('all-events', 'event_espresso') : sanitize_title_with_dashes($event_name); $filename = $filename . "-" . $today; switch ($_REQUEST['type']) { case "csv": $st = ""; $et = ","; $s = $et . $st; header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=" . $filename . ".csv"); //header("Content-Disposition: attachment; filename='" .$filename .".csv'"); header("Pragma: no-cache"); header("Expires: 0"); //echo header echo implode($s, $basic_header) . "\r\n"; break; default: $st = ""; $et = "\t"; $s = $et . $st; header("Content-Disposition: attachment; filename=" . $filename . ".xls"); //header("Content-Disposition: attachment; filename='" .$filename .".xls'"); header("Content-Type: application/vnd.ms-excel"); header("Pragma: no-cache"); header("Expires: 0"); //echo header echo implode($s, $basic_header) . $et . "\r\n"; break; } //echo data if ($participants) { $temp_reg_id = ''; //will temporarily hold the registration id for checking with the next row $attendees_group = ''; //will hold the names of the group members $group_counter = 1; $amount_pd = 0; foreach ($participants as $participant) { if ($temp_reg_id == '') { $temp_reg_id = $participant->registration_id; $amount_pd = $participant->amount_pd; } if ($temp_reg_id == $participant->registration_id) { } else { $group_counter++; $temp_reg_id = $participant->registration_id; } $attendees_group = "Group {$group_counter}"; echo $attendees_group . $s . $participant->id . $s . escape_csv_val(stripslashes($participant->lname)) . $s . escape_csv_val(stripslashes($participant->fname)) . $s . stripslashes($participant->email) . $s . escape_csv_val(stripslashes($participant->address)) . $s . escape_csv_val(stripslashes($participant->address2)) . $s . escape_csv_val(stripslashes($participant->city)) . $s . escape_csv_val(stripslashes($participant->state)) . $s . escape_csv_val(stripslashes($participant->zip)) . $s . escape_csv_val(stripslashes($participant->phone)) . $s . escape_csv_val(stripslashes($participant->payment)) . $s . event_date_display($participant->date, 'Y-m-d') . $s . stripslashes($participant->payment_status) . $s . stripslashes($participant->txn_type) . $s . stripslashes($participant->txn_id) . $s . $participant->amount_pd . $s . escape_csv_val($participant->coupon_code) . $s . $participant->quantity . $s . event_date_display($participant->payment_date, 'Y-m-d') . $s . escape_csv_val($participant->event_name) . $s . $participant->price_option . $s . event_date_display($participant->start_date, 'Y-m-d') . $s . event_date_display($participant->event_time, get_option('time_format')) . $s . $participant->checked_in . $s . $participant->checked_in_quantity; $answers = $wpdb->get_results("SELECT a.question_id, a.answer FROM " . EVENTS_ANSWER_TABLE . " a WHERE question_id IN ({$question_filter}) AND attendee_id = '" . $participant->id . "'", OBJECT_K); foreach ($question_list as $k => $v) { /* * in case the event organizer removes a question from a question group, * the orphaned answers will remian in the answers table. This check will make sure they don't get exported. */ /*if (array_key_exists($k, $answers)) {*/ $search = array("\r", "\n", "\t"); $clean_answer = str_replace($search, " ", $answers[$k]->answer); $clean_answer = escape_csv_val($clean_answer); echo $s . $clean_answer; /*} else { echo $s; }*/ } switch ($_REQUEST['type']) { case "csv": echo "\r\n"; break; default: echo $et . "\r\n"; break; } } } else { echo __('No participant data has been collected.', 'event_espresso'); } exit; break; default: echo '<p>' . __('This Is Not A Valid Selection!', 'event_espresso') . '</p>'; break; } default: break; } } }
function espresso_ticket_config_mnu() { global $wpdb, $current_user, $espresso_premium; ?> <div class="wrap"> <div id="icon-options-event" class="icon32"> </div> <h2><?php echo _e('Manage Ticket Templates', 'event_espresso'); if (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'edit' && $_REQUEST['action'] != 'add_new_ticket') { echo '<a href="admin.php?page=event_tickets&action=add_new_ticket" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New', 'event_espresso') . '</a>'; } ?> </h2> <?php ob_start(); if (!empty($_POST['delete_ticket'])) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; //Delete ticket data $sql = "DELETE FROM " . EVENTS_TICKET_TEMPLATES . " WHERE id='{$del_id}'"; $wpdb->query($sql); } } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Ticket Templates have been successfully deleted.', 'event_espresso'); ?> </strong></p> </div> <?php } if (isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'update_ticket': require_once "update_ticket.php"; update_event_ticket(); break; case 'add': require_once "add_to_db.php"; add_ticket_to_db(); break; case 'add_new_ticket': require_once "add_new.php"; add_new_event_ticket(); break; case 'edit_ticket': require_once "edit_ticket.php"; edit_event_ticket(); break; } } do_action('action_hook_espresso_admin_notices'); //This line keeps the notices from displaying twice if (did_action('action_hook_espresso_admin_notices') == false) { do_action('action_hook_espresso_admin_notices'); } ?> <p> <?php _e('Create customized ticket template for use in multiple events. ', 'event_espresso'); echo apply_filters('filter_hook_espresso_help', 'customized_ticket_info'); ?> </p> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table" class="widefat manage-tickets"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:3.5%;"><input type="checkbox"></th> <th class="manage-column column-comments num" id="id" style="padding-top:7px; width:3.5%;" scope="col" title="Click to Sort"><?php _e('ID', 'event_espresso'); ?> </th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:60%;"><?php _e('Name', 'event_espresso'); ?> </th> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:10%;"><?php _e('Creator', 'event_espresso'); ?> </th> <?php } ?> <th class="manage-column column-title" id="action" scope="col" title="Click to Sort" style="width:30%;"><?php _e('Action', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM " . EVENTS_TICKET_TEMPLATES . " e"; if (function_exists('espresso_manager_pro_version') && !empty($_SESSION['espresso_use_selected_manager'])) { $sql .= " JOIN {$wpdb->users} u on u.ID = e.wp_user WHERE e.wp_user = "******" JOIN {$wpdb->users} u on u.ID = e.wp_user WHERE e.wp_user = "******" ORDER BY e.id ASC"); foreach ($results as $result) { $ticket_id = $result->id; $ticket_name = stripslashes($result->ticket_name); $ticket_content = stripslashes($result->ticket_content); $wp_user = $result->wp_user; ?> <tr> <td><input name="checkbox[<?php echo $ticket_id; ?> ]" type="checkbox" title="Delete <?php echo stripslashes($ticket_name); ?> "></td> <td><?php echo $ticket_id; ?> </td> <td class="post-title page-title column-title"><strong><a href="admin.php?page=event_tickets&action=edit_ticket&id=<?php echo $ticket_id; ?> "><?php echo $ticket_name; ?> </a></strong> <div class="row-actions"><span class="edit"><a href="admin.php?page=event_tickets&action=edit_ticket&id=<?php echo $ticket_id; ?> "><?php _e('Edit', 'event_espresso'); ?> </a> | </span><span class="delete"><a onclick="return confirmDelete();" class="delete submitdelete" href="admin.php?page=event_tickets&action=delete_ticket&id=<?php echo $ticket_id; ?> "><?php _e('Delete', 'event_espresso'); ?> </a></span></div> </td> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) { $user_company = espresso_user_meta($wp_user, 'company') != '' ? espresso_user_meta($wp_user, 'company') : ''; $user_organization = espresso_user_meta($wp_user, 'organization') != '' ? espresso_user_meta($wp_user, 'organization') : ''; $user_co_org = $user_company != '' ? $user_company : $user_organization; ?> <td class="date"><?php echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)' : espresso_user_meta($wp_user, 'display_name') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)'; echo $user_co_org != '' ? '<br />[' . espresso_user_meta($wp_user, 'company') . ']' : ''; ?> </td> <?php } ?> <td><a href="admin.php?page=event_tickets&action=edit_ticket&id=<?php echo $ticket_id; ?> "> <?php _e('Edit Ticket Template', 'event_espresso'); ?> </a></td> </tr> <?php } } ?> </tbody> </table> <p> <input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong> <?php _e('Check All', 'event_espresso'); ?> </strong> <input name="delete_ticket" type="submit" class="button-secondary" id="delete_ticket" value="<?php _e('Delete Selected', 'event_espresso'); ?> " style="margin-left:100px;" onclick="return confirmDelete();"> <?php echo '<a href="admin.php?page=event_tickets&action=add_new_ticket" style="margin-left:5px"class="button-primary">' . __('Add New', 'event_espresso') . '</a>'; ?> </p> </form> <?php $main_post_content = ob_get_clean(); if (function_exists('espresso_version') && espresso_version() >= '3.2') { ob_start(); do_meta_boxes('event-espresso_page_event_tickets', 'side', null); $sidebar_content = ob_get_clean(); espresso_choose_layout($main_post_content, $sidebar_content); } else { espresso_choose_layout($main_post_content, event_espresso_display_right_column()); } ?> </div> <?php include_once 'tickets_help.php'; ?> <script> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ { "bSortable": false }, null, null, <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : ''; ?> null ] } ); } ); </script> <?php //echo event_espresso_custom_ticket_info(); }
function event_espresso_email_config_mnu() { global $wpdb, $current_user, $espresso_premium; ?> <div class="wrap"> <div id="icon-options-event" class="icon32"> </div> <h2><?php echo _e('Manage Event Emails', 'event_espresso'); ?> <?php if (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'edit' && $_REQUEST['action'] != 'add_new_email') { echo '<a href="admin.php?page=event_emails&action=add_new_email" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Email', 'event_espresso') . '</a>'; } ?> </h2> <div id="poststuff" class="metabox-holder has-right-sidebar"> <?php event_espresso_display_right_column(); ?> <div id="post-body"> <div id="post-body-content"> <?php if (!empty($_POST['delete_email'])) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; //Delete email data $sql = "DELETE FROM " . EVENTS_EMAIL_TABLE . " WHERE id='{$del_id}'"; $wpdb->query($sql); } } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Emails have been successfully deleted.', 'event_espresso'); ?> </strong></p> </div> <?php } ?> <?php if (isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'update': update_event_email(); break; case 'add': add_email_to_db(); break; case 'add_new_email': add_new_event_email(); break; case 'edit': edit_event_email(); break; } } ?> <p><?php _e('Create customized emails for use in multiple events.', 'event_espresso'); ?> </p> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table1" class="widefat manage-emails"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:3.5%;"><input type="checkbox"></th> <th class="manage-column column-comments num" id="id" style="padding-top:7px; width:3.5%;" scope="col" title="Click to Sort"><?php _e('ID', 'event_espresso'); ?> </th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:60%;"><?php _e('Name', 'event_espresso'); ?> </th> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true) { ?> <th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:10%;"><?php _e('Creator', 'event_espresso'); ?> </th> <?php } ?> <th class="manage-column column-title" id="action" scope="col" title="Click to Sort" style="width:30%;"><?php _e('Action', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM " . EVENTS_EMAIL_TABLE . " e"; if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql .= " JOIN {$wpdb->users} u on u.ID = e.wp_user WHERE e.wp_user = "******" ORDER BY e.id ASC"); foreach ($results as $result) { $email_id = $result->id; $email_name = stripslashes($result->email_name); $email_text = stripslashes($result->email_text); $wp_user = $result->wp_user; ?> <tr> <td><input name="checkbox[<?php echo $email_id; ?> ]" type="checkbox" title="Delete <?php echo stripslashes($email_name); ?> "></td> <td><?php echo $email_id; ?> </td> <td class="post-title page-title column-title"><strong><a href="admin.php?page=event_emails&action=edit&id=<?php echo $email_id; ?> "><?php echo $email_name; ?> </a></strong> <div class="row-actions"><span class="edit"><a href="admin.php?page=event_emails&action=edit&id=<?php echo $email_id; ?> "><?php _e('Edit', 'event_espresso'); ?> </a> | </span><span class="delete"><a onclick="return confirmDelete();" class="delete submitdelete" href="admin.php?page=event_emails&action=delete_email&id=<?php echo $email_id; ?> "><?php _e('Delete', 'event_espresso'); ?> </a></span></div> </td> <?php if (function_exists('espresso_user_meta') && espresso_is_admin() == true) { ?> <td><?php echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') : espresso_user_meta($wp_user, 'display_name'); ?> </td> <?php } ?> <td><a href="admin.php?page=event_emails&action=edit&id=<?php echo $email_id; ?> "> <?php _e('Edit Email', 'event_espresso'); ?> </a></td> </tr> <?php } } ?> </tbody> </table> <p> <input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong> <?php _e('Check All', 'event_espresso'); ?> </strong> <input name="delete_email" type="submit" class="button-secondary" id="delete_email" value="<?php _e('Delete Email', 'event_espresso'); ?> " style="margin-left:100px;" onclick="return confirmDelete();"> <?php echo '<a href="admin.php?page=event_emails&action=add_new_email" style="margin-left:5px"class="button-primary">' . __('Add New Email', 'event_espresso') . '</a>'; ?> </p> </form> </div> </div> </div> </div> <script> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table1').dataTable( { "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ { "bSortable": false }, null, null, <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : ''; ?> null, ] } ); } ); </script> <?php echo event_espresso_custom_email_info(); }
function espresso_personnel_cb($event_id = 0) { global $espresso_premium; if ($espresso_premium != true) { return; } global $wpdb; $sql = "SELECT id, name, role, meta FROM " . EVENTS_PERSONNEL_TABLE; if (function_exists('espresso_member_data')) { $wpdb->get_results("SELECT wp_user FROM " . EVENTS_DETAIL_TABLE . " WHERE id = '" . $event_id . "'"); $wp_user = $wpdb->last_result[0]->wp_user != '' ? $wpdb->last_result[0]->wp_user : espresso_member_data('id'); $sql .= " WHERE "; if ($wp_user == 0 || $wp_user == 1) { $sql .= " (wp_user = '******' OR wp_user = '******') "; } else { $sql .= " wp_user = '******' "; } } $event_personnel = $wpdb->get_results($sql); $num_rows = $wpdb->num_rows; if ($num_rows > 0) { $html = ''; foreach ($event_personnel as $person) { $person_id = $person->id; $person_name = $person->name; $person_role = $person->role; $meta = unserialize($person->meta); $person_organization = isset($meta['organization']) && $meta['organization'] != '' ? $meta['organization'] : ''; //$person_title = $meta['title']!=''? $meta['title']:''; $person_info = isset($person_role) && $person_role != '' ? ' [' . $person_role . ']' : ''; $in_event_personnel = $wpdb->get_results("SELECT * FROM " . EVENTS_PERSONNEL_REL_TABLE . " WHERE event_id='" . $event_id . "' AND person_id='" . $person_id . "'"); $in_event_person = ''; foreach ($in_event_personnel as $in_person) { $in_event_person = $in_person->person_id; } $html .= '<p id="event-person-' . $person_id . '" class="event-staff-list"><label for="in-event-person-' . $person_id . '" class="selectit"><input value="' . $person_id . '" type="checkbox" name="event_person[]" id="in-event-person-' . $person_id . '"' . ($in_event_person == $person_id ? ' checked="checked"' : "") . '/> <a href="admin.php?page=event_staff&action=edit&id=' . $person_id . '" target="_blank" title="' . $person_organization . '">' . $person_name . '</a> ' . $person_info . '</label></p>'; } $top_div = ''; $bottom_div = ''; if ($num_rows > 10) { $top_div = '<div style="height:250px;overflow:auto;">'; $bottom_div = '</div>'; } $manage = '<p><a href="admin.php?page=event_staff" target="_blank">' . __('Manage Staff Members', 'event_espresso') . '</a> | <a class="thickbox link" href="#TB_inline?height=300&width=400&inlineId=staff_info">Shortcode</a> </p>'; echo '<div id="staff_info" style="display:none">'; echo '<h2>' . __('Staff Shortcode', 'event_espresso') . '</h2>'; echo '<p>' . __('Add the following shortcode into the description to show the staff for this event.', 'event_espresso') . '</p>'; echo '<p>[ESPRESSO_STAFF]</p>'; echo '<p>Example with Optional Parameters:<br /> [ESPRESSO_STAFF outside_wrapper="div" outside_wrapper_class="event_staff" inside_wrapper="p" inside_wrapper_class="event_person"]</p>'; echo '<p><strong><a href="http://eventespresso.com/forums/2010/10/post-type-variables-and-shortcodes/#staff_shortcode" target="_blank">More Examples</a></strong></p>'; echo '</div>'; $html = $top_div . $html . $bottom_div . $manage; return $html; } else { return '<a href="admin.php?page=event_staff&action=add_new_person">' . __('Please add at least one person.', 'event_espresso') . '</a>'; } }
function event_espresso_form_builder_edit() { global $wpdb; $question_id = $_REQUEST['question_id']; $questions = espresso_get_user_questions(null, $question_id); if (count($questions) > 0) { foreach ($questions as $question) { $question_id = $question->id; $question_name = stripslashes($question->question); $question_values = stripslashes($question->response); $question_type = stripslashes($question->question_type); $required = stripslashes($question->required); $sequence = $question->sequence; $required_text = $question->required_text; $admin_only = $question->admin_only; $system_name = $question->system_name; if ($question->system_name != '') { $system_question = true; } else { $system_question = false; } $wp_user = $question->wp_user; if (function_exists('espresso_member_data')) { if (function_exists('espresso_is_admin')) { // If the user doesn't have admin access get only user's own question groups if (!espresso_is_admin()) { if (espresso_member_data('id') != $wp_user) { echo '<h2>' . __('Sorry, you do not have permission to edit this question.', 'event_espresso') . '</h2>'; return; } } } } ?> <div class="metabox-holder"> <div class="postbox"> <div class="handlediv" title="Click to toggle"><br> </div> <h3 class="hndle"> <?php _e('Edit Question', 'event_espresso'); ?> </h3> <div class="inside"> <form id="edit-new-question-form" name="newquestion" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <p class="intro"> <?php _e('Edit the question using the form below. By default all participants will be asked for their first name, last name, and email address.', 'event_espresso'); ?> </p> <?php if ($system_question == true) { echo '<p class="inform">' . __('Attention: This is a "System Question", some settings may be disabled.', 'event_espresso') . '</p>'; } ?> <table class="form-table"> <tbody> <tr> <th> <label for="question"><?php _e('Question', 'event_espresso'); ?> </label> </th> <td> <input name="question" id="question" size="50" value="<?php echo htmlspecialchars($question_name, ENT_QUOTES, 'UTF-8'); ?> " type="text"> </td> </tr> <tr> <th id="question-type-select"> <label for="question_type"><?php _e('Type', 'event_espresso'); ?> </label> </th> <td> <?php $q_values = array(array('id' => 'TEXT', 'text' => __('Text', 'event_espresso')), array('id' => 'TEXTAREA', 'text' => __('Text Area', 'event_espresso')), array('id' => 'SINGLE', 'text' => __('Radio Button', 'event_espresso')), array('id' => 'DROPDOWN', 'text' => __('Drop Down', 'event_espresso')), array('id' => 'MULTIPLE', 'text' => __('Checkbox', 'event_espresso'))); if ($system_question == true) { $q_values = array(array('id' => 'TEXT', 'text' => __('Text', 'event_espresso'))); } echo select_input('question_type', $q_values, $question_type, 'id="question_type"'); ?> </td> </tr> <tr id="add-question-values"> <th> <label for="values"><?php _e('Values', 'event_espresso'); ?> </label> </th> <td> <input name="values" id="values" size="50" value="<?php echo htmlspecialchars($question_values, ENT_QUOTES, 'UTF-8'); ?> " type="text" /> <br /> <span class="description"><?php _e('A comma seperated list of values. Eg. black, blue, red', 'event_espresso'); ?> </span> </td> </tr> <tr> <th> <label for="required"><?php _e('Required', 'event_espresso'); ?> </label> </th> <td> <?php $values = array(array('id' => 'Y', 'text' => __('Yes', 'event_espresso')), array('id' => 'N', 'text' => __('No', 'event_espresso'))); if ($system_question == true && ($system_name == 'fname' || $system_name == 'lname' || $system_name == 'email')) { $values = array(array('id' => 'Y', 'text' => __('Yes', 'event_espresso'))); } echo select_input('required', $values, $required); ?> <br /> <span class="description"><?php _e('Mark this question as required.', 'event_espresso'); ?> </span> </td> </tr> <tr> <th> <label for="admin_only"> <?php _e('Admin View Only', 'event_espresso'); ?> </label> </th> <td> <?php $values = array(array('id' => 'Y', 'text' => __('Yes', 'event_espresso')), array('id' => 'N', 'text' => __('No', 'event_espresso'))); if ($system_question == true && ($system_name == 'fname' || $system_name == 'lname' || $system_name == 'email')) { $values = array(array('id' => 'N', 'text' => __('No', 'event_espresso'))); } echo select_input('admin_only', $values, $admin_only); ?> <br /> <span class="description"><?php _e('Only the administrator can see this field.', 'event_espresso'); ?> </span> </td> </tr> <tr> <th> <label for="required_text"> <?php _e('Required Text', 'event_espresso'); ?> </label> </th> <td> <input name="required_text" id="required_text" size="50" value="<?php echo htmlspecialchars($required_text, ENT_QUOTES, 'UTF-8'); ?> " type="text" /><br /> <span class="description"><?php _e('Text displayed if not completed.', 'event_espresso'); ?> </span> </td> </tr> <tr> <th> <label for="sequence"> <?php _e('Order/Sequence', 'event_espresso'); ?> </label> </th> <td> <input name="sequence" id="sequence" size="50" value="<?php echo $sequence; ?> " type="text" /> </td> </tr> </tbody> </table> <p class="submit-footer"> <input name="edit_action" value="update" type="hidden"> <input type="hidden" name="action" value="edit_question"> <input name="question_id" value="<?php echo $question_id; ?> " type="hidden"> <input class="button-primary" name="Submit" value="Update Question" type="submit"> <?php wp_nonce_field('espresso_form_check', 'edit_question'); ?> </p> </form> </div> </div> </div> <?php } } else { _e('Nothing found!', 'event_espresso'); } }
_e('Allow discount codes?', 'event_espresso'); ?> </label> <?php echo select_input('use_coupon_code', $values, !isset($use_coupon_code) || $use_coupon_code == '' ? 'N' : $use_coupon_code); ?> <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=coupon_code_info"><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> /images/question-frame.png" width="16" height="16" /></a></p> <?php $sql = "SELECT * FROM " . EVENTS_DISCOUNT_CODES_TABLE; if (function_exists('espresso_member_data')) { $wpdb->get_results("SELECT wp_user FROM " . EVENTS_DETAIL_TABLE . " WHERE id = '" . $event_id . "'"); $wp_user = $wpdb->last_result[0]->wp_user != '' ? $wpdb->last_result[0]->wp_user : espresso_member_data('id'); $sql .= " WHERE "; if ($wp_user == 0 || $wp_user == 1) { $sql .= " (wp_user = '******' OR wp_user = '******') "; } else { $sql .= " wp_user = '******' "; } } $event_discounts = $wpdb->get_results($sql); foreach ($event_discounts as $event_discount) { $discount_id = $event_discount->id; $coupon_code = $event_discount->coupon_code; $discount_type_price = $event_discount->use_percentage == 'Y' ? $event_discount->coupon_code_price . '%' : $org_options['currency_symbol'] . $event_discount->coupon_code_price; $in_event_discounts = $wpdb->get_results("SELECT * FROM " . EVENTS_DISCOUNT_REL_TABLE . " WHERE event_id='" . $event_id . "' AND discount_id='" . $discount_id . "'"); $in_event_discount = ''; foreach ($in_event_discounts as $in_discount) {
<?php if (function_exists('espresso_member_data')) { global $espresso_manager; $is_admin = espresso_member_data('role') == "administrator" || espresso_member_data('role') == 'espresso_event_admin' ? true : false; if ($espresso_manager['event_manager_create_post'] == 'N' && $is_admin == false) { return; } } ?> <div style="display: block;" id="event-post" class="postbox"> <div class="handlediv" title="Click to toggle"><br> </div> <h3 class="hndle"><span> <?php _e('Create a Post', 'event_espresso'); ?> </span></h3> <div class="inside"> <?php if (strlen($post_id) > 1) { $create_post = 'Y'; //If a post was created previously, default to yes on the update post. } else { $create_post = 'N'; //If a post was NOT created previously, default to no so we do not create a post on accident. } $create_post = apply_filters('filter_hook_espresso_defalt_update_post_option', $create_post); global $current_user; get_currentuserinfo();
function espresso_export_stuff() { $today = date("Y-m-d-Hi", time()); $export_all_events = isset($_REQUEST['all_events']) && $_REQUEST['all_events'] == "true" ? TRUE : FALSE; //Export data to Excel file if (isset($_REQUEST['export'])) { switch ($_REQUEST['export']) { case "report": global $wpdb; $event_id = isset($_REQUEST['event_id']) ? $_REQUEST['event_id'] : FALSE; // export for one event only ? if ($event_id) { $SQL = "SELECT event_name, event_desc, event_identifier, question_groups, event_meta FROM " . EVENTS_DETAIL_TABLE; $SQL .= " WHERE id = %d"; if ($results = $wpdb->get_row($wpdb->prepare($SQL, $event_id), ARRAY_N)) { list($event_name, $event_description, $event_identifier, $question_groups, $event_meta) = $results; $question_groups = maybe_unserialize($question_groups); $event_meta = maybe_unserialize($event_meta); if (!empty($event_meta['add_attendee_question_groups'])) { $question_groups = array_unique(array_merge((array) $question_groups, (array) $event_meta['add_attendee_question_groups'])); } } } else { // export for ALL EVENTS $question_groups = array(); $event_meta = array(); $SQL = "SELECT event_name, event_desc, event_identifier, question_groups, event_meta FROM " . EVENTS_DETAIL_TABLE; if ($results = $wpdb->get_results($SQL, ARRAY_N)) { foreach ($results as $result) { list($event_name, $event_description, $event_identifier, $q_groups, $e_meta) = $result; $question_groups = array_unique(array_merge($question_groups, (array) maybe_unserialize($q_groups))); $e_meta = (array) maybe_unserialize($e_meta); $event_meta = array_unique(array_merge($event_meta, (array) $e_meta['add_attendee_question_groups'])); } } } $basic_header = array(__('Group', 'event_espresso'), __('ID', 'event_espresso'), __('Reg ID', 'event_espresso'), __('Payment Method', 'event_espresso'), __('Reg Date', 'event_espresso'), __('Pay Status', 'event_espresso'), __('Type of Payment', 'event_espresso'), __('Transaction ID', 'event_espresso'), __('Price', 'event_espresso'), __('Coupon Code', 'event_espresso'), __('# Attendees', 'event_espresso'), __('Amount Paid', 'event_espresso'), __('Date Paid', 'event_espresso'), __('Event Name', 'event_espresso'), __('Price Option', 'event_espresso'), __('Event Date', 'event_espresso'), __('Event Time', 'event_espresso'), __('Website Check-in', 'event_espresso'), __('Tickets Scanned', 'event_espresso'), __('Seat Tag', 'event_espresso'), __('First Name', 'event_espresso'), __('Last Name', 'event_espresso'), __('Email', 'event_espresso')); $question_groups = maybe_unserialize($question_groups); $event_meta = maybe_unserialize($event_meta); if (isset($event_meta['add_attendee_question_groups'])) { // if ( is_serialized( $event_meta['add_attendee_question_groups'] ) ){ // $add_attendee_question_groups = unserialize($event_meta['add_attendee_question_groups']); // } else { // $add_attendee_question_groups = $event_meta['add_attendee_question_groups']; // } if (!empty($add_attendee_question_groups)) { $question_groups = array_unique(array_merge((array) $question_groups, (array) $event_meta['add_attendee_question_groups'])); } } switch ($_REQUEST['action']) { case "event": espresso_event_export($event_name); break; case "payment": $question_list = array(); //will be used to associate questions with correct answers $question_filter = array(); //will be used to keep track of newly added and deleted questions if (count($question_groups) > 0) { $question_sequence = array(); $questions_in = ''; foreach ($question_groups as $g_id) { $questions_in .= $g_id . ','; } $questions_in = substr($questions_in, 0, -1); $group_name = ''; $counter = 0; $quest_sql = "SELECT q.id, q.question FROM " . EVENTS_QUESTION_TABLE . " q "; $quest_sql .= " JOIN " . EVENTS_QST_GROUP_REL_TABLE . " qgr on q.id = qgr.question_id "; $quest_sql .= " JOIN " . EVENTS_QST_GROUP_TABLE . " qg on qg.id = qgr.group_id "; $quest_sql .= " WHERE qgr.group_id in ( {$questions_in} ) "; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_event_manager') { $quest_sql .= " AND qg.wp_user = '******'id') . "' "; } //Fix from Jesse in the forums (http://eventespresso.com/forums/2010/10/form-questions-appearing-in-wrong-columns-in-excel-export/) //$quest_sql .= " AND q.system_name is null ORDER BY qg.id, q.id ASC "; //$quest_sql .= " AND q.system_name is null "; $quest_sql .= " ORDER BY q.sequence, q.id ASC "; $questions = $wpdb->get_results($quest_sql); $ignore = array(1, 2, 3); $num_rows = $wpdb->num_rows; if ($num_rows > 0) { foreach ($questions as $question) { if (!isset($ignore[$question->id])) { $question_list[$question->id] = $question->question; $question_filter[$question->id] = $question->id; array_push($basic_header, escape_csv_val(stripslashes($question->question))); //array_push($question_sequence, $question->sequence); } } } } if (count($question_filter) > 0) { $question_filter = implode(",", $question_filter); } //$question_filter = str_replace( array( '1,','2,','3,' ), '', $question_filter ); $sql = ''; $espresso_member = function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin' ? TRUE : FALSE; if ($espresso_member) { $group = get_user_meta(espresso_member_data('id'), "espresso_group", true); $group = maybe_unserialize($group); $group = implode(",", $group); $sql .= "(SELECT ed.event_name, ed.start_date, a.id AS att_id, a.registration_id, a.payment, a.date, a.payment_status, a.txn_type, a.txn_id"; $sql .= ", a.amount_pd, a.quantity, a.coupon_code, a.checked_in, a.checked_in_quantity"; $sql .= ", a.payment_date, a.event_time, a.price_option, a.final_price a_final_price, a.quantity a_quantity, a.fname, a.lname, a.email"; $sql .= " FROM " . EVENTS_ATTENDEE_TABLE . " a "; $sql .= " JOIN " . EVENTS_DETAIL_TABLE . " ed ON ed.id=a.event_id "; if ($group != '') { $sql .= " JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = ed.id "; $sql .= " JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = r.venue_id "; } $sql .= $event_id ? " WHERE ed.id = '" . $event_id . "' " : ''; $sql .= $group != '' ? " AND l.locale_id IN (" . $group . ") " : ''; $sql .= ") UNION ("; } $sql .= "SELECT ed.event_name, ed.start_date, a.id AS att_id, a.registration_id, a.payment, a.date, a.payment_status, a.txn_type, a.txn_id"; $sql .= ", a.quantity, a.coupon_code, a.checked_in, a.checked_in_quantity, a.final_price a_final_price, a.amount_pd, a.quantity a_quantity"; $sql .= ", a.payment_date, a.event_time, a.price_option, a.fname, a.lname, a.email"; $sql .= " FROM " . EVENTS_ATTENDEE_TABLE . " a "; $sql .= " JOIN " . EVENTS_DETAIL_TABLE . " ed ON ed.id=a.event_id "; //$sql .= " JOIN " . EVENTS_ATTENDEE_COST_TABLE . " ac ON a.id=ac.attendee_id "; $sql .= $event_id ? " WHERE ed.id = '" . $event_id . "' " : ''; if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql .= " AND ed.wp_user = '******'id') . "' "; } $sql .= $espresso_member ? ") ORDER BY att_id " : " ORDER BY a.id "; $participants = $wpdb->get_results($sql); $filename = isset($_REQUEST['all_events']) && $_REQUEST['all_events'] == "true" ? __('all-events', 'event_espresso') : sanitize_title_with_dashes($event_name); $filename = $filename . "-" . $today; switch ($_REQUEST['type']) { case "csv": $st = ""; $et = ","; $s = $et . $st; header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=" . $filename . ".csv"); //header("Content-Disposition: attachment; filename='" .$filename .".csv'"); header("Pragma: no-cache"); header("Expires: 0"); //echo header echo implode($s, $basic_header) . "\r\n"; break; default: $st = ""; $et = "\t"; $s = $et . $st; header("Content-Disposition: attachment; filename=" . $filename . ".xls"); //header("Content-Disposition: attachment; filename='" .$filename .".xls'"); header("Content-Type: application/vnd.ms-excel"); header("Pragma: no-cache"); header("Expires: 0"); //echo header echo implode($s, $basic_header) . $et . "\r\n"; break; } if ($participants) { $temp_reg_id = ''; //will temporarily hold the registration id for checking with the next row $attendees_group = ''; //will hold the names of the group members $group_counter = 1; $amount_pd = 0; foreach ($participants as $participant) { if ($temp_reg_id == '') { $temp_reg_id = $participant->registration_id; $amount_pd = $participant->amount_pd; } if ($temp_reg_id == $participant->registration_id) { //Do nothing } else { $group_counter++; $temp_reg_id = $participant->registration_id; } $attendees_group = "Group {$group_counter}"; //Build the seating assignment $seatingchart_tag = ''; if (defined("ESPRESSO_SEATING_CHART")) { if (class_exists("seating_chart")) { if (seating_chart::check_event_has_seating_chart($event_id)) { $rs = $wpdb->get_row("select scs.* from " . EVENTS_SEATING_CHART_EVENT_SEAT_TABLE . " sces inner join " . EVENTS_SEATING_CHART_SEAT_TABLE . " scs on sces.seat_id = scs.id where sces.attendee_id = " . $participant->att_id); if ($rs !== NULL) { $participant->seatingchart_tag = $rs->custom_tag . " " . $rs->seat . " " . $rs->row; } } } } else { $participant->seatingchart_tag = ''; } echo $attendees_group . $s . escape_csv_val($participant->att_id) . $s . escape_csv_val($participant->registration_id) . $s . escape_csv_val(stripslashes($participant->payment)) . $s . escape_csv_val(stripslashes(event_date_display($participant->date, get_option('date_format')))) . $s . escape_csv_val(stripslashes($participant->payment_status)) . $s . escape_csv_val(stripslashes($participant->txn_type)) . $s . escape_csv_val(stripslashes($participant->txn_id)) . $s . escape_csv_val($participant->a_final_price * $participant->a_quantity) . $s . escape_csv_val($participant->coupon_code) . $s . escape_csv_val($participant->quantity) . $s . escape_csv_val($participant->amount_pd) . $s . escape_csv_val(event_date_display($participant->payment_date, get_option('date_format'))) . $s . escape_csv_val($participant->event_name) . $s . escape_csv_val($participant->price_option) . $s . escape_csv_val(event_date_display($participant->start_date, get_option('date_format'))) . $s . escape_csv_val(event_date_display($participant->event_time, get_option('time_format'))) . $s . escape_csv_val($participant->checked_in) . $s . escape_csv_val($participant->checked_in_quantity) . $s . escape_csv_val($participant->seatingchart_tag) . $s . escape_csv_val($participant->fname) . $s . escape_csv_val($participant->lname) . $s . escape_csv_val($participant->email); $SQL = "SELECT question_id, answer FROM " . EVENTS_ANSWER_TABLE . " "; $SQL .= "WHERE question_id IN ({$question_filter}) AND attendee_id = %d"; $answers = $wpdb->get_results($wpdb->prepare($SQL, $participant->att_id), OBJECT_K); foreach ($question_list as $k => $v) { // in case the event organizer removes a question from a question group, // the orphaned answers will remian in the answers table. This check will make sure they don't get exported. $search = array("\r", "\n", "\t"); if (isset($answers[$k])) { $clean_answer = str_replace($search, " ", $answers[$k]->answer); $clean_answer = stripslashes(str_replace("'", "'", trim($clean_answer))); $clean_answer = escape_csv_val($clean_answer); echo $s . $clean_answer; } else { echo $s; } } switch ($_REQUEST['type']) { case "csv": echo "\r\n"; break; default: echo $et . "\r\n"; break; } } } else { echo __('No participant data has been collected.', 'event_espresso'); } exit; break; default: echo '<p>' . __('This Is Not A Valid Selection!', 'event_espresso') . '</p>'; break; } default: break; } } }
function event_espresso_form_group_delete() { global $wpdb; if ($_POST['delete_group']) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; $go_delete = true; if (function_exists('espresso_member_data')) { if (function_exists('espresso_is_admin')) { // If the user doesn't have admin access get only user's own question groups if (!espresso_is_admin()) { $go_delete = false; $sql = " SELECT * FROM " . EVENTS_QST_GROUP_TABLE . " WHERE id = '" . $del_id . "' AND wp_user = '******'id') . "' "; $rs = $wpdb->get_results($sql); if (is_array($rs) && count($rs) > 0) { $go_delete = true; } } } } if ($go_delete) { //Delete question group data $sql = "DELETE FROM " . EVENTS_QST_GROUP_TABLE . " WHERE id='" . $del_id . "'"; $wpdb->query($sql); //Delete question group rel data $sql = "DELETE FROM " . EVENTS_QST_GROUP_REL_TABLE . " WHERE group_id='" . $del_id . "'"; $wpdb->query($sql); } } } } if ($_REQUEST['action'] == 'delete_group') { $go_delete = true; if (function_exists('espresso_member_data')) { if (function_exists('espresso_is_admin')) { // If the user doesn't have admin access get only user's own question groups if (!espresso_is_admin()) { $go_delete = false; $sql = " SELECT * FROM " . EVENTS_QST_GROUP_TABLE . " WHERE id = '" . $_REQUEST['group_id'] . "' AND wp_user = '******'id') . "' "; $rs = $wpdb->get_results($sql); if (is_array($rs) && count($rs) > 0) { $go_delete = true; } } } } if ($go_delete) { //Delete question group data $sql = "DELETE FROM " . EVENTS_QST_GROUP_TABLE . " WHERE id='" . $_REQUEST['group_id'] . "'"; $wpdb->query($sql); //Delete question group rel data $sql = "DELETE FROM " . EVENTS_QST_GROUP_REL_TABLE . " WHERE group_id='" . $_REQUEST['group_id'] . "'"; $wpdb->query($sql); } } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Question Groups have been successfully deleted.', 'event_espresso'); ?> </strong></p> </div> <?php }
function espresso_venue_dd($current_value = 0) { global $espresso_premium; if ($espresso_premium != true) { return; } global $wpdb, $espresso_manager, $current_user; $WHERE = " WHERE "; $sql = "SELECT ev.*, el.name AS locale FROM " . EVENTS_VENUE_TABLE . " ev "; $sql .= " LEFT JOIN " . EVENTS_LOCALE_REL_TABLE . " lr ON lr.venue_id = ev.id "; $sql .= " LEFT JOIN " . EVENTS_LOCALE_TABLE . " el ON el.id = lr.locale_id "; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') { if ($espresso_manager['event_manager_venue'] == "Y") { //show only venues inside their assigned locales. $group = get_user_meta(espresso_member_data('id'), "espresso_group", true); $sql .= " {$WHERE} lr.locale_id IN (" . implode(",", $group) . ")"; $sql .= " OR ev.wp_user = "******" AND "; } } $sql .= " GROUP BY ev.id ORDER by name"; //echo $sql; $venues = $wpdb->get_results($sql); $num_rows = $wpdb->num_rows; # return "<pre>".print_r( $venues,true )."</pre>"; /* [id] => 3 [name] => Home [identifier] => [address] => 101-1414 Government Street [address2] => [city] => Penticton [state] => BC [zip] => V2A 4W1 [country] => Canada [meta] => a:6:{s:7:"contact";s:0:"";s:5:"phone";s:0:"";s:7:"twitter";s:0:"";s:5:"image";s:0:"";s:7:"website";s:0:"";s:11:"description";s:0:"";} [locale] => [wp_user] => 0 */ //echo $current_value; if ($num_rows > 0) { $field = '<label>' . __('Select from Venue Manager list', 'event_espresso') . '</label>'; $field .= '<select name="venue_id[]" id="venue_id">\\n'; $field .= '<option value="0">' . __('Select a Venue', 'event_espresso') . '</option>'; $div = ""; $help_div = ""; $i = 0; foreach ($venues as $venue) { $i++; $selected = $venue->id == $current_value ? 'selected="selected"' : ''; if ($venue->locale != '') { $field .= '<option rel="' . $i . '" ' . $selected . ' value="' . $venue->id . '">' . stripslashes_deep($venue->name) . ' (' . stripslashes_deep($venue->locale) . ') </option>\\n'; } else { if ($venue->city != '' && $venue->state != '') { $field .= '<option rel="' . $i . '" ' . $selected . ' value="' . $venue->id . '">' . stripslashes_deep($venue->name) . ' (' . stripslashes_deep($venue->city) . ', ' . stripslashes_deep($venue->state) . ') </option>\\n'; } else { if ($venue->state != '') { $field .= '<option rel="' . $i . '" ' . $selected . ' value="' . $venue->id . '">' . stripslashes_deep($venue->name) . ' (' . stripslashes_deep($venue->state) . ') </option>\\n'; } else { $field .= '<option rel="' . $i . '" ' . $selected . ' value="' . $venue->id . '">' . stripslashes_deep($venue->name) . ' </option>\\n'; } } } $hidden = "display:none;"; if ($selected) { $hidden = ''; } $div .= "<fieldset id='eebox_" . $i . "' class='eebox' style='" . $hidden . "'>"; $div .= "<ul class='address-view'><li><p><span>Address:</span> " . stripslashes_deep($venue->address) . "</p>"; $div .= "<p><span>Address 2:</span> " . stripslashes_deep($venue->address2) . "</p>"; $div .= "<p><span>City:</span> " . stripslashes_deep($venue->city) . "</p>"; $div .= "<p><span>State:</span> " . stripslashes_deep($venue->state) . "</p>"; $div .= "<p><span>Zip:</span> " . stripslashes_deep($venue->zip) . "</p>"; $div .= "<p><span>Country:</span> " . stripslashes_deep($venue->country) . "</p>"; $div .= "<p><span>Venue ID:</span> " . $venue->id . "</p>"; $div .= '<p><a href="admin.php?page=event_venues&action=edit&id=' . $venue->id . '" target="_blank">' . __('Edit this venue', 'event_espresso') . '</a> | <a class="thickbox link" href="#TB_inline?height=300&width=400&inlineId=venue_info">Shortcode</a></p></li></ul>'; $div .= "</fieldset>"; } $field .= "</select>"; $help_div .= '<div id="venue_info" style="display:none">'; $help_div .= '<h2>' . __('Venue Shortcode', 'event_espresso') . '</h2>'; $help_div .= '<p>' . __('Add the following shortcode into the description to show the venue for this event.', 'event_espresso') . '</p>'; $help_div .= '<p>[ESPRESSO_VENUE]</p>'; $help_div .= '<p>' . __('To use this venue in a page or post. Use the following shortcode.', 'event_espresso') . '</p>'; $help_div .= '<p>[ESPRESSO_VENUE id="selected_venue_id"]</p>'; $help_div .= '<p>Example with Optional Parameters:<br />[ESPRESSO_VENUE outside_wrapper="div" outside_wrapper_class="event_venue"]</p>'; $help_div .= '<p><strong><a href="http://eventespresso.com/forums/2010/10/post-type-variables-and-shortcodes/#venue_shortcode" target="_blank">More Examples</a></strong></p>'; $help_div .= '</div>'; ob_start(); ?> <script> jQuery("#venue_id").change( function(){ var selected = jQuery("#venue_id option:selected"); var rel = selected.attr("rel"); jQuery(".eebox").hide(); jQuery("#eebox_"+rel).show(); }); </script> <?php $js = ob_get_contents(); ob_end_clean(); $html = '<table><tr><td>' . $field . '</td></tr><tr><td>' . $div . '</td></tr></table>' . $help_div . $js; return $html; } }
function event_espresso_form_group_edit() { global $wpdb; $groups = espresso_get_user_question_groups(null, false, false, $_REQUEST['group_id']); if (count($groups) > 0) { foreach ($groups as $group) { $group_id = $group->id; $group_order = $group->group_order; $group_name = stripslashes($group->group_name); $group_identifier = stripslashes($group->group_identifier); $group_description = stripslashes($group->group_description); $question = stripslashes(empty($group->question) ? '' : $group->question); $show_group_name = $group->show_group_name; $show_group_description = $group->show_group_description; $wp_user = $group->wp_user; if ($group->system_group > 0) { $system_group = true; } else { $system_group = false; } } } if (function_exists('espresso_member_data')) { if (function_exists('espresso_is_admin')) { // If the user doesn't have admin access get only user's own question groups if (!espresso_is_admin()) { if (espresso_member_data('id') != $wp_user) { echo '<h2>' . __('Sorry, you do not have permission to edit this question group.', 'event_espresso') . '</h2>'; return; } } } } ?> <div id="add-edit-new-group" class="metabox-holder"> <div class="postbox"> <div title="Click to toggle" class="handlediv"><br /></div> <h3 class="hndle"><?php _e('Edit Group - ', 'event_espresso'); ?> <span><?php echo $group_name; ?> </span></h3> <div class="inside"> <?php if ($system_group == true) { echo '<p class="yellow_inform">' . __('Attention: This is a "System Group", some settings may be disabled.', 'event_espresso') . '</p>'; } ?> <form name="newgroup" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table-edit-group" class="ee-tables" border="0"> <tr> <td class="a" valign="top"> <fieldset id="general-group-info"> <legend><?php _e('Group Information', 'event_espresso'); ?> </legend> <ul> <li> <label for="group_name"><?php _e('Group Name:', 'event_espresso'); ?> </label> <input name="group_name" id="group_name" size="50" value="<?php echo $group_name; ?> " type="text" /> </li> <li> <label for="group_order"><?php _e('Group Order:', 'event_espresso'); ?> </label> <input name="group_order" id="group_order" size="6" value="<?php echo $group_order; ?> " type="text" /> </li> <li> <label for="group_identifier"><?php _e('Group Identifier:', 'event_espresso'); ?> </label> <input disabled="disabled" name="group_identifier" id="group_identifier" size="50" value="<?php echo $group_identifier; ?> " type="text" /> </li> <li> <label for="group_description"><?php _e('Description:', 'event_espresso'); ?> </label> <textarea name="group_description" cols="40" rows="5"><?php echo $group_description; ?> </textarea> </li> <li> <label for="show_group_name"><?php _e('Show group name on registration page?', 'event_espresso'); ?> </label> <input type="checkbox" name="show_group_name" id="show_group_name" value="1" <?php if ($show_group_name != 0) { ?> checked="checked"<?php } ?> /> </li> <li> <label for="show_group_description"><?php _e('Show group description on registration page?', 'event_espresso'); ?> </label> <input type="checkbox" name="show_group_description" id="show_group_description" value="1" <?php if ($show_group_description != 0) { ?> checked="checked"<?php } ?> /> </li> </ul> </fieldset> </td> <td class="b" valign="top"> <fieldset id="questions-for-group"> <legend><?php _e('Questions', 'event_espresso'); ?> </legend> <ul> <li><p><?php _e('Selected Questions for group<span class="info"> Uncheck box to remove question from group</span>', 'event_espresso'); ?> </p></li> <?php //Questions that are already associated with this group $questions = espresso_get_user_questions_for_group($_REQUEST['group_id'], $wp_user); if (count($questions['questions_in_group']) > 0) { foreach ($questions['questions_in_group'] as $question) { $checked = !is_null($question->rel_id) ? 'checked="checked"' : ''; $visibility = preg_match("/fname|lname|email/", $question->system_name) == 1 && $question->system_group == 1 ? 'style="visibility:hidden"' : ''; echo '<li><label><input ' . $checked . ' type="checkbox" ' . $visibility . ' name="question_id[' . $question->id . ']" value="' . $question->id . '" id="question_id_' . $question->id . '" />' . stripslashes($question->question) . '</label></li>'; } } ?> </ul> <ul id="add-more-questions"> <li><p><?php _e('Add further questions to group', 'event_espresso'); ?> </p></li> <?php //Questions that are NOT part of this group. if (count($questions['remaining_questions']) > 0) { foreach ($questions['remaining_questions'] as $question) { $checked = ''; echo '<li><label><input ' . $checked . ' type="checkbox" name="question_id[' . $question->id . ']" value="' . $question->id . '" id="question_id_' . $question->id . '" />' . stripslashes($question->question) . '</label></li>'; } } ?> </ul> </fieldset> </td> </tr> </table> <p> <input type="hidden" name="edit_action" value="update_group" /> <input type="hidden" name="action" value="update_group" /> <input type="hidden" name="group_id" value="<?php echo $group_id; ?> " /> <input class="button-primary" name="Submit" value="Update Group" type="submit" /> </p> </form> </div> </div> </div> <?php }
function event_espresso_categories_dd($event_id = 0, $is_fes = false) { global $wpdb; $manage = ''; //Don't show manage link if using front-end event submission if ($is_fes == false) { $manage = '<p><a href="admin.php?page=event_categories" target="_blank">' . __('Manage Categories', 'event_espresso') . '</a></p>'; } $sql = "SELECT * FROM " . EVENTS_CATEGORY_TABLE; if (function_exists('espresso_member_data')) { global $espresso_manager; if (isset($espresso_manager['event_manager_share_cats']) && $espresso_manager['event_manager_share_cats'] == 'N') { $results = $wpdb->get_results("SELECT wp_user FROM " . EVENTS_DETAIL_TABLE . " WHERE id = '" . $event_id . "'"); $wp_user = $results && $wpdb->last_result[0]->wp_user != '' ? $wpdb->last_result[0]->wp_user : espresso_member_data('id'); $sql .= " WHERE "; if ($wp_user == 0 || $wp_user == 1) { $sql .= " (wp_user = '******' OR wp_user = '******') "; } else { $sql .= " wp_user = '******' "; } } } $sql .= " ORDER BY category_name "; $event_categories = $wpdb->get_results($sql); $num_rows = $wpdb->num_rows; if ($num_rows > 0) { $html = ''; $html .= '<select name="event_category[]">'; foreach ($event_categories as $category) { $category_id = $category->id; $category_name = $category->category_name; $in_event_categories = $wpdb->get_results("SELECT * FROM " . EVENTS_CATEGORY_REL_TABLE . " WHERE event_id='" . $event_id . "' AND cat_id='" . $category_id . "'"); foreach ($in_event_categories as $in_category) { $in_event_category = $in_category->cat_id; } if (empty($in_event_category)) { $in_event_category = ''; } // $html .= '<p id="event-category-' . $category_id . '"><label for="in-event-category-' . $category_id . '" class="selectit"><input value="' . $category_id . '" type="checkbox" name="event_category[]" id="in-event-category-' . $category_id . '"' . ($in_event_category == $category_id ? ' checked="checked"' : "" ) . '/> ' . $category_name . "</label></p>"; $html .= '<option value="' . $category_id . '" ' . ($in_event_category == $category_id ? ' selected' : "") . '>' . $category_name . '</option>'; } $html .= '</select>'; $html = $html . $manage; return $html; } else { _e('No Categories', 'event_espresso'); return; } }
function event_list_attendees() { global $wpdb, $org_options, $ticketing_installed, $espresso_premium; define('EVT_ADMIN_URL', admin_url('admin.php?page=events')); $EVT_ID = isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '' ? absint($_REQUEST['event_id']) : FALSE; if ($EVT_ID) { echo '<h1>' . espresso_event_list_attendee_title($EVT_ID) . '</h1>'; } $max_rows = isset($_REQUEST['max_rows']) & !empty($_REQUEST['max_rows']) ? absint($_REQUEST['max_rows']) : 50; $start_rec = isset($_REQUEST['start_rec']) && !empty($_REQUEST['start_rec']) ? absint($_REQUEST['start_rec']) : 0; $records_to_show = " LIMIT {$max_rows} OFFSET {$start_rec} "; //Dates $curdate = date('Y-m-d'); $this_year_r = date('Y'); $this_month_r = date('m'); $days_this_month = date('t', time()); if (isset($_POST['delete_customer']) && !empty($_POST['delete_customer'])) { if (is_array($_POST['checkbox'])) { while (list($att_id, $value) = each($_POST['checkbox'])) { $SQL = "DELETE FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id = '%d'"; $wpdb->query($wpdb->prepare($SQL, $att_id)); $SQL = "DELETE FROM " . EVENTS_ATTENDEE_META_TABLE . " WHERE attendee_id = '%d'"; $wpdb->query($wpdb->prepare($SQL, $att_id)); $SQL = "DELETE FROM " . EVENTS_ANSWER_TABLE . " WHERE attendee_id = '%d'"; $wpdb->query($wpdb->prepare($SQL, $att_id)); } } ?> <div id="message" class="updated fade"> <p> <strong><?php _e('Customer(s) have been successfully deleted from the event.', 'event_espresso'); ?> </strong> </p> </div> <?php } // MARKING USERS AS ATTENDED (OR NOT) if ((!empty($_POST['attended_customer']) || !empty($_POST['unattended_customer'])) && $ticketing_installed == TRUE) { if (is_array($_POST['checkbox'])) { while (list($att_id, $value) = each($_POST['checkbox'])) { // on / off value for attended status checkbox $checker = $value == "on" && $_POST['attended_customer'] ? 1 : 0; $SQL = "SELECT checked_in_quantity FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id = %d "; $ticket_scanned = $wpdb->get_var($wpdb->prepare($SQL, $att_id)); if ($ticket_scanned >= 1) { ?> <div id="message" class="error fade"> <p> <strong><?php _e('Scanned tickets cannot be redeemed/un-redeemed here.', 'event_espresso'); ?> </strong> </p> </div> <?php } else { if ($wpdb->update(EVENTS_ATTENDEE_TABLE, array('checked_in' => $checker), array('id' => $att_id), array('%d'), array('%d'))) { ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Customer(s) attendance data successfully updated for this event.', 'event_espresso'); ?> </strong></p> </div> <?php } } } } } require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/event-management/queries.php'; if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php')) { require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php'; } else { ?> <p> <strong><?php _e('Advanced filters are available in the premium versions.', 'event_espresso'); ?> </strong> <a href="http://eventespresso.com/download/" target="_blank"> <?php _e('Upgrade Now!', 'event_espresso'); ?> </a> </p> <?php } $sql_clause = " WHERE "; $sql_a = "("; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') { $group = get_user_meta(espresso_member_data('id'), "espresso_group", true); $group = implode(",", $group); $sql_a .= "SELECT a.*, e.id event_id, e.event_name, checked_in FROM " . EVENTS_ATTENDEE_TABLE . " a "; $sql_a .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id "; if ($_REQUEST['category_id'] != '') { $sql_a .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id "; $sql_a .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = r.cat_id "; } if ($group != '') { $sql_a .= " JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id "; $sql_a .= " JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = r.venue_id "; } $sql_a .= $_REQUEST['category_id'] != '' ? " AND c.id = '" . $_REQUEST['category_id'] . "' " : ''; $sql_clause = " WHERE "; if ($_REQUEST['payment_status'] != '') { $sql_a .= " {$sql_clause} a.payment_status = '" . $_REQUEST['payment_status'] . "' "; $sql_clause = " AND "; } if ($_POST['month_range'] != '') { $pieces = explode('-', $_REQUEST['month_range'], 3); $year_r = $pieces[0]; $month_r = $pieces[1]; $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-31', $format = 'Y-m-d') . "' "; $sql_clause = " AND "; } if ($EVT_ID) { $sql_a .= " {$sql_clause} a.event_id = '" . $EVT_ID . "' "; $sql_clause = " AND "; } if ($_REQUEST['today_a'] == 'true') { //$sql_a .= " $sql_clause a.date = '" . event_espresso_no_format_date($curdate,$format = 'Y-m-d') ."' "; $sql_a .= " {$sql_clause} a.date BETWEEN '" . $curdate . ' 00:00:00' . "' AND '" . $curdate . ' 23:59:59' . "' "; $sql_clause = " AND "; } if ($_REQUEST['this_month_a'] == 'true') { $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' "; $sql_clause = " AND "; } $sql_a .= $group != '' ? $sql_clause . " l.locale_id IN (" . $group . ") " : ''; $sql_a .= " AND e.event_status != 'D' "; $sql_a .= ") UNION ("; } $sql_a .= "SELECT a.*, e.id event_id, e.event_name, checked_in FROM " . EVENTS_ATTENDEE_TABLE . " a "; $sql_a .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id "; if (!empty($_REQUEST['category_id'])) { $sql_a .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id "; $sql_a .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = r.cat_id "; } $sql_a .= !empty($_REQUEST['category_id']) ? " AND c.id = '" . $_REQUEST['category_id'] . "' " : ''; $sql_clause = " WHERE "; if (!empty($_REQUEST['payment_status'])) { $sql_a .= " {$sql_clause} a.payment_status = '" . $_REQUEST['payment_status'] . "' "; $sql_clause = " AND "; } if (!empty($_POST['month_range'])) { $pieces = explode('-', $_REQUEST['month_range'], 3); $year_r = $pieces[0]; $month_r = $pieces[1]; $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-31', $format = 'Y-m-d') . "' "; $sql_clause = " AND "; } if ($EVT_ID) { $sql_a .= " {$sql_clause} a.event_id = '" . $EVT_ID . "' "; $sql_clause = " AND "; } if (!empty($_REQUEST['today_a'])) { //$sql_a .= " $sql_clause a.date = '" . event_espresso_no_format_date($curdate,$format = 'Y-m-d') ."' "; $sql_a .= " {$sql_clause} a.date BETWEEN '" . $curdate . ' 00:00:00' . "' AND '" . $curdate . ' 23:59:59' . "' "; $sql_clause = " AND "; } if (!empty($_REQUEST['this_month_a'])) { $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' "; $sql_clause = " AND "; } if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql_a .= $sql_clause . " e.wp_user = '******'id') . "' "; } $sql_a .= " {$sql_clause} e.event_status != 'D' "; $sql_a .= ") ORDER BY date DESC, id ASC "; $sql_a .= $records_to_show; $attendees = $wpdb->get_results($sql_a); $total_attendees = $wpdb->num_rows; $quantity = 0; $att_table_form_url = add_query_arg(array('event_admin_reports' => 'list_attendee_payments', 'event_id' => $EVT_ID), EVT_ADMIN_URL); ?> <form id="attendee-admin-list-page-select-frm" name="attendee_admin_list_page_select_frm" method="post" action="<?php echo $att_table_form_url; ?> "> <div id="attendee-admin-list-page-select-dv" class="admin-list-page-select-dv"> <input name="navig" value="<?php _e('Retrieve', 'event_espresso'); ?> " type="submit" class="button-secondary"> <?php //_e('a max total of', 'event_espresso'); ?> <?php $rows = array(50 => 50, 100 => 100, 250 => 250, 500 => 500, 100000 => 'all'); ?> <select name="max_rows" size="1"> <?php foreach ($rows as $key => $value) { ?> <?php $selected = $key == $max_rows ? ' selected="selected"' : ''; ?> <option value="<?php echo $key; ?> "<?php echo $selected; ?> ><?php echo $value; ?> </option> <?php } ?> </select> <?php _e('rows from the db at a time', 'event_espresso'); ?> <input name="start_rec" value="<?php echo $start_rec; ?> " class="textfield" type="hidden"> <?php if ($start_rec > 0 && $max_rows < 100000) { $prev_rows = $start_rec > $max_rows ? $start_rec - $max_rows - 1 : 0; $prev_rows_url = add_query_arg(array('event_admin_reports' => 'list_attendee_payments', 'event_id' => $EVT_ID, 'max_rows' => $max_rows, 'start_rec' => $prev_rows), EVT_ADMIN_URL); ?> <a id="attendee-admin-load-prev-rows-btn" href="<?php echo $prev_rows_url; ?> " title="load prev rows" class="button-secondary"> <?php echo __('Previous', 'event_espresso') . ' ' . $max_rows . ' ' . __('rows', 'event_espresso'); ?> </a> <?php } ?> <?php if ($total_attendees >= $max_rows && $max_rows < 100000) { $next_rows = $start_rec + $max_rows + 1; $next_rows_url = add_query_arg(array('event_admin_reports' => 'list_attendee_payments', 'event_id' => $EVT_ID, 'max_rows' => $max_rows, 'start_rec' => $next_rows), EVT_ADMIN_URL); ?> <a id="attendee-admin-load-next-rows-btn" href="<?php echo $next_rows_url; ?> " title="load next rows" class="button-secondary"> <?php echo __('Next', 'event_espresso') . ' ' . $max_rows . ' ' . __('rows', 'event_espresso'); ?> </a> <?php } ?> </div> </form> <form id="form1" name="form1" method="post" action="<?php echo $att_table_form_url; ?> "> <table id="table" class="widefat fixed" width="100%"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:3%;min-width:35px !important;"> <input type="checkbox"> </th> <th class="manage-column column-att-id" id="att-id" scope="col" title="Click to Sort"style="width:3%;max-width:35px !important;"> <span><?php _e('ID', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-name" id="name" scope="col" title="Click to Sort"style="width: 10%;"> <span><?php _e('Attendee Name', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-registrationid" id="registrationid" scope="col" title="Click to Sort" style="width: 10%;"> <span><?php _e('Reg ID', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="registration" scope="col" title="Click to Sort" style="width: 10%;"> <span><?php _e('Registered', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-title" id="event-title" scope="col" title="Click to Sort" style="width: 10%;"> <span><?php _e('Event Title', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-title" id="event-time" scope="col" title="Click to Sort" style="width: 8%;"> <span><?php _e('Event Time', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <?php if ($ticketing_installed == true) { ?> <th class="manage-column column-title" id="attended" scope="col" title="Click to Sort" style="width: 8%;"> <span><?php _e('Attended', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <?php } ?> <th class="manage-column column-title" id="ticket-option" scope="col" title="Click to Sort" style="width: 13%;"> <span><?php _e('Option', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th align="center" class="manage-column column-date" id="amount" style="width: 5%;" title="Click to Sort" scope="col"> <span><?php _e('Payment', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="payment_type" scope="col" title="Click to Sort" style="width: 8%;"> <span><?php _e('Type', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="coupon" scope="col" title="Click to Sort" style="width: 10%;"> <span><?php _e('Coupon', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="txn_id" scope="col" title="Click to Sort" style="width: 10%;"> <span><?php _e('Transaction ID', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="action" scope="col" title="" > <?php _e('Actions', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php if ($total_attendees > 0) { foreach ($attendees as $attendee) { $id = $attendee->id; $registration_id = $attendee->registration_id; $lname = htmlspecialchars(stripslashes($attendee->lname), ENT_QUOTES, 'UTF-8'); $fname = htmlspecialchars(stripslashes($attendee->fname), ENT_QUOTES, 'UTF-8'); $address = htmlspecialchars(stripslashes($attendee->address), ENT_QUOTES, 'UTF-8'); $city = htmlspecialchars(stripslashes($attendee->city), ENT_QUOTES, 'UTF-8'); $state = htmlspecialchars(stripslashes($attendee->state), ENT_QUOTES, 'UTF-8'); $zip = $attendee->zip; $email = '<span style="visibility:hidden">' . $attendee->email . '</span>'; $phone = $attendee->phone; $quantity = $attendee->quantity > 1 ? '<br />(' . __('Total Attendees', 'event_espresso') . ': ' . $attendee->quantity . ')' : ''; $attended = $attendee->checked_in; $ticket_scanned = $attendee->checked_in_quantity; $amount_pd = $attendee->amount_pd; $payment_status = $attendee->payment_status; $payment_date = $attendee->payment_date; $date = $attendee->date; $event_id = $attendee->event_id; $coupon_code = $attendee->coupon_code; $txn_id = $attendee->txn_id; $txn_type = $attendee->txn_type; $price_option = $attendee->price_option; $event_time = $attendee->event_time; $event_name = $attendee->event_name; $event_date = $attendee->start_date; ?> <tr> <td class="check-column" style="padding:7px 0 22px 7px; vertical-align:top;"> <input name="checkbox[<?php echo $id; ?> ]" type="checkbox" title="Delete <?php echo $fname; echo $lname; ?> "> </td> <td nowrap="nowrap"> <?php echo $attendee->id; ?> </td> <td class="row-title" nowrap="nowrap"> <a href="admin.php?page=events&event_admin_reports=edit_attendee_record&event_id=<?php echo $event_id; ?> &registration_id=<?php echo $registration_id; ?> &form_action=edit_attendee&id=<?php echo $id; ?> " title="<?php echo 'ID#:' . $id . ' [ REG#: ' . $registration_id . ' ] Email: ' . $attendee->email; ?> "> <?php echo $fname; ?> <?php echo $lname; ?> <?php echo $email; ?> </a> </td> <td nowrap="nowrap"> <?php echo $registration_id; ?> </td> <td class="date column-date"> <?php echo event_date_display($date, get_option('date_format') . ' g:i a'); ?> </td> <td nowrap="nowrap"> <a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php echo $event_id; ?> " title="<?php _e('View attendees for this event', 'event_espresso'); ?> "> <?php echo stripslashes_deep($event_name); ?> </a> </td> <td nowrap="nowrap"> <?php echo event_date_display($event_time, get_option('time_format')); ?> </td> <?php if ($ticketing_installed == true) { ?> <td nowrap="nowrap"> <p style="padding-left:15px"> <?php echo $attended == 1 || $ticket_scanned >= 1 ? event_espresso_paid_status_icon('Checkedin') : event_espresso_paid_status_icon('NotCheckedin'); ?> </p> </td> <?php } ?> <td nowrap="nowrap"> <?php echo $price_option; ?> </td> <td class="date column"> <a href="admin.php?page=events&attendee_pay=paynow&form_action=payment&registration_id=<?php echo $registration_id; ?> &event_admin_reports=enter_attendee_payments&event_id=<?php echo $event_id; ?> " title="<?php _e('Edit Payment', 'event_espresso'); ?> ID: <?php echo $registration_id; ?> "> <p style="padding-left:17px"><?php event_espresso_paid_status_icon($payment_status); ?> </p> </a> </td> <td class=""> <?php echo espresso_payment_type($txn_type); ?> </td> <td class=""> <?php echo $coupon_code; ?> </td> <td class=""> <?php echo $txn_id; ?> </td> <td class="" > <a href="admin.php?page=events&attendee_pay=paynow&form_action=payment&registration_id=<?php echo $registration_id; ?> &event_admin_reports=enter_attendee_payments&event_id=<?php echo $event_id; ?> " title="<?php _e('Edit Payment', 'event_espresso'); ?> ID: <?php echo $registration_id; ?> "> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/money.png" width="16" height="16" alt="<?php _e('Edit Payment', 'event_espresso'); ?> " /> </a> <a href="admin.php?page=events&event_admin_reports=edit_attendee_record&registration_id=<?php echo $registration_id; ?> &event_id=<?php echo $event_id; ?> &form_action=edit_attendee" title="<?php _e('Edit Attendee', 'event_espresso'); ?> "> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/user_edit.png" width="16" height="16" alt="<?php _e('Edit Attendee', 'event_espresso'); ?> " /> </a> <a href="admin.php?page=events&event_admin_reports=resend_email&registration_id=<?php echo $registration_id; ?> &event_id=<?php echo $event_id; ?> &form_action=resend_email" title="<?php _e('Resend Registration Details', 'event_espresso'); ?> "> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/email_link.png" width="16" height="16" alt="<?php _e('Resend Registration Details', 'event_espresso'); ?> " /> </a> <?php if ($espresso_premium == true) { ?> <a href="<?php echo home_url(); ?> /?download_invoice=true&admin=true&registration_id=<?php echo $registration_id; ?> " target="_blank" title="<?php _e('Download Invoice', 'event_espresso'); ?> "> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/page_white_acrobat.png" width="16" height="16" alt="<?php _e('Download Invoice', 'event_espresso'); ?> " /> </a> <?php } ?> <?php if ($ticketing_installed == true && function_exists('espresso_ticket_url')) { ?> <a href="<?php echo espresso_ticket_url($id, $registration_id); ?> " target="_blank" title="<?php _e('View/Download Ticket', 'event_espresso'); ?> "> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/ticket-arrow-icon.png" width="16" height="16" alt="<?php _e('Download Ticket', 'event_espresso'); ?> " /> </a> <?php } if ($org_options["use_attendee_pre_approval"] == "Y") { ?> <br/> <a href="admin.php?page=events&attendee_pay=paynow&form_action=payment&registration_id=<?php echo $registration_id; ?> &event_admin_reports=enter_attendee_payments&event_id=<?php echo $event_id; ?> " title="<?php _e('Edit Payment', 'event_espresso'); ?> ID: <?php echo $registration_id; ?> "> <?php if (is_attendee_approved($event_id, $id)) { ?> <strong><?php _e('Approved', 'event_espresso'); ?> </strong><br/> <?php } else { ?> <span style="color:#FF0000"><strong><?php _e('Awaiting approval', 'event_espresso'); ?> </strong></span> <?php } ?> </a> <?php } ?> </td> </tr> <?php } } ?> </tbody> </table> <div style="clear:both; margin-bottom:30px;"> <input name="delete_customer" type="submit" class="button-secondary" id="delete_customer" value="<?php _e('Delete Attendee(s)', 'event_espresso'); ?> " style="margin:10px 0 0 0;" onclick="return confirmDelete();" /> <?php if ($ticketing_installed == true) { ?> <input name="attended_customer" type="submit" class="button-secondary" id="attended_customer" value="<?php _e('Mark as Attended', 'event_espresso'); ?> " style="margin:10px 0 0 10px;" /> <input name="unattended_customer" type="submit" class="button-secondary" id="attended_customer" value="<?php _e('Unmark as Attended', 'event_espresso'); ?> " style="margin:10px 0 0 10px;" /> <?php } ?> <a style="margin-left:5px" class="button-secondary" href="admin.php?page=events&action=csv_import"> <?php _e('Import Events', 'event_espresso'); ?> </a> <?php if (function_exists('espresso_attendee_import') && $espresso_premium == true) { ?> <a style="margin-left:5px" class="button-secondary" href="admin.php?page=espresso_attendee_import"> <?php _e('Import Attendees', 'event_espresso'); ?> </a> <?php } ?> <a class="button-secondary" style="margin-left:5px" href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&export=report&action=payment&type=excel&"; echo $EVT_ID ? "event_id=" . $EVT_ID : "all_events=true"; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "> <?php _e('Export to Excel', 'event_espresso'); ?> </a> <?php if ($EVT_ID) { ?> <a style="margin-left:5px" class="button-secondary" href="admin.php?page=events&event_admin_reports=add_new_attendee&event_id=<?php echo $EVT_ID; ?> "> <?php _e('Add Attendee', 'event_espresso'); ?> </a> <?php } ?> <?php if ($EVT_ID) { ?> <a style="margin-left:5px" class="button-primary" href="admin.php?page=events&action=edit&event_id=<?php echo $EVT_ID; ?> "> <?php _e('Edit Event', 'event_espresso'); ?> </a> <?php } ?> </div> </form> <h4 style="clear:both"><?php _e('Legend', 'event_espresso'); ?> </h4> <dl style="float:left; margin-left:10px; width:200px"> <dt> <?php event_espresso_paid_status_icon('Completed'); ?> - <?php _e('Completed', 'event_espresso'); ?> </dt> <dt> <?php event_espresso_paid_status_icon('Incomplete'); ?> - <?php _e('Incomplete', 'event_espresso'); ?> </dt> <dt> <?php event_espresso_paid_status_icon('Pending'); ?> - <?php _e('Pending', 'event_espresso'); ?> </dt> <dt> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/money.png" width="16" height="16" alt="<?php _e('Payment Details', 'event_espresso'); ?> " /> - <?php _e('Payment Details', 'event_espresso'); ?> </dt> </dl> <dl style="float:left; margin-left:10px; width:200px"> <dt> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/email_link.png" width="16" height="16" alt="<?php _e('Resend Details', 'event_espresso'); ?> " /> - <?php _e('Resend Email', 'event_espresso'); ?> </dt> <dt> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/page_white_acrobat.png" width="16" height="16" alt="<?php _e('Download Invoice', 'event_espresso'); ?> " /> - <?php _e('Download Invoice', 'event_espresso'); ?> </dt> <dt> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/user_edit.png" width="16" height="16" alt="<?php _e(' Attendee Details', 'event_espresso'); ?> " /> - <?php _e('Attendee Details', 'event_espresso'); ?> </dt> </dl> <?php $hide = $EVT_ID ? '1,5' : '1,3'; $hide .= $ticketing_installed ? ',11,12' : ',10,11'; ?> <script> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "sDom": 'Clfrtip', "bAutoWidth": false, "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong> (eg, email, txn id, event, etc.)", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ { "bSortable": false }, null, <?php echo $ticketing_installed == true ? 'null,' : ''; ?> null, null, null, null, null, null, null, null, null, null, { "bSortable": false } ], "aoColumnDefs": [ { "bVisible": false, "aTargets": [<?php echo $hide; ?> ] } ], "oColVis": { "aiExclude": [0,2], "buttonText": "Filter: Show / Hide Columns", "bRestore": true }, }); }); </script> <?php }
} else { $manager_status = array(); } //Add the final available status $delete_status = array(array('id' => 'D', 'text' => __('Deleted', 'event_espresso'))); // Merge the satus arrays $status = array_merge((array) $default_status, (array) $manager_status, (array) $delete_status); if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_event_manager' && $espresso_manager['event_manager_approval'] == 'Y') { $status = array(array('id' => 'A', 'text' => __('Public', 'event_espresso')), array('id' => 'S', 'text' => __('Waitlist', 'event_espresso')), array('id' => 'O', 'text' => __('Ongoing', 'event_espresso')), array('id' => 'R', 'text' => __('Draft', 'event_espresso')), array('id' => 'D', 'text' => __('Deleted', 'event_espresso'))); } $additional_attendee_reg_info = array(array('id' => '1', 'text' => __('No info required', 'event_espresso')), array('id' => '2', 'text' => __('Personal Information only', 'event_espresso')), array('id' => '3', 'text' => __('Full registration information', 'event_espresso'))); $default_payment_status = array(array('id' => "", 'text' => 'No Change'), array('id' => 'Incomplete', 'text' => 'Incomplete'), array('id' => 'Pending', 'text' => 'Pending'), array('id' => 'Completed', 'text' => 'Completed')); $advanced_options = ''; $advanced_options .= '<p class="inputunder"><label>' . __('Additional Attendee Registration info?', 'event_espresso') . '</label> ' . select_input('additional_attendee_reg_info', $additional_attendee_reg_info, isset($event_meta['additional_attendee_reg_info']) ? $event_meta['additional_attendee_reg_info'] : '') . '</p>'; $advanced_options .= '<p><strong>' . __('Advanced Options:', 'event_espresso') . '</strong></p>'; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_event_manager' && $espresso_manager['event_manager_approval'] == 'Y' && ($event_status == '' || $event_status == 'X' || $event_status == 'P')) { $advanced_options .= '<p><label>' . __('Event Status: ', 'event_espresso') . '</label><span style="color: #ff8400; font-weight:bold;">' . __('PENDING', 'event_espresso') . '</span></p>'; $advanced_options .= '<input name="event_status" id="event_status" type="hidden" value="P" />'; $advanced_options .= '<input name="is_active" id="is_active" type="hidden" value="Y" />'; } else { $is_active = isset($is_active) ? $is_active : ''; $event_status = isset($event_status) ? $event_status : ''; $advanced_options .= '<p><label>' . __('Is this an active event? ', 'event_espresso') . '</label>' . __(select_input('is_active', $values, $is_active)) . '</p>'; $advanced_options .= '<p><label>' . __('Event Status: ', 'event_espresso') . '</label>' . __(select_input('event_status', $status, $event_status)) . ' <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=status_types_info"><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . '/images/question-frame.png" width="16" height="16" /></a></p>'; } $display_desc = isset($display_desc) ? $display_desc : ''; $display_reg_form = isset($display_reg_form) ? $display_reg_form : ''; $overflow_event_id = isset($overflow_event_id) ? $overflow_event_id : '0'; $allow_overflow = isset($allow_overflow) ? $allow_overflow : 'N'; $externalURL = isset($externalURL) ? $externalURL : ''; $alt_email = isset($alt_email) ? $alt_email : '';
function event_list_attendees() { global $wpdb, $org_options, $ticketing_installed; //Dates $curdate = date("Y-m-d"); $pieces = explode('-', $curdate, 3); $this_year_r = $pieces[0]; $this_month_r = $pieces[1]; $days_this_month = date('t', strtotime($curdate)); if (!empty($_POST['delete_customer'])) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; $sql = "DELETE FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id = '{$del_id}'"; $wpdb->query($sql); } } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Customer(s) have been successfully deleted from the event.', 'event_espresso'); ?> </strong></p> </div> <?php } // MARKING USERS AS ATTENDED (OR NOT) if ((!empty($_POST['attended_customer']) || !empty($_POST['unattended_customer'])) && $ticketing_installed == true) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; //echo $del_id . " / " . $value . "<br />\n"; if ($value == "on" && $_POST['attended_customer']) { $checker = 1; } else { $checker = 0; } $wpdb->get_results("SELECT checked_in_quantity FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id = '{$del_id}' LIMIT 0,1 "); $ticket_scanned = $wpdb->last_result[0]->checked_in_quantity; if ($ticket_scanned >= 1) { ?> <div id="message" class="error fade"> <p><strong> <?php _e('Scanned tickets cannot be redeemed/un-redeemed here.', 'event_espresso'); ?> </strong></p> </div> <?php } else { $sql = "UPDATE " . EVENTS_ATTENDEE_TABLE . " SET checked_in = {$checker} WHERE id = '{$del_id}'"; $wpdb->query($sql); //echo $sql; ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Customer(s) attendance data successfully updated for this event.', 'event_espresso'); ?> </strong></p> </div> <?php } } } } require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/event-management/queries.php'; $total_events = espresso_total_events(); if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php')) { require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php'; } else { echo '<p><strong>' . __('Advanced filters are available in the premium versions.', 'event_espresso') . '</strong> <a href="http://eventespresso.com/download/" target="_blank">' . __('Upgrade Now!', 'event_espresso') . '</a></p>'; } if (isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '') { echo '<h3>' . espresso_event_list_attendee_title($_REQUEST['event_id']) . '</h3>'; } ?> <style type="text/css"> .dataTables_paginate {margin-top:10px;} .sorting_asc .sorting_desc {} th.sorting_asc span.sorting-indicator {display:block; margin-left:3px; background-position: 0 0;} th.sorting_desc span.sorting-indicator {display:block; margin-left:3px; background-position: -7px 0;} #table thead tr th span {cursor:pointer; float:left;} #table thead tr th span:hover {color:#D54E21;} #table_filter input {width:250px; background:#fff;} /*fixing this */ .view_btn:hover, .edit_btn:hover, .complete_btn:hover, .shortcode_btn:hover, .excel_exp_btn:hover, .csv_exp_btn:hover, .newsletter_btn:hover {height: 18px; margin: 2px 3px 0 0;} </style> <?php /*if (!empty($_REQUEST['event_id'])) { ?> <h3 style="margin-bottom:15px;"><?php _e('Attendee Report for Event ID:', 'event_espresso'); ?> <?php espresso_event_list_attendee_title($_REQUEST['event_id']); ?></h3> <?php }*/ ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table" class="widefat fixed" width="100%"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width: 4%;"><input type="checkbox"></th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort"style="width: 10%;"> <span> <?php _e('Attendee Name', 'event_espresso'); ?> <span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="registrationid" scope="col" title="Click to Sort" style="width: 10%;"> <span> <?php _e('Reg ID', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="registration" scope="col" title="Click to Sort" style="width: 10%;"> <span> <?php _e('Registered', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-title" id="event" scope="col" title="Click to Sort" style="width: 10%;"> <span> <?php _e('Event Title', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-title" id="event" scope="col" title="Click to Sort" style="width: 8%;"> <span> <?php _e('Event Time', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <?php if ($ticketing_installed == true) { ?> <th class="manage-column column-title" id="attended" scope="col" title="Click to Sort" style="width: 8%;"> <span> <?php _e('Attended', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <?php } ?> <th class="manage-column column-title" id="event" scope="col" title="Click to Sort" style="width: 8%;"> <span> <?php _e('Option', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th align="center" class="manage-column column-date" id="amount" style="width: 10%;" title="Click to Sort" scope="col"> <span> <?php _e('Payment', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="payment_type" scope="col" title="Click to Sort" style="width: 10%;"> <span> <?php _e('Type', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="coupon" scope="col" title="Click to Sort" style="width: 12%;"> <span> <?php _e('Coupon', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="txn_id" scope="col" title="Click to Sort" style="width: 15%;"> <span> <?php _e('Transaction ID', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="action" scope="col" title="Click to Sort"style="width: 8%;"><?php _e('Action', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php $temp_reg_id = ''; //will temporarily hold the registration id for checking with the next row $attendees_group = ''; //will hold the names of the group members $counter = 0; //used for keeping track of the last row. If counter = num_rows, print $go = false; //triggers the output when true. Set when the next reg id != temp_reg_id $sql_clause = " WHERE "; $sql_a = "("; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') { $group = get_user_meta(espresso_member_data('id'), "espresso_group", true); $group = unserialize($group); $group = implode(",", $group); $sql_a .= "SELECT a.*, e.id event_id, e.event_name, checked_in FROM " . EVENTS_ATTENDEE_TABLE . " a "; $sql_a .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id "; if ($_REQUEST['category_id'] != '') { $sql_a .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id "; $sql_a .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = r.cat_id "; } if ($group != '') { $sql_a .= " JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id "; $sql_a .= " JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = r.venue_id "; } $sql_a .= $_REQUEST['category_id'] != '' ? " AND c.id = '" . $_REQUEST['category_id'] . "' " : ''; $sql_clause = " WHERE "; if ($_REQUEST['payment_status'] != '') { $sql_a .= " {$sql_clause} a.payment_status = '" . $_REQUEST['payment_status'] . "' "; $sql_clause = " AND "; } if ($_POST['month_range'] != '') { $pieces = explode('-', $_REQUEST['month_range'], 3); $year_r = $pieces[0]; $month_r = $pieces[1]; $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-31', $format = 'Y-m-d') . "' "; $sql_clause = " AND "; } if ($_REQUEST['event_id'] != '') { $sql_a .= " {$sql_clause} a.event_id = '" . $_REQUEST['event_id'] . "' "; $sql_clause = " AND "; } if ($_REQUEST['today_a'] == 'true') { //$sql_a .= " $sql_clause a.date = '" . event_espresso_no_format_date($curdate,$format = 'Y-m-d') ."' "; $sql_a .= " {$sql_clause} a.date BETWEEN '" . $curdate . ' 00:00:00' . "' AND '" . $curdate . ' 23:59:59' . "' "; $sql_clause = " AND "; } if ($_REQUEST['this_month_a'] == 'true') { $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' "; $sql_clause = " AND "; } $sql_a .= $group != '' ? $sql_clause . " l.locale_id IN (" . $group . ") " : ''; $sql_a .= " AND e.event_status != 'D' "; $sql_a .= ") UNION ("; } $sql_a .= "SELECT a.*, e.id event_id, e.event_name, checked_in FROM " . EVENTS_ATTENDEE_TABLE . " a "; $sql_a .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id "; if (!empty($_REQUEST['category_id'])) { $sql_a .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id "; $sql_a .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = r.cat_id "; } $sql_a .= !empty($_REQUEST['category_id']) ? " AND c.id = '" . $_REQUEST['category_id'] . "' " : ''; $sql_clause = " WHERE "; if (!empty($_REQUEST['payment_status'])) { $sql_a .= " {$sql_clause} a.payment_status = '" . $_REQUEST['payment_status'] . "' "; $sql_clause = " AND "; } if (!empty($_POST['month_range'])) { $pieces = explode('-', $_REQUEST['month_range'], 3); $year_r = $pieces[0]; $month_r = $pieces[1]; $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-31', $format = 'Y-m-d') . "' "; $sql_clause = " AND "; } if (!empty($_REQUEST['event_id'])) { $sql_a .= " {$sql_clause} a.event_id = '" . $_REQUEST['event_id'] . "' "; $sql_clause = " AND "; } if (!empty($_REQUEST['today_a'])) { //$sql_a .= " $sql_clause a.date = '" . event_espresso_no_format_date($curdate,$format = 'Y-m-d') ."' "; $sql_a .= " {$sql_clause} a.date BETWEEN '" . $curdate . ' 00:00:00' . "' AND '" . $curdate . ' 23:59:59' . "' "; $sql_clause = " AND "; } if (!empty($_REQUEST['this_month_a'])) { $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' "; $sql_clause = " AND "; } if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql_a .= $sql_clause . " e.wp_user = '******'id') . "' "; } $sql_a .= " {$sql_clause} e.event_status != 'D' "; $sql_a .= ") ORDER BY date DESC, id ASC "; $attendees = $wpdb->get_results($sql_a); //echo $sql_a; $total_attendees = $wpdb->num_rows; $quantity = 0; $attendees_group = ''; if ($total_attendees > 0) { foreach ($attendees as $attendee) { /** 09-07-11 Edit Seth Removing the grouping functionality to make attendees easier to manage **/ #if (isset($attendees[$i])){ //if (isset($attendees[$i])){ //$attendee = $attendees[$i]; //echo 'Reg. Id: '.$registration_id.'<br />'; $registration_id = $attendee->registration_id; $lname = $attendee->lname; $fname = $attendee->fname; $address = $attendee->address; $city = $attendee->city; $state = $attendee->state; $zip = $attendee->zip; $email = '<span style="visibility:hidden">' . $attendee->email . '</span>'; $phone = $attendee->phone; $quantity = $attendee->quantity > 1 ? '<br />(' . __('Total Attendees', 'event_espresso') . ': ' . $attendee->quantity . ')' : ''; //if ($temp_reg_id == '') { $id = $attendee->id; //$temp_reg_id = $registration_id; //echo 'Temp Reg. Id: '.$registration_id.'<br />'; $attended = $attendee->checked_in; $ticket_scanned = $attendee->checked_in_quantity; $amount_pd = $attendee->amount_pd; $payment_status = $attendee->payment_status; $payment_date = $attendee->payment_date; $date = $attendee->date; $event_id = $attendee->event_id; $coupon_code = $attendee->coupon_code; $txn_id = $attendee->txn_id; $txn_type = $attendee->txn_type; $price_option = $attendee->price_option; $event_time = $attendee->event_time; $event_name = $attendee->event_name; $event_date = $attendee->start_date; ?> <tr> <td class="check-column" style="padding:7px 0 22px 7px; vertical-align:top;"><input name="checkbox[<?php echo $id; ?> ]" type="checkbox" title="Delete <?php echo $fname; echo $lname; ?> "></td> <td class="row-title" nowrap="nowrap"><a href="admin.php?page=events&event_admin_reports=edit_attendee_record&event_id=<?php echo $event_id; ?> &registration_id=<?php echo $registration_id; ?> &form_action=edit_attendee&id=<?php echo $id; ?> " title="<?php echo 'ID#:' . $id . ' [ REG#: ' . $registration_id . ' ]'; ?> "><?php echo $fname; ?> <?php echo $lname; ?> <?php /*?><ul> <?php echo $attendees_group ?> </ul><?php */ ?> </a></td> <td nowrap="nowrap"><?php echo $registration_id; ?> </td> <td class="date column-date"><?php echo event_date_display($date, get_option('date_format') . ' g:i a'); ?> </td> <td nowrap="nowrap"><a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php echo $event_id; ?> " title="<?php _e('View attendees for this event', 'event_espresso'); ?> "><?php echo stripslashes_deep($event_name); ?> </a></td> <td nowrap="nowrap"><?php echo event_date_display($event_time, get_option('time_format')); ?> </td> <?php if ($ticketing_installed == true) { ?> <td nowrap="nowrap"><p style="padding-left:15px"><?php echo $attended == 1 || $ticket_scanned >= 1 ? event_espresso_paid_status_icon('Checkedin') : event_espresso_paid_status_icon('NotCheckedin'); ?> </p></td> <?php } ?> <td nowrap="nowrap"><?php echo $price_option; ?> </td> <td class="date column"><a href="admin.php?page=events&attendee_pay=paynow&form_action=payment&registration_id=<?php echo $registration_id; ?> &event_admin_reports=enter_attendee_payments&event_id=<?php echo $event_id; ?> " title="<?php _e('Edit Payment', 'event_espresso'); ?> ID: <?php echo $registration_id; ?> "> <p style="padding-left:17px"><?php event_espresso_paid_status_icon($payment_status); ?> </p> </a> <?php /*?><a href="admin.php?page=events&attendee_pay=paynow&form_action=payment&registration_id=<?php echo $temp_reg_id ?>&event_admin_reports=enter_attendee_payments&event_id=<?php echo $event_id ?>" title="<?php _e('Edit Payment', 'event_espresso'); ?> ID: <?php echo $temp_reg_id ?>"><?php //echo $org_options['currency_symbol'] ?><?php //echo $total_amount_pd ?></a><?php */ ?> </td> <td class="date column-date"><?php echo espresso_payment_type($txn_type); ?> </td> <td class="date column-date"><?php echo $coupon_code; ?> </td> <td class="date column-date"><?php echo $txn_id; ?> </td> <td class="date column-date" > <a href="admin.php?page=events&attendee_pay=paynow&form_action=payment&registration_id=<?php echo $registration_id; ?> &event_admin_reports=enter_attendee_payments&event_id=<?php echo $event_id; ?> " title="<?php _e('Edit Payment', 'event_espresso'); ?> ID: <?php echo $registration_id; ?> "><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/money.png" width="16" height="16" alt="<?php _e('Edit Payment', 'event_espresso'); ?> " /></a> <a href="admin.php?page=events&event_admin_reports=edit_attendee_record&registration_id=<?php echo $registration_id; ?> &event_id=<?php echo $event_id; ?> &form_action=edit_attendee" title="<?php _e('Edit Attendee', 'event_espresso'); ?> "><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/user_edit.png" width="16" height="16" alt="<?php _e('Edit Attendee', 'event_espresso'); ?> " /></a> <a href="admin.php?page=events&event_admin_reports=resend_email&registration_id=<?php echo $registration_id; ?> &event_id=<?php echo $event_id; ?> &form_action=resend_email" title="<?php _e('Resend Registration Details', 'event_espresso'); ?> "><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/email_link.png" width="16" height="16" alt="<?php _e('Resend Registration Details', 'event_espresso'); ?> " /></a> <a href="<?php echo home_url(); ?> /?download_invoice=true&admin=true&registration_id=<?php echo $registration_id; ?> " target="_blank" title="<?php _e('Download Invoice', 'event_espresso'); ?> "><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/page_white_acrobat.png" width="16" height="16" alt="<?php _e('Download Invoice', 'event_espresso'); ?> " /></a> <?php if ($org_options["use_attendee_pre_approval"] == "Y") { ?> <br/> <a href="admin.php?page=events&attendee_pay=paynow&form_action=payment&registration_id=<?php echo $registration_id; ?> &event_admin_reports=enter_attendee_payments&event_id=<?php echo $event_id; ?> " title="<?php _e('Edit Payment', 'event_espresso'); ?> ID: <?php echo $registration_id; ?> "> <?php if (is_attendee_approved($event_id, $id)) { ?> <strong> <?php _e('Approved', 'event_espresso'); ?> </strong><br/> <?php } else { ?> <span style="color:#FF0000"><strong> <?php _e('Awaiting approval', 'event_espresso'); ?> </strong></span> <?php } ?> </a> <?php } ?> </td> </tr> <?php $temp_reg_id = $registration_id; $registration_id = ''; } } ?> </tbody> </table> <div style="clear:both; margin-bottom:30px;"> <input name="delete_customer" type="submit" class="button-secondary" id="delete_customer" value="<?php _e('Delete Attendee(s)', 'event_espresso'); ?> " style="margin:10px 0 0 0;" onclick="return confirmDelete();" /> <?php if ($ticketing_installed == true) { ?> <input name="attended_customer" type="submit" class="button-secondary" id="attended_customer" value="<?php _e('Mark as Attended', 'event_espresso'); ?> " style="margin:10px 0 0 10px;" /> <input name="unattended_customer" type="submit" class="button-secondary" id="attended_customer" value="<?php _e('Unmark as Attended', 'event_espresso'); ?> " style="margin:10px 0 0 10px;" /> <?php } ?> <a style="margin-left:5px" class="button-primary" href="admin.php?page=events&action=csv_import"> <?php _e('Import CSV', 'event_espresso'); ?> </a> <a class="button-primary" style="margin-left:5px" href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&event_id=" . $_REQUEST['event_id'] . "&export=report&action=payment&type=excel"; echo $_REQUEST['event_id'] == '' ? '&all_events=true' : ''; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "> <?php _e('Export to Excel', 'event_espresso'); ?> </a> <?php echo isset($_REQUEST['event_id']) ? '<a style="margin-left:5px" class="button-primary" href="admin.php?page=events&event_admin_reports=add_new_attendee&event_id=' . $_REQUEST['event_id'] . '">' . __('Add Attendee', 'event_espresso') . '</a>' : ''; ?> <?php echo isset($_REQUEST['event_id']) ? '<a style="margin-left:5px" class="button-primary" href="admin.php?page=events&action=edit&event_id=' . $_REQUEST['event_id'] . '">' . __('Edit Event', 'event_espresso') . '</a>' : ''; ?> </div> </form> <h4 style="clear:both"><?php _e('Legend', 'event_espresso'); ?> </h4> <dl style="float:left; margin-left:10px; width:200px"> <dt><?php event_espresso_paid_status_icon('Completed'); ?> - <?php _e('Completed', 'event_espresso'); ?> </dt> <dt><?php event_espresso_paid_status_icon('Incomplete'); ?> - <?php _e('Incomplete', 'event_espresso'); ?> </dt> <dt><?php event_espresso_paid_status_icon('Pending'); ?> - <?php _e('Pending', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/money.png" width="16" height="16" alt="<?php _e('Payment Details', 'event_espresso'); ?> " /> - <?php _e('Payment Details', 'event_espresso'); ?> </dt> </dl> <dl style="float:left; margin-left:10px; width:200px"> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/email_link.png" width="16" height="16" alt="<?php _e('Resend Details', 'event_espresso'); ?> " /> - <?php _e('Resend Email', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/page_white_acrobat.png" width="16" height="16" alt="<?php _e('Download Invoice', 'event_espresso'); ?> " /> - <?php _e('Download Invoice', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/user_edit.png" width="16" height="16" alt="<?php _e(' Attendee Details', 'event_espresso'); ?> " /> - <?php _e('Attendee Details', 'event_espresso'); ?> </dt> </dl> <script> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "sDom": 'Clfrtip', "bAutoWidth": false, "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong> (eg, email, txn id, event, etc.)", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ { "bSortable": false }, null, <?php echo $ticketing_installed == true ? 'null,' : ''; ?> null, null, null, null, null, null, null, null, null, { "bSortable": false } ], "aoColumnDefs": [ { "bVisible": false, "aTargets": [ <?php if (isset($_REQUEST['event_id'])) { echo '4,'; } else { echo '2,'; } ?> <?php echo $ticketing_installed == true ? '10,11' : '9,10'; ?> ] } ], "oColVis": { "aiExclude": [ 0, 1], "buttonText": "Filter: Show / Hide Columns", "bRestore": true }, }); }); </script> <?php }