Example #1
0
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     if (isset($_GET['product_ids']) && is_array($_GET['product_ids'])) {
         $this->productIds = array_filter(array_map('absint', $_GET['product_ids']));
     } elseif (isset($_GET['product_ids'])) {
         $this->productIds = explode(',', $_GET['product_ids']);
         $this->productIds = array_filter(array_map('absint', $this->productIds));
     }
     // Prepare data for report
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin'));
         Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin'), array('in_footer' => true));
         Scripts::add('jigoshop.admin.reports.widget.product_search', \JigoshopInit::getUrl() . '/assets/js/admin/reports/widget/product_search.js', array('jquery', 'jigoshop.vendors.select2', 'jigoshop.helpers.ajax_search'), array('in_footer' => true));
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }
Example #2
0
 /**
  * @param Wordpress $wp
  * @param Options   $options
  * @param string    $currentRange
  */
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     if (isset($_GET['show_categories'])) {
         if (in_array(-1, $_GET['show_categories'])) {
             $allCategories = get_terms('product_category', array('orderby' => 'name', 'hide_empty' => false));
             $this->showCategories = array_map(function ($category) {
                 return $category->term_id;
             }, $allCategories);
         } else {
             $this->showCategories = is_array($_GET['show_categories']) ? array_map('absint', $_GET['show_categories']) : array(absint($_GET['show_categories']));
         }
     } else {
         $this->showCategories = $this->getLastCategoryID();
     }
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin.reports'));
         Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin.reports'), array('in_footer' => true));
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }
Example #3
0
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }
Example #4
0
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     // Prepare data for report
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin.reports'));
         Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin.reports'), array('in_footer' => true));
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }