|
@@ -1244,7 +1244,7 @@ var p5UI_TableAjax_generateFunctionNode = function(funObj, rowPK, props) {
|
|
|
|
|
|
|
|
_popoverCellAjaxXhr = $.ajax({
|
|
_popoverCellAjaxXhr = $.ajax({
|
|
|
type: 'GET',
|
|
type: 'GET',
|
|
|
- url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=MORE_FUNCTIONS_CELL&ID=' + rowPK,
|
|
|
|
|
|
|
+ url: '<?= $this->syncUrl; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=moreFunctionsCellAjax&ID=' + rowPK,
|
|
|
dataType: 'json',
|
|
dataType: 'json',
|
|
|
contentType: "application/json; charset=utf-8",
|
|
contentType: "application/json; charset=utf-8",
|
|
|
data: ''
|
|
data: ''
|
|
@@ -3508,7 +3508,7 @@ jQuery(document).ready(function(){
|
|
|
jQuery('<span class="loading-info"> loading ...</span>').appendTo(taskCnt);
|
|
jQuery('<span class="loading-info"> loading ...</span>').appendTo(taskCnt);
|
|
|
|
|
|
|
|
jQuery.ajax({
|
|
jQuery.ajax({
|
|
|
- url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=EDIT&ID=' + recordID,
|
|
|
|
|
|
|
+ url: '<?= $this->syncUrl; ?>&_hash=<?= $this->_htmlID; ?>&_task=editForm&_primaryKey=' + recordID,
|
|
|
type: 'GET',
|
|
type: 'GET',
|
|
|
dataType: 'text',
|
|
dataType: 'text',
|
|
|
data: '',
|
|
data: '',
|
|
@@ -3918,19 +3918,6 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
|
|
|
|
|
|
|
|
public function ajaxTask($task) {
|
|
public function ajaxTask($task) {
|
|
|
switch ($task) {
|
|
switch ($task) {
|
|
|
- case 'EDIT': {
|
|
|
|
|
- $id = V::get('ID', 0, $_REQUEST, 'int');
|
|
|
|
|
- if ($id > 0) {
|
|
|
|
|
- $this->sendAjaxEdit($id, $_REQUEST);
|
|
|
|
|
- } else {
|
|
|
|
|
- echo '404';
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- case 'EDIT_SAVE': {
|
|
|
|
|
- $this->sendAjaxResponseJson('ajaxEditSave', $_REQUEST);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
case 'EDIT_INLINE': {
|
|
case 'EDIT_INLINE': {
|
|
|
$this->sendAjaxResponseJson('ajaxInlineEdit', $_REQUEST);
|
|
$this->sendAjaxResponseJson('ajaxInlineEdit', $_REQUEST);
|
|
|
break;
|
|
break;
|
|
@@ -4018,10 +4005,6 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- case 'MORE_FUNCTIONS_CELL': {
|
|
|
|
|
- $this->sendAjaxResponseJson('ajaxMoreFunctionsCell', $_REQUEST);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
case 'HIDDEN_COLS_SAVE': {
|
|
case 'HIDDEN_COLS_SAVE': {
|
|
|
$this->sendAjaxResponseJson('ajaxHiddenColsSave', $_POST);
|
|
$this->sendAjaxResponseJson('ajaxHiddenColsSave', $_POST);
|
|
|
break;
|
|
break;
|
|
@@ -4207,7 +4190,7 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
|
|
|
return $response;
|
|
return $response;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private function sendAjaxEdit($id, $args) {
|
|
|
|
|
|
|
+ public function sendAjaxEdit($id, $args) {
|
|
|
header("Content-type: text/plain");
|
|
header("Content-type: text/plain");
|
|
|
$DBG = ('1' == V::get('DBG', '', $_REQUEST));
|
|
$DBG = ('1' == V::get('DBG', '', $_REQUEST));
|
|
|
$acl = $this->_acl;
|
|
$acl = $this->_acl;
|
|
@@ -4329,8 +4312,8 @@ jQuery(document).ready(function(){
|
|
|
jQuery('.frm-help').popover({trigger:'hover'});
|
|
jQuery('.frm-help').popover({trigger:'hover'});
|
|
|
|
|
|
|
|
jQuery('#EDIT_FRM_<?php echo $this->_htmlID; ?>').on('submit', function(){
|
|
jQuery('#EDIT_FRM_<?php echo $this->_htmlID; ?>').on('submit', function(){
|
|
|
- var data = jQuery(this).serialize();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ var formData = {};
|
|
|
|
|
+ jQuery(this).serializeArray().map(function(i) { formData[i.name] = i.value; });// TODO: edit Widget - send only updated fields
|
|
|
// TODO: change Edit btn to return to edit record with fields -> show form
|
|
// TODO: change Edit btn to return to edit record with fields -> show form
|
|
|
|
|
|
|
|
var taskCont = jQuery('#<?php echo $this->_htmlID; ?>_task').parent();
|
|
var taskCont = jQuery('#<?php echo $this->_htmlID; ?>_task').parent();
|
|
@@ -4369,75 +4352,68 @@ jQuery(document).ready(function(){
|
|
|
return outMsg;
|
|
return outMsg;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $.ajax({
|
|
|
|
|
- data: data,
|
|
|
|
|
- dataType: 'json',
|
|
|
|
|
- type: "POST",
|
|
|
|
|
- url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=EDIT_SAVE&ID=<?php echo $record->ID; ?>',
|
|
|
|
|
- })
|
|
|
|
|
- .done(function(data, textStatus, jqXHR){
|
|
|
|
|
- var outMsg = notifyAjaxCallback(data);
|
|
|
|
|
- alertCntWrap.removeClass('AjaxTable-loading');
|
|
|
|
|
- //console.log('request finished L.<?php echo __LINE__; ?>');
|
|
|
|
|
- alertCnt.empty();
|
|
|
|
|
- var out = '';
|
|
|
|
|
- out += outMsg;
|
|
|
|
|
- out += '<div class="breadcrumb">' +
|
|
|
|
|
- ' <a href="#" onclick="return tableAjaxBackToTable();" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-arrow-left"></i> Wróć do tabeli <?php echo $this->getLabelHtml(); ?></a>' +
|
|
|
|
|
- ' <a href="#EDIT/<?php echo $id; ?>/' + Math.random(1).toString().substr(2) + '" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-pencil"></i> Edytuj rekord <?php echo $id; ?></a>' +
|
|
|
|
|
- '</div>';
|
|
|
|
|
- jQuery(out).appendTo(alertCnt);
|
|
|
|
|
-
|
|
|
|
|
- // add rowFunctions from response
|
|
|
|
|
- if (data && data.rowFunctions && data.primaryKey) {
|
|
|
|
|
- // cellNode = priv.renderCellRowFunctions(data.rowFunctions, data.primaryKey);
|
|
|
|
|
- var rowFunWrapNode = $('<div class="container"></div>').insertAfter(alertCnt);
|
|
|
|
|
- var rowFunListNode = $('<ul></ul>').appendTo(rowFunWrapNode);
|
|
|
|
|
- var rowPK = '<?php echo $id; ?>';
|
|
|
|
|
- var keys = Object.keys(data.rowFunctions),
|
|
|
|
|
- total = keys.length,
|
|
|
|
|
- moreFuncBtnNode,
|
|
|
|
|
- moreFunctions = [],
|
|
|
|
|
- idx
|
|
|
|
|
- ;
|
|
|
|
|
- // if (priv.options.debug) console.log('TableAjax::renderCellRowFunctions: rowFunctions', data.rowFunctions);
|
|
|
|
|
- moreFunctions = keys.splice(3);
|
|
|
|
|
- keys.forEach(function(key) {
|
|
|
|
|
- var cellNode = $('<li></li>');
|
|
|
|
|
- var funObj = data.rowFunctions[key],
|
|
|
|
|
- funcNode = p5UI_TableAjax_generateFunctionNode(funObj, rowPK, {ico: true, label: true})
|
|
|
|
|
- ;
|
|
|
|
|
- funcNode.appendTo(cellNode);
|
|
|
|
|
- cellNode.appendTo(rowFunListNode);
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- .fail(function(jqXHR){// jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
|
|
|
|
|
- if (jqXHR.responseJSON) {
|
|
|
|
|
- notifyAjaxCallback(jqXHR.responseJSON);
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- var txt = jqXHR.responseText || 'Wystąpiły błędy';
|
|
|
|
|
- if (jqXHR.status == 404) {
|
|
|
|
|
- jQuery.notify(jqXHR.responseText, 'error');
|
|
|
|
|
|
|
+ superagent
|
|
|
|
|
+ .post('<?= $this->syncUrl; ?>&_hash=<?= $this->_htmlID; ?>&_task=editSaveAjax')
|
|
|
|
|
+ .type('json') // header ĺapplication/x-www-form-urlencoded' requires type('form');
|
|
|
|
|
+ .send({
|
|
|
|
|
+ namespace: '<?= $acl->getNamespace(); ?>',
|
|
|
|
|
+ primaryKey: '<?= $record->ID; ?>',
|
|
|
|
|
+ form: formData
|
|
|
|
|
+ })
|
|
|
|
|
+ .set('Accept', 'application/json')
|
|
|
|
|
+ .end(function(err, res) {
|
|
|
|
|
+ var payload;
|
|
|
|
|
+ if (err || !res.ok || 'application/json' !== res.type) {
|
|
|
|
|
+ payload = {type: 'warning', msg: res.body.msg || 'Wystąpiły błędy', body: res.body};
|
|
|
} else {
|
|
} else {
|
|
|
- jQuery.notify(jqXHR.responseText, 'warn');
|
|
|
|
|
|
|
+ payload = {type: 'success', msg: res.body.msg || '', body: res.body};
|
|
|
|
|
+ }
|
|
|
|
|
+ var data = res.body;
|
|
|
|
|
+
|
|
|
|
|
+ alertCntWrap.removeClass('AjaxTable-loading');
|
|
|
|
|
+ alertCnt.empty();
|
|
|
|
|
+ if (false === ['success', 'info'].indexOf(payload.type)) {
|
|
|
|
|
+ jQuery(errorTxt).appendTo(alertCnt);
|
|
|
|
|
+ var errLinks = jQuery('<div class="breadcrumb"></div>').appendTo(alertCnt);
|
|
|
|
|
+ jQuery('<a href="#" onclick="return tableAjaxBackToTable();"> <i class="icon-arrow-left"></i> Wróć do tabeli <?php echo $this->getLabelHtml(); ?></a>').appendTo(errLinks);
|
|
|
|
|
+ var backToEditBtn = jQuery('<a href="#EDIT/<?php echo $id; ?>/' + Math.random(1).toString().substr(2) + '" class="btn btn-link btn-small"> <i class="icon-pencil"></i> Popraw dane <?php echo $id; ?></a>').appendTo(errLinks);
|
|
|
|
|
+ backToEditBtn.on('click', function(){
|
|
|
|
|
+ alertCnt.remove();
|
|
|
|
|
+ taskCont.children().fadeIn('slow');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ var outMsg = notifyAjaxCallback(payload);
|
|
|
|
|
+ var out = '';
|
|
|
|
|
+ out += outMsg;
|
|
|
|
|
+ out += '<div class="breadcrumb">' +
|
|
|
|
|
+ ' <a href="#" onclick="return tableAjaxBackToTable();" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-arrow-left"></i> Wróć do tabeli <?php echo $this->getLabelHtml(); ?></a>' +
|
|
|
|
|
+ ' <a href="#EDIT/<?php echo $id; ?>/' + Math.random(1).toString().substr(2) + '" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-pencil"></i> Edytuj rekord <?php echo $id; ?></a>' +
|
|
|
|
|
+ '</div>';
|
|
|
|
|
+ jQuery(out).appendTo(alertCnt);
|
|
|
|
|
+
|
|
|
|
|
+ // add rowFunctions from response
|
|
|
|
|
+ if (data && data.rowFunctions && data.primaryKey) {
|
|
|
|
|
+ var rowFunWrapNode = $('<div class="container"></div>').insertAfter(alertCnt);
|
|
|
|
|
+ var rowFunListNode = $('<ul></ul>').appendTo(rowFunWrapNode);
|
|
|
|
|
+ var keys = Object.keys(data.rowFunctions),
|
|
|
|
|
+ total = keys.length,
|
|
|
|
|
+ moreFuncBtnNode,
|
|
|
|
|
+ moreFunctions = [],
|
|
|
|
|
+ idx
|
|
|
|
|
+ ;
|
|
|
|
|
+ moreFunctions = keys.splice(3);
|
|
|
|
|
+ keys.forEach(function(key) {
|
|
|
|
|
+ var cellNode = $('<li></li>');
|
|
|
|
|
+ var funObj = data.rowFunctions[key],
|
|
|
|
|
+ funcNode = p5UI_TableAjax_generateFunctionNode(funObj, data.primaryKey, {ico: true, label: true})
|
|
|
|
|
+ ;
|
|
|
|
|
+ funcNode.appendTo(cellNode);
|
|
|
|
|
+ cellNode.appendTo(rowFunListNode);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- alertCntWrap.removeClass('AjaxTable-loading');
|
|
|
|
|
- //console.log('Request Error: {0}: {1}'.f(textStatus, errorThrown));
|
|
|
|
|
- alertCnt.empty();
|
|
|
|
|
- jQuery(errorTxt).appendTo(alertCnt);
|
|
|
|
|
- var errLinks = jQuery('<div class="breadcrumb"></div>').appendTo(alertCnt);
|
|
|
|
|
- jQuery('<a href="#" onclick="return tableAjaxBackToTable();"> <i class="icon-arrow-left"></i> Wróć do tabeli <?php echo $this->getLabelHtml(); ?></a>').appendTo(errLinks);
|
|
|
|
|
- var backToEditBtn = jQuery('<a href="#EDIT/<?php echo $id; ?>/' + Math.random(1).toString().substr(2) + '" class="btn btn-link btn-small"> <i class="icon-pencil"></i> Popraw dane <?php echo $id; ?></a>').appendTo(errLinks);
|
|
|
|
|
- backToEditBtn.on('click', function(){
|
|
|
|
|
- alertCnt.remove();
|
|
|
|
|
- taskCont.children().fadeIn('slow');
|
|
|
|
|
- return false;
|
|
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
|
});
|
|
});
|
|
@@ -4447,7 +4423,6 @@ jQuery(document).ready(function(){
|
|
|
input = jQuery(e.target);
|
|
input = jQuery(e.target);
|
|
|
btn = input.next('.button-appendBack');
|
|
btn = input.next('.button-appendBack');
|
|
|
btnIco = btn.find('.glyphicon');
|
|
btnIco = btn.find('.glyphicon');
|
|
|
-//console.log('title',btn.attr('title'),'val',input.val(),'input', input, 'btn', btn);
|
|
|
|
|
if (btn.attr('title') != input.val()) {
|
|
if (btn.attr('title') != input.val()) {
|
|
|
btnIco.show();
|
|
btnIco.show();
|
|
|
} else {
|
|
} else {
|
|
@@ -4459,7 +4434,6 @@ jQuery(document).ready(function(){
|
|
|
btn = jQuery(this);
|
|
btn = jQuery(this);
|
|
|
btnIco = btn.find('.glyphicon');
|
|
btnIco = btn.find('.glyphicon');
|
|
|
input = btn.prev();
|
|
input = btn.prev();
|
|
|
-//console.log('title',btn.attr('title'),'val',input.val(),'input', input, 'btn', btn);
|
|
|
|
|
if (input.is('input')) {
|
|
if (input.is('input')) {
|
|
|
if (btn.attr('title') != input.val()) {
|
|
if (btn.attr('title') != input.val()) {
|
|
|
input.val(btn.attr('title'));
|
|
input.val(btn.attr('title'));
|
|
@@ -4473,43 +4447,6 @@ jQuery(document).ready(function(){
|
|
|
exit;
|
|
exit;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private function ajaxEditSave($args) {
|
|
|
|
|
- $acl = $this->_acl;
|
|
|
|
|
- $primaryKeyField = $acl->getPrimaryKeyField();
|
|
|
|
|
- $primaryKey = V::get($primaryKeyField, 0, $args, 'int');
|
|
|
|
|
- if (empty($primaryKey)) throw new HttpException("Wrong param id!", 400);
|
|
|
|
|
-
|
|
|
|
|
- $item = $acl->getItem($primaryKey);
|
|
|
|
|
- if (!$item) throw new HttpException("Item not exists!", 404);
|
|
|
|
|
-
|
|
|
|
|
- $itemFromUser = $acl->convertObjectFromUserInput($args, $type = 'array_by_id', $prefix = 'f');
|
|
|
|
|
-
|
|
|
|
|
- $response = new stdClass();
|
|
|
|
|
- $response->primaryKey = $primaryKey;
|
|
|
|
|
- try {
|
|
|
|
|
- $itemFromUser[$primaryKeyField] = $primaryKey;
|
|
|
|
|
- $affected = $acl->updateItem($itemFromUser);
|
|
|
|
|
-
|
|
|
|
|
- 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 = $acl->getItem($primaryKey);
|
|
|
|
|
- $rowFunList = $this->getMoreFunctionsCell(array('primary_key'=>$primaryKey, 'record'=>$response->record));
|
|
|
|
|
- if (!empty($rowFunList)) $response->rowFunctions = $rowFunList;
|
|
|
|
|
- }
|
|
|
|
|
- catch (Exception $e) {
|
|
|
|
|
- $response->type = 'error';
|
|
|
|
|
- $response->msg = "Wystąpiły błędy!";
|
|
|
|
|
- $response->msg .= $e->getMessage();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return $response;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private function sendAjaxCreate($args) {
|
|
private function sendAjaxCreate($args) {
|
|
|
$acl = $this->_acl;
|
|
$acl = $this->_acl;
|
|
|
header("Content-type: text/plain");
|
|
header("Content-type: text/plain");
|
|
@@ -6193,149 +6130,4 @@ jQuery(document).ready(function(){
|
|
|
return $response;
|
|
return $response;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function getMoreFunctionsCell($args) {
|
|
|
|
|
- $id = V::get('primary_key', 0, $args, 'int');
|
|
|
|
|
- if ($id <= 0) throw new HttpException("404", 404);
|
|
|
|
|
- $record = V::get('record', null, $args);
|
|
|
|
|
-
|
|
|
|
|
- $rowFunList = array();
|
|
|
|
|
- $acl = $this->_acl;
|
|
|
|
|
- $tableName = $acl->getName();
|
|
|
|
|
- $record = ($record)? $record : $acl->getItem($id);
|
|
|
|
|
-
|
|
|
|
|
- if(1){// TODO: fetch $totalMsgs from TableMsgs
|
|
|
|
|
- $msgs = Router::getRoute('Msgs');
|
|
|
|
|
- $msgsList = $msgs->getActiveMessagesForTableRecord($tableName, $id);
|
|
|
|
|
- $totalMsgs = count($msgsList);
|
|
|
|
|
- $rowFunc = new stdClass();
|
|
|
|
|
- $rowFunc->id = 'msgs';
|
|
|
|
|
- $rowFunc->ico = 'glyphicon glyphicon-envelope';
|
|
|
|
|
- $rowFunc->href = 'index.php?_route=TableMsgs&_task=tableRow&idTable=' . $this->_zasobID . '&idRow=' . $id;
|
|
|
|
|
- $rowFunc->title = "Wiadomości ({$totalMsgs})";
|
|
|
|
|
- $rowFunc->label = "Wiadomości <span class=\"badge\">{$totalMsgs}</span>";
|
|
|
|
|
- $rowFunList[] = $rowFunc;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if ('CRM_PROCES' == $acl->getName()) {// TODO: mv to table gui xml or php class
|
|
|
|
|
- // procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id=22001
|
|
|
|
|
- $rowFunc = new stdClass();
|
|
|
|
|
- $rowFunc->ico = 'glyphicon glyphicon-eye-open';
|
|
|
|
|
- $rowFunc->href = "procesy5.php?task=CRM_PROCES&filtr_id={$id}";
|
|
|
|
|
- $rowFunc->title = "Zobacz na drzewie procesów {{$id}}";
|
|
|
|
|
- $rowFunList[] = $rowFunc;
|
|
|
|
|
-
|
|
|
|
|
- $wskazniki = ProcesHelper::get_wskazniki($id);
|
|
|
|
|
- $connectedZasobyTotal = count($wskazniki);
|
|
|
|
|
- $rowFunc = new stdClass();
|
|
|
|
|
- $rowFunc->ico = 'glyphicon glyphicon-random';
|
|
|
|
|
- $rowFunc->href = "index.php?MENU_INIT=PROCES_ADD_ZASOB&procesID={$id}";
|
|
|
|
|
- $rowFunc->title = "Powiązane zasoby <span class=\"badge\">{$connectedZasobyTotal}</span>";
|
|
|
|
|
- $rowFunList[] = $rowFunc;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if ('CRM_LISTA_ZASOBOW' == $acl->getName()) {// TODO: mv to table gui xml or php class
|
|
|
|
|
- // procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id=22001
|
|
|
|
|
- $rowFunc = new stdClass();
|
|
|
|
|
- $rowFunc->ico = 'glyphicon glyphicon-eye-open';
|
|
|
|
|
- $rowFunc->href = "procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id={$id}";
|
|
|
|
|
- $rowFunc->title = "Zobacz na drzewie zasobów [{$id}]";
|
|
|
|
|
- $rowFunList[] = $rowFunc;
|
|
|
|
|
-
|
|
|
|
|
- // index.php?MENU_INIT=ZASOB_OBOWIAZKI&id_zasob=22001
|
|
|
|
|
- $rowFunc = new stdClass();
|
|
|
|
|
- $rowFunc->ico = 'glyphicon glyphicon-random';
|
|
|
|
|
- $rowFunc->href = "index.php?MENU_INIT=ZASOB_OBOWIAZKI&id_zasob={$id}";
|
|
|
|
|
- $rowFunc->title = "Powiązane procesy (OB)";
|
|
|
|
|
- $rowFunList[] = $rowFunc;
|
|
|
|
|
-
|
|
|
|
|
- // index.php?MENU_INIT=ZASOB_EXTERNAL_IDS&id_zasob=22001
|
|
|
|
|
- $rowFunc = new stdClass();
|
|
|
|
|
- $rowFunc->ico = 'glyphicon glyphicon-random';
|
|
|
|
|
- $rowFunc->href = "index.php?MENU_INIT=ZASOB_EXTERNAL_IDS&id_zasob={$id}";
|
|
|
|
|
- $rowFunc->title = "Powiązane dane (IDS)";
|
|
|
|
|
- $rowFunList[] = $rowFunc;
|
|
|
|
|
-
|
|
|
|
|
- $groupTypeList = array();
|
|
|
|
|
- $groupTypeList[] = 'STANOWISKO';
|
|
|
|
|
- $groupTypeList[] = 'PODMIOT';
|
|
|
|
|
- $groupTypeList[] = 'DZIAL';
|
|
|
|
|
- if (in_array($record->TYPE, $groupTypeList)) {
|
|
|
|
|
- $rowFunc = new stdClass();
|
|
|
|
|
- $rowFunc->ico = 'glyphicon glyphicon-retweet';
|
|
|
|
|
- $rowFunc->href = "index.php?_route=Users&_task=syncGroup&idGroup={$id}";
|
|
|
|
|
- $rowFunc->title = "Synchronizuj do LDAP";
|
|
|
|
|
- $rowFunList[] = $rowFunc;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if ('ADMIN_USERS' == $acl->getName()) {// TODO: mv to table gui xml
|
|
|
|
|
- $isAllowedoReadUserLogin = false;
|
|
|
|
|
- if ($acl->canReadRecord($record)) {
|
|
|
|
|
- $idFieldUserLogin = $acl->getFieldIdByName('ADM_ACCOUNT');
|
|
|
|
|
- if ($idFieldUserLogin) {
|
|
|
|
|
- if ($acl->isAllowed($idFieldUserLogin, 'R', $record)) {
|
|
|
|
|
- $isAllowedoReadUserLogin = true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if ($isAllowedoReadUserLogin) {
|
|
|
|
|
- $rowFunc = new stdClass();
|
|
|
|
|
- $rowFunc->ico = 'glyphicon glyphicon-user';
|
|
|
|
|
- $rowFunc->href = 'index.php?_route=Users&_task=userGroups&usrLogin=' . $record->ADM_ACCOUNT;
|
|
|
|
|
- $rowFunc->title = "Ustal stanowisko";
|
|
|
|
|
- $rowFunList[] = $rowFunc;
|
|
|
|
|
-
|
|
|
|
|
- $rowFunc = new stdClass();
|
|
|
|
|
- $rowFunc->ico = 'glyphicon glyphicon-retweet';
|
|
|
|
|
- $rowFunc->href = 'index.php?_route=Users&_task=syncUser&usrLogin=' . $record->ADM_ACCOUNT;
|
|
|
|
|
- $rowFunc->title = "Synchronizuj do LDAP";
|
|
|
|
|
- $rowFunList[] = $rowFunc;
|
|
|
|
|
-
|
|
|
|
|
- $rowFunc = new stdClass();
|
|
|
|
|
- $rowFunc->ico = 'glyphicon glyphicon-minus';
|
|
|
|
|
- $rowFunc->href = 'index.php?MENU_INIT=USER_OCENA_PRACOWNIKA&usrLogin=' . $record->ADM_ACCOUNT;
|
|
|
|
|
- $rowFunc->title = "Ocena pracownika";
|
|
|
|
|
- $rowFunList[] = $rowFunc;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if ($urlFunctions = Route_UrlAction::getTableFunctions($acl->getID(), $id, $acl->getName(), User::getLogin())) {
|
|
|
|
|
- foreach ($urlFunctions as $urlFunction) {
|
|
|
|
|
- // TODO: is allowed to view - test by Router::getRoute('UrlAction')->isFunctionAllowedForRecord($routeName = $urlFunction['name'], $acl->getID(), $id);
|
|
|
|
|
- $rowFunction = array();
|
|
|
|
|
- $rowFunction['href'] = $urlFunction['baseLink'];
|
|
|
|
|
- $rowFunction['ico'] = V::get('ico', 'glyphicon glyphicon-share', $urlFunction);
|
|
|
|
|
- $rowFunction['label'] = $urlFunction['label'];
|
|
|
|
|
- $rowFunction['title'] = V::get('title', $urlFunction['label'], $urlFunction);
|
|
|
|
|
- if (!empty($urlFunction['link_target'])) $rowFunction['target'] = $urlFunction['link_target'];
|
|
|
|
|
- if (!empty($urlFunction['cell_id_params'])) {
|
|
|
|
|
- $urlParams = array();// [ "{$urlParamName}={$paramValue}" ]
|
|
|
|
|
- foreach ($urlFunction['cell_id_params'] as $idField => $urlParamName) {
|
|
|
|
|
- $paramValue = '';
|
|
|
|
|
- $fld = $acl->getField($idField);
|
|
|
|
|
- if ($fld) {
|
|
|
|
|
- $fldName = $fld['name'];
|
|
|
|
|
- $paramValue = V::get($fldName, '', $record);
|
|
|
|
|
- $urlParams[] = "{$urlParamName}={$paramValue}";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (!empty($urlParams)) $rowFunction['href'] .= "&" . implode("&", $urlParams);
|
|
|
|
|
- }
|
|
|
|
|
- $rowFunList[] = $rowFunction;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return $rowFunList;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public function ajaxMoreFunctionsCell($args) {// ajax task 'MORE_FUNCTIONS_CELL'
|
|
|
|
|
- $id = V::get('ID', 0, $args, 'int');
|
|
|
|
|
- if ($id <= 0) throw new HttpException("404", 404);
|
|
|
|
|
-
|
|
|
|
|
- $response = new stdClass();
|
|
|
|
|
- $response->type = 'success';
|
|
|
|
|
- $response->msg = 'Funkcje';
|
|
|
|
|
- $response->rowFunctions = $this->getMoreFunctionsCell(array('primary_key' => $id));
|
|
|
|
|
- return $response;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|