| 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/payouts/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.
*/
/**
* Description of DatatableUsers
*
* @author Maroš
*/
namespace modules\payouts\code;
class InvoicesExtendedDatatable extends \modules\extendedDatatable\code\ExtendedDatatable {
private const ADMIN_ONLY_COLUMNS = [
'payouts_invoices_items.code_user',
];
private $helper;
public function __construct() {
parent::__construct("/modules/payouts/", "invoices_datatable");
$this->helper = new MappingHelper();
//$this->debug = true;
}
public function applyAccessRestrictions(bool $isAdmin): void {
if ($isAdmin) {
return;
}
foreach (self::ADMIN_ONLY_COLUMNS as $columnKey) {
if (isset($this->columns[$columnKey])) {
$this->columns[$columnKey][self::COLUMN_VISIBLE] = false;
}
}
$this->rebuildColumnIndexToName();
}
public function getColumnIndex(string $columnKey): ?int {
$index = array_search($columnKey, $this->columnIndexToName, true);
return $index === false ? null : (int) $index;
}
private function rebuildColumnIndexToName(): void {
$shift = intval($this->getIncConfig(self::CONFIG_SHIFT, false, $this->tableConfig, $this->iniVars)) - 1;
$this->columnIndexToName = [$shift => null];
foreach ($this->columns as $key => $val) {
if ($val[self::COLUMN_VISIBLE]) {
$this->columnIndexToName[] = $key;
}
}
}
public function processRow($array, $key, $params = array()) {
$actions = array(
"<span data-toggle='tooltip' title='" . $this->t->_get("Zmazať") . "' class='btn readOnlyHidden btn-danger btn-xs' onclick='deleteItem(" . $array["id"] . ")'><i class='fa fa-trash'></i></span>",
);
if (substr($array["data_pack_id"], 0, 2) === "X-") {
$actions[] = "<span data-toggle='tooltip' title='" . $this->t->_get("Duplikovať") . "' style='margin-left: 5px' class='btn btn-warning btn-xs' onclick='duplicateItem(" . $array["payouts_invoices_items_id"] . ")'><i class='fa fa-copy'></i></span>";
$actions[] = "<span data-toggle='tooltip' title='" . $this->t->_get("Zobraziť") . "' style='margin-left: 5px' class='btn btn-primary btn-xs' onclick='manageItem(" . $array["payouts_invoices_items_id"] . ")'><i class='fa fa-eye'></i></span>";
}
$array["code_item"] = $this->helper->mapInvoiceItem($array["code_item"], true) ?: ('<span style="color: gray">' . $array["code_item"] . " - " . $this->t->_get('Neznáme') . '</span>');
$array["code_user"] = $this->helper->mapUser($array["code_user"], true, false, true) ?: ('<span style="color: gray">' . $array["code_user"] . " - " . $this->t->_get('Neznáme') . '</span>');
$array["data_pack_id"] = "<i style='color: " . colorFromString($array["data_pack_id"]) . "' class='fa fa-circle'></i> " . $array["data_pack_id"];
$this->data[$key] = array(implode("", $actions)) + $array;
}
public function getFixedSqlCondition() {
if (strlen(trim($this->getPost("payouts_invoices_items_id_permanent"))) > 0) {
return "payouts_invoices_items.id IN (" . implode(",", explode("!", $this->getPost("payouts_invoices_items_id_permanent"))) . ")";
}
return "payouts_invoices_items.id=-1";
}
}