public function renderKpis()
 {
     $time = time();
     $kpis = array();
     /* The data generation is located in AdminStatsControllerCore */
     $helper = new HelperKpi();
     $helper->id = 'box-pending-messages';
     $helper->icon = 'icon-envelope';
     $helper->color = 'color1';
     $helper->href = $this->context->link->getAdminLink('AdminCustomerThreads');
     $helper->title = $this->l('Pending Discussion Threads', null, null, false);
     if (ConfigurationKPI::get('PENDING_MESSAGES') !== false) {
         $helper->value = ConfigurationKPI::get('PENDING_MESSAGES');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=pending_messages';
     $helper->refresh = (bool) (ConfigurationKPI::get('PENDING_MESSAGES_EXPIRE') < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-age';
     $helper->icon = 'icon-time';
     $helper->color = 'color2';
     $helper->title = $this->l('Average Response Time', null, null, false);
     $helper->subtitle = $this->l('30 days', null, null, false);
     if (ConfigurationKPI::get('AVG_MSG_RESPONSE_TIME') !== false) {
         $helper->value = ConfigurationKPI::get('AVG_MSG_RESPONSE_TIME');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=avg_msg_response_time';
     $helper->refresh = (bool) (ConfigurationKPI::get('AVG_MSG_RESPONSE_TIME_EXPIRE') < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-messages-per-thread';
     $helper->icon = 'icon-copy';
     $helper->color = 'color3';
     $helper->title = $this->l('Messages per Thread', null, null, false);
     $helper->subtitle = $this->l('30 day', null, null, false);
     if (ConfigurationKPI::get('MESSAGES_PER_THREAD') !== false) {
         $helper->value = ConfigurationKPI::get('MESSAGES_PER_THREAD');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=messages_per_thread';
     $helper->refresh = (bool) (ConfigurationKPI::get('MESSAGES_PER_THREAD_EXPIRE') < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpiRow();
     $helper->kpis = $kpis;
     return $helper->generate();
 }
Пример #2
0
    public function displayAjaxGetKpi()
    {
        $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
        switch (Tools::getValue('kpi')) {
            case 'conversion_rate':
                $visitors = AdminStatsController::getVisits(true, date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day')), false);
                $orders = AdminStatsController::getOrders(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day')), false);
                // $data = array();
                // $from = strtotime(date('Y-m-d 00:00:00', strtotime('-31 day')));
                // $to = strtotime(date('Y-m-d 23:59:59', strtotime('-1 day')));
                // for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date))
                // if (isset($visitors[$date]) && $visitors[$date])
                // $data[$date] = round(100 * ((isset($orders[$date]) && $orders[$date]) ? $orders[$date] : 0) / $visitors[$date], 2);
                // else
                // $data[$date] = 0;
                $visits_sum = $visitors;
                //array_sum($visitors);
                $orders_sum = $orders;
                //array_sum($orders);
                if ($visits_sum) {
                    $value = round(100 * $orders_sum / $visits_sum, 2);
                } elseif ($orders_sum) {
                    $value = '&infin;';
                } else {
                    $value = 0;
                }
                $value .= '%';
                // ConfigurationKPI::updateValue('CONVERSION_RATE_CHART', Tools::jsonEncode($data));
                ConfigurationKPI::updateValue('CONVERSION_RATE', $value);
                ConfigurationKPI::updateValue('CONVERSION_RATE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
                break;
            case 'abandoned_cart':
                $value = AdminStatsController::getAbandonedCarts(date('Y-m-d H:i:s', strtotime('-2 day')), date('Y-m-d H:i:s', strtotime('-1 day')));
                ConfigurationKPI::updateValue('ABANDONED_CARTS', $value);
                ConfigurationKPI::updateValue('ABANDONED_CARTS_EXPIRE', strtotime('+1 hour'));
                break;
            case 'installed_modules':
                $value = AdminStatsController::getInstalledModules();
                ConfigurationKPI::updateValue('INSTALLED_MODULES', $value);
                ConfigurationKPI::updateValue('INSTALLED_MODULES_EXPIRE', strtotime('+2 min'));
                break;
            case 'disabled_modules':
                $value = AdminStatsController::getDisabledModules();
                ConfigurationKPI::updateValue('DISABLED_MODULES', $value);
                ConfigurationKPI::updateValue('DISABLED_MODULES_EXPIRE', strtotime('+2 min'));
                break;
            case 'update_modules':
                $value = AdminStatsController::getModulesToUpdate();
                ConfigurationKPI::updateValue('UPDATE_MODULES', $value);
                ConfigurationKPI::updateValue('UPDATE_MODULES_EXPIRE', strtotime('+2 min'));
                break;
            case 'percent_product_stock':
                $value = AdminStatsController::getPercentProductStock();
                ConfigurationKPI::updateValue('PERCENT_PRODUCT_STOCK', $value);
                ConfigurationKPI::updateValue('PERCENT_PRODUCT_STOCK_EXPIRE', strtotime('+4 hour'));
                break;
            case 'product_avg_gross_margin':
                $value = AdminStatsController::getProductAverageGrossMargin();
                ConfigurationKPI::updateValue('PRODUCT_AVG_GROSS_MARGIN', $value);
                ConfigurationKPI::updateValue('PRODUCT_AVG_GROSS_MARGIN_EXPIRE', strtotime('+6 hour'));
                break;
            case 'disabled_categories':
                $value = AdminStatsController::getDisabledCategories();
                ConfigurationKPI::updateValue('DISABLED_CATEGORIES', $value);
                ConfigurationKPI::updateValue('DISABLED_CATEGORIES_EXPIRE', strtotime('+2 hour'));
                break;
            case 'disabled_products':
                $value = AdminStatsController::getDisabledProducts();
                ConfigurationKPI::updateValue('DISABLED_PRODUCTS', $value);
                ConfigurationKPI::updateValue('DISABLED_PRODUCTS_EXPIRE', strtotime('+2 hour'));
                break;
            case '8020_sales_catalog':
                $value = AdminStatsController::get8020SalesCatalog(date('Y-m-d', strtotime('-1 month')), date('Y-m-d'));
                $value = sprintf($this->l('%d%% of your Catalog'), $value);
                ConfigurationKPI::updateValue('8020_SALES_CATALOG', $value);
                ConfigurationKPI::updateValue('8020_SALES_CATALOG_EXPIRE', strtotime('+12 hour'));
                break;
            case 'empty_categories':
                $value = AdminStatsController::getEmptyCategories();
                ConfigurationKPI::updateValue('EMPTY_CATEGORIES', $value);
                ConfigurationKPI::updateValue('EMPTY_CATEGORIES_EXPIRE', strtotime('+2 hour'));
                break;
            case 'customer_main_gender':
                $value = AdminStatsController::getCustomerMainGender();
                if ($value === false) {
                    $value = $this->l('No customers', null, null, false);
                } elseif ($value['type'] == 'female') {
                    $value = sprintf($this->l('%d%% Women Customers', null, null, false), $value['value']);
                } elseif ($value['type'] == 'male') {
                    $value = sprintf($this->l('%d%% Men Customers', null, null, false), $value['value']);
                } else {
                    $value = sprintf($this->l('%d%% Neutral Customers', null, null, false), $value['value']);
                }
                ConfigurationKPI::updateValue('CUSTOMER_MAIN_GENDER', array($this->context->language->id => $value));
                ConfigurationKPI::updateValue('CUSTOMER_MAIN_GENDER_EXPIRE', array($this->context->language->id => strtotime('+1 day')));
                break;
            case 'avg_customer_age':
                $value = sprintf($this->l('%d years', null, null, false), AdminStatsController::getAverageCustomerAge(), 1);
                ConfigurationKPI::updateValue('AVG_CUSTOMER_AGE', $value);
                ConfigurationKPI::updateValue('AVG_CUSTOMER_AGE_EXPIRE', strtotime('+1 day'));
                break;
            case 'pending_messages':
                $value = (int) AdminStatsController::getPendingMessages();
                ConfigurationKPI::updateValue('PENDING_MESSAGES', $value);
                ConfigurationKPI::updateValue('PENDING_MESSAGES_EXPIRE', strtotime('+5 min'));
                break;
            case 'avg_msg_response_time':
                $value = sprintf($this->l('%.1f hours', null, null, false), AdminStatsController::getAverageMessageResponseTime(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day'))));
                ConfigurationKPI::updateValue('AVG_MSG_RESPONSE_TIME', $value);
                ConfigurationKPI::updateValue('AVG_MSG_RESPONSE_TIME_EXPIRE', strtotime('+4 hour'));
                break;
            case 'messages_per_thread':
                $value = round(AdminStatsController::getMessagesPerThread(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day'))), 1);
                ConfigurationKPI::updateValue('MESSAGES_PER_THREAD', $value);
                ConfigurationKPI::updateValue('MESSAGES_PER_THREAD_EXPIRE', strtotime('+12 hour'));
                break;
            case 'newsletter_registrations':
                $value = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
				SELECT COUNT(*)
				FROM `' . _DB_PREFIX_ . 'customer`
				WHERE newsletter = 1
				' . Shop::addSqlRestriction(Shop::SHARE_ORDER));
                if (Module::isInstalled('blocknewsletter')) {
                    $value += Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
					SELECT COUNT(*)
					FROM `' . _DB_PREFIX_ . 'newsletter`
					WHERE active = 1
					' . Shop::addSqlRestriction(Shop::SHARE_ORDER));
                }
                ConfigurationKPI::updateValue('NEWSLETTER_REGISTRATIONS', $value);
                ConfigurationKPI::updateValue('NEWSLETTER_REGISTRATIONS_EXPIRE', strtotime('+6 hour'));
                break;
            case 'enabled_languages':
                $value = Language::countActiveLanguages();
                ConfigurationKPI::updateValue('ENABLED_LANGUAGES', $value);
                ConfigurationKPI::updateValue('ENABLED_LANGUAGES_EXPIRE', strtotime('+1 min'));
                break;
            case 'frontoffice_translations':
                $themes = Theme::getThemes();
                $languages = Language::getLanguages();
                $total = $translated = 0;
                foreach ($themes as $theme) {
                    foreach ($languages as $language) {
                        $kpi_key = substr(strtoupper($theme->name . '_' . $language['iso_code']), 0, 16);
                        $total += ConfigurationKPI::get('TRANSLATE_TOTAL_' . $kpi_key);
                        $translated += ConfigurationKPI::get('TRANSLATE_DONE_' . $kpi_key);
                    }
                }
                $value = 0;
                if ($translated) {
                    $value = round(100 * $translated / $total, 1);
                }
                $value .= '%';
                ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATIONS', $value);
                ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATIONS_EXPIRE', strtotime('+2 min'));
                break;
            case 'main_country':
                if (!($row = AdminStatsController::getMainCountry(date('Y-m-d', strtotime('-30 day')), date('Y-m-d')))) {
                    $value = $this->l('No orders', null, null, false);
                } else {
                    $country = new Country($row['id_country'], $this->context->language->id);
                    $value = sprintf($this->l('%d%% %s', null, null, false), $row['orders'], $country->name);
                }
                ConfigurationKPI::updateValue('MAIN_COUNTRY', array($this->context->language->id => $value));
                ConfigurationKPI::updateValue('MAIN_COUNTRY_EXPIRE', array($this->context->language->id => strtotime('+1 day')));
                break;
            case 'orders_per_customer':
                $value = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
				SELECT COUNT(*)
				FROM `' . _DB_PREFIX_ . 'customer` c
				WHERE active = 1
				' . Shop::addSqlRestriction());
                if ($value) {
                    $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
					SELECT COUNT(*)
					FROM `' . _DB_PREFIX_ . 'orders` o
					WHERE valid = 1
					' . Shop::addSqlRestriction());
                    $value = round($orders / $value, 2);
                }
                ConfigurationKPI::updateValue('ORDERS_PER_CUSTOMER', $value);
                ConfigurationKPI::updateValue('ORDERS_PER_CUSTOMER_EXPIRE', strtotime('+1 day'));
                break;
            case 'average_order_value':
                $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
				SELECT
					COUNT(`id_order`) as orders,
					SUM(`total_paid_tax_excl` / `conversion_rate`) as total_paid_tax_excl
				FROM `' . _DB_PREFIX_ . 'orders`
				WHERE `invoice_date` BETWEEN "' . pSQL(date('Y-m-d', strtotime('-31 day'))) . ' 00:00:00" AND "' . pSQL(date('Y-m-d', strtotime('-1 day'))) . ' 23:59:59"
				' . Shop::addSqlRestriction());
                $value = Tools::displayPrice($row['orders'] ? $row['total_paid_tax_excl'] / $row['orders'] : 0, $currency);
                ConfigurationKPI::updateValue('AVG_ORDER_VALUE', $value);
                ConfigurationKPI::updateValue('AVG_ORDER_VALUE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
                break;
            case 'netprofit_visitor':
                $date_from = date('Y-m-d', strtotime('-31 day'));
                $date_to = date('Y-m-d', strtotime('-1 day'));
                $total_visitors = AdminStatsController::getVisits(true, $date_from, $date_to);
                $net_profits = AdminStatsController::getTotalSales($date_from, $date_to);
                $net_profits -= AdminStatsController::getExpenses($date_from, $date_to);
                $net_profits -= AdminStatsController::getPurchases($date_from, $date_to);
                if ($total_visitors) {
                    $value = Tools::displayPrice($net_profits / $total_visitors, $currency);
                } elseif ($net_profits) {
                    $value = '&infin;';
                } else {
                    $value = Tools::displayPrice(0, $currency);
                }
                ConfigurationKPI::updateValue('NETPROFIT_VISITOR', $value);
                ConfigurationKPI::updateValue('NETPROFIT_VISITOR_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
                break;
            case 'products_per_category':
                $products = AdminStatsController::getTotalProducts();
                $categories = AdminStatsController::getTotalCategories();
                $value = round($products / $categories);
                ConfigurationKPI::updateValue('PRODUCTS_PER_CATEGORY', $value);
                ConfigurationKPI::updateValue('PRODUCTS_PER_CATEGORY_EXPIRE', strtotime('+1 hour'));
                break;
            case 'top_category':
                if (!($id_category = AdminStatsController::getBestCategory(date('Y-m-d', strtotime('-1 month')), date('Y-m-d')))) {
                    $value = $this->l('No category', null, null, false);
                } else {
                    $category = new Category($id_category, $this->context->language->id);
                    $value = $category->name;
                }
                ConfigurationKPI::updateValue('TOP_CATEGORY', array($this->context->language->id => $value));
                ConfigurationKPI::updateValue('TOP_CATEGORY_EXPIRE', array($this->context->language->id => strtotime('+1 day')));
                break;
            default:
                $value = false;
        }
        if ($value !== false) {
            $array = array('value' => $value);
            if (isset($data)) {
                $array['data'] = $data;
            }
            die(Tools::jsonEncode($array));
        }
        die(Tools::jsonEncode(array('has_errors' => true)));
    }
Пример #3
0
 public function renderKpis()
 {
     $time = time();
     $kpis = array();
     /* The data generation is located in AdminStatsControllerCore */
     $helper = new HelperKpi();
     $helper->id = 'box-conversion-rate';
     $helper->icon = 'icon-sort-by-attributes-alt';
     //$helper->chart = true;
     $helper->color = 'color1';
     $helper->title = $this->l('Conversion Rate', null, null, false);
     $helper->subtitle = $this->l('30 days', null, null, false);
     if (ConfigurationKPI::get('CONVERSION_RATE') !== false) {
         $helper->value = ConfigurationKPI::get('CONVERSION_RATE');
     }
     if (ConfigurationKPI::get('CONVERSION_RATE_CHART') !== false) {
         $helper->data = ConfigurationKPI::get('CONVERSION_RATE_CHART');
     }
     if (ConfigurationKPI::get('CONVERSION_RATE_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=conversion_rate';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-carts';
     $helper->icon = 'icon-shopping-cart';
     $helper->color = 'color2';
     $helper->title = $this->l('Abandoned Carts', null, null, false);
     $helper->subtitle = $this->l('Today', null, null, false);
     $helper->href = $this->context->link->getAdminLink('AdminCarts');
     if (ConfigurationKPI::get('ABANDONED_CARTS') !== false) {
         $helper->value = ConfigurationKPI::get('ABANDONED_CARTS');
     }
     if (ConfigurationKPI::get('ABANDONED_CARTS_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=abandoned_cart';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-average-order';
     $helper->icon = 'icon-money';
     $helper->color = 'color3';
     $helper->title = $this->l('Average Order Value', null, null, false);
     $helper->subtitle = $this->l('30 days', null, null, false);
     if (ConfigurationKPI::get('AVG_ORDER_VALUE') !== false) {
         $helper->value = ConfigurationKPI::get('AVG_ORDER_VALUE');
     }
     if (ConfigurationKPI::get('AVG_ORDER_VALUE_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=average_order_value';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-net-profit-visitor';
     $helper->icon = 'icon-user';
     $helper->color = 'color4';
     $helper->title = $this->l('Net Profit per Visitor', null, null, false);
     $helper->subtitle = $this->l('30 days', null, null, false);
     if (ConfigurationKPI::get('NETPROFIT_VISITOR') !== false) {
         $helper->value = ConfigurationKPI::get('NETPROFIT_VISITOR');
     }
     if (ConfigurationKPI::get('NETPROFIT_VISITOR_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=netprofit_visitor';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpiRow();
     $helper->kpis = $kpis;
     return $helper->generate();
 }
 public function initContent()
 {
     $this->meta_title = 'Modules';
     // If we are on a module configuration, no need to load all modules
     if (Tools::getValue('configure') != '') {
         return true;
     }
     $this->initToolbar();
     $this->initPageHeaderToolbar();
     // Init
     $smarty = $this->context->smarty;
     $autocompleteList = 'var moduleList = [';
     $nameCountryDefault = Country::getNameById($this->context->language->id, Configuration::get('PS_COUNTRY_DEFAULT'));
     $categoryFiltered = array();
     $filterCategories = explode('|', Configuration::get('PS_SHOW_CAT_MODULES_' . (int) $this->id_employee));
     if (count($filterCategories) > 0) {
         foreach ($filterCategories as $fc) {
             if (!empty($fc)) {
                 $categoryFiltered[$fc] = 1;
             }
         }
     }
     if (empty($categoryFiltered) && Tools::getValue('tab_module')) {
         $categoryFiltered[Tools::getValue('tab_module')] = 1;
     }
     foreach ($this->list_modules_categories as $k => $v) {
         $this->list_modules_categories[$k]['nb'] = 0;
     }
     // Retrieve Modules Preferences
     $modules_preferences = '';
     $tab_modules_preferences = array();
     $modules_preferences_tmp = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'module_preference` WHERE `id_employee` = ' . (int) $this->id_employee);
     $tab_modules_preferences_tmp = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'tab_module_preference` WHERE `id_employee` = ' . (int) $this->id_employee);
     foreach ($tab_modules_preferences_tmp as $i => $j) {
         $tab_modules_preferences[$j['module']][] = $j['id_tab'];
     }
     foreach ($modules_preferences_tmp as $k => $v) {
         if ($v['interest'] == null) {
             unset($v['interest']);
         }
         if ($v['favorite'] == null) {
             unset($v['favorite']);
         }
         $modules_preferences[$v['module']] = $v;
     }
     // Retrieve Modules List
     $modules = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee);
     $this->initModulesList($modules);
     $this->nb_modules_total = count($modules);
     $module_errors = array();
     $module_success = array();
     $upgrade_available = array();
     $dont_filter = false;
     // Browse modules list
     foreach ($modules as $km => $module) {
         //if we are in favorites view we only display installed modules
         if (Tools::getValue('select') == 'favorites' && !$module->id) {
             unset($modules[$km]);
             continue;
         }
         // Upgrade Module process, init check if a module could be upgraded
         if (Module::initUpgradeModule($module)) {
             // When the XML cache file is up-to-date, the module may not be loaded yet
             if (!class_exists($module->name)) {
                 if (!file_exists(_PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php')) {
                     continue;
                 }
                 require_once _PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php';
             }
             if ($object = new $module->name()) {
                 $object->runUpgradeModule();
                 if (count($errors_module_list = $object->getErrors())) {
                     $module_errors[] = array('name' => $module->displayName, 'message' => $errors_module_list);
                 } else {
                     if (count($conf_module_list = $object->getConfirmations())) {
                         $module_success[] = array('name' => $module->displayName, 'message' => $conf_module_list);
                     }
                 }
                 unset($object);
             }
         } elseif (Module::getUpgradeStatus($module->name)) {
             // When the XML cache file is up-to-date, the module may not be loaded yet
             if (!class_exists($module->name)) {
                 if (file_exists(_PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php')) {
                     require_once _PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php';
                     $object = new $module->name();
                     $module_success[] = array('name' => $module->name, 'message' => array(0 => sprintf($this->l('Current version: %s'), $object->version), 1 => $this->l('No file upgrades applied (none exist).')));
                 } else {
                     continue;
                 }
             }
             unset($object);
         } elseif (Tools::getValue('updated') && Tools::getValue('module_name')) {
             $module_names = (string) Tools::getValue('module_name');
             if (strpos($module_names, '|')) {
                 $module_names = explode('|', $module_names);
                 $dont_filter = true;
             }
             if (!is_array($module_names)) {
                 $module_names = (array) $module_names;
             }
             if (in_array($module->name, $module_names)) {
                 $module_success[] = array('name' => $module->displayName, 'message' => array(0 => sprintf($this->l('Current version: %s'), $module->version)));
             }
         }
         // Make modules stats
         $this->makeModulesStats($module);
         // Assign warnings
         if ($module->active && isset($module->warning) && !empty($module->warning) && !$this->ajax) {
             $href = Context::getContext()->link->getAdminLink('AdminModules', true) . '&module_name=' . $module->name . '&tab_module=' . $module->tab . '&configure=' . $module->name;
             $this->context->smarty->assign('text', sprintf($this->l('%1$s: %2$s'), $module->displayName, $module->warning));
             $this->context->smarty->assign('module_link', $href);
             $this->displayWarning($this->context->smarty->fetch('controllers/modules/warning_module.tpl'));
         }
         // AutoComplete array
         $autocompleteList .= Tools::jsonEncode(array('displayName' => (string) $module->displayName, 'desc' => (string) $module->description, 'name' => (string) $module->name, 'author' => (string) $module->author, 'image' => isset($module->image) ? (string) $module->image : '', 'option' => '')) . ', ';
         // Apply filter
         if ($this->isModuleFiltered($module) && Tools::getValue('select') != 'favorites') {
             unset($modules[$km]);
         } else {
             if (isset($modules_preferences[$modules[$km]->name])) {
                 $modules[$km]->preferences = $modules_preferences[$modules[$km]->name];
             }
             $this->fillModuleData($module, 'array');
             $module->categoryName = isset($this->list_modules_categories[$module->tab]['name']) ? $this->list_modules_categories[$module->tab]['name'] : $this->list_modules_categories['others']['name'];
         }
         unset($object);
         if ($module->installed && isset($module->version_addons) && $module->version_addons) {
             $upgrade_available[] = array('anchor' => ucfirst($module->name), 'name' => $module->name, 'displayName' => $module->displayName);
         }
         if (in_array($module->name, $this->list_partners_modules)) {
             $module->type = 'addonsPartner';
         }
         if (isset($module->description_full) && trim($module->description_full) != '') {
             $module->show_quick_view = true;
         }
     }
     // Don't display categories without modules
     $cleaned_list = array();
     foreach ($this->list_modules_categories as $k => $list) {
         if ($list['nb'] > 0) {
             $cleaned_list[$k] = $list;
         }
     }
     // Actually used for the report of the upgraded errors
     if (count($module_errors)) {
         $html = $this->generateHtmlMessage($module_errors);
         $this->errors[] = sprintf(Tools::displayError('The following module(s) were not upgraded successfully: %s'), $html);
     }
     if (count($module_success)) {
         $html = $this->generateHtmlMessage($module_success);
         $this->confirmations[] = sprintf($this->l('The following module(s) were upgraded successfully:') . ' %s', $html);
     }
     ConfigurationKPI::updateValue('UPDATE_MODULES', count($upgrade_available));
     if (count($upgrade_available) == 0 && (int) Tools::getValue('check') == 1) {
         $this->confirmations[] = $this->l('Everything is up-to-date');
     }
     // Init tpl vars for smarty
     $tpl_vars = array('token' => $this->token, 'upgrade_available' => $upgrade_available, 'currentIndex' => self::$currentIndex, 'dirNameCurrentIndex' => dirname(self::$currentIndex), 'ajaxCurrentIndex' => str_replace('index', 'ajax-tab', self::$currentIndex), 'autocompleteList' => rtrim($autocompleteList, ' ,') . '];', 'showTypeModules' => $this->filter_configuration['PS_SHOW_TYPE_MODULES_' . (int) $this->id_employee], 'showCountryModules' => $this->filter_configuration['PS_SHOW_COUNTRY_MODULES_' . (int) $this->id_employee], 'showInstalledModules' => $this->filter_configuration['PS_SHOW_INSTALLED_MODULES_' . (int) $this->id_employee], 'showEnabledModules' => $this->filter_configuration['PS_SHOW_ENABLED_MODULES_' . (int) $this->id_employee], 'nameCountryDefault' => Country::getNameById($this->context->language->id, Configuration::get('PS_COUNTRY_DEFAULT')), 'isoCountryDefault' => $this->iso_default_country, 'categoryFiltered' => $categoryFiltered, 'modules' => $modules, 'nb_modules' => $this->nb_modules_total, 'nb_modules_favorites' => count($this->context->employee->favoriteModulesList()), 'nb_modules_installed' => $this->nb_modules_installed, 'nb_modules_uninstalled' => $this->nb_modules_total - $this->nb_modules_installed, 'nb_modules_activated' => $this->nb_modules_activated, 'nb_modules_unactivated' => $this->nb_modules_installed - $this->nb_modules_activated, 'list_modules_categories' => $cleaned_list, 'list_modules_authors' => $this->modules_authors, 'add_permission' => $this->tabAccess['add'], 'tab_modules_preferences' => $tab_modules_preferences, 'kpis' => $this->renderKpis(), 'module_name' => Tools::getValue('module_name'), 'page_header_toolbar_title' => $this->page_header_toolbar_title, 'page_header_toolbar_btn' => $this->page_header_toolbar_btn, 'modules_uri' => __PS_BASE_URI__ . basename(_PS_MODULE_DIR_), 'dont_filter' => $dont_filter);
     if ($this->logged_on_addons) {
         $tpl_vars['logged_on_addons'] = 1;
         $tpl_vars['username_addons'] = $this->context->cookie->username_addons;
     }
     $smarty->assign($tpl_vars);
 }
Пример #5
0
 protected static function sqlRestriction($id_shop_group, $id_shop)
 {
     ConfigurationKPI::setKpiDefinition();
     $r = parent::sqlRestriction($id_shop_group, $id_shop);
     ConfigurationKPI::unsetKpiDefinition();
     return $r;
 }
Пример #6
0
 public function getChartData($year)
 {
     // There are stream types (different charts) and for each types there are 3 available zones (one color for the goal, one if you over perform and one if you under perfom)
     $stream_types = array(array('type' => 'traffic', 'title' => $this->l('Traffic'), 'unit_text' => $this->l('visits')), array('type' => 'conversion', 'title' => $this->l('Conversion'), 'unit_text' => ''), array('type' => 'avg_cart_value', 'title' => $this->l('Average cart value'), 'unit_text' => ''), array('type' => 'sales', 'title' => $this->l('Sales'), 'unit_text' => ''));
     $stream_zones = array(array('zone' => 'real', 'text' => ''), array('zone' => 'more', 'text' => $this->l('Goal exceeded')), array('zone' => 'less', 'text' => $this->l('Goal not reached')));
     // We initialize all the streams types for all the zones
     $streams = array();
     $average_goals = array();
     foreach ($stream_types as $key => $stream_type) {
         $streams[$stream_type['type']] = array();
         foreach ($stream_zones as $stream_zone) {
             $streams[$stream_type['type']][$stream_zone['zone']] = array('key' => $stream_type['type'] . '_' . $stream_zone['zone'], 'title' => $stream_type['title'], 'unit_text' => $stream_type['unit_text'], 'zone_text' => $stream_zone['text'], 'color' => $stream_zone['zone'] == 'more' ? self::$more_color[$key] : ($stream_zone['zone'] == 'less' ? self::$less_color[$key] : self::$real_color[$key]), 'values' => array(), 'disabled' => isset($stream_type['type']) && $stream_type['type'] == 'sales' ? false : true);
         }
         if (isset($stream_type['type'])) {
             $average_goals[$stream_type['type']] = 0;
         }
     }
     if (Configuration::get('PS_DASHBOARD_SIMULATION')) {
         $visits = $orders = $sales = array();
         $from = strtotime(date('Y-01-01 00:00:00'));
         $to = strtotime(date('Y-12-31 00:00:00'));
         for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date)) {
             $visits[$date] = round(rand(2000, 5000));
             $orders[$date] = round(rand(40, 100));
             $sales[$date] = round(rand(3000, 9000), 2);
         }
         // We need to calculate the average value of each goals for the year, this will be the base rate for "100%"
         for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1)) {
             $average_goals['traffic'] += $this->fakeConfigurationKPI_get('DASHGOALS_TRAFFIC_' . $i . '_' . $year);
             $average_goals['conversion'] += $this->fakeConfigurationKPI_get('DASHGOALS_CONVERSION_' . $i . '_' . $year);
             $average_goals['avg_cart_value'] += $this->fakeConfigurationKPI_get('DASHGOALS_AVG_CART_VALUE_' . $i . '_' . $year);
         }
         foreach ($average_goals as &$average_goal) {
             $average_goal /= 12;
         }
         $average_goals['sales'] = $average_goals['traffic'] * $average_goals['conversion'] / 100 * $average_goals['avg_cart_value'];
         // Now we can calculate the value for every months
         for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1)) {
             $timestamp = strtotime($year . '-' . $i . '-01');
             $month_goal = $this->fakeConfigurationKPI_get('DASHGOALS_TRAFFIC_' . $i . '_' . $year);
             $value = isset($visits[$timestamp]) ? $visits[$timestamp] : 0;
             $stream_values = $this->getValuesFromGoals($average_goals['traffic'], $month_goal, $value, Dashgoals::$month_labels[$i]);
             $goal_diff = $value - $month_goal;
             $stream_values['real']['traffic'] = $value;
             $stream_values['real']['goal'] = $month_goal;
             if ($value > 0) {
                 $stream_values['real']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             }
             $stream_values['less']['traffic'] = $value;
             $stream_values['more']['traffic'] = $value;
             if ($value > 0 && $value < $month_goal) {
                 $stream_values['less']['goal_diff'] = $goal_diff;
             } elseif ($value > 0) {
                 $stream_values['more']['goal_diff'] = $goal_diff;
             }
             if ($value == 0) {
                 $streams['traffic']['less']['zone_text'] = $this->l('Goal set:');
                 $stream_values['less']['goal'] = $month_goal;
             }
             foreach ($stream_zones as $stream_zone) {
                 $streams['traffic'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
             }
             $month_goal = $this->fakeConfigurationKPI_get('DASHGOALS_CONVERSION_' . $i . '_' . $year);
             $value = 100 * (isset($visits[$timestamp]) && $visits[$timestamp] && isset($orders[$timestamp]) && $orders[$timestamp] ? $orders[$timestamp] / $visits[$timestamp] : 0);
             $stream_values = $this->getValuesFromGoals($average_goals['conversion'], $month_goal, $value, Dashgoals::$month_labels[$i]);
             $goal_diff = $value - $month_goal;
             $stream_values['real']['conversion'] = round($value, 2);
             $stream_values['real']['goal'] = round($month_goal, 2);
             if ($value > 0) {
                 $stream_values['real']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             }
             $stream_values['less']['conversion'] = $value;
             $stream_values['more']['conversion'] = $value;
             if ($value > 0 && $value < $month_goal) {
                 $stream_values['less']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             } elseif ($value > 0) {
                 $stream_values['more']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             }
             if ($value == 0) {
                 $streams['conversion']['less']['zone_text'] = $this->l('Goal set:');
                 $stream_values['less']['goal'] = $month_goal;
             }
             foreach ($stream_zones as $stream_zone) {
                 $streams['conversion'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
             }
             $month_goal = $this->fakeConfigurationKPI_get('DASHGOALS_AVG_CART_VALUE_' . $i . '_' . $year);
             $value = isset($orders[$timestamp]) && $orders[$timestamp] && isset($sales[$timestamp]) && $sales[$timestamp] ? $sales[$timestamp] / $orders[$timestamp] : 0;
             $stream_values = $this->getValuesFromGoals($average_goals['avg_cart_value'], $month_goal, $value, Dashgoals::$month_labels[$i]);
             $goal_diff = $value - $month_goal;
             $stream_values['real']['avg_cart_value'] = $value;
             $stream_values['real']['goal'] = $month_goal;
             if ($value > 0) {
                 $stream_values['real']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             }
             $stream_values['less']['avg_cart_value'] = $value;
             $stream_values['more']['avg_cart_value'] = $value;
             if ($value > 0 && $value < $month_goal) {
                 $stream_values['less']['goal_diff'] = $goal_diff;
             } elseif ($value > 0) {
                 $stream_values['more']['goal_diff'] = $goal_diff;
             }
             if ($value == 0) {
                 $streams['avg_cart_value']['less']['zone_text'] = $this->l('Goal set:');
                 $stream_values['less']['goal'] = $month_goal;
             }
             foreach ($stream_zones as $stream_zone) {
                 $streams['avg_cart_value'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
             }
             $month_goal = $this->fakeConfigurationKPI_get('DASHGOALS_TRAFFIC_' . $i . '_' . $year) * $this->fakeConfigurationKPI_get('DASHGOALS_CONVERSION_' . $i . '_' . $year) / 100 * $this->fakeConfigurationKPI_get('DASHGOALS_AVG_CART_VALUE_' . $i . '_' . $year);
             $value = isset($sales[$timestamp]) ? $sales[$timestamp] : 0;
             $stream_values = $this->getValuesFromGoals($average_goals['sales'], $month_goal, $value, Dashgoals::$month_labels[$i]);
             $goal_diff = $value - $month_goal;
             $stream_values['real']['sales'] = $value;
             $stream_values['real']['goal'] = $month_goal;
             if ($value > 0) {
                 $stream_values['real']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             }
             $stream_values['less']['sales'] = $value;
             $stream_values['more']['sales'] = $value;
             if ($value > 0 && $value < $month_goal) {
                 $stream_values['less']['goal_diff'] = $goal_diff;
             } elseif ($value > 0) {
                 $stream_values['more']['goal_diff'] = $goal_diff;
             }
             if ($value == 0) {
                 $streams['sales']['less']['zone_text'] = $this->l('Goal set:');
                 $stream_values['less']['goal'] = $month_goal;
             }
             foreach ($stream_zones as $stream_zone) {
                 $streams['sales'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
             }
         }
     } else {
         // Retrieve gross data from AdminStatsController
         $visits = AdminStatsController::getVisits(false, $year . date('-01-01'), $year . date('-12-31'), 'month');
         $orders = AdminStatsController::getOrders($year . date('-01-01'), $year . date('-12-31'), 'month');
         $sales = AdminStatsController::getTotalSales($year . date('-01-01'), $year . date('-12-31'), 'month');
         // We need to calculate the average value of each goals for the year, this will be the base rate for "100%"
         for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1)) {
             $average_goals['traffic'] += ConfigurationKPI::get('DASHGOALS_TRAFFIC_' . $i . '_' . $year);
             $average_goals['conversion'] += ConfigurationKPI::get('DASHGOALS_CONVERSION_' . $i . '_' . $year) / 100;
             $average_goals['avg_cart_value'] += ConfigurationKPI::get('DASHGOALS_AVG_CART_VALUE_' . $i . '_' . $year);
         }
         foreach ($average_goals as &$average_goal) {
             $average_goal /= 12;
         }
         $average_goals['sales'] = $average_goals['traffic'] * $average_goals['conversion'] * $average_goals['avg_cart_value'];
         // Now we can calculate the value for every months
         for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1)) {
             $timestamp = strtotime($year . '-' . $i . '-01');
             $month_goal = ConfigurationKPI::get('DASHGOALS_TRAFFIC_' . $i . '_' . $year);
             $value = isset($visits[$timestamp]) ? $visits[$timestamp] : 0;
             $stream_values = $this->getValuesFromGoals($average_goals['traffic'], $month_goal, $value, Dashgoals::$month_labels[$i]);
             $goal_diff = $value - $month_goal;
             $stream_values['real']['traffic'] = $value;
             $stream_values['real']['goal'] = $month_goal;
             if ($value > 0) {
                 $stream_values['real']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             }
             $stream_values['less']['traffic'] = $value;
             $stream_values['more']['traffic'] = $value;
             if ($value > 0 && $value < $month_goal) {
                 $stream_values['less']['goal_diff'] = $goal_diff;
             } elseif ($value > 0) {
                 $stream_values['more']['goal_diff'] = $goal_diff;
             }
             if ($value == 0) {
                 $streams['traffic']['less']['zone_text'] = $this->l('Goal set:');
                 $stream_values['less']['goal'] = $month_goal;
             }
             foreach ($stream_zones as $stream_zone) {
                 $streams['traffic'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
             }
             $month_goal = ConfigurationKPI::get('DASHGOALS_CONVERSION_' . $i . '_' . $year);
             $value = 100 * (isset($visits[$timestamp]) && $visits[$timestamp] && isset($orders[$timestamp]) && $orders[$timestamp] ? $orders[$timestamp] / $visits[$timestamp] : 0);
             $stream_values = $this->getValuesFromGoals($average_goals['conversion'] * 100, $month_goal, $value, Dashgoals::$month_labels[$i]);
             $goal_diff = $value - $month_goal;
             $stream_values['real']['conversion'] = round($value, 2);
             $stream_values['real']['goal'] = round($month_goal, 2);
             if ($value > 0) {
                 $stream_values['real']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             }
             $stream_values['less']['conversion'] = $value;
             $stream_values['more']['conversion'] = $value;
             if ($value > 0 && $value < $month_goal) {
                 $stream_values['less']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             } elseif ($value > 0) {
                 $stream_values['more']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             }
             if ($value == 0) {
                 $streams['conversion']['less']['zone_text'] = $this->l('Goal set:');
                 $stream_values['less']['goal'] = $month_goal;
             }
             foreach ($stream_zones as $stream_zone) {
                 $streams['conversion'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
             }
             $month_goal = ConfigurationKPI::get('DASHGOALS_AVG_CART_VALUE_' . $i . '_' . $year);
             $value = isset($orders[$timestamp]) && $orders[$timestamp] && isset($sales[$timestamp]) && $sales[$timestamp] ? $sales[$timestamp] / $orders[$timestamp] : 0;
             $stream_values = $this->getValuesFromGoals($average_goals['avg_cart_value'], $month_goal, $value, Dashgoals::$month_labels[$i]);
             $goal_diff = $value - $month_goal;
             $stream_values['real']['avg_cart_value'] = $value;
             $stream_values['real']['goal'] = $month_goal;
             if ($value > 0) {
                 $stream_values['real']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             }
             $stream_values['less']['avg_cart_value'] = $value;
             $stream_values['more']['avg_cart_value'] = $value;
             if ($value > 0 && $value < $month_goal) {
                 $stream_values['less']['goal_diff'] = $goal_diff;
             } elseif ($value > 0) {
                 $stream_values['more']['goal_diff'] = $goal_diff;
             }
             if ($value == 0) {
                 $streams['avg_cart_value']['less']['zone_text'] = $this->l('Goal set:');
                 $stream_values['less']['goal'] = $month_goal;
             }
             foreach ($stream_zones as $stream_zone) {
                 $streams['avg_cart_value'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
             }
             $month_goal = ConfigurationKPI::get('DASHGOALS_TRAFFIC_' . $i . '_' . $year) * ConfigurationKPI::get('DASHGOALS_CONVERSION_' . $i . '_' . $year) / 100 * ConfigurationKPI::get('DASHGOALS_AVG_CART_VALUE_' . $i . '_' . $year);
             $value = isset($sales[$timestamp]) && $sales[$timestamp] ? $sales[$timestamp] : 0;
             $stream_values = $this->getValuesFromGoals($average_goals['sales'], $month_goal, isset($sales[$timestamp]) ? $sales[$timestamp] : 0, Dashgoals::$month_labels[$i]);
             $goal_diff = $value - $month_goal;
             $stream_values['real']['sales'] = $value;
             $stream_values['real']['goal'] = $month_goal;
             if ($value > 0) {
                 $stream_values['real']['goal_diff'] = round($goal_diff * 100 / ($month_goal > 0 ? $month_goal : 1), 2);
             }
             $stream_values['less']['sales'] = $value;
             $stream_values['more']['sales'] = $value;
             if ($value > 0 && $value < $month_goal) {
                 $stream_values['less']['goal_diff'] = $goal_diff;
             } elseif ($value > 0) {
                 $stream_values['more']['goal_diff'] = $goal_diff;
             }
             if ($value == 0) {
                 $streams['sales']['less']['zone_text'] = $this->l('Goal set:');
                 $stream_values['less']['goal'] = $month_goal;
             }
             foreach ($stream_zones as $stream_zone) {
                 $streams['sales'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
             }
         }
     }
     // Merge all the streams before sending
     $all_streams = array();
     foreach ($stream_types as $stream_type) {
         foreach ($stream_zones as $stream_zone) {
             $all_streams[] = $streams[$stream_type['type']][$stream_zone['zone']];
         }
     }
     return array('chart_type' => 'bar_chart_goals', 'data' => $all_streams);
 }
Пример #7
0
 public function renderKpis()
 {
     $time = time();
     $kpis = array();
     /* The data generation is located in AdminStatsControllerCore */
     if (Configuration::get('PS_STOCK_MANAGEMENT')) {
         $helper = new HelperKpi();
         $helper->id = 'box-products-stock';
         $helper->icon = 'icon-archive';
         $helper->color = 'color1';
         $helper->title = $this->l('Items in Stock', null, null, false);
         if (ConfigurationKPI::get('PERCENT_PRODUCT_STOCK') !== false) {
             $helper->value = ConfigurationKPI::get('PERCENT_PRODUCT_STOCK');
         }
         if (ConfigurationKPI::get('PERCENT_PRODUCT_STOCK_EXPIRE') < $time) {
             $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=percent_product_stock';
         }
         $kpis[] = $helper->generate();
     }
     $helper = new HelperKpi();
     $helper->id = 'box-avg-gross-margin';
     $helper->icon = 'icon-tags';
     $helper->color = 'color2';
     $helper->title = $this->l('Average Gross Margin', null, null, false);
     if (ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN') !== false) {
         $helper->value = ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN');
     }
     if (ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=product_avg_gross_margin';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-8020-sales-catalog';
     $helper->icon = 'icon-beaker';
     $helper->color = 'color3';
     $helper->title = $this->l('80% of your sales', null, null, false);
     $helper->subtitle = $this->l('30 days', null, null, false);
     if (ConfigurationKPI::get('8020_SALES_CATALOG') !== false) {
         $helper->value = ConfigurationKPI::get('8020_SALES_CATALOG');
     }
     if (ConfigurationKPI::get('8020_SALES_CATALOG_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=8020_sales_catalog';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-disabled-products';
     $helper->icon = 'icon-off';
     $helper->color = 'color4';
     $helper->href = $this->context->link->getAdminLink('AdminProducts');
     $helper->title = $this->l('Disabled Products', null, null, false);
     if (ConfigurationKPI::get('DISABLED_PRODUCTS') !== false) {
         $helper->value = ConfigurationKPI::get('DISABLED_PRODUCTS');
     }
     if (ConfigurationKPI::get('DISABLED_PRODUCTS_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=disabled_products';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpiRow();
     $helper->kpis = $kpis;
     return $helper->generate();
 }
 public function renderKpis()
 {
     $time = time();
     $kpis = array();
     /* The data generation is located in AdminStatsControllerCore */
     if (Configuration::get('PS_STOCK_MANAGEMENT')) {
         $helper = new HelperKpi();
         $helper->id = 'box-products-stock';
         $helper->icon = 'icon-archive';
         $helper->color = 'color1';
         $helper->title = $this->l('Out of stock items', null, null, false);
         if (ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK') !== false) {
             $helper->value = ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK');
         }
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=percent_product_out_of_stock';
         $helper->tooltip = $this->l('X% of your products for sale are out of stock.', null, null, false);
         $helper->refresh = (bool) (ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK_EXPIRE') < $time);
         $helper->href = Context::getContext()->link->getAdminLink('AdminProducts') . '&productFilter_sav!quantity=0&productFilter_active=1&submitFilterproduct=1';
         $kpis[] = $helper->generate();
     }
     $helper = new HelperKpi();
     $helper->id = 'box-avg-gross-margin';
     $helper->icon = 'icon-tags';
     $helper->color = 'color2';
     $helper->title = $this->l('Average Gross Margin', null, null, false);
     if (ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN') !== false) {
         $helper->value = ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=product_avg_gross_margin';
     $helper->tooltip = $this->l('The gross margin is the difference between the retail price and the wholesale price, on all your products for sale.', null, null, false);
     $helper->refresh = (bool) (ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN_EXPIRE') < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-8020-sales-catalog';
     $helper->icon = 'icon-beaker';
     $helper->color = 'color3';
     $helper->title = $this->l('Purchased references', null, null, false);
     $helper->subtitle = $this->l('30 days', null, null, false);
     if (ConfigurationKPI::get('8020_SALES_CATALOG') !== false) {
         $helper->value = ConfigurationKPI::get('8020_SALES_CATALOG');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=8020_sales_catalog';
     $helper->tooltip = $this->l('X% of your references have been purchased for the past 30 days', null, null, false);
     $helper->refresh = (bool) (ConfigurationKPI::get('8020_SALES_CATALOG_EXPIRE') < $time);
     if (Module::isInstalled('statsbestproducts')) {
         $helper->href = Context::getContext()->link->getAdminLink('AdminStats') . '&module=statsbestproducts&datepickerFrom=' . date('Y-m-d', strtotime('-30 days')) . '&datepickerTo=' . date('Y-m-d');
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-disabled-products';
     $helper->icon = 'icon-off';
     $helper->color = 'color4';
     $helper->href = $this->context->link->getAdminLink('AdminProducts');
     $helper->title = $this->l('Disabled Products', null, null, false);
     if (ConfigurationKPI::get('DISABLED_PRODUCTS') !== false) {
         $helper->value = ConfigurationKPI::get('DISABLED_PRODUCTS');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=disabled_products';
     $helper->refresh = (bool) (ConfigurationKPI::get('DISABLED_PRODUCTS_EXPIRE') < $time);
     $helper->tooltip = $this->l('X% of your products are disabled and not visible to your customers', null, null, false);
     $helper->href = Context::getContext()->link->getAdminLink('AdminProducts') . '&productFilter_active=0&submitFilterproduct=1';
     $kpis[] = $helper->generate();
     $helper = new HelperKpiRow();
     $helper->kpis = $kpis;
     return $helper->generate();
 }
 public function renderKpis()
 {
     $time = time();
     $kpis = array();
     /* The data generation is located in AdminStatsControllerCore */
     $helper = new HelperKpi();
     $helper->id = 'box-gender';
     $helper->icon = 'icon-male';
     $helper->color = 'color1';
     $helper->title = $this->l('Customers', null, null, false);
     $helper->subtitle = $this->l('All Time', null, null, false);
     if (ConfigurationKPI::get('CUSTOMER_MAIN_GENDER', $this->context->language->id) !== false) {
         $helper->value = ConfigurationKPI::get('CUSTOMER_MAIN_GENDER', $this->context->language->id);
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=customer_main_gender';
     $helper->refresh = (bool) (ConfigurationKPI::get('CUSTOMER_MAIN_GENDER_EXPIRE', $this->context->language->id) < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-age';
     $helper->icon = 'icon-calendar';
     $helper->color = 'color2';
     $helper->title = $this->l('Average Age', 'AdminTab', null, false);
     $helper->subtitle = $this->l('All Time', null, null, false);
     if (ConfigurationKPI::get('AVG_CUSTOMER_AGE', $this->context->language->id) !== false) {
         $helper->value = ConfigurationKPI::get('AVG_CUSTOMER_AGE', $this->context->language->id);
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=avg_customer_age';
     $helper->refresh = (bool) (ConfigurationKPI::get('AVG_CUSTOMER_AGE_EXPIRE', $this->context->language->id) < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-orders';
     $helper->icon = 'icon-retweet';
     $helper->color = 'color3';
     $helper->title = $this->l('Orders per Customer', null, null, false);
     $helper->subtitle = $this->l('All Time', null, null, false);
     if (ConfigurationKPI::get('ORDERS_PER_CUSTOMER') !== false) {
         $helper->value = ConfigurationKPI::get('ORDERS_PER_CUSTOMER');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=orders_per_customer';
     $helper->refresh = (bool) (ConfigurationKPI::get('ORDERS_PER_CUSTOMER_EXPIRE') < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-newsletter';
     $helper->icon = 'icon-envelope';
     $helper->color = 'color4';
     $helper->title = $this->l('Newsletter Registrations', null, null, false);
     $helper->subtitle = $this->l('All Time', null, null, false);
     if (ConfigurationKPI::get('NEWSLETTER_REGISTRATIONS') !== false) {
         $helper->value = ConfigurationKPI::get('NEWSLETTER_REGISTRATIONS');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=newsletter_registrations';
     $helper->refresh = (bool) (ConfigurationKPI::get('NEWSLETTER_REGISTRATIONS_EXPIRE') < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpiRow();
     $helper->kpis = $kpis;
     return $helper->generate();
 }
 public function renderKpis()
 {
     $time = time();
     $kpis = array();
     /* The data generation is located in AdminStatsControllerCore */
     $helper = new HelperKpi();
     $helper->id = 'box-disabled-categories';
     $helper->icon = 'icon-off';
     $helper->color = 'color1';
     $helper->title = $this->l('Disabled Categories', null, null, false);
     if (ConfigurationKPI::get('DISABLED_CATEGORIES') !== false) {
         $helper->value = ConfigurationKPI::get('DISABLED_CATEGORIES');
     }
     if (ConfigurationKPI::get('DISABLED_CATEGORIES_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=disabled_categories';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-empty-categories';
     $helper->icon = 'icon-bookmark-empty';
     $helper->color = 'color2';
     $helper->href = $this->context->link->getAdminLink('AdminTracking');
     $helper->title = $this->l('Empty Categories', null, null, false);
     if (ConfigurationKPI::get('EMPTY_CATEGORIES') !== false) {
         $helper->value = ConfigurationKPI::get('EMPTY_CATEGORIES');
     }
     if (ConfigurationKPI::get('EMPTY_CATEGORIES_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=empty_categories';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-top-category';
     $helper->icon = 'icon-money';
     $helper->color = 'color3';
     $helper->title = $this->l('Top Category', null, null, false);
     $helper->subtitle = $this->l('30 days', null, null, false);
     if (ConfigurationKPI::get('TOP_CATEGORY', $this->context->employee->id_lang) !== false) {
         $helper->value = ConfigurationKPI::get('TOP_CATEGORY', $this->context->employee->id_lang);
     }
     if (ConfigurationKPI::get('TOP_CATEGORY_EXPIRE', $this->context->employee->id_lang) < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=top_category';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-products-per-category';
     $helper->icon = 'icon-search';
     $helper->color = 'color4';
     $helper->title = $this->l('Average number of products per category', null, null, false);
     if (ConfigurationKPI::get('PRODUCTS_PER_CATEGORY') !== false) {
         $helper->value = ConfigurationKPI::get('PRODUCTS_PER_CATEGORY');
     }
     if (ConfigurationKPI::get('PRODUCTS_PER_CATEGORY_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=products_per_category';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpiRow();
     $helper->kpis = $kpis;
     return $helper->generate();
 }
Пример #11
0
 public function renderKpis()
 {
     $time = time();
     $kpis = array();
     /* The data generation is located in AdminStatsControllerCore */
     $helper = new HelperKpi();
     $helper->id = 'box-languages';
     $helper->icon = 'icon-microphone';
     $helper->color = 'color1';
     $helper->title = $this->l('Enabled Languages', null, null, false);
     if (ConfigurationKPI::get('ENABLED_LANGUAGES') !== false) {
         $helper->value = ConfigurationKPI::get('ENABLED_LANGUAGES');
     }
     if (ConfigurationKPI::get('ENABLED_LANGUAGES_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=enabled_languages';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-country';
     $helper->icon = 'icon-home';
     $helper->color = 'color2';
     $helper->title = $this->l('Main Country', null, null, false);
     $helper->subtitle = $this->l('30 Days', null, null, false);
     if (ConfigurationKPI::get('MAIN_COUNTRY', $this->context->language->id) !== false) {
         $helper->value = ConfigurationKPI::get('MAIN_COUNTRY', $this->context->language->id);
     }
     if (ConfigurationKPI::get('MAIN_COUNTRY_EXPIRE', $this->context->language->id) < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=main_country';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-translations';
     $helper->icon = 'icon-list';
     $helper->color = 'color3';
     $helper->title = $this->l('Front Office Translations', null, null, false);
     if (ConfigurationKPI::get('FRONTOFFICE_TRANSLATIONS') !== false) {
         $helper->value = ConfigurationKPI::get('FRONTOFFICE_TRANSLATIONS');
     }
     if (ConfigurationKPI::get('FRONTOFFICE_TRANSLATIONS_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=frontoffice_translations';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpiRow();
     $helper->kpis = $kpis;
     return $helper->generate();
 }
Пример #12
0
 public function renderKpis()
 {
     $time = time();
     $kpis = array();
     /* The data generation is located in AdminStatsControllerCore */
     $helper = new HelperKpi();
     $helper->id = 'box-conversion-rate';
     $helper->icon = 'icon-sort-by-attributes-alt';
     //$helper->chart = true;
     $helper->color = 'color1';
     $helper->title = $this->trans('Conversion Rate', array(), 'Admin.Global');
     $helper->subtitle = $this->trans('30 days', array(), 'Admin.Global');
     if (ConfigurationKPI::get('CONVERSION_RATE') !== false) {
         $helper->value = ConfigurationKPI::get('CONVERSION_RATE');
     }
     if (ConfigurationKPI::get('CONVERSION_RATE_CHART') !== false) {
         $helper->data = ConfigurationKPI::get('CONVERSION_RATE_CHART');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=conversion_rate';
     $helper->refresh = (bool) (ConfigurationKPI::get('CONVERSION_RATE_EXPIRE') < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-carts';
     $helper->icon = 'icon-shopping-cart';
     $helper->color = 'color2';
     $helper->title = $this->trans('Abandoned Carts', array(), 'Admin.OrdersCustomers.Feature');
     $date_from = date(Context::getContext()->language->date_format_lite, strtotime('-2 day'));
     $date_to = date(Context::getContext()->language->date_format_lite, strtotime('-1 day'));
     $helper->subtitle = $this->trans('From %date1% to %date2%', array('%date1%' => $date_from, '%date2%' => $date_to), 'Admin.OrdersCustomers.Feature');
     $helper->href = $this->context->link->getAdminLink('AdminCarts') . '&action=filterOnlyAbandonedCarts';
     if (ConfigurationKPI::get('ABANDONED_CARTS') !== false) {
         $helper->value = ConfigurationKPI::get('ABANDONED_CARTS');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=abandoned_cart';
     $helper->refresh = (bool) (ConfigurationKPI::get('ABANDONED_CARTS_EXPIRE') < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-average-order';
     $helper->icon = 'icon-money';
     $helper->color = 'color3';
     $helper->title = $this->trans('Average Order Value', array(), 'Admin.OrdersCustomers.Feature');
     $helper->subtitle = $this->trans('30 days', array(), 'Admin.Global');
     if (ConfigurationKPI::get('AVG_ORDER_VALUE') !== false) {
         $helper->value = $this->trans('%amount% tax excl.', array('%amount%' => ConfigurationKPI::get('AVG_ORDER_VALUE')), 'Admin.OrdersCustomers.Feature');
     }
     if (ConfigurationKPI::get('AVG_ORDER_VALUE_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=average_order_value';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-net-profit-visitor';
     $helper->icon = 'icon-user';
     $helper->color = 'color4';
     $helper->title = $this->trans('Net Profit per Visitor', array(), 'Admin.OrdersCustomers.Feature');
     $helper->subtitle = $this->trans('30 days', array(), 'Admin.Global');
     if (ConfigurationKPI::get('NETPROFIT_VISITOR') !== false) {
         $helper->value = ConfigurationKPI::get('NETPROFIT_VISITOR');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=netprofit_visitor';
     $helper->refresh = (bool) (ConfigurationKPI::get('NETPROFIT_VISITOR_EXPIRE') < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpiRow();
     $helper->kpis = $kpis;
     return $helper->generate();
 }
Пример #13
0
 public function renderKpis()
 {
     $time = time();
     $kpis = array();
     /* The data generation is located in AdminStatsControllerCore */
     if (Configuration::get('PS_STOCK_MANAGEMENT')) {
         $helper = new HelperKpi();
         $helper->id = 'box-products-stock';
         $helper->icon = 'local_shipping';
         $helper->color = 'color1';
         $helper->title = $this->l('Out of stock items', null, null, false);
         if (ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK') !== false) {
             $helper->value = ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK');
         }
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=percent_product_out_of_stock';
         $helper->tooltip = sprintf($this->l('%s of your products for sale are out of stock.', null, null, false), $helper->value);
         $helper->refresh = (bool) (ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK_EXPIRE') < $time);
         $product_token = Tools::getAdminToken('AdminProducts' . (int) Tab::getIdFromClassName('AdminProducts') . (int) Context::getContext()->employee->id);
         $urlParams = ['filter_column_sav_quantity' => '<=0', 'filter_column_active' => '1', 'token' => $product_token, 'submitFilterproduct' => 1];
         $helper->href = preg_replace("/\\?.*\$/", '?tab=AdminProducts&productFilter_sav!quantity=0&productFilter_active=1&submitFilterproduct=1&token=' . $product_token, Context::getContext()->link->getAdminLink('AdminProducts', true, $urlParams));
         $kpis[] = $helper->generate();
     }
     $helper = new HelperKpi();
     $helper->id = 'box-avg-gross-margin';
     $helper->icon = 'label';
     $helper->color = 'color2';
     $helper->title = $this->l('Average Gross Margin %', null, null, false);
     if (ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN') !== false) {
         $helper->value = ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=product_avg_gross_margin';
     $helper->tooltip = sprintf($this->l('Gross margin expressed in percentage assesses how cost-effectively you sell your goods. Out of $100, you will retain $%s to cover profit and expenses.', null, null, false), str_replace('%', '', $helper->value));
     $helper->refresh = (bool) (ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN_EXPIRE') < $time);
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-8020-sales-catalog';
     $helper->icon = 'whatshot';
     $helper->color = 'color3';
     $helper->title = $this->l('Catalog popularity', null, null, false);
     $helper->subtitle = $this->l('30 days', null, null, false);
     if (ConfigurationKPI::get('8020_SALES_CATALOG') !== false) {
         $helper->value = ConfigurationKPI::get('8020_SALES_CATALOG');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=8020_sales_catalog';
     $helper->tooltip = sprintf($this->l('Within your catalog, %s of your products have had sales in the last 30 days', null, null, false), $helper->value);
     $helper->refresh = (bool) (ConfigurationKPI::get('8020_SALES_CATALOG_EXPIRE') < $time);
     $moduleManagerBuilder = ModuleManagerBuilder::getInstance();
     $moduleManager = $moduleManagerBuilder->build();
     if ($moduleManager->isInstalled('statsbestproducts')) {
         $helper->href = Context::getContext()->link->getAdminLink('AdminStats') . '&module=statsbestproducts&datepickerFrom=' . date('Y-m-d', strtotime('-30 days')) . '&datepickerTo=' . date('Y-m-d');
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-disabled-products';
     $helper->icon = 'visibility_off';
     $helper->color = 'color4';
     $helper->title = $this->l('Disabled Products', null, null, false);
     if (ConfigurationKPI::get('DISABLED_PRODUCTS') !== false) {
         $helper->value = ConfigurationKPI::get('DISABLED_PRODUCTS');
     }
     $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=disabled_products';
     $helper->refresh = (bool) (ConfigurationKPI::get('DISABLED_PRODUCTS_EXPIRE') < $time);
     $helper->tooltip = sprintf($this->l('%s of your products are disabled and not visible to your customers', null, null, false), $helper->value);
     $product_token = Tools::getAdminToken('AdminProducts' . (int) Tab::getIdFromClassName('AdminProducts') . (int) Context::getContext()->employee->id);
     $urlParams = ['filter_column_active' => '0', 'token' => $product_token, 'submitFilterproduct' => 1];
     $helper->href = preg_replace("/\\?.*\$/", '?tab=AdminProducts&productFilter_active=0&submitFilterproduct=1&token=' . $product_token, Context::getContext()->link->getAdminLink('AdminProducts', true, $urlParams));
     $kpis[] = $helper->generate();
     $helper = new HelperKpiRow();
     $helper->kpis = $kpis;
     return $helper->generate();
 }
Пример #14
0
 public function renderKpis()
 {
     $time = time();
     $kpis = array();
     /* The data generation is located in AdminStatsControllerCore */
     $helper = new HelperKpi();
     $helper->id = 'box-installed-modules';
     $helper->icon = 'icon-puzzle-piece';
     $helper->color = 'color1';
     $helper->title = $this->l('Installed Modules', null, null, false);
     if (ConfigurationKPI::get('INSTALLED_MODULES') !== false && ConfigurationKPI::get('INSTALLED_MODULES') != '') {
         $helper->value = ConfigurationKPI::get('INSTALLED_MODULES');
     }
     if (ConfigurationKPI::get('INSTALLED_MODULES_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=installed_modules';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-disabled-modules';
     $helper->icon = 'icon-off';
     $helper->color = 'color2';
     $helper->title = $this->l('Disabled Modules', null, null, false);
     if (ConfigurationKPI::get('DISABLED_MODULES') !== false && ConfigurationKPI::get('DISABLED_MODULES') != '') {
         $helper->value = ConfigurationKPI::get('DISABLED_MODULES');
     }
     if (ConfigurationKPI::get('DISABLED_MODULES_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=disabled_modules';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpi();
     $helper->id = 'box-update-modules';
     $helper->icon = 'icon-refresh';
     $helper->color = 'color3';
     $helper->title = $this->l('Modules to update', null, null, false);
     if (ConfigurationKPI::get('UPDATE_MODULES') !== false && ConfigurationKPI::get('UPDATE_MODULES') != '') {
         $helper->value = ConfigurationKPI::get('UPDATE_MODULES');
     }
     if (ConfigurationKPI::get('UPDATE_MODULES_EXPIRE') < $time) {
         $helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=update_modules';
     }
     $kpis[] = $helper->generate();
     $helper = new HelperKpiRow();
     $helper->kpis = $kpis;
     return $helper->generate();
 }