| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- function VIEWTABLE_AJAX( $params = array() ) {
- SE_Layout::menu();
- $zasobID = V::get('ZASOB_ID', 0, $_GET, 'int');
- if ($zasobID <= 0) {
- echo 'Wrong param ZASOB_ID';
- return;
- }
- Lib::loadClass('ProcesHelper');
- $zasobObj = ProcesHelper::getZasobTableInfo($zasobID);
- if (!$zasobObj) {
- echo "Zasob TABELA ID={$zasobID} nie istnieje";
- return;
- }
- //echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">zasobObj (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($zasobObj);echo'</pre>';
- $userAcl = User::getAcl();
- $userAcl->fetchGroups();
- //echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;display:none;">$userAcl (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($userAcl);echo'</pre>';
- if (!$userAcl->hasTableAcl($zasobObj->ID)) {
- die("Brak uprawnień do tabeli ID={$zasobObj->ID}");
- }
- $tblAcl = $userAcl->getTableAcl($zasobObj->ID);
- //echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">tblAcl (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($tblAcl);echo'</pre>';
- $forceTblAclInit = ('1' == V::get('_force', '', $_GET));
- $tblAcl->init($forceTblAclInit);
- Lib::loadClass('TableAjax');
- $forceFilterInit = array();
- $filterInit = new stdClass();
- $filterInit->currSortCol = 'ID';
- $filterInit->currSortFlip = 'desc';
- foreach ($_GET as $k => $v) {
- if (strlen($k) > 3 && substr($k, 0, 2) == 'f_' && !empty($v)) {// filter prefix
- $filterInit->$k = $v;
- }
- else if (strlen($k) > 4 && substr($k, 0, 3) == 'sf_' && !empty($v)) {// special filter prefix
- $filterInit->$k = $v;
- }
- else if (strlen($k) > 4 && substr($k, 0, 3) == 'ff_' && !empty($v)) {// force filter prefix
- $fldName = substr($k, 3);
- $forceFilterInit[$fldName] = $v;
- }
- }
- $tbl = new TableAjax($tblAcl);
- $tblLabel = array();
- if (!empty($zasobObj->DESC_PL)) $tblLabel []= $zasobObj->DESC_PL;
- if (!empty($zasobObj->OPIS)) $tblLabel []= $zasobObj->OPIS;
- $tblLabel = implode(" - ", $tblLabel);
- $tbl->setLabel($tblLabel);
- $tbl->setFilterInit($filterInit);
- if (!empty($forceFilterInit)) $tbl->setForceFilterInit($forceFilterInit);
- $tbl->addRowFunction('edit');
- $tbl->addRowFunction('hist');
- $tbl->addRowFunction('files');
- $tbl->addRowFunction('cp');
- echo $tbl->render();
- }
|