|
|
@@ -6,7 +6,6 @@ class TableAjax extends ViewAjax {
|
|
|
|
|
|
private $_cnf = '';// Column
|
|
|
private $_htmlID = '';
|
|
|
- private $_dataSource = null;
|
|
|
private $_rowFunctions = array();
|
|
|
private $_pageSizes = array();
|
|
|
private $_filterInit = null;
|
|
|
@@ -17,7 +16,6 @@ class TableAjax extends ViewAjax {
|
|
|
$this->_tbl = $tblAcl->getName();
|
|
|
$this->_acl = $tblAcl;
|
|
|
$this->_zasobID = $tblAcl->getID();
|
|
|
- $this->_dataSource = $tblAcl->getDataSource();
|
|
|
|
|
|
$this->_pageSizes = array(10, 20, 50, 100);// default page sizes
|
|
|
$this->_filterInit = new stdClass();
|
|
|
@@ -30,8 +28,6 @@ class TableAjax extends ViewAjax {
|
|
|
$this->_htmlID = $this->generateHtmlID();
|
|
|
$this->_readState();
|
|
|
}
|
|
|
-
|
|
|
- $this->_geomFields = $this->_dataSource->getGeomFields();
|
|
|
}
|
|
|
|
|
|
public function showProcesInit($bool = true) {
|
|
|
@@ -235,7 +231,7 @@ class TableAjax extends ViewAjax {
|
|
|
$hasGeomFields = false;
|
|
|
$fieldsList = $this->_acl->getFields();
|
|
|
foreach ($fieldsList as $kID => $vCol) {
|
|
|
- if ($this->_dataSource->isGeomField($vCol['name'])) {
|
|
|
+ if ($this->_acl->isGeomField($vCol['name'])) {
|
|
|
if ($this->_acl->hasFieldPerm($kID, 'R')) {
|
|
|
$hasGeomFields = true;
|
|
|
break;
|
|
|
@@ -2534,7 +2530,7 @@ jQuery(document).ready(function(){
|
|
|
rowFunctions: <?php echo json_encode($rowFunctions); ?>,
|
|
|
exportFields: <?php echo json_encode($exportFields); ?>,
|
|
|
specialFilterFunctions: <?php
|
|
|
- $fltrs = $this->_dataSource->getSpecialFilters();
|
|
|
+ $fltrs = $this->_acl->getSpecialFilters();
|
|
|
if (!empty($fltrs)) {
|
|
|
echo json_encode($fltrs);
|
|
|
} else {
|
|
|
@@ -3073,7 +3069,7 @@ function hidePopover() {
|
|
|
if (!empty($tsValues[$row->ID])) {
|
|
|
$fieldParams['typespecialValue'] = $tsValues[$row->ID];
|
|
|
}
|
|
|
- $vDefault = $this->_dataSource->getColDefault($fieldName);
|
|
|
+ $vDefault = $this->_acl->getColDefault($fieldName);
|
|
|
if (!empty($vDefault)) {
|
|
|
$fieldParams['default'] = $vDefault;
|
|
|
}
|
|
|
@@ -3695,7 +3691,7 @@ jQuery(document).ready(function(){
|
|
|
private function sendAjaxHistory($id, $args) {
|
|
|
header("Content-type: text/plain");
|
|
|
|
|
|
- $record = $this->_dataSource->getItem($id);
|
|
|
+ $record = $this->_acl->getItem($id);
|
|
|
if (!$record) {
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
echo "404: No item ID({$rowID})";
|
|
|
@@ -3703,7 +3699,7 @@ jQuery(document).ready(function(){
|
|
|
}
|
|
|
|
|
|
$visibleCols = $this->_acl->getRealFieldList();
|
|
|
- $rowsHist = $this->_dataSource->getHistItems($id);
|
|
|
+ $rowsHist = $this->_acl->getHistItems($id);
|
|
|
|
|
|
$rowFunctionsOut = $this->_showRowFunctions($record->ID, array('hist', 'cp'), true);
|
|
|
|
|
|
@@ -3815,7 +3811,7 @@ jQuery(document).ready(function(){
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
- $record = $this->_dataSource->getItem($id);
|
|
|
+ $record = $this->_acl->getItem($id);
|
|
|
if (!$record) {
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
echo '{"type":"ERROR", "string": "No item ID(' . $rowID . ')"}';
|
|
|
@@ -3890,7 +3886,7 @@ jQuery(document).ready(function(){
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
- $record = $this->_dataSource->getItem($id);
|
|
|
+ $record = $this->_acl->getItem($id);
|
|
|
if (!$record) {
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
echo '{"type":"ERROR", "string": "No item ID(' . $rowID . ')"}';
|
|
|
@@ -3939,7 +3935,7 @@ jQuery(document).ready(function(){
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
- $record = $this->_dataSource->getItem($id);
|
|
|
+ $record = $this->_acl->getItem($id);
|
|
|
if (!$record) {
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
echo '{"type":"ERROR", "string": "No item ID(' . $rowID . ')"}';
|
|
|
@@ -3987,7 +3983,7 @@ jQuery(document).ready(function(){
|
|
|
$db = DB::getDB($dbID);
|
|
|
if (!$db) throw new HttpException("No DB", 406);
|
|
|
|
|
|
- $record = $this->_dataSource->getItem($id);
|
|
|
+ $record = $this->_acl->getItem($id);
|
|
|
if (!$record) throw new Exception("No item ID({$rowID})", 404);
|
|
|
|
|
|
$tblName = $this->_acl->getName();
|
|
|
@@ -4100,7 +4096,7 @@ jQuery(document).ready(function(){
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
- $record = $this->_dataSource->getItem($id);
|
|
|
+ $record = $this->_acl->getItem($id);
|
|
|
if (!$record) {
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
echo 'No item ID(' . $rowID . ')';
|
|
|
@@ -4243,7 +4239,7 @@ jQuery(document).ready(function(){
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
- $record = $this->_dataSource->getItem($id);
|
|
|
+ $record = $this->_acl->getItem($id);
|
|
|
if (!$record) {
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
echo "404: No item ID({$rowID})";
|
|
|
@@ -4846,7 +4842,7 @@ jQuery(document).ready(function(){
|
|
|
$fldID = $this->_acl->getFieldIdByName($fldName);
|
|
|
if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">fld('.$fldName.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($fldID);echo'</pre>';}
|
|
|
|
|
|
- $item = $this->_dataSource->getItem($id);
|
|
|
+ $item = $this->_acl->getItem($id);
|
|
|
if (!$this->_acl->isAllowed($fldID, 'R', $item)) {
|
|
|
$jsonData->msg = 'Brak dostępu';
|
|
|
echo json_encode($jsonData);
|
|
|
@@ -4906,7 +4902,6 @@ jQuery(document).ready(function(){
|
|
|
|
|
|
$this->setFilters($filters);
|
|
|
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">_dataSource (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($this->_dataSource);echo'</pre>';}
|
|
|
$vCols = $this->_acl->getVirtualFieldList();
|
|
|
if (!empty($vCols)) {
|
|
|
if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">vCols (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($vCols);echo'</pre>';}
|
|
|
@@ -4914,9 +4909,9 @@ jQuery(document).ready(function(){
|
|
|
|
|
|
Lib::loadClass('Typespecial');
|
|
|
|
|
|
- $total = $this->_dataSource->getTotal($params);
|
|
|
+ $total = $this->_acl->getTotal($params);
|
|
|
if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">get_total (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($total);echo'</pre>';}
|
|
|
- $items = $this->_dataSource->getItems($params);
|
|
|
+ $items = $this->_acl->getItems($params);
|
|
|
if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">items (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($items);echo'</pre>';}
|
|
|
// TODO: add virtual data by Typespecial
|
|
|
if (!empty($vCols) && !empty($items)) {
|
|
|
@@ -4965,7 +4960,7 @@ jQuery(document).ready(function(){
|
|
|
// Ahmes problems Status colors
|
|
|
$columnConfig->format = '<div class="cell-Status-{0}">{0}</div>';
|
|
|
}
|
|
|
- else if ($this->_dataSource->isGeomField($col)) {
|
|
|
+ else if ($this->_acl->isGeomField($col)) {
|
|
|
$columnConfig->type = 'geom';
|
|
|
}
|
|
|
if ('' !== ($label = $this->_acl->getFieldLabel($fieldID))) {
|
|
|
@@ -5017,8 +5012,6 @@ jQuery(document).ready(function(){
|
|
|
}
|
|
|
$jsonData->rows[] = $vItem;
|
|
|
}
|
|
|
-//echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">this->_dataSource (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($this->_dataSource);echo'</pre>';
|
|
|
-//echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">jsonData (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($jsonData);echo'</pre>';
|
|
|
return $jsonData;
|
|
|
}
|
|
|
|
|
|
@@ -5105,7 +5098,7 @@ jQuery(document).ready(function(){
|
|
|
}
|
|
|
// TODO: validate polygon - ex.: POLYGON((2072030.2315435 7234115.910678,2072029.4815435 7234093.660678,2072115.2315435 7234091.160678,2072115.4815435 7234113.660678,2072115.2315435 7234113.660678,2072094.2315435 7234113.910678,2072030.2315435 7234115.910678)))
|
|
|
|
|
|
- $record = $this->_dataSource->getItem($id);
|
|
|
+ $record = $this->_acl->getItem($id);
|
|
|
if (!$this->_acl->canWriteRecord($record) && !$this->_acl->hasPermSuperWrite()) {
|
|
|
throw new HttpException("Brak dostępu do rekordu", 403);
|
|
|
}
|
|
|
@@ -5119,21 +5112,24 @@ jQuery(document).ready(function(){
|
|
|
$itemPatch->{$geomFieldName} = "GeomFromText('{$polygon}')";
|
|
|
$itemPatch->ID = $id;
|
|
|
|
|
|
- $affected = $this->_dataSource->updateItem($itemPatch);
|
|
|
-
|
|
|
$response = new stdClass();
|
|
|
- if ($affected > 0) {
|
|
|
- $response->type = 'success';
|
|
|
- $response->msg = "Rekord zapisany pomyślnie";//"Record saved successfully";
|
|
|
- } else if ($affected == 0) {
|
|
|
- $response->type = 'info';
|
|
|
- $response->msg = "Nie wprowadzono żadnych zmian";
|
|
|
- } else {
|
|
|
+ try {
|
|
|
+ $affected = $this->_acl->updateItem($itemPatch);
|
|
|
+
|
|
|
+ if ($affected > 0) {
|
|
|
+ $response->type = 'success';
|
|
|
+ $response->msg = "Rekord zapisany pomyślnie";//"Record saved successfully";
|
|
|
+ } else if ($affected == 0) {
|
|
|
+ $response->type = 'info';
|
|
|
+ $response->msg = "Nie wprowadzono żadnych zmian";
|
|
|
+ }
|
|
|
+ $response->record = $this->_acl->getItem($id);
|
|
|
+ }
|
|
|
+ catch (Exception $e) {
|
|
|
$response->type = 'error';
|
|
|
- $response->msg = "Wystąpiły błędy!";
|
|
|
- $response->errors = $this->_dataSource->getDbErrors();
|
|
|
+ $response->msg = $e->getMessage();
|
|
|
}
|
|
|
- $response->record = $this->_dataSource->getItem($id);
|
|
|
+
|
|
|
return $response;
|
|
|
}
|
|
|
|
|
|
@@ -5171,9 +5167,7 @@ jQuery(document).ready(function(){
|
|
|
throw new HttpException("Wrong param ID", 404);
|
|
|
}
|
|
|
|
|
|
- $tblName = $this->_acl->getName();
|
|
|
-
|
|
|
- $record = $this->_dataSource->getItem($id);
|
|
|
+ $record = $this->_acl->getItem($id);
|
|
|
if (!$record) {
|
|
|
throw new HttpException("Nie odnaleziono rekordu nr {$id}", 404);
|
|
|
}
|
|
|
@@ -5197,21 +5191,24 @@ jQuery(document).ready(function(){
|
|
|
$itemPatch->{$geomFieldName} = "NULL";
|
|
|
$itemPatch->ID = $id;
|
|
|
|
|
|
- $affected = $this->_dataSource->updateItem($itemPatch);
|
|
|
-
|
|
|
$response = new stdClass();
|
|
|
- if ($affected > 0) {
|
|
|
- $response->type = 'success';
|
|
|
- $response->msg = "Rekord zapisany pomyślnie";//"Record saved successfully";
|
|
|
- } else if ($affected == 0) {
|
|
|
- $response->type = 'info';
|
|
|
- $response->msg = "Nie wprowadzono żadnych zmian";
|
|
|
- } else {
|
|
|
+ try {
|
|
|
+ $affected = $this->_acl->updateItem($itemPatch);
|
|
|
+
|
|
|
+ if ($affected > 0) {
|
|
|
+ $response->type = 'success';
|
|
|
+ $response->msg = "Rekord zapisany pomyślnie";//"Record saved successfully";
|
|
|
+ } else if ($affected == 0) {
|
|
|
+ $response->type = 'info';
|
|
|
+ $response->msg = "Nie wprowadzono żadnych zmian";
|
|
|
+ }
|
|
|
+ $response->record = $this->_acl->getItem($id);
|
|
|
+ }
|
|
|
+ catch (Exception $e) {
|
|
|
$response->type = 'error';
|
|
|
- $response->msg = "Wystąpiły błędy!";
|
|
|
- $response->errors = $this->_dataSource->getDbErrors();
|
|
|
+ $response->msg = $e->getMessage();
|
|
|
}
|
|
|
- $response->record = $this->_dataSource->getItem($id);
|
|
|
+
|
|
|
return $response;
|
|
|
}
|
|
|
|