Beispiel #1
0
 public function settings_tab_controller($tab)
 {
     if ($tab == 'reports') {
         fue_settings_header($tab);
         echo FUE_Reports::settings_main();
         fue_settings_footer();
     } elseif ($tab == 'reportview') {
         fue_settings_header($tab);
         echo FUE_Reports::reportview_html();
         fue_settings_footer();
     } elseif ($tab == 'reportuser_view') {
         fue_settings_header($tab);
         echo FUE_Reports::user_view_html();
         fue_settings_footer();
     } elseif ($tab == 'emailopen_view') {
         fue_settings_header($tab);
         echo FUE_Reports::email_open_html($_GET['eid'], $_GET['ename']);
         fue_settings_footer();
     } elseif ($tab == 'linkclick_view') {
         fue_settings_header($tab);
         echo FUE_Reports::link_click_html($_GET['eid'], $_GET['ename']);
         fue_settings_footer();
     } elseif ($tab == 'dbg_queue') {
         FUE_Reports::queue();
     }
 }
Beispiel #2
0
 /**
  * Settings controller
  *
  * @param string $tab The active tab
  */
 public function settings_tab_controller($tab)
 {
     global $wpdb;
     if ($tab == 'coupons') {
         fue_settings_header($tab);
         FUE_Coupons::settings_main();
         fue_settings_footer();
     } elseif ($tab == 'new-coupon') {
         fue_settings_header($tab);
         FUE_Coupons::coupon_form_html();
         fue_settings_footer();
     } elseif ($tab == 'edit-coupon') {
         fue_settings_header($tab);
         FUE_Coupons::coupon_form_html();
         fue_settings_footer();
     }
 }
 function settings()
 {
     global $wpdb, $woocommerce;
     $tab = isset($_GET['tab']) ? $_GET['tab'] : 'list';
     if ($tab == 'list') {
         $generics = $this->get_emails('generic');
         $categories = $this->get_emails('category');
         $products = $this->get_emails('product');
         $signups = $this->get_emails('signup');
         $manual = $this->get_emails('manual');
         $customers = $this->get_emails('customer');
         $reminders = $this->get_emails('reminder');
         fue_settings_header($tab);
         include FUE_TEMPLATES_DIR . '/emails_list.php';
         fue_settings_footer();
         if (false == get_option('fue_installed_tables', false)) {
             $this->update_db();
         }
         if (false === wp_next_scheduled('sfn_followup_emails')) {
             wp_schedule_event(time(), 'minute', 'sfn_followup_emails');
         }
         if (false === wp_next_scheduled('sfn_optimize_tables')) {
             wp_schedule_event(time(), 'weekly', 'sfn_optimize_tables');
         }
     } elseif ($tab == 'new') {
         // load the categories
         $categories = get_terms('product_cat', array('order_by' => 'name', 'order' => 'ASC'));
         fue_settings_header($tab);
         include FUE_TEMPLATES_DIR . '/new_email.php';
         fue_settings_footer();
     } elseif ($tab == 'edit') {
         $id = $_GET['id'];
         $email = $wpdb->get_row($wpdb->prepare("SELECT * FROM `{$wpdb->prefix}followup_emails` WHERE `id` = %d", $id));
         $product = false;
         if ($email->product_id != 0) {
             $product = sfn_get_product($email->product_id);
         }
         // load the categories
         $categories = get_terms('product_cat');
         if (!$email) {
             wp_die("The requested data could not be found!");
         }
         fue_settings_header($tab);
         include FUE_TEMPLATES_DIR . '/edit_email.php';
         fue_settings_footer();
     } elseif ($tab == 'send') {
         $id = $_GET['id'];
         $email = $wpdb->get_row($wpdb->prepare("SELECT * FROM `{$wpdb->prefix}followup_emails` WHERE `id` = %d AND `email_type` = 'manual'", $id));
         $categories = get_terms('product_cat', array('order_by' => 'name', 'order' => 'ASC'));
         if (!$email) {
             wp_die("The requested data could not be found!");
         }
         fue_settings_header($tab);
         include FUE_TEMPLATES_DIR . '/send_manual.php';
         fue_settings_footer();
     } elseif ($tab == 'delete') {
         $id = $_GET['id'];
         // delete
         $wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}followup_email_orders` WHERE `email_id` = %d", $id));
         $wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}followup_emails` WHERE `id` = %d", $id));
         wp_redirect('admin.php?page=wc-followup-emails&tab=list&deleted=true');
         exit;
     } elseif ($tab == 'settings') {
         $pages = get_pages();
         $page = woocommerce_get_page_id('followup_unsubscribe');
         $emails = get_option('fue_daily_emails');
         $all_emails = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}followup_emails ORDER BY name ASC");
         fue_settings_header($tab);
         include FUE_TEMPLATES_DIR . '/settings.php';
         fue_settings_footer();
     } else {
         // allow add-ons to add tabs
         do_action('fue_settings_tab_controller', $tab);
         fue_settings_footer();
     }
 }
 public function settings_tab_controller($tab)
 {
     global $wpdb;
     if ($tab == 'coupons') {
         fue_settings_header($tab);
         FUE_Coupons::settings_main();
         fue_settings_footer();
     } elseif ($tab == 'new-coupon') {
         fue_settings_header($tab);
         FUE_Coupons::new_coupon_html();
         fue_settings_footer();
     } elseif ($tab == 'edit-coupon') {
         fue_settings_header($tab);
         FUE_Coupons::edit_coupon_html();
         fue_settings_footer();
     } elseif ($tab == 'delete-coupon') {
         $id = $_GET['id'];
         // delete
         $wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}followup_coupons` WHERE `id` = %d", $id));
         wp_redirect('admin.php?page=wc-followup-emails&tab=coupons&coupon_deleted=true');
         exit;
     }
 }
 function settings()
 {
     global $wpdb, $woocommerce;
     $tab = isset($_GET['tab']) ? $_GET['tab'] : 'list';
     if ($tab == 'list') {
         $generics = $this->get_emails('generic');
         $categories = $this->get_emails('category');
         $products = $this->get_emails('product');
         $signups = $this->get_emails('signup');
         fue_settings_header($tab);
         include FUE_TEMPLATES_DIR . '/emails_list.php';
         fue_settings_footer();
     } elseif ($tab == 'new') {
         // load the categories
         $categories = get_terms('product_cat', array('order_by' => 'name', 'order' => 'ASC'));
         fue_settings_header($tab);
         include FUE_TEMPLATES_DIR . '/new_email.php';
         fue_settings_footer();
     } elseif ($tab == 'edit') {
         $id = $_GET['id'];
         $email = $wpdb->get_row($wpdb->prepare("SELECT * FROM `{$wpdb->prefix}followup_emails` WHERE `id` = %d", $id));
         $product = false;
         if ($email->product_id != 0) {
             $product = sfn_get_product($email->product_id);
         }
         // load the categories
         $categories = get_terms('product_cat');
         if (!$email) {
             wp_die("The requested data could not be found!");
         }
         fue_settings_header($tab);
         include FUE_TEMPLATES_DIR . '/edit_email.php';
         fue_settings_footer();
     } elseif ($tab == 'delete') {
         $id = $_GET['id'];
         // delete
         $wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}followup_email_orders` WHERE `email_id` = %d", $id));
         $wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}followup_emails` WHERE `id` = %d", $id));
         wp_redirect('admin.php?page=wc-followup-emails&tab=list&deleted=true');
         exit;
     } elseif ($tab == 'settings') {
         $pages = get_pages();
         $page = woocommerce_get_page_id('followup_unsubscribe');
         $emails = get_option('fue_daily_emails');
         fue_settings_header($tab);
         include FUE_TEMPLATES_DIR . '/settings.php';
         fue_settings_footer();
     } else {
         // allow add-ons to add tabs
         do_action('fue_settings_tab_controller', $tab);
         fue_settings_footer();
     }
 }