1<?php 2/** 3 * Copyright since 2007 PrestaShop SA and Contributors 4 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA 5 * 6 * NOTICE OF LICENSE 7 * 8 * This source file is subject to the Open Software License (OSL 3.0) 9 * that is bundled with this package in the file LICENSE.md. 10 * It is also available through the world-wide-web at this URL: 11 * https://opensource.org/licenses/OSL-3.0 12 * If you did not receive a copy of the license and are unable to 13 * obtain it through the world-wide-web, please send an email 14 * to license@prestashop.com so we can send you a copy immediately. 15 * 16 * DISCLAIMER 17 * 18 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer 19 * versions in the future. If you wish to customize PrestaShop for your 20 * needs please refer to https://devdocs.prestashop.com/ for more information. 21 * 22 * @author PrestaShop SA and Contributors <contact@prestashop.com> 23 * @copyright Since 2007 PrestaShop SA and Contributors 24 * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) 25 */ 26abstract class ModuleGraphEngineCore extends Module 27{ 28 protected $_type; 29 30 public function __construct($type) 31 { 32 $this->_type = $type; 33 } 34 35 public function install() 36 { 37 if (!parent::install()) { 38 return false; 39 } 40 41 return Configuration::updateValue('PS_STATS_RENDER', $this->name); 42 } 43 44 public static function getGraphEngines() 45 { 46 $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' 47 SELECT m.`name` 48 FROM `' . _DB_PREFIX_ . 'module` m 49 LEFT JOIN `' . _DB_PREFIX_ . 'hook_module` hm ON hm.`id_module` = m.`id_module` 50 LEFT JOIN `' . _DB_PREFIX_ . 'hook` h ON hm.`id_hook` = h.`id_hook` 51 WHERE h.`name` = \'displayAdminStatsGraphEngine\' 52 '); 53 54 $array_engines = []; 55 foreach ($result as $module) { 56 $instance = Module::getInstanceByName($module['name']); 57 if (!$instance) { 58 continue; 59 } 60 $array_engines[$module['name']] = [$instance->displayName, $instance->description]; 61 } 62 63 return $array_engines; 64 } 65 66 abstract public function createValues($values); 67 68 abstract public function setSize($width, $height); 69 70 abstract public function setLegend($legend); 71 72 abstract public function setTitles($titles); 73 74 abstract public function draw(); 75} 76