| 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/enums/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\enums\code;
use modules\extendedDatatable\code\ExtendedDatatable as ExtendedDatatable;
/**
* Description of EnumsColumnController
*
* @author maros
*/
class EnumsColumnController extends \modules\extendedDatatable\code\ColumnController {
public function __construct(string $column, &$config) {
parent::__construct($column, $config);
$this->isUsingLikeConditions = true;
}
protected function initFilterOptions() {
$enums = new EnumsModule();
$columnExplode = explode(".", $this->column);
$collection = $enums->getStaticEnum($columnExplode[0], isset($columnExplode[1]) ? $columnExplode[1] : false);
if (isset($this->config[ExtendedDatatable::COLUMN_TRANSLATE_FILTER_OPTIONS]) && $this->config[ExtendedDatatable::COLUMN_TRANSLATE_FILTER_OPTIONS]) {
$t = \app\classes\Translator::getInstance();
foreach ($collection as $key => $val) {
$collection[$key] = $t->_get(
(key_exists(ExtendedDatatable::COLUMN_TRANSLATE_FILTER_OPTIONS_PREFIX, $this->config) ? $this->config[ExtendedDatatable::COLUMN_TRANSLATE_FILTER_OPTIONS_PREFIX] . "_" : "")
. $val
);
}
}
$this->filterOptions = array("" => "") + $collection;
}
public function getDatatableSqlCondition($sqlVarName, $bindArrayVarName, $value) {
if (is_array($value) && count($value) === 1 && strlen(trim($value[0])) === 0) {
return false;
}
if (is_array($value)) {
$vars = range(0, count($value) - 1);
$conds = array();
foreach ($vars as $key => $val) {
$vars[$key] = $bindArrayVarName . $val;
$conds[] = $sqlVarName . " LIKE :" . $bindArrayVarName . $val . " ";
}
return "(" . implode(" OR ", $conds) . ")";
}
return $sqlVarName . " LIKE :" . $bindArrayVarName . " COLLATE utf8_general_ci";
}
public function getTableValue($val) {
return $val;
}
}