Sfoglia il codice sorgente

Testowe UrlAction dla IN7_DZIENNIK_KORESP oraz IN7_MK_BAZA_DYSTRYBUCJI

Mariusz Muszyński 8 anni fa
parent
commit
2c14b88456

+ 54 - 0
SE/se-lib/Route/UrlAction/defaultIn7DziennikKoresp.php

@@ -0,0 +1,54 @@
+<?php
+
+class Route_UrlAction_defaultIn7DziennikKoresp extends RouteBase {
+
+	private $OBJECT;
+	private $TABLE = 'IN7_DZIENNIK_KORESP';
+
+	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>";
+	}
+
+}

+ 54 - 0
SE/se-lib/Route/UrlAction/defaultIn7MkBazaDystrybucji.php

@@ -0,0 +1,54 @@
+<?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>";
+	}
+
+}