defaultIn7MkBazaDystrybucji.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. echo "<pre>";
  41. print_r($this->OBJECT);
  42. echo "</pre>";
  43. }
  44. }