defaultIn7MkBazaDystrybucji.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <?php
  2. class Route_UrlAction_defaultIn7MkBazaDystrybucji extends RouteBase {
  3. private $OBJECT;
  4. private $TABLE = 'IN7_MK_BAZA_DYSTRYBUCJI';
  5. public function handleAuth() {
  6. if (!User::logged()) {
  7. User::authByRequest();
  8. }
  9. }
  10. public function defaultAction() {
  11. SE_Layout::gora();
  12. SE_Layout::menu();
  13. try {
  14. if (!($ID = V::get("ID_{$this->TABLE}", 0, $_GET, 'int'))) throw new Exception("Błąd parametru");
  15. if (!(DB::getPDO()->fetchValue("select count(*) from `{$this->TABLE}` where `ID` = {$ID}"))) throw new Exception("Nie znaleziono rekordu");
  16. $result = ACL::getAclByNamespace("default_db/{$this->TABLE}")->buildQuery(['f_ID' => "$ID", 'limit' => 1])->getItems();
  17. // if (!$result) $result = ACL::getAclByNamespace("default_db/{$this->TABLE}/{$this->TABLE}")->buildQuery(['f_ID' => "$ID", 'limit' => 1])->getItems();
  18. if (!$result) throw new Exception("Brak uprawnień");
  19. $this->OBJECT = $result[0];
  20. switch ($this->OBJECT['A_STATUS']) {
  21. case "WAITING":
  22. $this->test();
  23. break;
  24. case "NORMAL":
  25. $this->test();
  26. break;
  27. case "OFF_HARD":
  28. $this->test();
  29. break;
  30. default:
  31. $this->test();
  32. //SE_Layout::alert('danger', "Błędny status rekordu.");
  33. }
  34. } catch (Exception $e) {
  35. SE_Layout::alert('danger', $e->getMessage());
  36. }
  37. SE_Layout::dol();
  38. }
  39. private function test() {
  40. ?>
  41. <hr>
  42. TODO:
  43. <hr>
  44. <table border="1" cellpadding="1" cellspacing="3">
  45. <tr>
  46. <td>Relacje do dzieci
  47. </td>
  48. <td>Check minOccurs
  49. </td>
  50. <td>Check maxOccurs
  51. </td>
  52. </tr>
  53. </table>
  54. <table border="1" cellpadding="1" cellspacing="3">
  55. <tr>
  56. <td>Relacje do rodzicow following/sibling
  57. </td>
  58. <td>Check minOccurs
  59. </td>
  60. <td>Check maxOccurs
  61. </td>
  62. </tr>
  63. </table>
  64. <table border="1" cellpadding="1" cellspacing="3">
  65. <tr>
  66. <td>Relacje akcje
  67. </td>
  68. <td>Dowiaz istniejacy brakujacy wymagany obiekt
  69. </td>
  70. <td>Dodaj brakujacy obiekt poprzez utworzenie nowego
  71. </td>
  72. </tr>
  73. </table>
  74. <table border="1" cellpadding="1" cellspacing="3">
  75. <tr>
  76. <td>Elementy lokalne
  77. </td>
  78. <td>Wskaz brakujace elementy nie wypelnione
  79. </td>
  80. <td>Wskaz elementy ktore sa niewlasciwie wypelnione - nie powinno ich byc
  81. </td>
  82. <td>Wskaz elementy ktore sa niewlasciwie wypelnione - zla treść
  83. </td>
  84. </tr>
  85. </table>
  86. <table border="1" cellpadding="1" cellspacing="3">
  87. <tr>
  88. <td>Elementy lokalne - zaleznosci matematyczne assert - wartosci pojedyncze
  89. </td>
  90. <td>Wskaz brakujace elementy nie obliczone
  91. </td>
  92. <td>Wskaz bledne zaleznosci obliczen - lokalna wartość niezgodna
  93. </td>
  94. <td>Wskaz bledne zaleznosci obliczen - zdalna wartość nie istnieje
  95. </td>
  96. </tr>
  97. </table>
  98. <table border="1" cellpadding="1" cellspacing="3">
  99. <tr>
  100. <td>Elementy lokalne - zaleznosci matematyczne assert - sumy
  101. </td>
  102. <td>Wskaz brakujace elementy nie obliczone
  103. </td>
  104. <td>Wskaz bledne zaleznosci obliczen - lokalna wartość niezgodna
  105. </td>
  106. <td>Wskaz bledne zaleznosci obliczen - zdalna wartość nie kompletna
  107. </td>
  108. <td>Wskaz bledne zaleznosci obliczen - zdalna wartość nie istnieje
  109. </td>
  110. </tr>
  111. </table>
  112. <table border="1" cellpadding="1" cellspacing="3">
  113. <tr>
  114. <td>Elementy lokalne - zaleznosci matematyczne assert - sumy
  115. </td>
  116. <td>Wskaz brakujace elementy nie obliczone
  117. </td>
  118. <td>Wskaz bledne zaleznosci obliczen - lokalna wartość niezgodna
  119. </td>
  120. <td>Wskaz bledne zaleznosci obliczen - zdalna wartość nie kompletna
  121. </td>
  122. <td>Wskaz bledne zaleznosci obliczen - zdalna wartość nie istnieje
  123. </td>
  124. </tr>
  125. </table>
  126. <table border="1" cellpadding="1" cellspacing="3">
  127. <tr>
  128. <td>Elementy zdalne - zaleznosci matematyczne assert - sumy
  129. </td>
  130. <td>Wskaz brakujace elementy nie obliczone
  131. </td>
  132. <td>Wskaz bledne zaleznosci obliczen - lokalna wartość niezgodna
  133. </td>
  134. <td>Wskaz bledne zaleznosci obliczen - zdalna wartość nie kompletna
  135. </td>
  136. <td>Wskaz bledne zaleznosci obliczen - zdalna wartość nie istnieje
  137. </td>
  138. </tr>
  139. </table>
  140. <hr>
  141. 1. Tu potrzebuje wywolac dane z recurse 1 lub 2
  142. <hr>
  143. <hr>
  144. 2. Potrzebuje dostep do struktury xsd obiektu - plik xsd, dostep do danych z rekordu - moze transakcja pociagnac
  145. <hr>
  146. <hr>
  147. 3. Potrzebuje wywolac XSLT i wywalic jego output
  148. <hr>
  149. <hr>
  150. 4. wyswietlic plik wygenerowny przez xslt
  151. <hr>
  152. <hr>
  153. 5. komunikacja - wynik z XSLT do GUI, GUI akcja do XSLT i nowy wynik - w kolko
  154. <hr>
  155. <?
  156. echo "<pre>";
  157. print_r($this->OBJECT);
  158. $namespace = 'default_db/IN7_MK_BAZA_DYSTRYBUCJI/IN7_MK_BAZA_DYSTRYBUCJI';
  159. $item = SchemaFactory::loadDefaultObject('SystemObject')->getItem($namespace, [ 'propertyName' => '*,field' ]);
  160. print_r($item);
  161. echo "</pre>";
  162. }
  163. public static function getRefTables($tableFrom) { //copied from BiAuditGenerate.php
  164. static $refTables = [];
  165. if (!isset($refTables[$tableFrom])) {
  166. $namespace = "default_db/{$tableFrom}/{$tableFrom}";
  167. try {
  168. $item = SchemaFactory::loadDefaultObject('SystemObject')->getItem($namespace, [ 'propertyName' => '*,field' ]);
  169. if (!($item['hasStruct'] && $item['isStructInstalled'] && $item['isObjectActive'])) throw new Exception("Object error");
  170. $fields = $item['field'];
  171. $_refTables = [];
  172. foreach ($fields as $field) {
  173. list($type, $child) = explode(":", $field['xsdType'], 2);
  174. if ($type == "ref" && $field['idZasob'] && $field['isActive'] && (!$field['isLocal'])) {
  175. try {
  176. $_refTable = ACL::getRefTable($namespace, $child);
  177. $_refTables[] = $_refTable;
  178. } catch (Exception $e) {
  179. }
  180. }
  181. }
  182. $refTables[$tableFrom] = $_refTables;
  183. } catch (Exception $e) {
  184. $refTables[$tableFrom] = [];
  185. }
  186. }
  187. return $refTables[$tableFrom];
  188. }
  189. }