Quellcode durchsuchen

added filter Twoje, Wszyscy in Przypomnij StorageAcl

Piotr Labudda vor 8 Jahren
Ursprung
Commit
27c1c1140c
1 geänderte Dateien mit 35 neuen und 15 gelöschten Zeilen
  1. 35 15
      SE/se-lib/Schema/PrzypomnijStorageAcl.php

+ 35 - 15
SE/se-lib/Schema/PrzypomnijStorageAcl.php

@@ -751,6 +751,7 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
 	function parseSpecialFilter($filterName, $value) { // @return string | array | null
 		switch ($filterName) {
 			case 'UserStatus': return $this->_parseSpecialFilterUserStatus($value);
+			case 'User': return $this->_parseSpecialFilterUser($value);
 			case 'ns': return $this->_parseSpecialFilterNamespace($value);
 			case 'time': return $this->_parseSpecialFilterTime($value);
 			default: return null;
@@ -777,6 +778,17 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
 			default: return null;
 		}
 	}
+	function _parseSpecialFilterUser($value) {
+		$login = User::getLogin();
+		switch ($value) {
+			case 'USER': return [ 'L_APPOITMENT_USER', 'or', [
+				[ 'L_APPOITMENT_USER', '=', $login ],
+				[ 'PROJECT__L_APPOITMENT_USER', '=', $login ],
+			]];
+			case 'ALL': return null;
+			default: return null;
+		}
+	}
 	function _parseSpecialFilterTime($value) {
 		switch ($value) {
 			case 'PO_TERMINIE': return ['L_APPOITMENT_DATE', 'and', [
@@ -803,12 +815,23 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
 	function getSpecialFilters() {
 		$fltrs = array();
 		{
-			$fltrs['UserStatus'] = new stdClass();
-			$fltrs['UserStatus']->icon = 'glyphicon glyphicon-user';
-			$fltrs['UserStatus']->label = 'Status użytkownika';
-			$fltrs['UserStatus']->btns = [];
-			$fltrs['UserStatus']->btns['Aktywny'] = (object)[ 'value' => 'IS_ACTIVE' ];
-			$fltrs['UserStatus']->btns['Nieaktywny'] = (object)[ 'value' => 'IS_NOT_ACTIVE' ];
+			$fltrs['User'] = new stdClass();
+			$fltrs['User']->icon = 'glyphicon glyphicon-user';
+			$fltrs['User']->label = 'Osoba odpowiedzialna';
+			$fltrs['User']->btns = [];
+			$fltrs['User']->btns['Twoje'] = (object)[ 'value' => 'USER' ];
+			$fltrs['User']->btns['Wszyscy'] = (object)[ 'value' => 'ALL' ];
+		}
+		{
+			$fltrs['time'] = new stdClass();
+			$fltrs['time']->icon = 'glyphicon glyphicon-calendar';
+			$fltrs['time']->label = 'Czas';
+			$fltrs['time']->btns = [];
+			$fltrs['time']->btns['po termine'] = (object)[ 'value' => 'PO_TERMINIE' ];
+			$fltrs['time']->btns['dzisiaj'] = (object)[ 'value' => 'DZISIAJ' ];
+			$fltrs['time']->btns['w ciągu 7 dni'] = (object)[ 'value' => 'W_CIAGU_7_DNI' ];
+			$fltrs['time']->btns['po 7 dniach'] = (object)[ 'value' => 'PO_7_DNIACH' ];
+			$fltrs['time']->btns['brak'] = (object)[ 'value' => 'BRAK' ];
 		}
 		{
 			$fltrs['ns'] = new stdClass();
@@ -826,15 +849,12 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
 			$fltrs['ns']->btns['Badania w terenie'] = (object)[ 'value' => 'BADANIA_W_TERENIE' ];
 		}
 		{
-			$fltrs['time'] = new stdClass();
-			$fltrs['time']->icon = 'glyphicon glyphicon-calendar';
-			$fltrs['time']->label = 'Czas';
-			$fltrs['time']->btns = [];
-			$fltrs['time']->btns['po termine'] = (object)[ 'value' => 'PO_TERMINIE' ];
-			$fltrs['time']->btns['dzisiaj'] = (object)[ 'value' => 'DZISIAJ' ];
-			$fltrs['time']->btns['w ciągu 7 dni'] = (object)[ 'value' => 'W_CIAGU_7_DNI' ];
-			$fltrs['time']->btns['po 7 dniach'] = (object)[ 'value' => 'PO_7_DNIACH' ];
-			$fltrs['time']->btns['brak'] = (object)[ 'value' => 'BRAK' ];
+			$fltrs['UserStatus'] = new stdClass();
+			$fltrs['UserStatus']->icon = 'glyphicon glyphicon-user';
+			$fltrs['UserStatus']->label = 'Status użytkownika';
+			$fltrs['UserStatus']->btns = [];
+			$fltrs['UserStatus']->btns['Aktywny'] = (object)[ 'value' => 'IS_ACTIVE' ];
+			$fltrs['UserStatus']->btns['Nieaktywny'] = (object)[ 'value' => 'IS_NOT_ACTIVE' ];
 		}
 		return $fltrs;
 	}