| 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/mnSwitcher/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\mnSwitcher\code;
/**
* Description of MNExtendedDatatable
*
* @author maros
*/
abstract class MNExtendedDatatable extends \modules\extendedDatatable\code\ExtendedDatatable {
/** @var MNSwitcher */
private $switcher;
public function setSwitcher($switcher) {
$this->switcher = $switcher;
}
public function processRow($array, $key, $params = array()) {
$actions = array(
'<label style="margin-top: 2px;" class="mt-checkbox mt-checkbox-single mt-checkbox-outline readOnlyHidden"><input name="' . $this->switcher->getSourceTableIdColumn() . '[]" class="price-lists-items-id checkboxes" type="checkbox" value="' . $array[$this->switcher->getSourceTableIdColumn()] . '"/><span></span></label>'
);
$this->data[$key] = array(implode("", $actions)) + $array;
}
protected function getFixedBindArray() {
return array(
"target_id" => $this->switcher->getTargetId()
);
}
protected function getFixedSqlCondition() {
return $this->switcher->getSourceTable() . "." . $this->switcher->getSourceTableIdColumn() . " " .
($this->type === "target" ? "" : "NOT") . " IN(SELECT " . $this->switcher->getSourceTable() . "_" . $this->switcher->getSourceTableIdColumn() . (
$this->switcher->getSourceTable() === $this->switcher->getTargetTable() && $this->switcher->getSourceTableIdColumn() === $this->switcher->getTargetTableIdColumn() ? "_assigned" : ""
) . " FROM " .
$this->switcher->getTable() . " WHERE " . $this->switcher->getTargetTable() . "_" . $this->switcher->getTargetTableIdColumn() . "=:target_id)";
}
public function prepareAjaxTableData($post) {
$this->post = $post;
$this->targetTable = $this->switcher->getTargetTable();
$this->type = $this->getPost("type") === "source" ? "source" : "target";
$this->targetId = $this->switcher->getTargetId();
parent::prepareAjaxTableData($post);
}
public function getReponseData() {
$ids = new \app\classes\PDOCollection($this->switcher->getSourceTable(), $this->switcher->getSourceTableIdColumn(), "SELECT " . $this->switcher->getSourceTable() . "." . $this->switcher->getSourceTableIdColumn() . ", " . substr($this->sqlFiltered, 6), $this->bindArrayFiltered);
return array("ids" => array_column($ids->toArray(), $this->switcher->getSourceTableIdColumn())) + parent::getReponseData();
}
}