| 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/artav.sk/poradna/modules/prototype/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\prototype\code;
class Datatable extends DatableCollection {
public function __construct($post) {
$columns = array(
"id" => "id",
"first_name" => "first_name",
"last_name" => "last_name",
"email" => "email",
"last_login" => "last_login",
"grade" => "grade",
"phone" => "phone"
);
parent::__construct("users", "id", " WHERE state=:state", $columns, $post, array("state" => \app\constants\State::ACTIVE));
}
public function getReponseData() {
$loggedUser = AdminUser::getLoggedUser();
$this->loggedUserGrade = intval($loggedUser->_get("grade"));
$this->collection = array_map(function($element) {
$element["last_login"] = $element["last_login"] === NULL ? "" : date("d.m.Y H:i:s", strtotime($element["last_login"]));
$element["actions"] = $this->loggedUserGrade < intval($element["grade"]) ? "<span class='btn btn-danger btn-block btn-xs' onclick='deleteAdminUser(" . $element["id"] . ")'><i class='fa fa-trash'></i> Zmazať</span>" : "<span class='btn btn-danger btn-block btn-xs disabled'><i class='fa fa-trash'></i> Zmazať</span>";
unset($element["grade"]);
return $element;
}, $this->collection);
return parent::getReponseData();
}
}