Przeglądaj źródła

added forward rowFunction in Przypomnij StorageAcl

Piotr Labudda 8 lat temu
rodzic
commit
6fb9fcf1d2
1 zmienionych plików z 30 dodań i 2 usunięć
  1. 30 2
      SE/se-lib/Schema/PrzypomnijStorageAcl.php

+ 30 - 2
SE/se-lib/Schema/PrzypomnijStorageAcl.php

@@ -871,12 +871,18 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
 				'title' => 'Edytuj powiązany projekt',
 				'class' => "btn btn-xs btn-link"
 			],
+			'forward' => [ 'href' => Router::getRoute('ViewTableAjax')->getLink('executeRowFunction', [ 'name' => "forward", 'namespace' => $this->getNamespace(), 'pk' => "{0}" ]),
+				'ico' => 'glyphicon glyphicon-forward',
+				'title' => 'Przesuń termin wykonania',
+				'class' => "btn btn-xs btn-link"
+			],
 		];
 	}
 	function executeGuiRowFunction($name, $pk) {
 		switch ($name) {
-			case 'edit': $this->executeGuiRowFunctionEdit($pk);
-			case 'project': $this->executeGuiRowFunctionProject($pk);
+			case 'edit': return $this->executeGuiRowFunctionEdit($pk);
+			case 'project': return $this->executeGuiRowFunctionProject($pk);
+			case 'forward': return $this->executeGuiRowFunctionForward($pk);
 			default: throw new Exception("Not implemented GuiRowFunction name='{$name}' for '" . $this->getNamespace() . "'");
 		}
 	}
@@ -892,5 +898,27 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
 		Lib::loadClass('Response');
 		Response::sendRedirect( Router::getRoute('ViewTableAjax')->getLink('', [ 'namespace' => "default_db/IN7_MK_BAZA_DYSTRYBUCJI" ]) . "#EDIT/{$idProject}" );
 	}
+	function executeGuiRowFunctionForward($pk) {
+		list($tableName, $id) = explode(".", $pk);
+		$acl = ACL::getAclByNamespace("default_db/{$tableName}");
+		$remoteItem = $acl->buildQuery([])->getItem($id);
+		echo UI::h('ul', [ 'class' => "breadcrumb" ], [
+			UI::h('li', [], [
+				UI::h('a', [
+					'href' => Router::getRoute('ViewTableAjax')->getLink('', [ 'namespace' => $this->getNamespace() ])
+				], "Przypomnij")
+			]),
+			UI::h('li', [], [
+				"Przesuń termin"
+			]),
+		]);
+		UI::alert('warning', "Funckja w trakcie tworzenia - przeniesienie przypomnienia na później: 1, 7, 14, 30 dni");
+
+		DBG::nicePrint($remoteItem, "\$remoteItem");
+		// $ = DB::getPDO()->fetchValue(" select PROJECT__ID from `_PRZYPOMNIJ_ITEMS` where feature_id = :feature_id ", [ ':feature_id' => $pk ]);
+		// if (!$idProject) throw new Exception("Brak przypisanego projektu");
+		// Lib::loadClass('Response');
+		// Response::sendRedirect( Router::getRoute('ViewTableAjax')->getLink('', [ 'namespace' => "default_db/IN7_MK_BAZA_DYSTRYBUCJI" ]) . "#EDIT/{$idProject}" );
+	}
 
 }