* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 6594 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_CAN_LOAD_FILES_')) exit; class GridHtml extends ModuleGridEngine { private $_values; private static $_columns; function __construct($type = null) { if ($type != null) parent::__construct($type); else { $this->name = 'gridhtml'; $this->tab = 'administration'; $this->version = 1.0; $this->author = 'PrestaShop'; $this->need_instance = 0; Module::__construct(); $this->displayName = $this->l('Simple HTML table display'); $this->description = ''; } } function install() { return (parent::install() AND $this->registerHook('GridEngine')); } public static function hookGridEngine($params, $grider) { self::$_columns = $params['columns']; if (!isset($params['emptyMsg'])) $params['emptyMsg'] = 'Empty'; $html = '
'; foreach ($params['columns'] as $column) $html .= ''; $html .= '
'.$column['header'].'
'; return $html; } public function setColumnsInfos(&$infos) { } public function setValues($values) { $this->_values = $values; } public function setTitle($title) { $this->_title = $title; } public function setSize($width, $height) { $this->_width = $width; $this->_height = $height; } public function setTotalCount($totalCount) { $this->_totalCount = $totalCount; } public function setLimit($start, $limit) { $this->_start = (int)$start; $this->_limit = (int)$limit; } public function render() { echo Tools::jsonEncode(array( 'total' => $this->_totalCount, 'from' => min($this->_start + 1, $this->_totalCount), 'to' => min($this->_start + $this->_limit, $this->_totalCount), 'values' => $this->_values )); } }