| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <?php
- Lib::loadClass('TypespecialVariable');
- function PROCES_MENU() {
- $taskMsgs = array();
- $taskErrors = array();
- $task = V::get('_task', '', $_REQUEST);
- switch ($task) {
- case 'TYPESPECIAL': {
- $DBG = ('1' == V::get('DBG', '', $_REQUEST));
- header("Content-type: application/json");
- $fld = V::get('fld', '', $_GET);
- switch ($fld) {
- case '_user_id': {
- $typeSpecialUserId = TypespecialVariable::getInstance(-1, '__USER_ID');
- if (!$typeSpecialUserId) {
- $jsonData = new stdClass();
- $jsonData->message = "TypeSpecial '__USER_ID' not exists";
- echo json_encode($jsonData);
- exit;
- }
- $query = V::get('q', '', $_REQUEST);
- $rawRows = null;
- $jsonData = array();
- $queryParams = array();
- $rows = $typeSpecialUserId->getValuesWithExports($query, $queryParams);
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">rows('.$query.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($rows);echo'</pre>';}
- foreach ($rows as $kID => $vItem) {
- $itemJson = new stdClass();
- $itemJson->id = $vItem->id;
- $itemJson->name = $vItem->param_out;
- if (!empty($vItem->exports)) {
- $itemJson->exports = $vItem->exports;
- }
- $jsonData[] = $itemJson;
- }
- echo json_encode($jsonData);
- break;
- }
- case 'ProcesMenu__Proces_filtr_id': {
- $typeSpecialProces = TypespecialVariable::getInstance(-1, '__PROCES');
- if (!$typeSpecialProces) {
- $jsonData = new stdClass();
- $jsonData->message = "TypeSpecial '__PROCES' not exists";
- echo json_encode($jsonData);
- exit;
- }
- $query = V::get('q', '', $_REQUEST);
- $rawRows = null;
- $jsonData = array();
- $queryParams = array();
- $rows = $typeSpecialProces->getValuesWithExports($query, $queryParams);
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">rows('.$query.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($rows);echo'</pre>';}
- foreach ($rows as $kID => $vItem) {
- $itemJson = new stdClass();
- $itemJson->id = $vItem->id;
- $itemJson->name = $vItem->param_out;
- if (!empty($vItem->exports)) {
- $itemJson->exports = $vItem->exports;
- }
- $jsonData[] = $itemJson;
- }
- echo json_encode($jsonData);
- break;
- }
- case 'ProcesMenu__Zasob_filtr_id': {
- $typeSpecialZasob = TypespecialVariable::getInstance(-1, '__ZASOB');
- if (!$typeSpecialZasob) {
- $jsonData = new stdClass();
- $jsonData->message = "TypeSpecial '__ZASOB' not exists";
- echo json_encode($jsonData);
- exit;
- }
- $query = V::get('q', '', $_REQUEST);
- $rawRows = null;
- $jsonData = array();
- $queryParams = array();
- $rows = $typeSpecialZasob->getValuesWithExports($query, $queryParams);
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">rows('.$query.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($rows);echo'</pre>';}
- foreach ($rows as $kID => $vItem) {
- $itemJson = new stdClass();
- $itemJson->id = $vItem->id;
- $itemJson->name = $vItem->param_out;
- if (!empty($vItem->exports)) {
- $itemJson->exports = $vItem->exports;
- }
- $jsonData[] = $itemJson;
- }
- echo json_encode($jsonData);
- break;
- }
- }
- exit;
- }
- case 'PROCES_FOR_TABLE': {
- $tblId = V::get('tblId', 0, $_REQUEST, 'int');
- $tableProcesInitIds = ACL::getTableProcesInitIds($tblId);
- $tableProcesIdsCSV = implode(",", $tableProcesInitIds);
- $url = Request::getPathUri() . "procesy5.php?task=CRM_PROCES&filtr_id={$tableProcesIdsCSV}&filtr_ids=%2B&filtr_ob=%2B&filtr_img=%2B";
- if (!headers_sent()) {
- header('HTTP/1.1 303 See Other');
- header('Location: '.$url);
- } else {
- ?>
- <script type="text/javascript">
- window.location.href='<?php echo $url; ?>';
- </script>
- <noscript>
- <meta http-equiv="refresh" content="0;url=<?php echo $url; ?>" />
- </noscript>
- <p><a href="<?php echo $url; ?>">dalej</a></p>
- <?php
- }
- exit;
- }
- case 'PROCES_FOR_USER': {
- // <a href="procesy5.php?task=CRM_PROCES echo "&filtr_id={$userProcesIdsCSV}&filtr_ids=%2B&filtr_ob=%2B&filtr_img=%2B"; ">Moje Procesy</a>
- $userAcl = User::getAcl();
- $usedProcesInitIds = $userAcl->getUserProcesInitIds();
- $userProcesIdsCSV = implode(",", $usedProcesInitIds);
- $url = Request::getPathUri() . "procesy5.php?task=CRM_PROCES&filtr_id={$userProcesIdsCSV}&filtr_ids=%2B&filtr_ob=%2B&filtr_img=%2B";
- if (!headers_sent()) {
- header('HTTP/1.1 303 See Other');
- header('Location: '.$url);
- } else {
- ?>
- <script type="text/javascript">
- window.location.href='<?php echo $url; ?>';
- </script>
- <noscript>
- <meta http-equiv="refresh" content="0;url=<?php echo $url; ?>" />
- </noscript>
- <p><a href="<?php echo $url; ?>">dalej</a></p>
- <?php
- }
- exit;
- }
- }
- }
|