| Server IP : 37.9.174.138 / Your IP : 216.73.216.117 Web Server : Apache System : Linux vps6.backend.sk 6.12.100+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.100-1 (2026-07-30) x86_64 User : ftpuser ( 1001) PHP Version : 8.4.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/backend-accounting.sk/app/modules/dbUpdatesLogger/code/ |
Upload File : |
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace modules\dbUpdatesLogger\code;
/**
* Description of HistoryExtendedDatatable
*
* @author maros
*/
class HistoryExtendedDatatable extends \modules\extendedDatatable\code\ExtendedDatatable {
protected $table;
protected $autoConvets = array();
CONST AUTO_CONVERTS_FUNC_convertYesNo = "convertYesNo";
CONST AUTO_CONVERTS_FUNC_convertDate = "convertDate";
CONST AUTO_CONVERTS_FUNC_convertDateTime = "convertDateTime";
CONST AUTO_CONVERTS_FUNC_STATIC = "static";
public function __construct($table) {
$this->table = $table;
parent::__construct("/modules/dbUpdatesLogger/", "history_datatable");
$this->columns["db_updates_logger.column_name"][\modules\extendedDatatable\code\ExtendedDatatable::COLUMN_FILTER] = "SELECT column_name FROM db_updates_logger WHERE table_name='" . $table . "' GROUP BY column_name";
$this->columns["db_updates_logger.column_name"][\modules\extendedDatatable\code\ExtendedDatatable::COLUMN_TRANSLATE_FILTER_OPTIONS_PREFIX] = $table;
}
public function processRow($array, $key, $params = array()) {
$method = false;
foreach ($this->autoConvets as $ckey => $cval) {
if (is_array($cval) && in_array($array["column_name"], $cval)) {
$method = $ckey;
break;
} else if (is_array($cval) && key_exists($array["column_name"], $cval)) {
$statitcClassFunc = $cval[$array["column_name"]];
$explode = explode("::", $statitcClassFunc);
if (count($explode) === 2) {
if (class_exists($explode[0], true) && method_exists($explode[0], $explode[1])) {
$array["old_val"] = call_user_func($statitcClassFunc, $array["old_val"]);
$array["new_val"] = call_user_func($statitcClassFunc, $array["new_val"]);
if (!$array["old_val"]) {
$array["old_val"] = "";
}
if (!$array["new_val"]) {
$array["new_val"] = "";
}
}
}
}
}
if ($method === false) {
$method = $array["column_name"];
}
if (method_exists($this, $method)) {
$array["old_val"] = $this->{$method}($array["old_val"]);
$array["new_val"] = $this->{$method}($array["new_val"]);
}
$array["column_name"] = $this->t->_get($this->table . "_" . $array["column_name"]);
$groupColor = substr(md5(strtotime($array["created"])), 0, 6);
$array["created"] = "<span style='color:#" . $groupColor . "'>" . date("d.m.Y H:i:s", strtotime($array["created"])) . "</span>";
$this->data[$key] = array(""
. "<i title='" . $this->t->_get("Položka") . "' data-toggle='tooltip' style='margin-right: 5px; color:#" . substr(md5($array["row_id"]), 0, 6) . "' class='fa fa-circle'></i>"
. "<i title='" . $this->t->_get("Skupina zmeny") . "' data-toggle='tooltip' style='color:#" . $groupColor . "' class='fa fa-clock'></i>"
. "") + $array;
}
public function getFixedSqlCondition() {
return "db_updates_logger.table_name=:tableName AND db_updates_logger.row_id=:rowId";
}
public function getFixedBindArray() {
return array(
"rowId" => $this->getPost("rowId"),
"tableName" => $this->table
);
}
protected function convertYesNo($val) {
return intval($val) === 1 ? $this->t->_get("Áno") : $this->t->_get("Nie");
}
protected function convertDate($val) {
return strtotime($val) === false ? $val : date("d.m.Y", strtotime($val));
}
protected function convertDateTime($val) {
return strtotime($val) === false ? $val : date("d.m.Y H:i:s", strtotime($val));
}
}