public static function display_activity_data() { $the_activity = new WC_CRM_Activity($_REQUEST['log_id']); $date = date("d F Y", strtotime($the_activity->created)); $time = date("H:i:s", strtotime($the_activity->created)); ?> <div class="wrap wc-crm-page-logs-view" id="wc-crm-page"> <?php if ($the_activity->activity_type == 'email') { $file = 'views/html-activity-email.php'; $title = __('Email Details', 'wc_crm'); } else { if ($the_activity->activity_type == 'phone call') { $file = 'views/html-activity-phone-call.php'; $title = __('Call Details', 'wc_crm'); } } ?> <h2><?php echo $title; ?> </h2> <?php wc_crm_print_notices(); ?> <form method="post"> <input type="hidden" name="page" value="<?php echo WC_CRM_TOKEN; ?> "> <?php include_once $file; ?> </form> </div> <?php }
/** * Add group admin panel * * Shows the interface for adding new groups */ public static function add_group() { if (wc_crm_notice_count('error') == 0) { $_POST = array(); } // Grab the submitted data $group_name = isset($_POST['group_name']) ? (string) stripslashes($_POST['group_name']) : ''; $group_slug = isset($_POST['group_slug']) ? wc_sanitize_taxonomy_name(stripslashes((string) $_POST['group_slug'])) : ''; $group_type = isset($_POST['group_type']) ? (string) stripslashes($_POST['group_type']) : ''; $group_total_spent_mark = isset($_POST['group_total_spent_mark']) ? (string) stripslashes($_POST['group_total_spent_mark']) : ''; $group_total_spent = isset($_POST['group_total_spent']) ? (string) stripslashes($_POST['group_total_spent']) : ''; $group_user_role = isset($_POST['group_user_role']) ? (string) stripslashes($_POST['group_user_role']) : ''; $group_customer_status = isset($_POST['group_customer_status']) ? $_POST['group_customer_status'] : array(); $group_product_categories = isset($_POST['group_product_categories']) ? $_POST['group_product_categories'] : array(); $group_order_status = isset($_POST['group_order_status']) ? $_POST['group_order_status'] : array(); $group_last_order = isset($_POST['group_last_order']) ? (string) stripslashes($_POST['group_last_order']) : ''; $group_last_order_from = isset($_POST['group_last_order_from']) ? (string) stripslashes($_POST['group_last_order_from']) : ''; $group_last_order_to = isset($_POST['group_last_order_to']) ? (string) stripslashes($_POST['group_last_order_to']) : ''; ?> <div class="wrap woocommerce"> <div class="icon32 icon32-groups" id="icon-woocommerce"><br/></div> <h2><?php _e('Customer Groups', 'woocommerce'); ?> </h2> <?php wc_crm_print_notices(); ?> <br class="clear" /> <div id="col-container"> <div id="col-right"> <div class="col-wrap"> <form action="admin.php?page=wc_crm-groups" method="post"> <?php WC_CRM()->tables['groups']->prepare_items(); WC_CRM()->tables['groups']->display(); ?> </form> </div> </div> <div id="col-left"> <div class="col-wrap"> <div class="form-wrap"> <h3><?php _e('Add New group', 'wc_crm'); ?> </h3> <p><?php _e('Groups are used to organise your customers. Please Note: you cannot rename a group later.', 'wc_crm'); ?> </p> <form action="admin.php?page=wc_crm-groups" method="post" style=" padding-bottom: 150px;"> <div class="form-field"> <label for="f_group_name"><?php _e('Name', 'woocommerce'); ?> </label> <input name="group_name" id="f_group_name" type="text" value="<?php echo $group_name; ?> " /> <p class="description"><?php _e('Name for the group.', 'wc_crm'); ?> </p> </div> <div class="form-field"> <label for="f_group_slug"><?php _e('Slug', 'woocommerce'); ?> </label> <input name="group_slug" id="f_group_slug" type="text" value="<?php echo $group_slug; ?> " maxlength="28" /> <p class="description"><?php _e('Unique slug/reference for the group; must be shorter than 28 characters.', 'wc_crm'); ?> </p> </div> <div class="form-field"> <label for="f_group_type"><?php _e('Type', 'wc_crm'); ?> </label> <select name="group_type" id="f_group_type"> <option value="dynamic" <?php selected($group_type, 'dynamic'); ?> ><?php _e('Dynamic', 'wc_crm'); ?> </option> <option value="static" <?php selected($group_type, 'static'); ?> ><?php _e('Static', 'wc_crm'); ?> </option> <?php do_action('wc_crm_customer_group_types'); ?> </select> <p class="description"><?php _e('Determines how you select group for customers.', 'wc_crm'); ?> </p> </div> <div class="form-field dynamic_group_type"> <label for="group_total_spent"><?php _e('Total Spent', 'wc_crm'); ?> </label> <select name="group_total_spent_mark" id="group_total_spent_mark"> <option value="equal" <?php selected($group_total_spent_mark, 'equal'); ?> ><?php _e('=', 'wc_crm'); ?> </option> <option value="greater" <?php selected($group_total_spent_mark, 'greater'); ?> ><?php _e('>', 'wc_crm'); ?> </option> <option value="less" <?php selected($group_total_spent_mark, 'less'); ?> ><?php _e('<', 'wc_crm'); ?> </option> <option value="greater_or_equal" <?php selected($group_total_spent_mark, 'greater_or_equal'); ?> ><?php _e('≥', 'wc_crm'); ?> </option> <option value="less_or_equal" <?php selected($group_total_spent_mark, 'less_or_equal'); ?> ><?php _e('≤', 'wc_crm'); ?> </option> </select> <input type="number" step="any" id="group_total_spent" name="group_total_spent" value="<?php echo $group_total_spent; ?> "> </div> <div class="form-field dynamic_group_type"> <label for="group_user_role"><?php _e('User Role', 'wc_crm'); ?> </label> <select name="group_user_role" id="group_user_role" class="wc-enhanced-select"> <option value="any"> <?php _e('Any', 'wc_crm'); ?> </option> <option value="guest"> <?php _e('Guest', 'wc_crm'); ?> </option> <?php global $wp_roles; foreach ($wp_roles->role_names as $role => $name) { ?> <option value="<?php echo strtolower($name); ?> " <?php selected($group_user_role, strtolower($name)); ?> > <?php _e($name, 'wc_crm'); ?> </option> <?php } ?> </select> </div> <div class="form-field dynamic_group_type"> <label for="group_customer_status"><?php _e('Customer Status', 'wc_crm'); ?> </label> <select name="group_customer_status[]" id="group_customer_status" multiple="multiple" data-placeholder="<?php _e('Choose a Customer Status...', 'wc_crm'); ?> " class="wc-enhanced-select"> <?php $statuses = wc_crm_get_statuses(); foreach ($statuses as $status) { ?> <option value="<?php echo strtolower($status->status_slug); ?> " <?php echo in_array(strtolower($status->status_slug), $group_customer_status) ? 'selected="selected"' : ''; ?> > <?php echo $status->status_name; ?> </option> <?php } ?> </select> </div> <div class="form-field dynamic_group_type"> <label for="group_product_categories"><?php _e('Product Category', 'wc_crm'); ?> </label> <select name="group_product_categories[]" id="group_product_categories" multiple="multiple" data-placeholder="<?php _e('Choose a Product Category...', 'wc_crm'); ?> " class="wc-enhanced-select"> <?php $all_cat = get_terms(array('product_cat'), array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false)); if (!empty($all_cat)) { foreach ($all_cat as $cat) { ?> <option value="<?php echo $cat->term_id; ?> " <?php echo in_array($cat->term_id, $group_product_categories) ? 'selected="selected"' : ''; ?> > <?php echo $cat->name; ?> </option> <?php } } ?> </select> </div> <div class="form-field dynamic_group_type"> <label for="group_order_status"><?php _e('Order Status', 'wc_crm'); ?> </label> <select name="group_order_status[]" id="group_order_status" multiple="multiple" data-placeholder="<?php _e('Choose a Product Category...', 'wc_crm'); ?> " class="wc-enhanced-select"> <?php $wc_statuses = wc_get_order_statuses(); if (!empty($wc_statuses)) { foreach ($wc_statuses as $key => $status_name) { ?> <option value="<?php echo $key; ?> " <?php echo in_array($key, $group_order_status) ? 'selected="selected"' : ''; ?> > <?php echo $status_name; ?> </option> <?php } } ?> </select> </div> <div class="form-field dynamic_group_type"> <label for="group_last_order"><?php _e('Last Order', 'wc_crm'); ?> </label> <div class="wrap_date"> <select name="group_last_order" id="group_last_order"> <option value="between" <?php selected($group_last_order, 'between'); ?> ><?php _e('Between', 'wc_crm'); ?> </option> <option value="before" <?php selected($group_last_order, 'before'); ?> ><?php _e('Before', 'wc_crm'); ?> </option> <option value="after" <?php selected($group_last_order, 'after'); ?> ><?php _e('After', 'wc_crm'); ?> </option> </select> </div> <div class="wrap_date"> <input type="text" id="group_last_order_from" name="group_last_order_from" value="<?php echo $group_last_order_from; ?> "> <i class="ico_calendar"></i> </div> <div class="wrap_date group_last_order_between" style="height: 30px; line-height: 30px; padding: 0 10px;"> to </div> <div class="wrap_date group_last_order_between"> <input type="text" id="group_last_order_to" name="group_last_order_to" value="<?php echo $group_last_order_to; ?> "> <i class="ico_calendar"></i> </div> <div class="clear"></div> </div> <p class="submit"><input type="submit" name="wc_crm_add_new_group" id="submit" class="button" value="<?php _e('Add group', 'wc_crm'); ?> "></p> <?php wp_nonce_field('wc-crm-add-new-group'); ?> </form> </div> </div> </div> </div> <script type="text/javascript"> /* <![CDATA[ */ jQuery('a.delete').click(function(){ var answer = confirm ("<?php _e('Are you sure you want to delete this group?', 'wc_crm'); ?> "); if (answer) return true; return false; }); /* ]]> */ </script> </div> <?php }
public static function output() { add_action('wc_crm_restrict_list_customers', 'WC_CRM_Screen_Customer_Filters::restrict_list_customers'); echo '<div class="wrap" id="wc-crm-page">'; self::page_title(); $group = ''; if (isset($_REQUEST['group']) && !empty($_REQUEST['group']) && $_REQUEST['group'] > 0) { $group = '&group=' . $_REQUEST['group']; } ?> <?php wc_crm_print_notices(); ?> <form method="get" id="wc_crm_customers_form" action=""> <input type="hidden" name="page" value="<?php echo WC_CRM_TOKEN; ?> "> <?php $customers_table = WC_CRM()->tables['customers']; $customers_table->views(); ?> <p class="search-box"> <?php $ss = ''; if (!empty($_GET['s'])) { $ss = $_GET['s']; } ?> <label for="post-search-input" class="screen-reader-text"><?php _e('Search', 'wc_crm'); ?> </label> <input type="search" value="<?php echo $ss; ?> " name="s" id="post-search-input"> <input type="submit" value="<?php _e('Search Customers', 'wc_crm'); ?> " class="button" id="search-submit" name=""> </p> <?php $customers_table->prepare_items(); $customers_table->display(); ?> </form> <div id="customer_notes_popup" class="overlay_media_popup"> <div class="media-modal wp-core-ui"> <a href="#" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text">Close</span></span></a> <div class="media-modal-content"> <div class="media-frame mode-select wp-core-ui hide-menu"> <div class="media-frame-title"><h1>Customer Notes</h1></div> <div class="media-frame-content"> <iframe src="" frameborder="0"></iframe> </div> </div> </div> </div> <div class="media-modal-backdrop"></div> </div> </div> <?php }
public static function output($id = 0) { global $the_customer, $thepostid, $post; if ($id > 0) { $thepostid = $id; } else { $thepostid = 'new'; } $the_customer = new WC_CRM_Customer($id); $post_type = 'crm_customers'; do_action('add_meta_boxes', $post_type, $the_customer); do_action('add_meta_boxes_' . $post_type, $the_customer); do_action('do_meta_boxes', $post_type, 'normal', $the_customer); /** This action is documented in wp-admin/edit-form-advanced.php */ do_action('do_meta_boxes', $post_type, 'advanced', $the_customer); /** This action is documented in wp-admin/edit-form-advanced.php */ do_action('do_meta_boxes', $post_type, 'side', $the_customer); $title = __('Edit Customer ', 'wc_crm'); if ($the_customer->user_id == 0) { $title .= ' (' . __('Guest', 'wc_crm') . ')'; } if ($id == 0) { $title = __('Add New Customer', 'wc_crm'); } ?> <div class="wrap"> <h1><?php echo $title; ?> <a class="add-new-h2" href="admin.php?page=<?php echo WC_CRM_TOKEN; ?> -new-customer"><?php _e('Add Customer', 'wc_crm'); ?> </a></h1> <?php wc_crm_print_notices(); ?> <form id="wc_crm_edit_customer_form" method="post"> <?php if ($id > 0) { ?> <input type="hidden" id="customer_id" name="customer_id" value="<?php echo $the_customer->customer_id; ?> "> <input type="hidden" id="user_id" name="user_id" value="<?php echo $the_customer->user_id; ?> "> <input type="hidden" id="order_id" name="order_id" value="<?php echo $the_customer->order_id; ?> "> <?php } ?> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2"> <div id="postbox-container-1" class="postbox-container"> <div class="meta-box-sortables"> <?php include_once 'views/html-customer-actions.php'; ?> <?php include_once 'views/html-customer-groups.php'; ?> <?php if ($the_customer->customer_id > 0) { include_once 'views/html-customer-notes.php'; } ?> </div> <?php do_meta_boxes($post_type, 'side', $the_customer); ?> </div> <div id="postbox-container-2" class="postbox-container"> <div class="meta-box-sortables"> <?php include_once 'views/html-customer-details.php'; ?> <?php if ($id > 0) { ?> <?php include_once 'views/html-customer-orders.php'; ?> <?php include_once 'views/html-customer-activity.php'; ?> <?php include_once 'views/html-customer-products-purchased.php'; ?> <?php } ?> </div> <?php do_meta_boxes($post_type, 'normal', $the_customer); do_meta_boxes($post_type, 'advanced', $the_customer); ?> </div> </div> </div> </form> </div> <?php }