| 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/extendedDatatable/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\extendedDatatable\code;
/**
* Description of TextColumnController
*
* @author maros
*/
class DatetimeColumnController extends ColumnController {
public function getTableValue($val, $export = false) {
return strtotime($val) === false ? $val : date("d.m.Y H:i:s", strtotime($val));
}
public function renderFilterInput($params = array()) {
if (!(key_exists(ExtendedDatatable::COLUMN_DISABLE_FILTER, $this->config) && $this->config[ExtendedDatatable::COLUMN_DISABLE_FILTER] === true)) {
$from = new \PFBC\Element\Textbox("", $this->column . "[0]", array("class" => "datepicker form-control input-sm double-filter form-filter", "placeholder" => "od"));
$to = new \PFBC\Element\Textbox("", $this->column . "[1]", array("class" => "datepicker form-control input-sm double-filter form-filter", "placeholder" => "do"));
$from->render();
$to->render();
}
}
public function getDatatableSqlConditionValue($value) {
$value[0] = $value[0] === "" || $value[0] === FALSE || $value[0] === NULL ? NULL : date("Y-m-d H:i:s", strtotime($value[0]));
$value[1] = $value[1] === "" || $value[1] === FALSE || $value[1] === NULL ? NULL : date("Y-m-d H:i:s", strtotime($value[1]));
return $value;
}
public function getDatatableSqlCondition($sqlVarName, $bindArrayVarName, $value) {
if ($value[0] === NULL && $value[1] === NULL) {
return "";
}
if ($value[0] !== NULL && $value[1] !== NULL) {
return "(" . $sqlVarName . " >=:" . $bindArrayVarName . "0 AND " . $sqlVarName . " <=:" . $bindArrayVarName . "1)";
}
if ($value[0] !== NULL) {
return $sqlVarName . " >=:" . $bindArrayVarName . "0";
}
if ($value[1] !== NULL) {
return $sqlVarName . " <=:" . $bindArrayVarName . "1";
}
return "";
}
}