- Timestamp:
- Apr 6, 2020, 9:19:50 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r870 r871 1 1 <?php 2 2 3 $Revision = 87 0; // Subversion revision3 $Revision = 871; // Subversion revision 4 4 $DatabaseRevision = 870; // SQL structure revision 5 $ReleaseTime = strtotime('2020-04-0 3');5 $ReleaseTime = strtotime('2020-04-06'); -
trunk/Common/Form/Form.php
r747 r871 43 43 function LoadDefaults() 44 44 { 45 foreach($this->Definition['Items'] as $Index => $Item) 46 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 47 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 48 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 49 { 50 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) 51 $this->Values[$Index] = $Item['Default']; 45 foreach ($this->Definition['Items'] as $Index => $Item) 46 { 47 if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 48 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 49 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 50 { 51 if (!array_key_exists($Index, $this->Values)) 52 $this->Values[$Index] = $Item['Default']; 53 } 52 54 } 53 55 } … … 128 130 'Rows' => array(), 129 131 ); 130 if ($Context != '') $Context = $Context.'-';131 foreach ($this->Definition['Items'] as $Index => $Item)132 { 133 if (!array_key_exists('ReadOnly', $Item)) $Item['ReadOnly'] = false;134 if($Item['ReadOnly'] == false)135 if(!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false))136 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or137 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and138 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))139 {132 if ($Context != '') $Context = $Context.'-'; 133 foreach ($this->Definition['Items'] as $Index => $Item) 134 { 135 if (!array_key_exists('ReadOnly', $Item)) $Item['ReadOnly'] = false; 136 if ($Item['ReadOnly'] == false) 137 if (!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false)) 138 if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 139 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 140 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 141 { 140 142 $Parameters = array('Value' => $this->Values[$Index], 'Name' => $Index, 141 142 if (array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null'];143 'Type' => $Item['Type'], 'Values' => $this->Values); 144 if (array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null']; 143 145 else unset($Parameters['Null']); 144 if (array_key_exists('OnPreset', $Item)) $Parameters['OnPreset'] = $Item['OnPreset'];146 if (array_key_exists('OnPreset', $Item)) $Parameters['OnPreset'] = $Item['OnPreset']; 145 147 else unset($Parameters['OnPreset']); 146 148 147 if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))148 { 149 if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))149 if (array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 150 { 151 if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 150 152 $this->FormManager->Type->RegisterType($Item['Type'], '', 151 153 $this->FormManager->FormTypes[$Item['Type']]); 152 if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')154 if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 153 155 { 154 156 $UseType = 'OneToMany'; 155 } else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')157 } else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 156 158 $UseType = 'Enumeration'; 157 159 } else $UseType = $Item['Type']; 158 160 $Edit = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnEdit', $Parameters); 159 if(array_key_exists('Suffix', $Item)) $Edit .= $Item['Suffix']; 160 161 $Caption = $Item['Caption'].':'; 162 if(array_key_exists($Index, $this->ValuesValidate) and 163 $this->ValuesValidate[$Index]) { 161 if (array_key_exists('Suffix', $Item)) $Edit .= $Item['Suffix']; 162 163 $Caption = $Item['Caption'].':'; 164 if (array_key_exists($Index, $this->ValuesValidate) and 165 $this->ValuesValidate[$Index]) 166 { 164 167 $Format = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'GetValidationFormat', array()); 165 if ($Format != '') $Caption .= '<br/><small>'.$Format.'</small>';168 if ($Format != '') $Caption .= '<br/><small>'.$Format.'</small>'; 166 169 $Caption = '<span style="color:red;">'.$Caption.'</span>'; 167 170 } 168 if(!$this->FormManager->Type->IsHidden($UseType))171 if (!$this->FormManager->Type->IsHidden($UseType)) 169 172 array_push($Table['Rows'], array($Caption, $Edit)); 170 else $Hidden .= $Edit;171 }173 else $Hidden .= $Edit; 174 } 172 175 } 173 176 $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table). 174 177 $Hidden.'</fieldset>'; 175 return ($Output);178 return $Output; 176 179 } 177 180 … … 270 273 function LoadValuesFromFormBlock($Context = '') 271 274 { 272 if ($Context != '') $Context = $Context.'-';275 if ($Context != '') $Context = $Context.'-'; 273 276 $Values = array(); 277 foreach ($this->Definition['Items'] as $Index => $Item) 278 { 279 if (!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false)) 280 { 281 if ((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 282 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 283 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) and 284 (!array_key_exists('ReadOnly', $Item) or 285 (array_key_exists('ReadOnly', $Item) and 286 ($Item['ReadOnly'] != true)))) 287 { 288 //if (array_key_exists($Context.$Index, $_POST)) 289 if (array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 290 { 291 if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 292 $this->FormManager->Type->RegisterType($Item['Type'], '', 293 $this->FormManager->FormTypes[$Item['Type']]); 294 $CustomType = $this->FormManager->FormTypes[$Item['Type']]['Type']; 295 if ($CustomType == 'Reference') 296 $UseType = 'OneToMany'; 297 else if ($CustomType == 'Enumeration') 298 $UseType = 'Enumeration'; 299 } else $UseType = $Item['Type']; 300 $Parameters = array('Name' => $Index, 'Type' => $Item['Type'], 'Values' => $this->Values); 301 if (array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null']; 302 else unset($Parameters['Null']); 303 $Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoad', 304 $Parameters); 305 } 306 } else 307 { 308 if (isset($Item['Default'])) { 309 if (isset($Item['Null']) and ($Item['Null'] == true)) 310 $Values[$Index] = null; 311 else $Values[$Index] = $Item['Default']; 312 } 313 } 314 } 315 return($Values); 316 } 317 318 function Validate() 319 { 320 $Valid = true; 274 321 foreach($this->Definition['Items'] as $Index => $Item) 275 if(!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false))276 {277 322 if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 278 323 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and … … 294 339 $UseType = 'Enumeration'; 295 340 } else $UseType = $Item['Type']; 296 $Parameters = array('Name' => $Index, 'Type' => $Item['Type'], 'Values' => $this->Values);297 if(array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null'];298 else unset($Parameters['Null']);299 $Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoad',300 $Parameters);301 }302 } else303 {304 if(isset($Item['Default'])) {305 if(isset($Item['Null']) and ($Item['Null'] == true))306 $Values[$Index] = null;307 else $Values[$Index] = $Item['Default'];308 }309 }310 return($Values);311 }312 313 function Validate()314 {315 $Valid = true;316 foreach($this->Definition['Items'] as $Index => $Item)317 if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or318 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and319 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) and320 (!array_key_exists('ReadOnly', $Item) or321 (array_key_exists('ReadOnly', $Item) and322 ($Item['ReadOnly'] != true))))323 {324 //if(array_key_exists($Context.$Index, $_POST))325 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))326 {327 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))328 $this->FormManager->Type->RegisterType($Item['Type'], '',329 $this->FormManager->FormTypes[$Item['Type']]);330 $CustomType = $this->FormManager->FormTypes[$Item['Type']]['Type'];331 if($CustomType == 'Reference')332 $UseType = 'OneToMany';333 else if($CustomType == 'Enumeration')334 $UseType = 'Enumeration';335 } else $UseType = $Item['Type'];336 341 337 342 $Parameters = array('Value' => $this->Values[$Index]); -
trunk/Common/Form/Types/DateTime.php
r738 r871 11 11 global $MonthNames; 12 12 13 if ($Item['Value'] == 0) return('');14 if ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')) $Item['Value'] = time();13 if ($Item['Value'] == 0) return ''; 14 if ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')) $Item['Value'] = time(); 15 15 $Parts = getdate($Item['Value']); 16 16 $Output = $Parts['mday'].'.'.$Parts['mon'].'.'.$Parts['year'].' '. 17 17 sprintf('%02d', $Parts['hours']).':'.sprintf('%02d', $Parts['minutes']).':'.sprintf('%02d', $Parts['seconds']); 18 return ($Output);18 return $Output; 19 19 } 20 20 … … 23 23 global $MonthNames; 24 24 25 if(($Item['Value'] !== null) and ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == ''))) $Item['Value'] = time(); 25 if (($Item['Value'] == null) or (($Item['Value'] !== null) and ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')))) 26 { 27 $Item['Value'] = time(); 28 $IsNull = true; 29 } else $IsNull = false; 26 30 $Parts = getdate($Item['Value']); 27 31 28 32 $Output = ''; 29 33 $Style = ''; 30 if (array_key_exists('Null', $Item) and $Item['Null'])34 if (array_key_exists('Null', $Item) and $Item['Null']) 31 35 { 32 if ($Item['Value'] != null)36 if (!$IsNull) 33 37 { 34 38 $Checked = ' checked="1"'; … … 46 50 // Hour 47 51 $Output .= '<select name="'.$Item['Name'].'-hour" id="'.$Item['Name'].'-hour" '.$Style.'>'; 48 for ($I = 1; $I <= 24; $I++)52 for ($I = 1; $I <= 24; $I++) 49 53 { 50 if ($Parts['hours'] == $I) $Selected = ' selected="1"'; else $Selected = '';54 if ($Parts['hours'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 51 55 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 52 56 } … … 54 58 // Minute 55 59 $Output .= '<select name="'.$Item['Name'].'-minute" id="'.$Item['Name'].'-minute" '.$Style.'>'; 56 for ($I = 1; $I <= 60; $I++)60 for ($I = 1; $I <= 60; $I++) 57 61 { 58 if ($Parts['minutes'] == $I) $Selected = ' selected="1"'; else $Selected = '';62 if ($Parts['minutes'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 59 63 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 60 64 } … … 62 66 // Second 63 67 $Output .= '<select name="'.$Item['Name'].'-second" id="'.$Item['Name'].'-second" '.$Style.'>'; 64 for ($I = 1; $I <= 60; $I++)68 for ($I = 1; $I <= 60; $I++) 65 69 { 66 if ($Parts['seconds'] == $I) $Selected = ' selected="1"'; else $Selected = '';70 if ($Parts['seconds'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 67 71 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 68 72 } … … 70 74 // Day 71 75 $Output .= ' <select name="'.$Item['Name'].'-day" id="'.$Item['Name'].'-day" '.$Style.'>'; 72 for ($I = 1; $I <= 31; $I++)76 for ($I = 1; $I <= 31; $I++) 73 77 { 74 if ($Parts['mday'] == $I) $Selected = ' selected="1"'; else $Selected = '';78 if ($Parts['mday'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 75 79 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 76 80 } … … 78 82 // Month 79 83 $Output .= '<select name="'.$Item['Name'].'-month" id="'.$Item['Name'].'-month" '.$Style.'>'; 80 for ($I = 1; $I <= 12; $I++)84 for ($I = 1; $I <= 12; $I++) 81 85 { 82 if ($Parts['mon'] == $I) $Selected = ' selected="1"'; else $Selected = '';86 if ($Parts['mon'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 83 87 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$MonthNames[$I].'</option>'; 84 88 } … … 86 90 // Year 87 91 $Output .= '<select name="'.$Item['Name'].'-year" id="'.$Item['Name'].'-year" '.$Style.'>'; 88 for ($I = 1900; $I < 2100; $I++)92 for ($I = 1900; $I < 2100; $I++) 89 93 { 90 if ($Parts['year'] == $I) $Selected = ' selected="1"'; else $Selected = '';94 if ($Parts['year'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 91 95 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 92 96 } 93 97 $Output .= '</select>'; 94 return ($Output);98 return $Output; 95 99 } 96 100 97 101 function OnLoad($Item) 98 102 { 99 if (!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return(null);100 else return (mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second'],101 $_POST[$Item['Name'].'-month'], $_POST[$Item['Name'].'-day'], $_POST[$Item['Name'].'-year']) );103 if (!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return null; 104 else return mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second'], 105 $_POST[$Item['Name'].'-month'], $_POST[$Item['Name'].'-day'], $_POST[$Item['Name'].'-year']); 102 106 } 103 107 104 108 function OnLoadDb($Item) 105 109 { 106 return (MysqlDateTimeToTime($Item['Value']));110 return MysqlDateTimeToTime($Item['Value']); 107 111 } 108 112 109 113 function OnSaveDb($Item) 110 114 { 111 if ($Item['Value'] == null) return(null);112 else return (date('Y-m-d H:i:s', $Item['Value']));115 if ($Item['Value'] == null) return null; 116 else return date('Y-m-d H:i:s', $Item['Value']); 113 117 } 114 118 115 119 function DatabaseEscape($Value) 116 120 { 117 return ('"'.addslashes($Value).'"');121 return '"'.addslashes($Value).'"'; 118 122 } 119 123 } -
trunk/Modules/Customer/Customer.php
r869 r871 106 106 'SpeedLimit' => array('Type' => 'TNetworkSpeedLimit', 'Caption' => 'Omezení rychlosti', 'Default' => null, 'Null' => true), 107 107 'Devices' => array('Type' => 'TNetworkDeviceListService', 'Caption' => 'Zařízení', 'Default' => ''), 108 'Subnets' => array('Type' => 'TNetworkSubnetListService', 'Caption' => 'Podsítě', 'Default' => ''), 108 109 'ChangeAction' => array('Type' => 'TActionEnum', 'Caption' => 'Změna - akce', 'Default' => '', 'Null' => true), 109 110 'ChangeTime' => array('Type' => 'DateTime', 'Caption' => 'Změna - čas', 'Default' => '', 'Null' => true, 'NotInList' => true), … … 142 143 'Type' => 'ManyToOne', 143 144 'Table' => 'NetworkDevice', 145 'Id' => 'Id', 146 'Ref' => 'Service', 147 'Filter' => '1', 148 )); 149 $this->System->FormManager->RegisterFormType('TNetworkSubnetListService', array( 150 'Type' => 'ManyToOne', 151 'Table' => 'NetworkSubnet', 144 152 'Id' => 'Id', 145 153 'Ref' => 'Service', -
trunk/Modules/IS/IS.php
r864 r871 22 22 function Show() 23 23 { 24 if (!$this->System->User->CheckPermission('IS', 'Manage'))25 return ('Nemáte oprávnění');24 if (!$this->System->User->CheckPermission('IS', 'Manage')) 25 return 'Nemáte oprávnění'; 26 26 $this->System->FormManager->ShowRelation = true; 27 27 28 28 // a - action 29 if (array_key_exists('a', $_GET)) $Action = $_GET['a'];29 if (array_key_exists('a', $_GET)) $Action = $_GET['a']; 30 30 else $Action = ''; 31 31 // t - table 32 if (array_key_exists('t', $_GET)) $Table = $_GET['t'];32 if (array_key_exists('t', $_GET)) $Table = $_GET['t']; 33 33 else $Table = ''; 34 34 // i - index of item 35 if (array_key_exists('i', $_GET)) $ItemId = $_GET['i'];35 if (array_key_exists('i', $_GET)) $ItemId = $_GET['i']; 36 36 else $ItemId = 0; 37 37 // fc - preset colum 38 if (array_key_exists('fn', $_GET)) $FilterName = $_GET['fn'];38 if (array_key_exists('fn', $_GET)) $FilterName = $_GET['fn']; 39 39 else $FilterName = ''; 40 if (array_key_exists('fv', $_GET)) $FilterValue = $_GET['fv'];40 if (array_key_exists('fv', $_GET)) $FilterValue = $_GET['fv']; 41 41 else $FilterValue = ''; 42 if (array_key_exists('menutype', $_COOKIE)) $MenuType = $_COOKIE['menutype'];42 if (array_key_exists('menutype', $_COOKIE)) $MenuType = $_COOKIE['menutype']; 43 43 else $MenuType = 0; 44 if (array_key_exists('menutype', $_GET)) $MenuType = $_GET['menutype'] * 1;44 if (array_key_exists('menutype', $_GET)) $MenuType = $_GET['menutype'] * 1; 45 45 setcookie('menutype', $MenuType, time() + 60 * 60 * 24 * 365); 46 46 47 if ($Action == 'list') {48 if ($FilterName == '') $Content = $this->ShowList($Table);47 if ($Action == 'list') { 48 if ($FilterName == '') $Content = $this->ShowList($Table); 49 49 else $Content = $this->ShowList($Table, '', '', $FilterName, $FilterValue); 50 50 } 51 else if ($Action == 'select') $Content = $this->ShowSelect($Table);52 else if ($Action == 'mapselect') $Content = $this->ShowMapSelect($Table);53 else if ($Action == 'edit') $Content = $this->ShowEdit($Table, $ItemId);54 else if ($Action == 'add') $Content = $this->ShowAdd($Table);55 else if ($Action == 'addsub') $Content = $this->ShowAddSub($Table);56 else if ($Action == 'view') $Content = $this->ShowView($Table, $ItemId);57 else if ($Action == 'delete') $Content = $this->ShowDelete($Table, $ItemId);58 else if ($Action == 'fav_add') $Content = $this->ShowFavoriteAdd($Table, $ItemId);59 else if ($Action == 'fav_del') $Content = $this->ShowFavoriteDel($Table, $ItemId);51 else if ($Action == 'select') $Content = $this->ShowSelect($Table); 52 else if ($Action == 'mapselect') $Content = $this->ShowMapSelect($Table); 53 else if ($Action == 'edit') $Content = $this->ShowEdit($Table, $ItemId); 54 else if ($Action == 'add') $Content = $this->ShowAdd($Table); 55 else if ($Action == 'addsub') $Content = $this->ShowAddSub($Table); 56 else if ($Action == 'view') $Content = $this->ShowView($Table, $ItemId); 57 else if ($Action == 'delete') $Content = $this->ShowDelete($Table, $ItemId); 58 else if ($Action == 'fav_add') $Content = $this->ShowFavoriteAdd($Table, $ItemId); 59 else if ($Action == 'fav_del') $Content = $this->ShowFavoriteDel($Table, $ItemId); 60 60 else $Content = $this->Dashboard(); 61 if ($this->HideMenu == false)61 if ($this->HideMenu == false) 62 62 { 63 63 $Output = '<table style="width: 100%"><tr><td style="width: 20%; vertical-align: top;">'; 64 64 $MenuTypeText = '<a href="?menutype=0">Nabídka</a>'; 65 if ($MenuType == 0) $MenuTypeText = '<strong>'.$MenuTypeText.'</strong>';65 if ($MenuType == 0) $MenuTypeText = '<strong>'.$MenuTypeText.'</strong>'; 66 66 $Output .= $MenuTypeText.' '; 67 67 $MenuTypeText = '<a href="?menutype=1">Oblíbené</a>'; 68 if ($MenuType == 1) $MenuTypeText = '<strong>'.$MenuTypeText.'</strong>';68 if ($MenuType == 1) $MenuTypeText = '<strong>'.$MenuTypeText.'</strong>'; 69 69 $Output .= $MenuTypeText.' '; 70 if ($MenuType == 0) $Output .= $this->ShowMenu();71 if ($MenuType == 1) $Output .= $this->ShowFavorites();70 if ($MenuType == 0) $Output .= $this->ShowMenu(); 71 if ($MenuType == 1) $Output .= $this->ShowFavorites(); 72 72 $Output .= '</td><td style="width: 80%; vertical-align: top;">'; 73 73 $Output .= $Content; … … 75 75 } else $Output = $Content; 76 76 77 return ($Output);77 return $Output; 78 78 } 79 79 … … 81 81 { 82 82 $Output = '<strong>Nástěnka:</strong><br/>'; 83 foreach ($this->System->ModuleManager->Modules['IS']->DashboardItems as $Item)84 { 85 if (is_string($Item['Callback'][0]))83 foreach ($this->System->ModuleManager->Modules['IS']->DashboardItems as $Item) 84 { 85 if (is_string($Item['Callback'][0])) 86 86 { 87 87 $Class = new $Item['Callback'][0]($this->System); … … 96 96 { 97 97 $DbResult = $this->Database->select('MenuItemFavorite', 'Id', '(`MenuItem`='.($_GET['i'] * 1).') AND (`User`='.$this->System->User->User['Id'].')'); 98 if ($DbResult->num_rows > 0)98 if ($DbResult->num_rows > 0) 99 99 { 100 100 $Output = $this->SystemMessage('Oblíbené', 'Již existuje v oblíbených'); 101 } else { 101 } else 102 { 102 103 $this->Database->insert('MenuItemFavorite', array('MenuItem' => ($_GET['i'] * 1), 'User' => $this->System->User->User['Id'])); 103 104 $Output = $this->SystemMessage('Oblíbené', 'Přidáno do oblíbených'); 104 105 } 105 106 $Output .= $this->ShowList($Table); 106 return ($Output);107 return $Output; 107 108 } 108 109 … … 110 111 { 111 112 $DbResult = $this->Database->select('MenuItemFavorite', 'Id', '(`MenuItem`='.($_GET['i'] * 1).') AND (`User`='.$this->System->User->User['Id'].')'); 112 if ($DbResult->num_rows > 0)113 if ($DbResult->num_rows > 0) 113 114 { 114 115 $DbRow = $DbResult->fetch_assoc(); 115 116 $this->Database->delete('MenuItemFavorite', '`Id`= '.$DbRow['Id']); 116 117 $Output = $this->SystemMessage('Oblíbené', 'Odstraněno z oblíbených'); 117 } else { 118 } else 119 { 118 120 $Output = $this->SystemMessage('Oblíbené', 'Nenalezeno v oblíbených'); 119 121 } 120 122 $Output .= $this->ShowList($Table); 121 return ($Output);123 return $Output; 122 124 } 123 125 … … 127 129 // Compare old values loaded from database with new values in Form variable 128 130 $NewValues = $Form->Values; 129 if ($OldId != 0)131 if ($OldId != 0) 130 132 { 131 133 $FormOld = new Form($this->System->FormManager); … … 134 136 $OldValues = $FormOld->Values; 135 137 // Keep only changes values 136 foreach ($NewValues as $Index => $Value)137 { 138 if ($OldValues[$Index] != $NewValues[$Index])138 foreach ($NewValues as $Index => $Value) 139 { 140 if ($OldValues[$Index] != $NewValues[$Index]) 139 141 { 140 142 $Values .= $Index.': '.$FormOld->GetValue($Index); 141 if ($NewId != 0) $Values .= ' => '.$Form->GetValue($Index);143 if ($NewId != 0) $Values .= ' => '.$Form->GetValue($Index); 142 144 $Values .= "\n"; 143 145 } 144 146 } 145 } else { 146 foreach($NewValues as $Index => $Value) 147 } else 148 { 149 foreach ($NewValues as $Index => $Value) 147 150 { 148 151 $Values .= $Index.': '.$Form->GetValue($Index)."\n"; … … 155 158 { 156 159 $Output = ''; 157 if (!array_key_exists($Table, $this->System->FormManager->Classes))158 return ($this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'));159 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write'))160 return ($this->SystemMessage('Oprávnění', 'Nemáte oprávnění'));161 if (array_key_exists('o', $_GET))162 { 163 if ($_GET['o'] == 'save')164 { 165 if (!array_key_exists('submit', $_POST))166 return ($this->SystemMessage('Formulář', 'Formulář nebyl řádně odeslán. Vraťte se zpět a odešlete formulář znovu.'));160 if (!array_key_exists($Table, $this->System->FormManager->Classes)) 161 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'); 162 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write')) 163 return $this->SystemMessage('Oprávnění', 'Nemáte oprávnění'); 164 if (array_key_exists('o', $_GET)) 165 { 166 if ($_GET['o'] == 'save') 167 { 168 if (!array_key_exists('submit', $_POST)) 169 return $this->SystemMessage('Formulář', 'Formulář nebyl řádně odeslán. Vraťte se zpět a odešlete formulář znovu.'); 167 170 $Form = new Form($this->System->FormManager); 168 171 $Form->SetClass($Table); 169 172 $Form->LoadValuesFromForm(); 170 173 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' úprava'; 171 try { 174 try 175 { 172 176 $Form->Validate(); 173 if (array_key_exists('BeforeModify', $Form->Definition))177 if (array_key_exists('BeforeModify', $Form->Definition)) 174 178 { 175 179 $Class = $Form->Definition['BeforeModify'][0]; … … 181 185 $Output .= $this->SystemMessage('Úprava položky', 'Položka upravena'); 182 186 $Output .= $this->ShowView($Table, $Id); 183 if (array_key_exists('AfterModify', $Form->Definition))187 if (array_key_exists('AfterModify', $Form->Definition)) 184 188 { 185 189 $Class = $Form->Definition['AfterModify'][0]; … … 219 223 $Output .= '</ul>'; 220 224 } 221 return ($Output);225 return $Output; 222 226 } 223 227 … … 225 229 { 226 230 $Output = ''; 227 if (!array_key_exists($Table, $this->System->FormManager->Classes))228 return ($this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'));231 if (!array_key_exists($Table, $this->System->FormManager->Classes)) 232 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'); 229 233 $FormClass = $this->System->FormManager->Classes[$Table]; 230 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write'))231 return ('Nemáte oprávnění');234 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write')) 235 return 'Nemáte oprávnění'; 232 236 $DbResult = $this->Database->select($Table, '*', '`Id`='.$Id); 233 if ($DbResult->num_rows > 0)237 if ($DbResult->num_rows > 0) 234 238 { 235 239 $DbRow = $DbResult->fetch_assoc(); 236 try { 240 try 241 { 237 242 $Form = new Form($this->System->FormManager); 238 243 $Form->SetClass($Table); 239 244 $Form->LoadValuesFromDatabase($Id); 240 245 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' odstranění'; 241 if (array_key_exists('BeforeDelete', $Form->Definition))246 if (array_key_exists('BeforeDelete', $Form->Definition)) 242 247 { 243 248 call_user_func($Form->Definition['BeforeDelete'], $Form, $Id); … … 246 251 $this->Database->delete($Table, '`Id`='.$Id); 247 252 $Output .= $this->SystemMessage('Smazání položky', 'Položka odstraněna'); 248 if (array_key_exists('AfterDelete', $Form->Definition))253 if (array_key_exists('AfterDelete', $Form->Definition)) 249 254 { 250 255 $Class = $Form->Definition['AfterDelete'][0]; … … 258 263 } else $Output .= $this->SystemMessage('Smazání položky', 'Položka nenalezena'); 259 264 $Output .= $this->ShowList($Table); 260 return ($Output);265 return $Output; 261 266 } 262 267 … … 264 269 { 265 270 $Output = ''; 266 if (!array_key_exists($Table, $this->System->FormManager->Classes))267 return ($this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'));268 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write'))269 return ('Nemáte oprávnění');270 if (array_key_exists('o', $_GET))271 { 272 if ($_GET['o'] == 'save')271 if (!array_key_exists($Table, $this->System->FormManager->Classes)) 272 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'); 273 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write')) 274 return 'Nemáte oprávnění'; 275 if (array_key_exists('o', $_GET)) 276 { 277 if ($_GET['o'] == 'save') 273 278 { 274 279 $Form = new Form($this->System->FormManager); … … 276 281 $Form->LoadValuesFromForm(); 277 282 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' přidání'; 278 try { 283 try 284 { 279 285 $Form->Validate(); 280 if (array_key_exists('BeforeInsert', $Form->Definition))286 if (array_key_exists('BeforeInsert', $Form->Definition)) 281 287 { 282 288 $Class = $Form->Definition['BeforeInsert'][0]; … … 290 296 $Output .= $this->SystemMessage('Přidání položky', 'Nová položka vytvořena'); 291 297 $Output .= $this->ShowView($Table, $Id, $_GET['a'] == 'addsub'); 292 if (array_key_exists('AfterInsert', $Form->Definition))298 if (array_key_exists('AfterInsert', $Form->Definition)) 293 299 { 294 300 $Class = $Form->Definition['AfterInsert'][0]; … … 297 303 } 298 304 // Add action to update caller form 299 if ($_GET['a'] == 'addsub')305 if ($_GET['a'] == 'addsub') 300 306 { 301 307 $Type = $this->System->FormManager->FormTypes[$_GET['rt']]; … … 326 332 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' přidání'; 327 333 // Load presets from URL 328 foreach($_GET as $Key => $Value) 329 if(substr($Key, 0, 6) == 'preset') 330 { 331 $Key = substr($Key, 6); 332 if(($Key != '') and array_key_exists($Key, $Form->Values)) 333 $Form->Values[$Key] = $Value; 334 } 335 if(array_key_exists('r', $_GET)) $URL = '&r='.$_GET['r'].'&rt='.$_GET['rt']; 334 foreach ($_GET as $Key => $Value) 335 { 336 if (substr($Key, 0, 6) == 'preset') 337 { 338 $Key = substr($Key, 6); 339 if (($Key != '') and array_key_exists($Key, $Form->Values)) 340 $Form->Values[$Key] = $Value; 341 } 342 } 343 if (array_key_exists('r', $_GET)) $URL = '&r='.$_GET['r'].'&rt='.$_GET['rt']; 336 344 else $URL = ''; 337 345 $Form->OnSubmit = '?a='.$_GET['a'].'&t='.$Table.'&o=save'.$URL; … … 341 349 } 342 350 $Output .= '<ul class="ActionMenu">'; 343 foreach ($Actions as $Action)351 foreach ($Actions as $Action) 344 352 { 345 353 $Output .= '<li>'.$Action.'</li>'; 346 354 } 347 355 $Output .= '</ul>'; 348 return ($Output);356 return $Output; 349 357 } 350 358 351 359 function ShowAddSub($Table, $Filter = '', $Title = '') 352 360 { 353 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write'))354 return ('Nemáte oprávnění');361 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write')) 362 return 'Nemáte oprávnění'; 355 363 $this->BasicHTML = true; 356 364 $this->HideMenu = true; 357 365 $Output = $this->ShowAdd($Table); 358 return ($Output);366 return $Output; 359 367 } 360 368 … … 364 372 $QueryItems['a'] = 'view'; 365 373 366 if (array_key_exists($QueryParamName, $_GET)) $TabIndex = $_GET[$QueryParamName];374 if (array_key_exists($QueryParamName, $_GET)) $TabIndex = $_GET[$QueryParamName]; 367 375 else $TabIndex = 0; 368 376 369 377 $Output = '<div class="Tab">'. 370 378 '<ul>'; 371 foreach ($Tabs as $Index => $Tab)379 foreach ($Tabs as $Index => $Tab) 372 380 { 373 381 $QueryItems[$QueryParamName] = $Index; 374 if ($Index == $TabIndex) $Selected = ' id="selected"';382 if ($Index == $TabIndex) $Selected = ' id="selected"'; 375 383 else $Selected = ''; 376 384 $Output .= '<li'.$Selected.'><a href="?'.SetQueryStringArray($QueryItems).'">'.$Tab.'</a></li>'; 377 385 } 378 386 $Output .= '</ul></div><div class="TabContent">'.$TabContent.'</div>'; 379 return ($Output);387 return $Output; 380 388 } 381 389 382 390 function ShowView($Table, $Id, $WithoutActions = false) 383 391 { 384 if (!array_key_exists($Table, $this->System->FormManager->Classes))385 return ($this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'));392 if (!array_key_exists($Table, $this->System->FormManager->Classes)) 393 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'); 386 394 $FormClass = $this->System->FormManager->Classes[$Table]; 387 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read'))388 return ('Nemáte oprávnění');395 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read')) 396 return 'Nemáte oprávnění'; 389 397 390 398 $FormClass = $this->System->FormManager->Classes[$Table]; 391 if (array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable'];399 if (array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable']; 392 400 else $TableModify = $Table; 393 401 … … 398 406 $Form->OnSubmit = '?a=view'; 399 407 $Output = $Form->ShowViewForm(); 400 if ($WithoutActions == false)408 if ($WithoutActions == false) 401 409 { 402 410 $Actions = array( … … 410 418 $this->System->Link('/images/add.png')) 411 419 ); 412 if (array_key_exists('ItemActions', $FormClass))413 { 414 foreach ($FormClass['ItemActions'] as $Action)420 if (array_key_exists('ItemActions', $FormClass)) 421 { 422 foreach ($FormClass['ItemActions'] as $Action) 415 423 { 416 424 $URL = str_replace('#RowId', $Id, $this->System->Link($Action['URL'])); … … 420 428 } 421 429 $Output .= '<ul class="ActionMenu">'; 422 foreach ($Actions as $Action)430 foreach ($Actions as $Action) 423 431 { 424 432 $Output .= '<li>'.$Action.'</li>'; … … 429 437 // Show ManyToOne relations 430 438 $Tabs = array(); 431 foreach ($Form->Definition['Items'] as $Index => $Item)432 if ((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and439 foreach ($Form->Definition['Items'] as $Index => $Item) 440 if ((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and 433 441 ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne'))) 434 442 { … … 436 444 } 437 445 $Tabs[] = 'Vše'; 438 if (array_key_exists('tab', $_GET)) $TabIndex = $_GET['tab'];446 if (array_key_exists('tab', $_GET)) $TabIndex = $_GET['tab']; 439 447 else $TabIndex = 0; 440 448 441 449 $TabContent = ''; 442 450 $I = 0; 443 foreach ($Form->Definition['Items'] as $Index => $Item)444 if ((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and451 foreach ($Form->Definition['Items'] as $Index => $Item) 452 if ((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and 445 453 ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne'))) 446 454 { … … 462 470 463 471 $Output .= $this->ShowTabs($Tabs, 'tab', $TabContent); 464 return ($Output);472 return $Output; 465 473 } 466 474 467 475 function ShowTable($Table, $Filter = '', $Title = '', $RowActions = array(), $ExcludeColumn = '') 468 476 { 469 if (!array_key_exists($Table, $this->System->FormManager->Classes))470 return ($this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'));477 if (!array_key_exists($Table, $this->System->FormManager->Classes)) 478 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'); 471 479 $FormClass = $this->System->FormManager->Classes[$Table]; 472 480 473 if (array_key_exists('SQL', $FormClass))481 if (array_key_exists('SQL', $FormClass)) 474 482 $SourceTable = '('.$FormClass['SQL'].') AS `TX`'; 475 483 else $SourceTable = '`'.$FormClass['Table'].'` AS `TX`'; … … 480 488 // Build form type filter 481 489 $TypeFilter = ''; 482 foreach ($FormClass['Items'] as $ItemIndex => $FormItem)483 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or490 foreach ($FormClass['Items'] as $ItemIndex => $FormItem) 491 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 484 492 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 485 493 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 486 if (array_key_exists('Filter', $FormItem) and ($FormItem['Filter'] == true))487 { 488 if ($TypeFilter != '') $TypeFilter .= ' AND ';494 if (array_key_exists('Filter', $FormItem) and ($FormItem['Filter'] == true)) 495 { 496 if ($TypeFilter != '') $TypeFilter .= ' AND '; 489 497 $TypeFilter .= '(`'.$ItemIndex.'` = "'.$FormItem['Default'].'")'; 490 498 } 491 if ($TypeFilter != '')492 { 493 if ($HavingFilter != '') $HavingFilter = ' AND';499 if ($TypeFilter != '') 500 { 501 if ($HavingFilter != '') $HavingFilter = ' AND'; 494 502 $HavingFilter .= ' '.$TypeFilter; 495 503 } … … 498 506 $UserFilter = ''; 499 507 $Columns = array('Id' => '`Id`'); 500 if (array_key_exists('filter', $_GET) and ($_GET['filter'] == 1))501 { 502 foreach ($FormClass['Items'] as $ItemIndex => $FormItem)503 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))504 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or508 if (array_key_exists('filter', $_GET) and ($_GET['filter'] == 1)) 509 { 510 foreach ($FormClass['Items'] as $ItemIndex => $FormItem) 511 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false)) 512 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 505 513 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 506 514 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 507 515 { 508 516 $UseType = $UseType = $FormItem['Type']; 509 if (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes))510 { 511 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList))517 if (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 518 { 519 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 512 520 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 513 521 $this->System->FormManager->FormTypes[$FormItem['Type']]); 514 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference')522 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 515 523 $UseType = 'OneToMany'; 516 524 else 517 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration')525 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 518 526 $UseType = 'Enumeration'; 519 527 } 520 528 $FilterName = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterName', 521 529 array('Name' => $ItemIndex, 'Type' => $FormItem['Type'])); 522 if (array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != ''))523 { 524 if ($UserFilter != '') $UserFilter .= ' AND ';530 if (array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 531 { 532 if ($UserFilter != '') $UserFilter .= ' AND '; 525 533 $UserFilter .= '('.$FilterName.' LIKE "%'.$_POST['Filter'.$ItemIndex].'%")'; 526 534 } 527 535 } 528 536 } 529 if ($UserFilter != '')530 { 531 if ($HavingFilter != '') $HavingFilter .= ' AND';537 if ($UserFilter != '') 538 { 539 if ($HavingFilter != '') $HavingFilter .= ' AND'; 532 540 $HavingFilter .= ' '.$UserFilter; 533 541 } 534 if ($WhereFilter != '') $Filter = ' WHERE '.$WhereFilter;535 if ($HavingFilter != '') $Filter = ' HAVING '.$HavingFilter;536 537 538 foreach ($FormClass['Items'] as $ItemIndex => $FormItem)539 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or542 if ($WhereFilter != '') $Filter = ' WHERE '.$WhereFilter; 543 if ($HavingFilter != '') $Filter = ' HAVING '.$HavingFilter; 544 545 546 foreach ($FormClass['Items'] as $ItemIndex => $FormItem) 547 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 540 548 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 541 549 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 542 550 { 543 if ($ExcludeColumn != $ItemIndex)544 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))545 if (!array_key_exists('NotInList', $FormItem) or ($FormItem['NotInList'] == false))551 if ($ExcludeColumn != $ItemIndex) 552 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false)) 553 if (!array_key_exists('NotInList', $FormItem) or ($FormItem['NotInList'] == false)) 546 554 $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']); 547 555 $UseType = $UseType = $FormItem['Type']; 548 if (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes))549 { 550 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList))556 if (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 557 { 558 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 551 559 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 552 560 $this->System->FormManager->FormTypes[$FormItem['Type']]); 553 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference')561 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 554 562 $UseType = 'OneToMany'; 555 563 else 556 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration')564 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 557 565 $UseType = 'Enumeration'; 558 566 } 559 if (array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != ''))567 if (array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 560 568 $Value = $_POST['Filter'.$ItemIndex]; 561 569 else $Value = ''; 562 if ($ItemIndex == 'Id') unset($Columns['Id']);563 564 if (!array_key_exists('SQL', $FormItem)) $FormItem['SQL'] = '';570 if ($ItemIndex == 'Id') unset($Columns['Id']); 571 572 if (!array_key_exists('SQL', $FormItem)) $FormItem['SQL'] = ''; 565 573 else $FormItem['SQL'] = str_replace('#Id', '`TX`.`Id`', $FormItem['SQL']); 566 574 $Columns[] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterNameQuery', … … 577 585 // Get total filtered item count in database 578 586 $Columns = implode(',', $Columns); 579 if ($Filter != '')587 if ($Filter != '') 580 588 { 581 589 $Query = 'SELECT COUNT(*) FROM (SELECT '.$Columns.' FROM '.$SourceTable.' '.$Filter.') AS `TS`'; … … 590 598 591 599 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 592 if (!array_key_exists('DefaultSortColumn', $FormClass))600 if (!array_key_exists('DefaultSortColumn', $FormClass)) 593 601 $FormClass['DefaultSortColumn'] = 'Id'; 594 if (!array_key_exists('DefaultSortOrder', $FormClass))602 if (!array_key_exists('DefaultSortOrder', $FormClass)) 595 603 $FormClass['DefaultSortOrder'] = 0; 596 604 $Order = GetOrderTableHeader($Table, $TableColumns, $FormClass['DefaultSortColumn'], $FormClass['DefaultSortOrder']); … … 598 606 599 607 // Show search fields 600 if (array_key_exists('r', $_GET)) $Addition = '&r='.$_GET['r'];608 if (array_key_exists('r', $_GET)) $Addition = '&r='.$_GET['r']; 601 609 else $Addition = ''; 602 610 $Output .= '<tr><form action="?a='.$_GET['a'].'&t='.$Table.'&filter=1'.$Addition.'" method="post">'; 603 foreach ($FormClass['Items'] as $ItemIndex => $FormItem)604 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))605 if (!array_key_exists('NotInList', $FormItem) or ($FormItem['NotInList'] == false))606 if ((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or611 foreach ($FormClass['Items'] as $ItemIndex => $FormItem) 612 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false)) 613 if (!array_key_exists('NotInList', $FormItem) or ($FormItem['NotInList'] == false)) 614 if ((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 607 615 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 608 616 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) and 609 617 ($ExcludeColumn != $ItemIndex)) 610 618 { 611 if (array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != ''))619 if (array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 612 620 $Value = $_POST['Filter'.$ItemIndex]; 613 621 else $Value = ''; … … 621 629 $VisibleItemCount = 0; 622 630 $DbResult = $this->Database->query($Query); 623 while ($Row = $DbResult->fetch_assoc())631 while ($Row = $DbResult->fetch_assoc()) 624 632 { 625 633 $Output .= '<tr>'; 626 foreach ($FormClass['Items'] as $ItemIndex => $FormItem)627 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))628 if (!array_key_exists('NotInList', $FormItem) or ($FormItem['NotInList'] == false))629 if ((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or634 foreach ($FormClass['Items'] as $ItemIndex => $FormItem) 635 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false)) 636 if (!array_key_exists('NotInList', $FormItem) or ($FormItem['NotInList'] == false)) 637 if ((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 630 638 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 631 639 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) and … … 634 642 //$Output .= '<td>'.$Row[$ItemIndex].'</td>'; 635 643 $UseType = $UseType = $FormItem['Type']; 636 if (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes))637 { 638 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList))644 if (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 645 { 646 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 639 647 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 640 648 $this->System->FormManager->FormTypes[$FormItem['Type']]); 641 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference')649 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 642 650 $UseType = 'OneToMany'; 643 651 else 644 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration')652 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 645 653 $UseType = 'Enumeration'; 646 654 } … … 651 659 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 652 660 'Type' => $FormItem['Type'], 'Filter' => $Row[$ItemIndex.'_Filter'])); 653 if ($Value == '') $Value = ' ';661 if ($Value == '') $Value = ' '; 654 662 $Output .= '<td>'.$Value.'</td>'; 655 663 } … … 658 666 } 659 667 $Output .= '<tr><td colspan="'.count($TableColumns).'" style="text-align: right;">Zobrazeno <strong>'.$VisibleItemCount.'</strong>'; 660 if ($UserFilter != '') $Output .= ' z filtrovaných <strong>'.$TotalFilteredCount.'</strong>';668 if ($UserFilter != '') $Output .= ' z filtrovaných <strong>'.$TotalFilteredCount.'</strong>'; 661 669 $Output .= ' z celkem <strong>'.$TotalCount.'</strong></td></tr>'; 662 670 $Output .= '</table>'; 663 671 $Output .= $PageList['Output']; 664 return ($Output);672 return $Output; 665 673 } 666 674 667 675 function ShowSelect($Table, $Filter = '', $Title = '') 668 676 { 669 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read'))670 return ('Nemáte oprávnění');677 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read')) 678 return 'Nemáte oprávnění'; 671 679 $this->BasicHTML = true; 672 680 $this->HideMenu = true; … … 675 683 $this->System->Link('/images/select.png').'"/></a>'; 676 684 $Output = $this->ShowTable($Table, $Filter, $Title, $RowActions); 677 return ($Output);685 return $Output; 678 686 } 679 687 680 688 function ShowMapSelect($Table, $Filter = '', $Title = '') 681 689 { 682 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write'))683 return ('Nemáte oprávnění');690 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write')) 691 return 'Nemáte oprávnění'; 684 692 $Map = new MapOpenStreetMaps($this->System); 685 693 $Map->Position = array('Lat' => $this->System->Config['Map']['DefaultLatitude'], … … 690 698 //$MapApi->ShowMarker = true; 691 699 $Output = $Map->ShowPage($this); 692 return ($Output);700 return $Output; 693 701 } 694 702 … … 696 704 { 697 705 $Output = ''; 698 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read'))699 return ('Nemáte oprávnění');706 if (defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read')) 707 return 'Nemáte oprávnění'; 700 708 if(!array_key_exists($Table, $this->System->FormManager->Classes)) 701 return ($this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'));709 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'); 702 710 $FormClass = $this->System->FormManager->Classes[$Table]; 703 if (array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable'];711 if (array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable']; 704 712 else $TableModify = $Table; 705 713 … … 710 718 '<a href="?a=delete&t='.$Table.'&i=#RowId"><img alt="Smazat" title="Smazat" src="'. 711 719 $this->System->Link('/images/delete.png').'" onclick="return confirmAction(\'Opravdu smazat položku?\');"/></a>'; 712 if (($Table != '') and (array_key_exists($Table, $this->System->FormManager->Classes)))720 if (($Table != '') and (array_key_exists($Table, $this->System->FormManager->Classes))) 713 721 $FormClass = $this->System->FormManager->Classes[$Table]; 714 else return ($this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'));715 if ($ExcludeColumn == '') $this->ShortTitle .= ' - '.$FormClass['Title'];716 if (array_key_exists('ItemActions', $FormClass))717 { 718 foreach ($FormClass['ItemActions'] as $Action)722 else return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'); 723 if ($ExcludeColumn == '') $this->ShortTitle .= ' - '.$FormClass['Title']; 724 if (array_key_exists('ItemActions', $FormClass)) 725 { 726 foreach ($FormClass['ItemActions'] as $Action) 719 727 { 720 728 $URL = $this->System->Link($Action['URL']); … … 728 736 $Output .= '<li>'.$this->ShowAction('Seznam', '?a=list&t='.$Table, $this->System->Link('/images/list.png')).'</li>'; 729 737 $MI = 0; 730 if (array_key_exists('mi', $_GET))738 if (array_key_exists('mi', $_GET)) 731 739 { 732 740 $DbResult = $this->Database->select('MenuItemFavorite', 'Id', '(`MenuItem`='.($_GET['mi'] * 1).') AND (`User`='.$this->System->User->User['Id'].')'); 733 if ($DbResult->num_rows > 0)741 if ($DbResult->num_rows > 0) 734 742 { 735 743 $DbRow = $DbResult->fetch_assoc(); … … 740 748 $this->System->Link('/images/Favorite-Add.png')).'</li>'; 741 749 } 742 if(array_key_exists('Actions', $FormClass)) 743 { 744 foreach($FormClass['Actions'] as $Action) 750 if (array_key_exists('Actions', $FormClass)) 751 { 752 foreach ($FormClass['Actions'] as $Action) 753 { 745 754 $Output .= '<li>'.$this->ShowAction($Action['Caption'], $this->System->Link($Action['URL']), 746 $this->System->Link('/images/action.png')).'</li>'; 755 $this->System->Link('/images/action.png')).'</li>'; 756 } 747 757 } 748 758 $Output .= '</ul>'; 749 759 $Output .= $this->ShowTable($Table, $Filter, $Title, $RowActions, $ExcludeColumn); 750 return ($Output);760 return $Output; 751 761 } 752 762 … … 760 770 'WHERE `MenuItemFavorite`.`User`='.$this->System->User->User['Id'].' '. 761 771 'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`'); 762 while ($DbRow = $DbResult->fetch_assoc())763 { 764 //if ($DbRow['Permission'] != '')772 while ($DbRow = $DbResult->fetch_assoc()) 773 { 774 //if ($DbRow['Permission'] != '') 765 775 $this->MenuItems[$DbRow['Id']] = $DbRow; 766 776 } 767 return ($this->ShowMenuItem('', true));777 return $this->ShowMenuItem('', true); 768 778 } 769 779 … … 776 786 'WHERE `MenuItem`.`Menu`=1 '. 777 787 'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`'); 778 while ($DbRow = $DbResult->fetch_assoc())779 { 780 //if ($DbRow['Permission'] != '')788 while ($DbRow = $DbResult->fetch_assoc()) 789 { 790 //if ($DbRow['Permission'] != '') 781 791 $this->MenuItems[$DbRow['Id']] = $DbRow; 782 792 } 783 return ($this->ShowMenuItem(''));793 return $this->ShowMenuItem(''); 784 794 } 785 795 … … 787 797 { 788 798 $Output = '<ul style="list-style: none; margin-left:1em; padding-left:0em;">'; 789 foreach($this->MenuItems as $MenuItem) 790 if(($MenuItem['Parent'] == $Parent) or $All) 791 { 792 $LinkTitle = $MenuItem['Name']; 793 if($MenuItem['URL'] != '') 794 { 795 $Icon = 'Device.png'; 796 if(substr($MenuItem['URL'], 0, 4) != 'http') $MenuItem['URL'] = $this->System->Link($MenuItem['URL']); 797 $LinkTitle = MakeLink($MenuItem['URL'].'&mi='.$MenuItem['Id'], $LinkTitle); 798 } else $Icon = 'Folder.png'; 799 if($MenuItem['IconName'] != '') $Image = '<img src="'.$this->System->Link('/images/favicons/'.$MenuItem['IconName']).'"/> '; 800 else $Image = '<img src="'.$this->System->Link('/images/favicons/'.$Icon).'"/> '; 801 //if($this->System->User->CheckPermission($this->TableToModule($Table), 'Write') or !defined('NEW_PERMISSION')) 802 $Output .= '<li>'.$Image.$LinkTitle.'</li>'; 803 if($All == false) $Output .= $this->ShowMenuItem($MenuItem['Id']); 799 foreach ($this->MenuItems as $MenuItem) 800 { 801 if (($MenuItem['Parent'] == $Parent) or $All) 802 { 803 $LinkTitle = $MenuItem['Name']; 804 if ($MenuItem['URL'] != '') 805 { 806 $Icon = 'Device.png'; 807 if (substr($MenuItem['URL'], 0, 4) != 'http') $MenuItem['URL'] = $this->System->Link($MenuItem['URL']); 808 $LinkTitle = MakeLink($MenuItem['URL'].'&mi='.$MenuItem['Id'], $LinkTitle); 809 } else $Icon = 'Folder.png'; 810 if ($MenuItem['IconName'] != '') $Image = '<img src="'.$this->System->Link('/images/favicons/'.$MenuItem['IconName']).'"/> '; 811 else $Image = '<img src="'.$this->System->Link('/images/favicons/'.$Icon).'"/> '; 812 //if ($this->System->User->CheckPermission($this->TableToModule($Table), 'Write') or !defined('NEW_PERMISSION')) 813 $Output .= '<li>'.$Image.$LinkTitle.'</li>'; 814 if ($All == false) $Output .= $this->ShowMenuItem($MenuItem['Id']); 815 } 804 816 } 805 817 $Output .= '</ul>'; 806 return ($Output);818 return $Output; 807 819 } 808 820 … … 811 823 $DbResult = $this->Database->query('SELECT (SELECT `Name` FROM `Module` '. 812 824 'WHERE `Module`.`Id`=`Model`.`Module`) AS `Name` FROM `Model` WHERE `Name`="'.$Table.'"'); 813 if ($DbResult->num_rows == 1)825 if ($DbResult->num_rows == 1) 814 826 { 815 827 $DbRow = $DbResult->fetch_assoc(); 816 return ($DbRow['Name']);817 } else return ('');828 return $DbRow['Name']; 829 } else return ''; 818 830 } 819 831 … … 822 834 $Output = '<img alt="'.$Name.'" title="'.$Name.'" src="'. 823 835 $Icon.'"/>'; 824 if ($this->ShowActionName) $Output .= $Name;825 if ($Confirm != '')836 if ($this->ShowActionName) $Output .= $Name; 837 if ($Confirm != '') 826 838 $Confirm = ' onclick="return confirmAction(\''.$Confirm.'\');"'; 827 839 $Output = '<a href="'.$Target.'"'.$Confirm.'>'.$Output.'</a>'; 828 return ($Output);840 return $Output; 829 841 } 830 842 } -
trunk/Modules/Network/Network.php
r870 r871 265 265 'NTP' => array('Type' => 'String', 'Caption' => 'NTP', 'Default' => ''), 266 266 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '', 'Null' => true), 267 'Service' => array('Type' => 'TServiceCustomerRel', 'Caption' => 'Služba', 'Default' => '', 'Null' => true), 267 268 'ExtAddressRange' => array('Type' => 'String', 'Caption' => 'Vnější rozsah adres', 'Default' => ''), 268 269 'ExtMask' => array('Type' => 'String', 'Caption' => 'Vnější prefix', 'Default' => ''),
Note:
See TracChangeset
for help on using the changeset viewer.