Explorar o código

added preparation for iteration algo to add resources in Url Action

Piotr Labudda %!s(int64=10) %!d(string=hai) anos
pai
achega
0e6e9c2bc5
Modificáronse 1 ficheiros con 136 adicións e 6 borrados
  1. 136 6
      SE/se-lib/Route/UrlAction/ProjektyKosztyWstepnychRobot.php

+ 136 - 6
SE/se-lib/Route/UrlAction/ProjektyKosztyWstepnychRobot.php

@@ -44,16 +44,146 @@ class Route_UrlAction_ProjektyKosztyWstepnychRobot extends RouteBase {// TODO: U
 
 	public function reinstall() {// TODO: mv to UrlActionBase
 		/* required Zasoby tree structure:
-[25] TYPESPECIALS
-  [:action_id] URL_ACTION 'ProjektyKosztyWstepnychRobot'
-    [:param_id] PARAM_IN :arg_id_project
+- required base structure
+[:ts_main_id] TYPESPECIALS
+  [:action_id] URL_ACTION :url_action_name
+    [:action_param_1_id] PARAM_IN :url_action_param_1_name
+- current function from schema
 [:main_db_id] (DATABASE_MYSQL, BAZA_DANYCH, DATABASE_POSTGRESQL)
   [:tbl_id] TABELA 'IN7_MK_BAZA_DYSTRYBUCJI'
     [:cell_id] KOMORKA 'ID'
-    [:link_action_id] (ALIAS DO :action_id) URL_ACTION 'ProjektyKosztyWstepnychRobot'
-      [:link_param_id] (ALIAS DO :cell_id) PARAM_IN :arg_id_project
+    [:link_action_id] (ALIAS DO :action_id) URL_ACTION :url_action_name
+      [:link_param_id] (ALIAS DO :cell_id) PARAM_IN :url_action_param_1_name
 
-:arg_id_project = 'ID_PROJECT'
+:url_action_name = 'ProjektyKosztyWstepnychRobot'
+:url_action_param_1_name = 'ID_PROJECT'
+		*/
+		$flatConfig_main = array();
+		{
+			$flatConfig_main[] = (object)array(// Zasob::assert(TYPESPECIALS)
+				'query' => "
+					select z.ID from CRM_LISTA_ZASOBOW z
+					where z.TYPE='TYPESPECIALS'
+						and z.A_STATUS not in('DELETED')
+				",
+				'createTable' => 'CRM_LISTA_ZASOBOW',
+				'createArgs' => array('TYPE' => 'TYPESPECIALS', 'DESC' => 'Typespecials'),
+				'out' => array(':ts_main_id' => 'ID')
+			);
+			$flatConfig_main[] = (object)array(// Zasob::assert(TYPESPECIALS/:url_action_name)
+				'query' => "
+					select z.ID from CRM_LISTA_ZASOBOW z
+					where z.PARENT_ID = :ts_main_id
+						and z.TYPE = 'URL_ACTION'
+						and z.DESC = :url_action_name
+						and z.A_STATUS not in('DELETED')
+				",
+				'createTable' => 'CRM_LISTA_ZASOBOW',
+				'createArgs' => array('TYPE' => 'URL_ACTION', 'PARENT_ID' => ':ts_main_id', 'DESC' => ':url_action_name'),
+				'in' => array(':ts_main_id', ':url_action_name'),
+				'out' => array(':action_id' => 'ID')
+			);
+			$flatConfig_main[] = (object)array(// Zasob::assert(TYPESPECIALS/:url_action_name/:url_action_param_1_name)
+				'query' => "
+					select z.ID from CRM_LISTA_ZASOBOW z
+					where z.PARENT_ID = :action_id
+						and z.TYPE = 'PARAM_IN'
+						and z.DESC = :url_action_param_1_name
+						and z.A_STATUS not in('DELETED')
+				",
+				'createTable' => 'CRM_LISTA_ZASOBOW',
+				'createArgs' => array('TYPE' => 'PARAM_IN', 'PARENT_ID' => ':action_id', 'DESC' => ':url_action_param_1_name'),
+				'in' => array(':action_id', ':url_action_param_1_name'),
+				'out' => array(':action_param_1_id' => 'ID')
+			);
+		}
+		DBG::_(true, true, "flatConfig_main", $flatConfig_main, __CLASS__, __FUNCTION__, __LINE__);
+		$flatConfig_link_in_projekt = array();
+		{
+			$flatConfig_link_in_projekt[] = (object)array(// Zasob::assert(default_db)
+				'query' => "
+					select z.ID from CRM_LISTA_ZASOBOW z
+					where z.ID = :main_db_id
+						and z.TYPE in('DATABASE_MYSQL', 'BAZA_DANYCH', 'DATABASE_POSTGRESQL')
+						and z.A_STATUS not in('DELETED')
+				",
+				'createTable' => 'CRM_LISTA_ZASOBOW',
+				'createArgs' => array('TYPE' => 'BAZA_DANYCH', 'DESC' => 'Baza danych'),
+				'in' => array(':main_db_id'),
+				'out' => array(':main_db_id' => 'ID')
+			);
+			$flatConfig_link_in_projekt[] = (object)array(// Zasob::assert(default_db/IN7_MK_BAZA_DYSTRYBUCJI)
+				'query' => "
+					select z.ID from CRM_LISTA_ZASOBOW z
+					where z.PARENT_ID = :main_db_id
+						and z.TYPE = 'TABELA'
+						and z.DESC = 'IN7_MK_BAZA_DYSTRYBUCJI'
+						and z.A_STATUS not in('DELETED')
+				",
+				'createTable' => 'CRM_LISTA_ZASOBOW',
+				'createArgs' => array('TYPE' => 'TABELA', 'PARENT_ID' => ':main_db_id', 'DESC' => 'IN7_MK_BAZA_DYSTRYBUCJI'),
+				'in' => array(':main_db_id'),
+				'out' => array(':tbl_id' => 'ID')
+			);
+			$flatConfig_link_in_projekt[] = (object)array(// Zasob::assert(default_db/IN7_MK_BAZA_DYSTRYBUCJI/ID)
+				'query' => "
+					select z.ID from CRM_LISTA_ZASOBOW z
+					where z.PARENT_ID = :tbl_id
+						and z.TYPE = 'KOMORKA'
+						and z.DESC = 'ID'
+						and z.A_STATUS not in('DELETED')
+				",
+				'createTable' => 'CRM_LISTA_ZASOBOW',
+				'createArgs' => array('TYPE' => 'KOMORKA', 'PARENT_ID' => ':tbl_id', 'DESC' => 'ID'),
+				'in' => array(':tbl_id'),
+				'out' => array(':cell_id' => 'ID')
+			);
+			$flatConfig_link_in_projekt[] = (object)array(// Zasob::assert(default_db/IN7_MK_BAZA_DYSTRYBUCJI/:url_action_name)
+				'query' => "
+					select z.ID from CRM_LISTA_ZASOBOW z
+					where z.PARENT_ID = :tbl_id
+						and z.ALIAS_ID = ':action_id'
+						and z.TYPE = 'URL_ACTION'
+						and z.DESC = ':url_action_name'
+						and z.A_STATUS not in('DELETED')
+				",
+				'createTable' => 'CRM_LISTA_ZASOBOW',
+				'createArgs' => array('TYPE' => 'URL_ACTION', 'PARENT_ID' => ':tbl_id', 'ALIAS_ID' => ':action_id', 'DESC' => ':url_action_name'),
+				'in' => array(':tbl_id', ':action_id', ':url_action_name'),
+				'out' => array(':link_action_id' => 'ID')
+			);
+//      [:link_param_id] (ALIAS DO :cell_id) PARAM_IN :url_action_param_1_name
+			$flatConfig_link_in_projekt[] = (object)array(// Zasob::assert(default_db/IN7_MK_BAZA_DYSTRYBUCJI/:url_action_name/:url_action_param_1_name)
+				'query' => "
+					select z.ID from CRM_LISTA_ZASOBOW z
+					where z.PARENT_ID = :link_action_id
+						and z.ALIAS_ID = ':cell_id'
+						and z.TYPE = 'PARAM_IN'
+						and z.DESC = ':url_action_param_1_name'
+						and z.A_STATUS not in('DELETED')
+				",
+				'createTable' => 'CRM_LISTA_ZASOBOW',
+				'createArgs' => array('TYPE' => 'PARAM_IN', 'PARENT_ID' => ':link_action_id', 'ALIAS_ID' => ':cell_id', 'DESC' => ':url_action_param_1_name'),
+				'in' => array(':cell_id', ':link_action_id', ':url_action_param_1_name'),
+				'out' => array(':link_action_id' => 'ID')
+			);
+		}
+		DBG::_(true, true, "flatConfig_link_in_projekt", $flatConfig_link_in_projekt, __CLASS__, __FUNCTION__, __LINE__);
+		/* flat config - table Projekty (default_db:IN7_MK_BAZA_DYSTRYBUCJI):
+[
+	{ // Zasob::assert(default_db/IN7_MK_BAZA_DYSTRYBUCJI/:url_action_name/ID)
+		query: "select z.ID from CRM_LISTA_ZASOBOW z
+			where z.PARENT_ID = :link_action_id
+				and z.ALIAS_ID = ':cell_id'
+				and z.TYPE = 'PARAM_IN'
+				and z.DESC = 'ID'
+				and z.A_STATUS not in('DELETED')
+		",
+		create: {CRM_LISTA_ZASOBOW: [TYPE: 'KOMORKA', PARENT_ID: ':tbl_id', DESC: 'ID']},
+		in: [':tbl_id', ':cell_id', ':link_action_id'],
+		out: { ID: ':link_param_id' }
+	}
+]
 		*/
 		$pdo = DB::getPDO();