Преглед на файлове

fixed getItem usage - return array

Piotr Labudda преди 9 години
родител
ревизия
54aff03afe
променени са 3 файла, в които са добавени 94 реда и са изтрити 119 реда
  1. 3 3
      SE/se-lib/AclQueryFeatures.php
  2. 5 8
      SE/se-lib/TableAcl.php
  3. 86 108
      SE/se-lib/TableAjax.php

+ 3 - 3
SE/se-lib/AclQueryFeatures.php

@@ -324,7 +324,7 @@ class AclQueryFeatures {
   public function getParam($key) { return V::get($key, '', $this->_params); }
 
   public function getItems() {
-    if ($this->_legacyMode) return $this->_acl->getItems($this->_params);
+    if ($this->_legacyMode) return $this->_acl->getItems($this->_params);// TODO: array_map( $r => (array)$r )
     // 'limit' => 10,
     //  'limitstart' => 0,
     //  'order_by' => 'ID',
@@ -354,8 +354,8 @@ class AclQueryFeatures {
     );
   }
 
-  public function getItem($primaryKey) {
-    if ($this->_legacyMode) return $this->_acl->getItem($primaryKey, $this->_params);
+  public function getItem($primaryKey) { // TODO: throw exception if not found?
+    if ($this->_legacyMode) return (array)$this->_acl->getItem($primaryKey, $this->_params);
     $select = $this->prepareSelect();
     $pkField = $this->_acl->getPrimaryKeyField();
     return $this->fetchRowRefs(

+ 5 - 8
SE/se-lib/TableAcl.php

@@ -1672,14 +1672,11 @@ class TableAcl extends Core_AclBase {
 		$types = $this->getTypes();
 		$uniqKeys = $ds->getUniqueKeys();// TODO: getUniqueFields
 		$primaryKeyField = $ds->getPrimaryKeyField();
-		$itemCopy = new stdClass();
-
+		$itemCopy = array();
 		foreach ($types as $kName => $vType) {
-			if ($kName == $primaryKeyField) {
-				continue;
-			} else if (in_array($kName, array('A_RECORD_UPDATE_AUTHOR','A_RECORD_UPDATE_DATE'))) {
-				continue;
-			}
+			if ($kName == $primaryKeyField) continue;
+			if (in_array($kName, array('A_RECORD_UPDATE_AUTHOR','A_RECORD_UPDATE_DATE'))) continue;
+
 			$value = V::get($kName, '', $item);
 			if (in_array($kName, $uniqKeys)) {
 				$value .= '?';
@@ -1687,7 +1684,7 @@ class TableAcl extends Core_AclBase {
 			if ($ds->isGeomField($kName) && !empty($value)) {
 				$value = "GeomFromText('{$value}')";
 			}
-			$itemCopy->{$kName} = $value;
+			$itemCopy[$kName] = $value;
 		}
 		return $itemCopy;
 	}

+ 86 - 108
SE/se-lib/TableAjax.php

@@ -195,12 +195,12 @@ class TableAjax extends ViewAjax {
 		$this->_saveState('_rowFunctions');
 	}
 
-	private function _parseRowFunctions($recordID = null, $pomin = array(), $showLabel = false) {
+	private function _parseRowFunctions($idRecord = null, $pomin = array(), $showLabel = false) {
 		$rowFunctions = array();
 		foreach ($this->_rowFunctions as $kFunName => $vParams) {
 			if (in_array($kFunName, $pomin)) continue;
 
-			//$rowFunctionsOut .= str_replace('{0}', $recordID, $vUrl);
+			//$rowFunctionsOut .= str_replace('{0}', $idRecord, $vUrl);
 			$attrs = array();
 			// $defaultRowFunction['cp'] = (object)array('href'=>'#', 'ico'=>'glyphicon glyphicon-plus-sign', 'title'=>'Kopiuj rekord', 'onclick'=>'return tableAjaxCopy({0});');
 			$label = '';
@@ -213,8 +213,8 @@ class TableAjax extends ViewAjax {
 
 				$attr = $v;
 
-				if ($recordID > 0) {
-					$attr = str_replace('{0}', $recordID, $attr);
+				if ($idRecord > 0) {
+					$attr = str_replace('{0}', $idRecord, $attr);
 				}
 
 				if ($showLabel && $kParamName == 'title') {
@@ -230,14 +230,14 @@ class TableAjax extends ViewAjax {
 		return $rowFunctions;
 	}
 
-	private function _showRowFunctions($recordID = null, $pomin = array(), $showLabel = false) {
-		$rowFunctionsOut = $this->_parseRowFunctions($recordID, $pomin, $showLabel);
+	private function _showRowFunctions($idRecord = null, $pomin = array(), $showLabel = false) {
+		$rowFunctionsOut = $this->_parseRowFunctions($idRecord, $pomin, $showLabel);
 		$rowFunctionsOut = implode('', $rowFunctionsOut);
 		return $rowFunctionsOut;
 	}
 
-	private function _showRowFunctionsJson($recordID = null, $pomin = array(), $showLabel = false) {
-		$rowFunctions = $this->_parseRowFunctions($recordID, $pomin, $showLabel);
+	private function _showRowFunctionsJson($idRecord = null, $pomin = array(), $showLabel = false) {
+		$rowFunctions = $this->_parseRowFunctions($idRecord, $pomin, $showLabel);
 		$rowFunctions = (object)$rowFunctions;
 		return $rowFunctions;
 	}
@@ -1220,6 +1220,8 @@ var p5UI_TableAjax_generateFunctionNode = function(funObj, rowPK, props) {
 						cellCnt.on('click', {id:rowPK, col:columnName, friendly:columnProps.friendly, value:p5Utils__format(format, [val])}, priv.popoverCellTypeSpecial);
 					}
 				}
+				if ('ref' === columnProps.type) showTooltip = false;
+				if ('ref' === columnProps.type) cellNode.css('padding', "3px")
 
 				if (i > 1 && priv.options.longDesc) {// TODO: use better check for columns: functions and pk
 					cellNode.addClass('tbl-short-txt');
@@ -4265,45 +4267,27 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 		$DBG = ('1' == V::get('DBG', '', $_REQUEST));
 
 		$args = $_REQUEST;
-		$rowID = V::get('ID', 0, $_REQUEST, 'int');
+		$idRecord = V::get('ID', 0, $_REQUEST, 'int');
 		$fieldName = V::get('col', '', $_REQUEST);
 
-		if ($rowID <= 0 || empty($fieldName)) throw new HttpException("404", 404);
+		if ($idRecord <= 0 || empty($fieldName)) throw new HttpException("404", 404);
 
 		$response = array();
 
 		ob_start();
 		$fieldID = $this->_acl->getFieldIdByName($fieldName);
-		if (!$fieldID) {
-			echo "404: No field by name ({$fieldName})";
-			exit;
-		}
+		if (!$fieldID) die("404: No field by name ({$fieldName})");
 		$response['idZasob'] = $fieldID;
 		$response['htmlFieldName'] = "f{$fieldID}";
 
 		if ($DBG) echo "fieldID: {$fieldID}\n";
 
-		$row = $this->_acl->buildQuery([])->getItem($rowID);
-		if (!$row) {
-			echo "404: No item ID({$rowID})";
-			exit;
-		}
-
-		if (!$this->_acl->canReadObjectField($fieldName, $row)) {
-			if ($DBG) echo " R not allowed\n";
-		} else {
-			if ($DBG) echo " R allowed\n";
-		}
-
-		if (!$this->_acl->canWriteObjectField($fieldName, $row)) {
-			if ($DBG) echo " W not allowed\n";
-		} else {
-			if ($DBG) echo " W allowed\n";
-		}
+		$record = $this->_acl->buildQuery([])->getItem($idRecord);
+		if (!$record) die("404: No item ID({$idRecord})");
 
 		$fieldVal = '';
-		if ($this->_acl->canReadObjectField($fieldName, $row)) {
-			$fieldVal = V::get($fieldName, $fieldVal, $row);
+		if ($this->_acl->canReadObjectField($fieldName, $record)) {
+			$fieldVal = V::get($fieldName, $fieldVal, $record);
 		} else {
 			$fieldVal = '*****';
 		}
@@ -4318,22 +4302,22 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 		$typeSpecial = Typespecial::getInstance($fieldID, $vCol['name']);
 		if ($typeSpecial) {
 			if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Typespecial('.$fieldID.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($typeSpecial);echo'</pre>';}
-			$specialValues = $typeSpecial->getEditSelectedValuesByIds($this->_zasobID, $row->ID, $fieldName, V::get($fieldName, $fieldVal, $row));
+			$specialValues = $typeSpecial->getEditSelectedValuesByIds($this->_zasobID, $record['ID'], $fieldName, V::get($fieldName, $fieldVal, $record));
 			if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Typespecial('.$fieldID.') specialValues (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($specialValues);echo'</pre>';}
 			if (!empty($specialValues)) {
-				$tsValues[$row->ID] = implode('<br>', $specialValues);
+				$tsValues[ $record['ID'] ] = implode('<br>', $specialValues);
 			}
 		}
 
 		$fieldParams = array('widthClass'=>'inside-modal', 'maxGrid'=>6);
-		if (!empty($tsValues[$row->ID])) $fieldParams['typespecialValue'] = $tsValues[$row->ID];
-		if (!empty($tsValues[$row->ID])) $response['typespecialValue'] = $tsValues[$row->ID];
+		if (!empty($tsValues[ $record['ID'] ])) $fieldParams['typespecialValue'] = $tsValues[ $record['ID'] ];
+		if (!empty($tsValues[ $record['ID'] ])) $response['typespecialValue'] = $tsValues[ $record['ID'] ];
 		$vDefault = $this->_acl->getColDefault($fieldName);
 		if (!empty($vDefault)) $fieldParams['default'] = $vDefault;
 		if (!empty($vDefault)) $response['defaultValue'] = $vDefault;
 		{
 			try {
-				$item = $this->_acl->getFormItem('W', $fieldID, "f{$fieldID}", $fieldVal, $fieldParams, $row);
+				$item = $this->_acl->getFormItem('W', $fieldID, "f{$fieldID}", $fieldVal, $fieldParams, $record);
 				$response['formItem'] = $item;
 				if (!empty($item['rawColType']['simpleType'])) $response['simpleType'] = $item['rawColType']['simpleType'];
 				if (!empty($item['rawColType']['restrictions'])) $response['restrictions'] = $item['rawColType']['restrictions'];
@@ -4348,23 +4332,23 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 		}
 
 		?>
-		<label for="<?php echo "f{$fieldID}"; ?>" class="AjaxTableEdit-label">
-			<strong title="<?php echo "[{$fieldID}] {$fieldName}"; ?>"><?php echo "{$vCol['label']}"; ?></strong>
+		<label for="<?= "f{$fieldID}"; ?>" class="AjaxTableEdit-label">
+			<strong title="<?= "[{$fieldID}] {$fieldName}"; ?>"><?= "{$vCol['label']}"; ?></strong>
 			<?php if (!empty($vCol['opis'])) : ?>
-				<em><?php echo $vCol['opis']; ?></em>
+				<em><?= $vCol['opis']; ?></em>
 			<?php endif; ?>
 		</label>
 		<?php
-			if (!$this->_acl->canWriteObjectField($fieldName, $row)) {
+			if (!$this->_acl->canWriteObjectField($fieldName, $record)) {
 				// TODO: hide Zapisz btn on frontend side
-				if (!$this->_acl->canReadObjectField($fieldName, $row)) {
+				if (!$this->_acl->canReadObjectField($fieldName, $record)) {
 					UI::alert('warning', "Brak uprawnień do odczytu i zapisu");
 				} else {
 					echo '<p style="margin-top:16px">' . $fieldVal . '</p>';
 					UI::alert('warning', "Brak uprawnień do zapisu");
 				}
 			} else {
-				echo $this->_acl->showFormItem('W', $fieldID, "f{$fieldID}", $fieldVal, $fieldParams, $row);
+				echo $this->_acl->showFormItem('W', $fieldID, "f{$fieldID}", $fieldVal, $fieldParams, $record);
 				if ($typeSpecial
 						|| $this->_acl->isDateField($fieldName)
 						|| $this->_acl->isDateTimeField($fieldName)
@@ -4421,7 +4405,6 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 
 	public function sendAjaxEdit($id, $args) {
 		header("Content-type: text/plain");
-		$DBG = ('1' == V::get('DBG', '', $_REQUEST));
 		$acl = $this->_acl;
 
 		$record = $acl->buildQuery([])->getItem($id);
@@ -4459,37 +4442,32 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 		}
 
 		$tsValues = array();
-		if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">fieldsList (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($fieldsList);echo'</pre>';}
 		if (!empty($fieldsList)) {
 			foreach ($fieldsList as $vColID => $vCol) {
 				$typeSpecial = Typespecial::getInstance($vColID, $vCol['name']);
 				if ($typeSpecial) {
-					if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Typespecial('.$vColID.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($typeSpecial);echo'</pre>';}
 					$colValue = V::get($vCol['name'], '', $record);
-					if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">V::get('.$vCol['name'].', "", $record) (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($colValue);echo'</pre>';}
 					$specialValues = $typeSpecial->getEditSelectedValuesByIds($this->_zasobID, $record['ID'], $vCol['name'], $colValue);
-					if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Typespecial('.$vColID.') specialValues (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($specialValues);echo'</pre>';}
 					if (!empty($specialValues)) {
 						$tsValues[$vColID] = implode('<br>', $specialValues);
 					}
 				}
 			}
 		}
-		if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">tsValues (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($tsValues);echo'</pre>';}
 
 		$rowFunctionsOut = $this->_showRowFunctions($record['ID'], array('edit', 'cp'), true);
 
 		?>
 		<div class="container AjaxFrmHorizontalEdit" style="max-width:940px">
-		<form class="form-horizontal" action="" method="post" id="EDIT_FRM_<?php echo $this->_htmlID; ?>">
+		<form class="form-horizontal" action="" method="post" id="EDIT_FRM_<?= $this->_htmlID; ?>">
 			<fieldset>
-				<legend>Edycja rekordu Nr <?php echo $record['ID']; ?><span class="pull-right valign-btns-bottom"><?php echo $rowFunctionsOut; ?></span></legend>
+				<legend>Edycja rekordu Nr <?= $record['ID']; ?><span class="pull-right valign-btns-bottom"><?= $rowFunctionsOut; ?></span></legend>
 
 				<?php $tabindex = 0; foreach ($fieldsList as $kID => $vCol) : ?>
 					<?php if ($acl->canWriteObjectField($vCol['name'], $record)) : ?>
 						<div class="form-group">
-							<label class="col-xs-12 col-sm-3 col-md-2 control-label" for="<?php echo "f{$kID}"; ?>"><?php echo $vCol['label']; ?>
-								<i class="glyphicon glyphicon-info-sign frm-help" data-toggle="popover" data-trigger="hover" title="" data-content="<?php echo htmlspecialchars($vCol['opis']); ?>" data-original-title="<?php echo "[{$kID}] {$vCol['name']}"; ?>"></i>
+							<label class="col-xs-12 col-sm-3 col-md-2 control-label" for="<?= "f{$kID}"; ?>"><?= $vCol['label']; ?>
+								<i class="glyphicon glyphicon-info-sign frm-help" data-toggle="popover" data-trigger="hover" title="" data-content="<?= htmlspecialchars($vCol['opis']); ?>" data-original-title="<?= "[{$kID}] {$vCol['name']}"; ?>"></i>
 							</label>
 							<div class="col-xs-12 col-sm-9 col-md-10">
 								<?php
@@ -4503,8 +4481,8 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 						</div>
 					<?php elseif ($acl->canReadObjectField($vCol['name'], $record)) : ?>
 						<div class="form-group">
-							<label class="col-xs-12 col-sm-3 col-md-2 control-label" for="<?php echo "f{$kID}"; ?>"><?php echo $vCol['label']; ?>
-								<i class="glyphicon glyphicon-info-sign frm-help" data-toggle="popover" data-trigger="hover" title="" data-content="<?php echo htmlspecialchars($vCol['opis']); ?>" data-original-title="<?php echo "[{$kID}] {$vCol['name']}"; ?>"></i>
+							<label class="col-xs-12 col-sm-3 col-md-2 control-label" for="<?= "f{$kID}"; ?>"><?= $vCol['label']; ?>
+								<i class="glyphicon glyphicon-info-sign frm-help" data-toggle="popover" data-trigger="hover" title="" data-content="<?= htmlspecialchars($vCol['opis']); ?>" data-original-title="<?= "[{$kID}] {$vCol['name']}"; ?>"></i>
 							</label>
 							<div class="col-xs-12 col-sm-9 col-md-10">
 								<p style="margin-top:5px;">
@@ -4524,7 +4502,7 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 
 				<div class="form-group">
 					<div class="col-xs-offset-0 col-xs-12 col-sm-offset-3 col-sm-9 col-md-offset-2 col-md-10">
-						<button type="submit" class="btn btn-primary" tabindex="<?php echo (++$tabindex); ?>">Zapisz</button>
+						<button type="submit" class="btn btn-primary" tabindex="<?= (++$tabindex); ?>">Zapisz</button>
 					</div>
 				</div>
 
@@ -4950,7 +4928,7 @@ jQuery(document).ready(function(){
 		$visibleCols = $acl->getRealFieldList();
 		$rowsHist = $acl->getHistItems($id);
 
-		$jsonResponse['row_functions'] = $this->_parseRowFunctions($record->ID, array('hist', 'cp'), $showLabel = true);
+		$jsonResponse['row_functions'] = $this->_parseRowFunctions($record['ID'], array('hist', 'cp'), $showLabel = true);
 
 		$visibleColsWithIds = array();
 		$visibleColsLabels = array();
@@ -5020,7 +4998,7 @@ jQuery(document).ready(function(){
 		if (!FoldersConfig::hasConfig($confTblName)) throw new HttpException("Brak danych konfiguracyjnych ({$tblName})", 404);
 		$folderConf = FoldersConfig::getAll($confTblName);
 
-		$uploader = new FileUploader($confTblName, $record);
+		$uploader = new FileUploader($confTblName, (object)$record);
 		if (!$uploader->setConfig($folderConf)) throw new HttpException("Błąd danych konfiguracyjnych ({$tblName})", 404);
 		$uploader->findFolder();
 		$errorMsg = '';
@@ -5045,7 +5023,7 @@ jQuery(document).ready(function(){
 
 		if (!empty($uploadedFileName)) {
 			$sqlObj = new stdClass();
-			$sqlObj->ID = $record->ID;
+			$sqlObj->ID = $record['ID'];
 			$sqlObj->M_DIST_FILES = "Wgrano plik {$uploadedFileName}";
 			$db->UPDATE_OBJ($this->_tbl, $sqlObj);
 		}
@@ -5070,7 +5048,7 @@ jQuery(document).ready(function(){
 		if (!FoldersConfig::hasConfig($confTblName)) throw new HttpException("Brak danych konfiguracyjnych ({$tblName})", 404);
 		$folderConf = FoldersConfig::getAll($confTblName);
 
-		$uploader = new FileUploader($confTblName, $record);
+		$uploader = new FileUploader($confTblName, (object)$record);
 		if (!$uploader->setConfig($folderConf)) throw new HttpException("Błąd danych konfiguracyjnych ({$tblName})", 404);
 		$uploader->findFolder();
 
@@ -5098,7 +5076,7 @@ jQuery(document).ready(function(){
 		if (!FoldersConfig::hasConfig($confTblName)) throw new HttpException("Brak danych konfiguracyjnych ({$tblName})", 404);
 		$folderConf = FoldersConfig::getAll($confTblName);
 
-		$uploader = new FileUploader($confTblName, $record);
+		$uploader = new FileUploader($confTblName, (object)$record);
 		if (!$uploader->setConfig($folderConf)) throw new HttpException("Błąd danych konfiguracyjnych ({$tblName})", 404);
 		$uploader->findFolder();
 		$mainFolder = $uploader->getDestFolder();
@@ -5134,7 +5112,7 @@ jQuery(document).ready(function(){
 					`A_SYNCHRONIZED`
 				)
 				values (
-					'{$record->ID}'
+					'{$record['ID']}'
 					, 0
 				)
 				ON DUPLICATE KEY UPDATE
@@ -5147,7 +5125,7 @@ jQuery(document).ready(function(){
 					`A_SYNCHRONIZED`
 				)
 				values (
-					'{$record->ID_PROJECT}'
+					'{$record['ID_PROJECT']}'
 					, 0
 				)
 				ON DUPLICATE KEY UPDATE
@@ -5198,7 +5176,7 @@ jQuery(document).ready(function(){
 
 		$folderConf = FoldersConfig::getAll($confTblName);
 
-		$uploader = new FileUploader($confTblName, $record);
+		$uploader = new FileUploader($confTblName, (object)$record);
 		if (!$uploader->setConfig($folderConf)) {
 			throw new Exception("Błąd danych konfiguracyjnych ({$tblName})", 404);
 		}
@@ -5270,7 +5248,7 @@ jQuery(document).ready(function(){
 
 		$folderConf = FoldersConfig::getAll($confTblName);
 
-		$uploader = new FileUploader($confTblName, $record);
+		$uploader = new FileUploader($confTblName, (object)$record);
 		if (!$uploader->setConfig($folderConf)) {
 			header('HTTP/1.0 404 Not Found');
 			echo '{"type":"ERROR", "string": "Błąd danych konfiguracyjnych (' . $tblName . ')"}';
@@ -5372,7 +5350,7 @@ jQuery(document).ready(function(){
 		$folderConf = FoldersConfig::getAll($confTblName);
 		//echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">$folderConf (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($folderConf);echo'</pre>';
 
-		$uploader = new FileUploader($confTblName, $record);
+		$uploader = new FileUploader($confTblName, (object)$record);
 		$errMsg = '';
 		if (!$uploader->setConfig($folderConf, $errMsg)) throw new HttpException("Błąd danych konfiguracyjnych ({$tblName})" . '<br>' . "\n" . $errMsg, 404);
 		$uploader->findFolder();
@@ -5418,10 +5396,10 @@ jQuery(document).ready(function(){
 
 		$fileTypes = FoldersConfig::getAll('m_dist_files_types');
 
-		$rowFunctionsOut = $this->_showRowFunctions($record->ID, array('files', 'cp'), true);
+		$rowFunctionsOut = $this->_showRowFunctions($record['ID'], array('files', 'cp'), true);
 
 		$fileIndexField = V::get('DEST_FILE_INDEX_FIELD', 'ID', $folderConf);
-		$fileIndex = V::get($fileIndexField, $record->ID, $record);
+		$fileIndex = V::get($fileIndexField, $record['ID'], $record);
 		?>
 		<script src="stuff/jquery.form.js"></script>
 		<div class="container">
@@ -5516,11 +5494,11 @@ jQuery(document).ready(function(){
 										$vFileSize = filesize($vFilePath);
 										$vFileSizeOut = V::humanFileSize($vFileSize);
 									?>
-									<td><input style="margin:0" type="radio" name="SCANS_COLUMN_ADD" value="<?php echo $vFileName; ?>"></td>
-									<td><div style="overflow:hidden; white-space:nowrap" title="<?php echo $vFileName; ?>"><?php echo $vFileName; ?></div></td>
-									<td style="white-space:nowrap; text-align:center"><a href="<?php echo str_replace($skanyLocalPath, $skanyFolderWeb, $vFilePath); ?>" target="_blank" class="glyphicon glyphicon-download-alt"></a></td>
-									<td style="white-space:nowrap; text-align:right"><?php echo $vFileSizeOut; ?></td>
-									<td style="white-space:nowrap"><?php echo date("Y-m-d H:i:s", filectime($vFilePath)); ?></td>
+									<td><input style="margin:0" type="radio" name="SCANS_COLUMN_ADD" value="<?= $vFileName; ?>"></td>
+									<td><div style="overflow:hidden; white-space:nowrap" title="<?= $vFileName; ?>"><?= $vFileName; ?></div></td>
+									<td style="white-space:nowrap; text-align:center"><a href="<?= str_replace($skanyLocalPath, $skanyFolderWeb, $vFilePath); ?>" target="_blank" class="glyphicon glyphicon-download-alt"></a></td>
+									<td style="white-space:nowrap; text-align:right"><?= $vFileSizeOut; ?></td>
+									<td style="white-space:nowrap"><?= date("Y-m-d H:i:s", filectime($vFilePath)); ?></td>
 									</tr>
 								<?php endforeach; ?>
 								</tbody>
@@ -5545,12 +5523,12 @@ jQuery(document).ready(function(){
 				</tr>
 				<tr>
 					<td>
-						<?php echo $fileIndex; ?>
+						<?= $fileIndex; ?>
 					</td>
 					<td>
 						<select class="form-control" name="M_DIST_FILES_TYPE">
 							<?php foreach ($fileTypes as $kType => $vLabel) : ?>
-								<option value="<?php echo $kType; ?>"<?php if ($kType == 'TODO') { echo ' selected="selected"'; } ?> ><?php echo $vLabel; ?></option>
+								<option value="<?= $kType; ?>"<?php if ($kType == 'TODO') { echo ' selected="selected"'; } ?> ><?= $vLabel; ?></option>
 							<?php endforeach; ?>
 						</select>
 						<br>
@@ -5569,14 +5547,14 @@ jQuery(document).ready(function(){
 					</td>
 					<td>
 						<div class="input-group">
-							<input name="M_DIST_FILES_DATE" type="text" value="<?php echo date('Y-m-d');?>" class="se_type-date form-control" data-format="yyyy-MM-dd" maxlength="10"><span class="input-group-addon">
+							<input name="M_DIST_FILES_DATE" type="text" value="<?= date('Y-m-d');?>" class="se_type-date form-control" data-format="yyyy-MM-dd" maxlength="10"><span class="input-group-addon">
 								<span class="glyphicon glyphicon-calendar"></span>
 							</span>
 						</div>
 <!--
-						<input class="form-control" type="date" name="M_DIST_FILES_DATE" value="<?php echo date('Y-m-d');?>" maxlength="10">
+						<input class="form-control" type="date" name="M_DIST_FILES_DATE" value="<?= date('Y-m-d');?>" maxlength="10">
 -->
-						<br><label>jeśli nie zostanie podana to zostanie ustawiona na dzisiaj (<?php echo date('Y-m-d');?>)</label>
+						<br><label>jeśli nie zostanie podana to zostanie ustawiona na dzisiaj (<?= date('Y-m-d');?>)</label>
 					</td>
 					<td>
 						<input class="form-control" style="width:100%" type="number" name="M_DIST_FILES_VERSION">
@@ -5589,12 +5567,12 @@ jQuery(document).ready(function(){
 				</tr>
 				<tr>
 					<td colspan="5">
-						<div id="FRM_UPLOAD_RESULTS_<?php echo $this->_htmlID; ?>"></div>
+						<div id="FRM_UPLOAD_RESULTS_<?= $this->_htmlID; ?>"></div>
 						<p>
 							<input type="submit" value="Wyślij" class="btn btn-primary"> wybrany plik do folderu:
 						</p>
 						<p>
-							<code><b><?php echo $uploader->getDestPathShare(true); ?></b></code>
+							<code><b><?= $uploader->getDestPathShare(true); ?></b></code>
 							<br><i style="color:#777">(Jeśli folder nie istnieje to zostanie utworzony automatycznie)</i>
 						</p>
 					</td>
@@ -5604,10 +5582,10 @@ jQuery(document).ready(function(){
 		</div>
 <?php endif; ?>
 		<script>
-function fileListUpdateAjax<?php echo $this->_htmlID; ?>() {
+function fileListUpdateAjax<?= $this->_htmlID; ?>() {
 	var postData = {};
 	jQuery.ajax({
-		url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=FILES_LIST&ID=<?php echo $record->ID; ?>',
+		url: 'index-ajax.php?_zasobID=<?= $this->_zasobID; ?>&_cls=<?= __CLASS__; ?>&_hash=<?= $this->_htmlID; ?>&_task=FILES_LIST&ID=<?= $record['ID']; ?>',
 		type: 'POST',
 		//dataType: 'json',
 		//contentType: "application/json; charset=utf-8",
@@ -5639,7 +5617,7 @@ function fileListUpdate<?php echo $this->_htmlID; ?>(fileListJson) {
 		node.append(fNameCell);
 		node.append('<td style="overflow:hidden; white-space:nowrap; text-align:center;">' + '<a href="' + file.web + '" target="_blank" class="glyphicon glyphicon-download-alt"></a>' + '</td>');
 		<?php if ($sharePoint) : ?>
-			node.append('<td style="overflow:hidden; white-space:nowrap; text-align:center;">' + '<a href="<?php echo $sharePoint; ?>/' + file.name + '" target="_blank" class="glyphicon glyphicon-folder-open"></a>' + '</td>');
+			node.append('<td style="overflow:hidden; white-space:nowrap; text-align:center;">' + '<a href="<?= $sharePoint; ?>/' + file.name + '" target="_blank" class="glyphicon glyphicon-folder-open"></a>' + '</td>');
 		<?php endif; ?>
 		node.append('<td style="overflow:hidden; white-space:nowrap; text-align:right;">' + file.sizeStr + '</td>');
 		node.append('<td style="overflow:hidden; white-space:nowrap;">' + file.created + '</td>');
@@ -5655,7 +5633,7 @@ function fileListUpdate<?php echo $this->_htmlID; ?>(fileListJson) {
 				if (confirm('Czy jesteś pewien, że chcesz usunąć plik o nazwie ' + fname + '?')) {
 					var postData = {filename: fname};
 					jQuery.ajax({
-						url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=FILE_REMOVE&ID=<?php echo $record->ID; ?>',
+						url: 'index-ajax.php?_zasobID=<?= $this->_zasobID; ?>&_cls=<?= __CLASS__; ?>&_hash=<?= $this->_htmlID; ?>&_task=FILE_REMOVE&ID=<?= $record['ID']; ?>',
 						type: 'POST',
 						//dataType: 'json',
 						//contentType: "application/json; charset=utf-8",
@@ -5683,24 +5661,24 @@ function fileListUpdate<?php echo $this->_htmlID; ?>(fileListJson) {
 	});
 }
 
-function connTblListUpdateAjax<?php echo $this->_htmlID; ?>(connTblID) {
+function connTblListUpdateAjax<?= $this->_htmlID; ?>(connTblID) {
 	var postData = {};
 
 	// clear current file list
-	jQuery('#FILES_CONN_TBLS_<?php echo $this->_htmlID; ?>').find('.files-list').empty();
+	jQuery('#FILES_CONN_TBLS_<?= $this->_htmlID; ?>').find('.files-list').empty();
 
 	jQuery.ajax({
-		url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=FILES_CONN_TBL_LIST&ID=<?php echo $record->ID; ?>&connTblID=' + connTblID,
+		url: 'index-ajax.php?_zasobID=<?= $this->_zasobID; ?>&_cls=<?= __CLASS__; ?>&_hash=<?= $this->_htmlID; ?>&_task=FILES_CONN_TBL_LIST&ID=<?= $record['ID']; ?>&connTblID=' + connTblID,
 		type: 'POST',
 		//dataType: 'json',
 		//contentType: "application/json; charset=utf-8",
 		data: postData,
 		success: function(data) {
-			connTblListUpdate<?php echo $this->_htmlID; ?>(data);
+			connTblListUpdate<?= $this->_htmlID; ?>(data);
 		},
 		error: function(jqXHR, textStatus, errorThrown) {
 			var txt = jqXHR.responseText || 'Error';
-			jQuery('#FILES_CONN_TBLS_<?php echo $this->_htmlID; ?>').find('.files-list').html('<tr><td colspan="6"><div class="alert alert-danger">' + txt + '</div></td></tr>');
+			jQuery('#FILES_CONN_TBLS_<?= $this->_htmlID; ?>').find('.files-list').html('<tr><td colspan="6"><div class="alert alert-danger">' + txt + '</div></td></tr>');
 			if (priv.options.debug) console.log('connTblListUpdateAjax error: ', errorThrown, ' textStatus: ', textStatus);
 		}
 	});
@@ -5760,12 +5738,12 @@ function fileListActions<?php echo $this->_htmlID; ?>() {
 			data: reqData,
 			dataType: 'json',
 			type: "GET",
-			url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=filePermsRefresh&ID=<?php echo $record->ID; ?>',
+			url: 'index-ajax.php?_zasobID=<?= $this->_zasobID; ?>&_cls=<?= __CLASS__; ?>&_hash=<?= $this->_htmlID; ?>&_task=filePermsRefresh&ID=<?= $record['ID']; ?>',
 		})
 		.done(function(data, textStatus, jqXHR){
 			notifyAjaxCallback(data);
 			if (data && data.files) {
-				fileListUpdate<?php echo $this->_htmlID; ?>(data.files);
+				fileListUpdate<?= $this->_htmlID; ?>(data.files);
 			}
 		})
 		.fail(function(jqXHR){// jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
@@ -5786,22 +5764,22 @@ function fileListActions<?php echo $this->_htmlID; ?>() {
 }
 
 jQuery(document).ready(function(){
-	$('#FILES_TAB_<?php echo $this->_htmlID; ?> a').click(function(e) {
+	$('#FILES_TAB_<?= $this->_htmlID; ?> a').click(function(e) {
 		e.preventDefault();
 		$(this).tab('show');
 	})
 	.on('shown.bs.tab', function(e) {
 		var fileSource = $(e.target).data('toggle')
-			, frm = jQuery('#FILES_FRM_<?php echo $this->_htmlID; ?>').get(0);
+			, frm = jQuery('#FILES_FRM_<?= $this->_htmlID; ?>').get(0);
 		if (frm['M_DIST_UPLOAD_SOURCE']) {
 			frm['M_DIST_UPLOAD_SOURCE'].value = fileSource;
 		}
 	})
 
-	jQuery('#FILES_FRM_<?php echo $this->_htmlID; ?>').ajaxForm({
-		url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=FILES_UPLOAD&ID=<?php echo $record->ID; ?>',
+	jQuery('#FILES_FRM_<?= $this->_htmlID; ?>').ajaxForm({
+		url: 'index-ajax.php?_zasobID=<?= $this->_zasobID; ?>&_cls=<?= __CLASS__; ?>&_hash=<?= $this->_htmlID; ?>&_task=FILES_UPLOAD&ID=<?= $record['ID']; ?>',
 		beforeSubmit: function(args, $form, options) {
-			//console.log('#FILES_FRM_<?php echo $this->_htmlID; ?>.ajaxForm->beforeSubmit()...');
+			//console.log('#FILES_FRM_<?= $this->_htmlID; ?>.ajaxForm->beforeSubmit()...');
 			var argsMap = [];
 			args.map(function(v, k) {
 				argsMap[v.name] = v.value;
@@ -5809,13 +5787,13 @@ jQuery(document).ready(function(){
 			// validate
 			if (argsMap['M_DIST_UPLOAD_SOURCE'] == 'local') {
 				if (!argsMap['M_DIST_FILES_NAME']) {
-					//console.log('#FILES_FRM_<?php echo $this->_htmlID; ?>.ajaxForm->beforeSubmit() M_DIST_UPLOAD_SOURCE=local && !M_DIST_FILES_NAME');
+					//console.log('#FILES_FRM_<?= $this->_htmlID; ?>.ajaxForm->beforeSubmit() M_DIST_UPLOAD_SOURCE=local && !M_DIST_FILES_NAME');
 					return false;
 				}
 			}
 			else if (argsMap['M_DIST_UPLOAD_SOURCE'] == 'scan') {
 				if (!argsMap['SCANS_COLUMN_ADD']) {
-					//console.log('#FILES_FRM_<?php echo $this->_htmlID; ?>.ajaxForm->beforeSubmit() M_DIST_UPLOAD_SOURCE=scan && !SCANS_COLUMN_ADD');
+					//console.log('#FILES_FRM_<?= $this->_htmlID; ?>.ajaxForm->beforeSubmit() M_DIST_UPLOAD_SOURCE=scan && !SCANS_COLUMN_ADD');
 					return false;
 				}
 			}
@@ -5823,19 +5801,19 @@ jQuery(document).ready(function(){
 				return false;
 			}
 
-			var $out = $('#FRM_UPLOAD_RESULTS_<?php echo $this->_htmlID; ?>');
+			var $out = $('#FRM_UPLOAD_RESULTS_<?= $this->_htmlID; ?>');
 			$out.html('Wysyłanie...');
 		},
 		success: function(data) {
-			//console.log('#FILES_FRM_<?php echo $this->_htmlID; ?>.ajaxForm->success()...');
-			var $out = $('#FRM_UPLOAD_RESULTS_<?php echo $this->_htmlID; ?>');
+			//console.log('#FILES_FRM_<?= $this->_htmlID; ?>.ajaxForm->success()...');
+			var $out = $('#FRM_UPLOAD_RESULTS_<?= $this->_htmlID; ?>');
 			var btnClose = '<button type="button" class="close" data-dismiss="alert"><i class="glyphicon glyphicon-remove"></i></button>';
 			if (typeof data == 'object') {
 				if (data.type == 'error') {
 					$out.html('<div class="alert alert-danger">' + btnClose + data.msg + '</div>');
 				} else if (data.type == 'SUCCESS') {
 					$out.html('<div class="alert alert-success">' + btnClose + data.msg + '</div>');
-					fileListUpdateAjax<?php echo $this->_htmlID; ?>();
+					fileListUpdateAjax<?= $this->_htmlID; ?>();
 					// TODO: scanFileListUpdateAjax...
 				}
 			} else {
@@ -5848,7 +5826,7 @@ jQuery(document).ready(function(){
 				} else if (data.substr(0, 7) == 'SUCCESS') {
 					data = data.substr(7);
 					$out.html('<div class="alert alert-success">' + btnClose + data + '</div>');
-					fileListUpdateAjax<?php echo $this->_htmlID; ?>();
+					fileListUpdateAjax<?= $this->_htmlID; ?>();
 					// TODO: scanFileListUpdateAjax...
 				} else if (data.substr(0, 4) == 'INFO') {
 					data = data.substr(4);
@@ -5858,13 +5836,13 @@ jQuery(document).ready(function(){
 		}
 	});
 
-	fileListActions<?php echo $this->_htmlID; ?>();
+	fileListActions<?= $this->_htmlID; ?>();
 
-	var fileList = <?php echo json_encode($jsonFiles); ?>;
+	var fileList = <?= json_encode($jsonFiles); ?>;
 
-	fileListUpdate<?php echo $this->_htmlID; ?>(fileList);
+	fileListUpdate<?= $this->_htmlID; ?>(fileList);
 
-	var connTbls = <?php echo json_encode($this->getConnectedTables()); ?>;
+	var connTbls = <?= json_encode($this->getConnectedTables()); ?>;
 	if (connTbls) {
 		var connTblsOut = '';
 		for(var key in connTbls) {