| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- class Route_UrlAction_defaultIn7MkBazaDystrybucji extends RouteBase {
- private $OBJECT;
- private $TABLE = 'IN7_MK_BAZA_DYSTRYBUCJI';
- public function handleAuth() {
- if (!User::logged()) {
- User::authByRequest();
- }
- }
- public function defaultAction() {
- SE_Layout::gora();
- SE_Layout::menu();
- try {
- if (!($ID = V::get("ID_{$this->TABLE}", 0, $_GET, 'int'))) throw new Exception("Błąd parametru");
- if (!(DB::getPDO()->fetchValue("select count(*) from `{$this->TABLE}` where `ID` = {$ID}"))) throw new Exception("Nie znaleziono rekordu");
- $result = ACL::getAclByNamespace("default_db/{$this->TABLE}")->buildQuery(['f_ID' => "$ID", 'limit' => 1])->getItems();
- // if (!$result) $result = ACL::getAclByNamespace("default_db/{$this->TABLE}/{$this->TABLE}")->buildQuery(['f_ID' => "$ID", 'limit' => 1])->getItems();
- if (!$result) throw new Exception("Brak uprawnień");
- $this->OBJECT = $result[0];
- switch ($this->OBJECT['A_STATUS']) {
- case "WAITING":
- $this->test();
- break;
- case "NORMAL":
- $this->test();
- break;
- case "OFF_HARD":
- $this->test();
- break;
- default:
- $this->test();
- //SE_Layout::alert('danger', "Błędny status rekordu.");
- }
- } catch (Exception $e) {
- SE_Layout::alert('danger', $e->getMessage());
- }
- SE_Layout::dol();
- }
- private function test() {
- echo "<pre>";
- print_r($this->OBJECT);
- echo "</pre>";
- }
- }
|