Skip to content

Commit

Permalink
Merge pull request #877 from shreesh-webkul/gli-1284
Browse files Browse the repository at this point in the history
Added: New module for extra service and facilities stastistics
  • Loading branch information
rohit053 authored Apr 3, 2024
2 parents 1b9ee35 + 9c4ba10 commit 18fe10c
Show file tree
Hide file tree
Showing 12 changed files with 510 additions and 18 deletions.
7 changes: 3 additions & 4 deletions classes/module/ModuleGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,12 @@ protected function csvExport($datas)
{
$this->_sort = $datas['defaultSortColumn'];
$this->setLang(Context::getContext()->language->id);
$this->getData();

$layers = isset($datas['layers']) ? $datas['layers'] : 1;

if (isset($datas['option'])) {
$this->setOption($datas['option'], $layers);
}
$this->getData();

$layers = isset($datas['layers']) ? $datas['layers'] : 1;

if (count($datas['columns'])) {
foreach ($datas['columns'] as $column) {
Expand Down
1 change: 1 addition & 0 deletions install/models/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ public function getModulesList()
'statsbestvouchers',
'statsbestcustomers',
'statsequipment',
'qlostatsserviceproducts',
'blockcart',
'blockuserinfo',
'qlochannelmanagerconnector',
Expand Down
31 changes: 17 additions & 14 deletions modules/gridhtml/gridhtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ function install()

public static function hookGridEngine($params, $grider)
{
static $divid = 1;

$objModule = Module::getInstanceByName('gridhtml');
self::$_columns = $params['columns'];
if (!isset($params['emptyMsg']))
Expand All @@ -71,32 +73,32 @@ public static function hookGridEngine($params, $grider)
}

$html = '
<table class="table" id="grid_1">
<table class="table" id="grid_'.$divid.'">
<thead>
<tr>';
foreach ($params['columns'] as $column)
$html .= '<th class="center" '.((isset($column['tooltip']) && $column['tooltip']) ? ('data-toggle="tooltip" title="'.$column['tooltip'].'"') : '').'><span class="title_box active">'.$column['header'].'</span></th>';
$html .= '<th class="'.((isset($column['align']) && $column['align']) ? $column['align'] : 'center').'" '.((isset($column['tooltip']) && $column['tooltip']) ? ('data-toggle="tooltip" title="'.$column['tooltip'].'"') : '').'><span class="title_box active">'.$column['header'].'</span></th>';
$html .= '</tr>
</thead>
<tbody></tbody>
<tfoot><tr><th colspan="'.count($params['columns']).'"></th></tr></tfoot>
</table>
<script type="text/javascript">
function getGridData(url)
function getGridData'.$divid.'(url)
{
$("#grid_1 tbody").html("<tr><td style=\"text-align:center\" colspan=\"" + '.count($params['columns']).' + "\"><img src=\"../img/loadingAnimation.gif\" /></td></tr>");
$("#grid_'.$divid.' tbody").html("<tr><td style=\"text-align:center\" colspan=\"" + '.count($params['columns']).' + "\"><img src=\"../img/loadingAnimation.gif\" /></td></tr>");
$.get(url, "", function(json) {
$("#grid_1 tbody").html("");
$("#grid_'.$divid.' tbody").html("");
var array = $.parseJSON(json);
$("#grid_1 tfoot tr th").html("'.addslashes($params['pagingMessage']).'");
$("#grid_1 tfoot tr th").html($("#grid_1 tfoot tr th").html().replace("{0}", array["from"]));
$("#grid_1 tfoot tr th").html($("#grid_1 tfoot tr th").html().replace("{1}", array["to"]));
$("#grid_1 tfoot tr th").html($("#grid_1 tfoot tr th").html().replace("{2}", array["total"]));
$("#grid_'.$divid.' tfoot tr th").html("'.addslashes($params['pagingMessage']).'");
$("#grid_'.$divid.' tfoot tr th").html($("#grid_'.$divid.' tfoot tr th").html().replace("{0}", array["from"]));
$("#grid_'.$divid.' tfoot tr th").html($("#grid_'.$divid.' tfoot tr th").html().replace("{1}", array["to"]));
$("#grid_'.$divid.' tfoot tr th").html($("#grid_'.$divid.' tfoot tr th").html().replace("{2}", array["total"]));
if (array["from"] > 1)
$("#grid_1 tfoot tr th").html($("#grid_1 tfoot tr th").html() + " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style=\\"cursor:pointer;text-decoration:none\\" onclick=\\"gridPrevPage(\'"+ url +"\');\\">&lt;&lt;</a>");
$("#grid_'.$divid.' tfoot tr th").html($("#grid_'.$divid.' tfoot tr th").html() + " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style=\\"cursor:pointer;text-decoration:none\\" onclick=\\"gridPrevPage(\'"+ url +"\');\\">&lt;&lt;</a>");
if (array["to"] < array["total"])
$("#grid_1 tfoot tr th").html($("#grid_1 tfoot tr th").html() + " | <a style=\\"cursor:pointer;text-decoration:none\\" onclick=\\"gridNextPage(\'"+ url +"\');\\">&gt;&gt;</a>");
$("#grid_'.$divid.' tfoot tr th").html($("#grid_'.$divid.' tfoot tr th").html() + " | <a style=\\"cursor:pointer;text-decoration:none\\" onclick=\\"gridNextPage(\'"+ url +"\');\\">&gt;&gt;</a>");
var values = array["values"];
if (values.length > 0)
$.each(values, function(index, row){
Expand All @@ -107,10 +109,10 @@ function getGridData(url)
$params['defaultSortColumn'] = false;
if (!isset($params['defaultSortDirection']))
$params['defaultSortDirection'] = false;
$html .= ' $("#grid_1 tbody").append(newLine);
$html .= ' $("#grid_'.$divid.' tbody").append(newLine);
});
else
$("#grid_1 tbody").append("<tr><td class=\"center\" colspan=\"" + '.count($params['columns']).' + "\">'.$params['emptyMsg'].'</td></tr>");
$("#grid_'.$divid.' tbody").append("<tr><td class=\"center\" colspan=\"" + '.count($params['columns']).' + "\">'.$params['emptyMsg'].'</td></tr>");
});
}
Expand Down Expand Up @@ -142,8 +144,9 @@ function gridPrevPage(url)
getGridData(url);
}
$(document).ready(function(){getGridData("'.$grider.'&sort='.urlencode($params['defaultSortColumn']).'&dir='.urlencode($params['defaultSortDirection']).$customParams.'");});
$(document).ready(function(){getGridData'.$divid.'("'.$grider.'&sort='.urlencode($params['defaultSortColumn']).'&dir='.urlencode($params['defaultSortDirection']).$customParams.'");});
</script>';
$divid++;
return $html;
}

Expand Down
4 changes: 4 additions & 0 deletions modules/qlostatsserviceproducts/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Changelog

v1.0.0
- first release
29 changes: 29 additions & 0 deletions modules/qlostatsserviceproducts/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* Since 2010 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <[email protected]>
* @copyright Since 2010 Webkul IN
* @license https://store.webkul.com/license.html
*/

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');

header('Location: ../../../');
exit;
Binary file added modules/qlostatsserviceproducts/logo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/qlostatsserviceproducts/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 18fe10c

Please sign in to comment.