Procházet zdrojové kódy

changes SE_Layout to UI in ZamZlec for pro-netmedia

Piotr Labudda před 9 roky
rodič
revize
d52e5523f0

+ 18 - 17
SE/se-lib/Route/UrlAction/ProjektyProNetMediaZamZlec.php

@@ -6,6 +6,7 @@ Lib::loadClass('Request');
 Lib::loadClass('Response');
 Lib::loadClass('ProcesHelper');
 Lib::loadClass('Route_UrlAction');
+Lib::loadClass('UI');
 
 class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
 
@@ -44,8 +45,8 @@ class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: Url
 	}
 
 	public function defaultAction() {
-		SE_Layout::gora();
-		if (1 != V::get('_print', '', $_GET)) SE_Layout::menu();
+		UI::gora();
+		if (1 != V::get('_print', '', $_GET)) UI::menu();
 		try {
 			$data = array();
 			$data['id_project'] = V::get('ID_PROJECT', 0, $_REQUEST, 'int');
@@ -57,9 +58,9 @@ class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: Url
 			$data['widgetCompanies']['typeSpecial'] = TypespecialVariable::getInstance(-1, '__COMPANIES');
 			$this->zamZlecFormView($data);
 		} catch (Exception $e) {
-			SE_Layout::alert('danger', "Error #" . $e->getCode() .  "|" . $e->getLine() .  ": " . $e->getMessage());
+			UI::alert('danger', "Error #" . $e->getCode() .  "|" . $e->getLine() .  ": " . $e->getMessage());
 		}
-		if (1 != V::get('_print', '', $_GET)) SE_Layout::dol();
+		if (1 != V::get('_print', '', $_GET)) UI::dol();
 	}
 
 	public function addZlecenieAction() {
@@ -75,8 +76,8 @@ class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: Url
 	}
 
 	public function zlecenieAction() {
-		SE_Layout::gora();
-		if (1 != V::get('_print', '', $_GET)) SE_Layout::menu();
+		UI::gora();
+		if (1 != V::get('_print', '', $_GET)) UI::menu();
 		try {
 			$id_project = V::get('ID_PROJECT', 0, $_REQUEST, 'int');
 			$id_company = V::get('id_company', 0, $_REQUEST, 'int');
@@ -99,9 +100,9 @@ class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: Url
 			$data = $this->setProps($data);
 			$this->zlecenieView($data);
 		} catch (Exception $e) {
-			SE_Layout::alert('danger', "Error #" . $e->getCode() .  "|" . $e->getLine() .  ": " . $e->getMessage());
+			UI::alert('danger', "Error #" . $e->getCode() .  "|" . $e->getLine() .  ": " . $e->getMessage());
 		}
-		if (1 != V::get('_print', '', $_GET)) SE_Layout::dol();
+		if (1 != V::get('_print', '', $_GET)) UI::dol();
 	}
 
 	public function addZamowienieAction() {
@@ -183,16 +184,16 @@ class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: Url
 			header("Location: {$urlZam}");
 			exit;
 		} else {
-			SE_Layout::gora();
-			SE_Layout::menu();
-			SE_Layout::alert('danger', 'Nie udało się utworzyć rekordu');
-			SE_Layout::dol();
+			UI::gora();
+			UI::menu();
+			UI::alert('danger', 'Nie udało się utworzyć rekordu');
+			UI::dol();
 		}
 	}
 
 	public function zamowienieAction() {
-		SE_Layout::gora();
-		if (1 != V::get('_print', '', $_GET)) SE_Layout::menu();
+		UI::gora();
+		if (1 != V::get('_print', '', $_GET)) UI::menu();
 		try {
 			$id_order = V::get('id', 0, $_REQUEST, 'int');
 			$id_project = V::get('ID_PROJECT', 0, $_REQUEST, 'int');
@@ -207,9 +208,9 @@ class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: Url
 			$mode = (V::get('_print', '', $_REQUEST))? 'print' : 'view';
 			$this->zamowienieView($data, $mode);
 		} catch (Exception $e) {
-			SE_Layout::alert('danger', "Error #" . $e->getCode() .  "|" . $e->getLine() .  ": " . $e->getMessage());
+			UI::alert('danger', "Error #" . $e->getCode() .  "|" . $e->getLine() .  ": " . $e->getMessage());
 		}
-		if (1 != V::get('_print', '', $_GET)) SE_Layout::dol();
+		if (1 != V::get('_print', '', $_GET)) UI::dol();
 	}
 
 	public function previewOrder($idOrder) {
@@ -220,7 +221,7 @@ class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: Url
 			$data = $this->setProps($data);
 			$this->zamowienieView($data, $mode = 'preview');
 		} catch (Exception $e) {
-			SE_Layout::alert('danger', "Error #" . $e->getCode() .  "|" . $e->getLine() .  ": " . $e->getMessage());
+			UI::alert('danger', "Error #" . $e->getCode() .  "|" . $e->getLine() .  ": " . $e->getMessage());
 		}
 	}
 

+ 43 - 0
atom-open-by-url.php

@@ -0,0 +1,43 @@
+#!/usr/bin/env php
+<?php
+
+$scriptName = basename(__FILE__);
+if ($_SERVER['argc'] < 2) die("Usage: {$scriptName} url\n");
+if (empty($_SERVER['argv'][1])) die("Usage: {$scriptName} url\n");
+
+$url = $_SERVER['argv'][1];
+echo">>> DBG L." . __LINE__ . ": url: '{$url}'\n";
+// UrlAction_ProjektyProNetMediaZamZlec
+// https://biuro.pro-netmedia.pl/dev-pl-se/index.php?_route=UrlAction_ProjektyProNetMediaZamZlec&ID_PROJECT=50
+
+if (false === strpos($url, 'index.php')) die("Unrecognized url - no index.php\n");
+
+$query = parse_url($url, PHP_URL_QUERY);// only query string
+echo">>> query:"; print_r($query);echo"\n";
+$args = array(); parse_str($query, $args);
+echo">>> args:"; print_r($args);echo"\n";
+
+if (!empty($args['_route'])) {
+  $route = $args['_route'];
+  echo">>> DBG L." . __LINE__ . ": found route '{$route}'\n";
+
+  $pathProject = dirname(__FILE__);
+	$path = $pathProject . '/SE/se-lib/Route/' . implode('/', explode('_', $route)) . '.php';
+  echo">>> DBG L." . __LINE__ . ": path '{$path}'\n";
+	if (file_exists($path)) {
+    echo">>> DBG L." . __LINE__ . ": found file '{$path}' for route '{$route}'\n";
+		exec("cd {$pathProject}; atom {$path}");
+    return;
+	} else {
+		$path = "{$pathProject}/SE/se-lib/Route/{$route}.php";
+		if (file_exists($path)) {
+      echo">>> DBG L." . __LINE__ . ": found file '{$path}' for route '{$route}'\n";
+      exec("cd {$pathProject}; atom {$path}");
+      return;
+		}
+	}
+  die("Unrecognized url - cannot find class file for route '{$route}'\n");
+} else die("Unrecognized url - missing _route\n");
+
+exit;
+?>