superedit-PROCES_MENU.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. Lib::loadClass('TypespecialVariable');
  3. function PROCES_MENU() {
  4. $taskMsgs = array();
  5. $taskErrors = array();
  6. $task = V::get('_task', '', $_REQUEST);
  7. switch ($task) {
  8. case 'TYPESPECIAL': {
  9. $DBG = ('1' == V::get('DBG', '', $_REQUEST));
  10. header("Content-type: application/json");
  11. $fld = V::get('fld', '', $_GET);
  12. switch ($fld) {
  13. case '_user_id': {
  14. $typeSpecialUserId = TypespecialVariable::getInstance(-1, '__USER_ID');
  15. if (!$typeSpecialUserId) {
  16. $jsonData = new stdClass();
  17. $jsonData->message = "TypeSpecial '__USER_ID' not exists";
  18. echo json_encode($jsonData);
  19. exit;
  20. }
  21. $query = V::get('q', '', $_REQUEST);
  22. $rawRows = null;
  23. $jsonData = array();
  24. $queryParams = array();
  25. $rows = $typeSpecialUserId->getValuesWithExports($query, $queryParams);
  26. 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>';}
  27. foreach ($rows as $kID => $vItem) {
  28. $itemJson = new stdClass();
  29. $itemJson->id = $vItem->id;
  30. $itemJson->name = $vItem->param_out;
  31. if (!empty($vItem->exports)) {
  32. $itemJson->exports = $vItem->exports;
  33. }
  34. $jsonData[] = $itemJson;
  35. }
  36. echo json_encode($jsonData);
  37. break;
  38. }
  39. case 'ProcesMenu__filtr_id': {
  40. $typeSpecialUserId = TypespecialVariable::getInstance(-1, '__ZASOB');
  41. if (!$typeSpecialUserId) {
  42. $jsonData = new stdClass();
  43. $jsonData->message = "TypeSpecial '__ZASOB' not exists";
  44. echo json_encode($jsonData);
  45. exit;
  46. }
  47. $query = V::get('q', '', $_REQUEST);
  48. $rawRows = null;
  49. $jsonData = array();
  50. $queryParams = array();
  51. $rows = $typeSpecialUserId->getValuesWithExports($query, $queryParams);
  52. 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>';}
  53. foreach ($rows as $kID => $vItem) {
  54. $itemJson = new stdClass();
  55. $itemJson->id = $vItem->id;
  56. $itemJson->name = $vItem->param_out;
  57. if (!empty($vItem->exports)) {
  58. $itemJson->exports = $vItem->exports;
  59. }
  60. $jsonData[] = $itemJson;
  61. }
  62. echo json_encode($jsonData);
  63. break;
  64. }
  65. }
  66. exit;
  67. }
  68. }
  69. }