Changeset 536
- Timestamp:
- May 18, 2013, 6:51:10 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Database.php
r524 r536 72 72 if(($this->Error != '') and ($this->ShowSQLError == true)) 73 73 echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>'); 74 throw new Exception('SQL Error: </strong>'.$this->Error.', Query: '.$Query);74 throw new Exception('SQL Error: '.$this->Error.', Query: '.$Query); 75 75 } 76 76 return($Result); -
trunk/Common/Form/Form.php
r529 r536 9 9 var $Definition; 10 10 var $Values; 11 var $ValuesFilter; 11 12 var $OnSubmit; 12 13 var $Database; … … 18 19 $this->Definition = array(); 19 20 $this->Values = array(); 21 $this->ValuesFilter = array(); 20 22 $this->OnSubmit = ''; 21 23 } … … 49 51 $Edit = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 50 52 array('Value' => $this->Values[$Index], 'Name' => $Index, 51 'Type' => $Item['Type'], 'Values' => $this->Values)); 53 'Type' => $Item['Type'], 'Values' => $this->Values, 54 'Filter' => $this->ValuesFilter[$Index])); 52 55 if(array_key_exists('Suffix', $Item)) $Edit .= ' '.$Item['Suffix']; 53 56 if(!$this->FormManager->Type->IsHidden($UseType)) … … 116 119 117 120 function LoadValuesFromDatabase($Id) 118 { 119 $DbResult = $this->Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id); 121 { 122 foreach($this->Definition['Items'] as $Index => $Item) 123 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 124 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 125 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 126 { 127 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 128 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 129 { 130 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 131 $this->FormManager->Type->RegisterType($Item['Type'], '', 132 $this->FormManager->FormTypes[$Item['Type']]); 133 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 134 $UseType = 'OneToMany'; 135 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 136 $UseType = 'Enumeration'; 137 } else $UseType = $Item['Type']; 138 $Columns[] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterNameQuery', 139 array('Name' => $Index, 'Type' => $Item['Type'])); 140 } 141 $Columns = implode(',', $Columns); 142 $DbResult = $this->Database->query('SELECT '.$Columns.' FROM `'.$this->Definition['Table'].'` AS `T` WHERE `T`.`Id`='.$Id); 120 143 $DbRow = $DbResult->fetch_array(); 121 144 foreach($this->Definition['Items'] as $Index => $Item) … … 138 161 array('Value' => $DbRow[$Index], 'Name' => $Index, 139 162 'Type' => $Item['Type'], 'Values' => $this->Values)); 163 $this->ValuesFilter[$Index] = $DbRow[$Index.'_Filter']; 140 164 } 141 165 } -
trunk/Common/Form/Types/Base.php
r501 r536 44 44 return(addslashes($Value)); 45 45 } 46 47 function OnFilterName($Item) 48 { 49 return('`'.$Item['Name'].'`'); 50 } 51 52 function OnFilterNameQuery($Item) 53 { 54 return('`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`'); 55 } 46 56 } 47 57 -
trunk/Common/Form/Types/OneToMany.php
r531 r536 12 12 if($Item['Value'] != '') 13 13 { 14 if(array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];14 /*if(array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View']; 15 15 else $Table = $Type['Parameters']['Table']; 16 16 $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name']. 17 ' AS `Name` FROM '.$Table.'WHERE `'.17 ' AS `Name` FROM `'.$Table.'` WHERE `'. 18 18 $Type['Parameters']['Id'].'`='.$Item['Value']); 19 19 $DbRow = $DbResult->fetch_assoc(); 20 20 $Output = '<a href="?t='.$Type['Parameters']['Table'].'&a='. 21 'view'.'&i='.$Item['Value'].'">'.$DbRow['Name'].'</a>'; 22 } else $Output = ''; 21 'view'.'&i='.$Item['Value'].'">'.$DbRow['Name'].'</a>';*/ 22 $Output = '<a href="?t='.$Type['Parameters']['Table'].'&a='. 23 'view'.'&i='.$Item['Value'].'">'.$Item['Filter'].'</a>'; 24 } else $Output = ''; 23 25 return($Output); 24 26 } … … 60 62 else return($Item['Value']); 61 63 } 64 65 function OnFilterName($Item) 66 { 67 return('`'.$Item['Name'].'_Filter`'); 68 } 69 70 function OnFilterNameQuery($Item) 71 { 72 $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']]; 73 //if($Item['Value'] != '') 74 //{ 75 if(array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View']; 76 else $Table = $Type['Parameters']['Table']; 77 $Output = '`'.$Item['Name'].'`, (SELECT '.$Type['Parameters']['Name']. 78 ' AS `Name` FROM `'.$Table.'` WHERE `'. 79 $Type['Parameters']['Id'].'`=`'.$Item['Name'].'`) AS `'.$Item['Name'].'_Filter`'; 80 //} else $Output = '`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`'; 81 return($Output); 82 } 62 83 } 63 84 -
trunk/Common/Global.php
r533 r536 46 46 include_once(dirname(__FILE__).'/../Modules/NetworkConfigLinux/NetworkConfigLinux.php'); 47 47 include_once(dirname(__FILE__).'/../Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php'); 48 include_once(dirname(__FILE__).'/../Modules/TimeMeasure/TimeMeasure.php'); 48 49 49 50 function GlobalInit() … … 109 110 $System->ModuleManager->RegisterModule(new ModuleNetworkConfigRouterOS($System)); 110 111 $System->ModuleManager->RegisterModule(new ModuleNetworkConfigLinux($System)); 112 $System->ModuleManager->RegisterModule(new ModuleTimeMeasure($System)); 111 113 $System->ModuleManager->StartAll(); 112 114 } -
trunk/Common/Version.php
r535 r536 1 1 <?php 2 2 3 $Revision = 53 5; // Subversion revision3 $Revision = 536; // Subversion revision 4 4 $DatabaseRevision = 535; // SQL structure revision 5 $ReleaseTime = '2013-05-1 2';5 $ReleaseTime = '2013-05-18'; 6 6 7 7 ?> -
trunk/FormClasses.php
r533 r536 9 9 Default - výchozí hodnota 10 10 Null - hodnota nemusí být zadána 11 InList - sloupec viditelný v seznamu11 NoInList - sloupec viditelný v seznamu 12 12 Suffix - text za hodnotou 13 13 Description - popis významu položky -
trunk/Modules/FinanceBankAPI/FileImport.php
r524 r536 26 26 var $FullTitle = 'Import plateb přes API'; 27 27 var $ShortTitle = 'Import plateb přes API'; 28 var $ParentClass = 'PageFinance'; 28 29 29 30 function Show() 30 31 { 32 $Output = ''; 31 33 if(!$this->System->User->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění'); 32 34 33 $DbResult = $this->Database->select('FinanceBankAccount', '*', 'Id='.$_GET['i d']);35 $DbResult = $this->Database->select('FinanceBankAccount', '*', 'Id='.$_GET['i']); 34 36 $BankAccount = $DbResult->fetch_assoc(); 35 37 … … 41 43 else if($Bank['Code'] == '0300') $Import = new ImportPS($this->Database); 42 44 else $Output = $this->SystemMessage('Nepodporované API', 'Pro zvolenou banku není import podporován'); 43 $Import->BankAccountId = $BankAccount['Id']; 44 $Output .= $Import->Import(); 45 45 if(isset($Import)) 46 { 47 $Import->BankAccountId = $BankAccount['Id']; 48 $Output .= $Import->Import(); 49 } 46 50 return($Output); 47 51 } … … 52 56 var $FullTitle = 'Import plateb ze souboru'; 53 57 var $ShortTitle = 'Import plateb ze souboru'; 54 58 var $ParentClass = 'PageFinance'; 59 55 60 function Show() 56 61 { -
trunk/Modules/FinanceBankAPI/FioAPI.php
r500 r536 20 20 21 21 // URL format: https://www.fio.cz/ib_api/rest/periods/{token}/{datum od}/{datum do}/transactions.{format} 22 echo('1'); 22 23 $fp = fsockopen('ssl://www.fio.cz', 443, $errno, $errstr, 30); 24 echo('2'); 23 25 if(!$fp) 24 26 { … … 37 39 38 40 // Read response 41 echo('3'); 39 42 $Response = array(); 40 43 while(!feof($fp)) 41 44 $Response .= trim(fgets($fp, 1024))."\n"; 42 45 fclose($fp); 46 echo('4'); 43 47 $Response = iconv('windows-1250', $this->Encoding, $Response); 44 48 $Response = explode("\n", $Response); … … 54 58 foreach($Response as $Index => $Line) 55 59 { 56 60 if(($Index == 0) and (substr($Line, 0, strlen(GPC_TYPE_REPORT)) != GPC_TYPE_REPORT)) $this->NoValidDataError($Response); 57 61 $GPCLine = $GPC->ParseLine($Line); 58 62 if($GPCLine != NULL) $Result[] = $GPCLine; … … 66 70 // Try to get error message 67 71 // If something go wrong fio show HTML login page and display error message 68 72 $Response = implode('', $Response); 69 73 $ErrorMessageStart = '<div id="oldform_warning">'; 70 74 if(strpos($Response, $ErrorMessageStart) !== false) 71 72 73 74 75 75 { 76 $Response = substr($Response, strpos($Response, $ErrorMessageStart) + strlen($ErrorMessageStart)); 77 $ErrorMessage = trim(substr($Response, 0, strpos($Response, '</div>'))); 78 } else $ErrorMessage = ''; 79 throw new Exception('No valid GPC data: '.$ErrorMessage); 76 80 } 77 81 } -
trunk/Modules/IS/IS.php
r533 r536 9 9 var $ParentClass = 'PagePortal'; 10 10 var $MenuItems = array(); 11 var $MenuItemsLoaded = false; 11 12 var $HideMenu = false; 12 13 … … 88 89 $Output .= $Form->ShowEditForm(); 89 90 $Output .= '<ul class="ActionMenu">'; 90 $Output .= '<li><a href="?a=view&t='.$Table.' "><img alt="Prohlížet" title="Prohlížet" src="'.91 $Output .= '<li><a href="?a=view&t='.$Table.'&i='.$Id.'"><img alt="Prohlížet" title="Prohlížet" src="'. 91 92 $this->System->Link('/images/view.png').'"/>Prohlížet</a></li>'; 92 93 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. … … 178 179 } 179 180 180 function ShowSelect($Table, $Filter = '', $Title = '') 181 { 182 $this->BasicHTML = true; 183 $this->HideMenu = true; 181 function ShowTable($Table, $Filter = '', $Title = '', $RowActions = array()) 182 { 184 183 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; 185 184 else return($this->SystemMessage('Chyba', 'Tabulka nenalezena')); 186 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `'.$FormClass['Table'].'`'.$Filter); 187 $DbRow = $DbResult->fetch_row(); 188 $PageList = GetPageList($DbRow[0]); 189 190 $Output = '<script type="text/javascript"> 191 function set_return(id, obj) 192 { 193 window.opener.document.getElementById(obj).value = id; 194 } 195 </script>'; 196 $Output .= '<div style="text-align: center;">'.$FormClass['Title'].'</div>'; 185 186 // Build user filter 187 $UserFilter = ''; 188 $Columns = array('Id' => '`Id`'); 189 if(array_key_exists('filter', $_GET) and ($_GET['filter'] == 1)) 190 { 191 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 192 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 193 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 194 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 195 { 196 $UseType = $UseType = $FormItem['Type']; 197 if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 198 { 199 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 200 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 201 $this->System->FormManager->FormTypes[$FormItem['Type']]); 202 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 203 $UseType = 'OneToMany'; 204 else 205 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 206 $UseType = 'Enumeration'; 207 } 208 $FilterName = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterName', 209 array('Name' => $ItemIndex, 'Type' => $FormItem['Type'])); 210 if(array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 211 $UserFilter .= ' AND ('.$FilterName.' LIKE "%'.$_POST['Filter'.$ItemIndex].'%")'; 212 } 213 } 214 if(($Filter == '') and ($UserFilter != '')) $Filter = '1 '.$UserFilter; 215 if($Filter != '') $Filter = ' WHERE '.$Filter; 216 217 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 218 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 219 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 220 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 221 { 222 $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']); 223 $UseType = $UseType = $FormItem['Type']; 224 if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 225 { 226 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 227 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 228 $this->System->FormManager->FormTypes[$FormItem['Type']]); 229 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 230 $UseType = 'OneToMany'; 231 else 232 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 233 $UseType = 'Enumeration'; 234 } 235 if(array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 236 $Value = $_POST['Filter'.$ItemIndex]; 237 else $Value = ''; 238 if($ItemIndex == 'Id') unset($Columns['Id']); 239 $Columns[] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterNameQuery', 240 array('Value' => $Value, 'Name' => $ItemIndex, 241 'Type' => $FormItem['Type'])); 242 } 243 244 // Get total item count in database 245 $Query = 'SELECT COUNT(*) FROM `'.$FormClass['Table'].'`'; 246 $DbResult = $this->Database->query($Query); 247 $DbRow = $DbResult->fetch_assoc(); 248 $TotalCount = $DbRow['COUNT(*)']; 249 250 // Get total filtered item count in database 251 $Columns = implode(',', $Columns); 252 if($UserFilter != '') 253 { 254 $Query = 'SELECT COUNT(*) FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '.$Filter; 255 $DbResult = $this->Database->query($Query); 256 $DbRow = $DbResult->fetch_row(); 257 $TotalFilteredCount = $DbRow[0]; 258 } else $TotalFilteredCount = $TotalCount; 259 $PageList = GetPageList($TotalFilteredCount); 260 261 $Output = '<div style="text-align: center;">'.$FormClass['Title'].'</div>'; 197 262 $Output .= $PageList['Output']; 198 263 $Output .= '<table class="WideTable" style="font-size: small;">'; 199 264 200 foreach($FormClass['Items'] as $ItemIndex => $FormItem)201 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or202 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and203 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))204 {205 $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']);206 }207 265 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 208 266 if(!array_key_exists('DefaultSortColumn', $FormClass)) … … 212 270 213 271 // Show search fields 214 $UserFilter = ''; 215 if(array_key_exists('filter', $_GET) and ($_GET['filter'] == 1)) 216 { 217 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 218 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 219 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 220 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 221 { 222 if(array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 223 $UserFilter .= ' AND (`'.$ItemIndex.'` LIKE "%'.$_POST['Filter'.$ItemIndex].'%")'; 224 } 225 } 226 $Output .= '<tr><form action="?a=select&t='.$Table.'&r='.$_GET['r'].'&filter=1" method="post">'; 272 $Output .= '<tr><form action="?a=list&t='.$Table.'&filter=1" method="post">'; 227 273 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 228 274 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or … … 236 282 } 237 283 $Output .= '<td><input type="Submit" value="Hledat"/></td></form></tr>'; 238 239 if(($Filter == '') and ($UserFilter != '')) $Filter = '1 '.$UserFilter; 240 if($Filter != '') $Filter = ' WHERE '.$Filter; 241 $Query = 'SELECT * FROM `'.$FormClass['Table'].'`'.$Filter.' '.$Order['SQL'].$PageList['SQLLimit']; 242 284 285 // Load and show items 286 $Query = 'SELECT * FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '.$Filter.' '.$Order['SQL'].$PageList['SQLLimit']; 287 $VisibleItemCount = 0; 243 288 $DbResult = $this->Database->query($Query); 244 289 while($Row = $DbResult->fetch_assoc()) … … 268 313 $Value = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 269 314 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 270 'Type' => $FormItem['Type'] ));315 'Type' => $FormItem['Type'], 'Filter' => $Row[$ItemIndex.'_Filter'])); 271 316 if($Value == '') $Value = ' '; 272 317 $Output .= '<td>'.$Value.'</td>'; 273 318 } 274 $Output .= '<td><a href="javascript:window.close();" onclick="set_return('.$Row['Id'].',"'.$_GET['r'].'");"><img alt="Vybrat" title="Vybrat" src="'. 275 $this->System->Link('/images/select.png').'"/></a>'; 276 $Output .= '</td></tr>'; 277 } 278 $Output .= '</table>'; 279 $Output .= $PageList['Output']; 280 return($Output); 281 } 282 283 function ShowList($Table, $Filter = '', $Title = '') 284 { 285 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; 286 else return($this->SystemMessage('Chyba', 'Tabulka nenalezena')); 287 288 // Build user filter 289 $UserFilter = ''; 290 if(array_key_exists('filter', $_GET) and ($_GET['filter'] == 1)) 291 { 292 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 293 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 294 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 295 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 296 { 297 if(array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 298 $UserFilter .= ' AND (`'.$ItemIndex.'` LIKE "%'.$_POST['Filter'.$ItemIndex].'%")'; 299 } 300 } 301 if(($Filter == '') and ($UserFilter != '')) $Filter = '1 '.$UserFilter; 302 if($Filter != '') $Filter = ' WHERE '.$Filter; 303 304 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `'.$FormClass['Table'].'`'.$Filter); 305 $DbRow = $DbResult->fetch_row(); 306 $PageList = GetPageList($DbRow[0]); 307 308 $Output = '<div style="text-align: center;">'.$FormClass['Title'].'</div>'; 309 $Output .= $PageList['Output']; 310 $Output .= '<table class="WideTable" style="font-size: small;">'; 311 312 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 313 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 314 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 315 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 316 { 317 $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']); 318 } 319 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 320 if(!array_key_exists('DefaultSortColumn', $FormClass)) 321 $FormClass['DefaultSortColumn'] = 'Id'; 322 $Order = GetOrderTableHeader($TableColumns, $FormClass['DefaultSortColumn'], 0); 323 $Output .= $Order['Output']; 324 325 // Show search fields 326 $Output .= '<tr><form action="?a=list&t='.$Table.'&filter=1" method="post">'; 327 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 328 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 329 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 330 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 331 { 332 if(array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 333 $Value = $_POST['Filter'.$ItemIndex]; 334 else $Value = ''; 335 $Output .= '<td><input type="text" name="Filter'.$ItemIndex.'" value="'.$Value.'" style="width: 100%"/></td>'; 336 } 337 $Output .= '<td><input type="Submit" value="Hledat"/></td></form></tr>'; 338 339 // Get total item count in database 340 $Query = 'SELECT COUNT(*) FROM `'.$FormClass['Table'].'`'; 341 $DbResult = $this->Database->query($Query); 342 $DbRow = $DbResult->fetch_assoc(); 343 $TotalCount = $DbRow['COUNT(*)']; 344 345 // Get total filtered item count in database 346 if($UserFilter != '') 347 { 348 $Query = 'SELECT COUNT(*) FROM `'.$FormClass['Table'].'`'.$Filter; 349 $DbResult = $this->Database->query($Query); 350 $DbRow = $DbResult->fetch_assoc(); 351 $TotalFilteredCount = $DbRow['COUNT(*)']; 352 } 353 354 // Load and show items 355 $Query = 'SELECT * FROM `'.$FormClass['Table'].'`'.$Filter.' '.$Order['SQL'].$PageList['SQLLimit']; 356 $VisibleItemCount = 0; 357 $DbResult = $this->Database->query($Query); 358 while($Row = $DbResult->fetch_assoc()) 359 { 360 $Output .= '<tr>'; 361 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 362 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 363 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 364 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 365 { 366 //$Output .= '<td>'.$Row[$ItemIndex].'</td>'; 367 $UseType = $UseType = $FormItem['Type']; 368 if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 369 { 370 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 371 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 372 $this->System->FormManager->FormTypes[$FormItem['Type']]); 373 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 374 $UseType = 'OneToMany'; 375 else 376 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 377 $UseType = 'Enumeration'; 378 } 379 $Row[$ItemIndex] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 380 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 381 'Type' => $FormItem['Type'])); 382 $Value = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 383 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 384 'Type' => $FormItem['Type'])); 385 if($Value == '') $Value = ' '; 386 $Output .= '<td>'.$Value.'</td>'; 387 } 388 $Output .= '<td><a href="?a=view&t='.$Table.'&i='.$Row['Id'].'"><img alt="Ukázat" title="Ukázat" src="'. 389 $this->System->Link('/images/view.png').'"/></a>'. 390 '<a href="?a=edit&t='.$Table.'&i='.$Row['Id'].'"><img alt="Upravit" title="Upravit" src="'. 391 $this->System->Link('/images/edit.png').'"/></a>'. 392 '<a href="?a=delete&t='.$Table.'&i='.$Row['Id'].'"><img alt="Smazat" title="Smazat" src="'. 393 $this->System->Link('/images/delete.png').'" onclick="return confirmAction(\'Opravdu smazat položku?\');"/></a>'; 394 if(array_key_exists('ItemActions', $FormClass)) 395 { 396 foreach($FormClass['ItemActions'] as $Action) 397 $Output .= '<a href="'.$this->System->Link($Action['URL']).'&i='.$Row['Id'].'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'. 398 $this->System->Link('/images/action.png').'"/></a>'; 399 } 400 $Output .= '</td></tr>'; 319 $Output .= '<td>'.str_replace('#RowId', $Row['Id'], $RowActions).'</td></tr>'; 401 320 $VisibleItemCount = $VisibleItemCount + 1; 402 321 } … … 406 325 $Output .= '</table>'; 407 326 $Output .= $PageList['Output']; 327 return($Output); 328 } 329 330 function ShowSelect($Table, $Filter = '', $Title = '') 331 { 332 $this->BasicHTML = true; 333 $this->HideMenu = true; 334 $RowActions = '<a href="javascript:window.close();" onclick="set_return(#RowId,"'.$_GET['r'].'");"><img alt="Vybrat" title="Vybrat" src="'. 335 $this->System->Link('/images/select.png').'"/></a>'; 336 $Output = $this->ShowTable($Table, $Filter, $Title, $RowActions); 337 return($Output); 338 } 339 340 function ShowList($Table, $Filter = '', $Title = '') 341 { 342 $RowActions = '<a href="?a=view&t='.$Table.'&i=#RowId"><img alt="Ukázat" title="Ukázat" src="'. 343 $this->System->Link('/images/view.png').'"/></a>'. 344 '<a href="?a=edit&t='.$Table.'&i=#RowId"><img alt="Upravit" title="Upravit" src="'. 345 $this->System->Link('/images/edit.png').'"/></a>'. 346 '<a href="?a=delete&t='.$Table.'&i=#RowId"><img alt="Smazat" title="Smazat" src="'. 347 $this->System->Link('/images/delete.png').'" onclick="return confirmAction(\'Opravdu smazat položku?\');"/></a>'; 348 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; 349 else return($this->SystemMessage('Chyba', 'Tabulka nenalezena')); 350 if(array_key_exists('ItemActions', $FormClass)) 351 { 352 foreach($FormClass['ItemActions'] as $Action) 353 $RowActions .= '<a href="'.$this->System->Link($Action['URL']).'&i=#RowId"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'. 354 $this->System->Link('/images/action.png').'"/></a>'; 355 } 356 $Output = $this->ShowTable($Table, $Filter, $Title, $RowActions); 408 357 $Output .= '<ul class="ActionMenu">'; 409 358 $Output .= '<li><a href="?a=add&t='.$Table.'"><img alt="Přidat" title="Přidat" src="'. … … 418 367 } 419 368 $Output .= '</ul>'; 420 return($Output); 369 return($Output); 421 370 } 422 371 423 372 function ShowMenuItem($Parent) 424 373 { 425 $DbResult = $this->Database->query('SELECT `MenuItem`.`Id`, `MenuItem`.`Name`, `MenuItem`.`Parent`, `Action`.`URL` AS `URL`, `ActionIcon`.`Name` AS `IconName` FROM `MenuItem` '. 426 'LEFT JOIN `Action` ON `Action`.`Id` = `MenuItem`.`Action` '. 427 'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '. 428 'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`'); 429 while($DbRow = $DbResult->fetch_assoc()) 430 { 431 $this->MenuItems[$DbRow['Id']] = $DbRow; 374 if($this->MenuItemsLoaded == false) 375 { 376 $DbResult = $this->Database->query('SELECT `MenuItem`.`Id`, `MenuItem`.`Name`, `MenuItem`.`Parent`, `Action`.`URL` AS `URL`, `ActionIcon`.`Name` AS `IconName` FROM `MenuItem` '. 377 'LEFT JOIN `Action` ON `Action`.`Id` = `MenuItem`.`Action` '. 378 'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '. 379 'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`'); 380 while($DbRow = $DbResult->fetch_assoc()) 381 { 382 $this->MenuItems[$DbRow['Id']] = $DbRow; 383 } 384 $this->MenuItemsLoaded = true; 432 385 } 433 386 -
trunk/Modules/News/NewsPage.php
r533 r536 104 104 { 105 105 // Process uploaded file 106 // TODO: Make upload using general File class 106 107 $EnclosureFileNames = array('enclosure1', 'enclosure2', 'enclosure3'); 107 108 $Enclosures = ''; … … 193 194 if($this->System->User->User['Id'] == $Row['User']) 194 195 { 196 // TODO: Make upload using general File class 195 197 if($Row['Enclosure'] != '') 196 198 { -
trunk/ToDo.txt
r534 r536 2 2 ====== 3 3 4 - Čtení dat z meteostanice 5 - Automatický import plateb z Fio banky 4 - Meteostation: Čtení dat z meteostanice 5 - FinanceImportFio: Automatický import plateb z Fio banky 6 - Finance: umožnit uzavření účetního roku 6 7 - Automatické blokování internetu při vyčerpání kreditu 7 - Modul pro správu VPS hostingu8 - Osamostatnit web jídelny9 - Funkce pro rozesílání hromadných emailů10 - Převést frontu mailů na samostatný modul8 - ServiceVPS: Modul pro správu VPS hostingu 9 - Meals: Osamostatnit web jídelny 10 - Mail: Funkce pro rozesílání hromadných emailů 11 - Mail: Převést frontu mailů na samostatný modul 11 12 - Podpora pro inventůru 12 - Podpora IPv6 13 - Evidovat IP adresy v samostatné tabulce. 13 - Network: Podpora IPv6 14 14 - Fulltextové vyhledávání v obsahu 15 - Automatické zálohování nastavení z routerů 16 - Vytvořit solidní speedtest se záznamem měření 15 - SpeedTest: Vytvořit solidní speedtest se záznamem měření 17 16 - Přepracovat na modulární systém. 18 17 * Volitelná instalace modulů 19 18 * Každý modul si řeší aktualizace databáze a perzistenci 20 19 * Umožnit dědičnost modelů (tabulek) 20 * Moduly si při instalaci registrují: 21 # datové struktury 22 # datové položky. 23 # položky globálního nastavení 24 # akce 25 # soubory, ikony 26 - IS: 21 27 * Obecný export/import dat 22 28 * Nastavení oprávnění uživatelů … … 24 30 * Oblíbené položky nabídky uživatelů 25 31 * Předvolené sestavy filtrů, řazení, pořadí sloupců 26 - Udělat fond IP adres, zobrazit jejich užití, umožnit automatické přiřazení volných 27 - Vytvořit třídy pro práci s Mikrotik RouterOS API 28 - Automatické zasílání SMS informací 29 - Vytvořit modul pro záznam a vykreslování časových grafů 30 - V modulu News předělat přílohy na odkazy do tabulky File 31 - Opravit v automaticky generovaných aktualitách zapisování uživatele automatu 32 - Přidat podporu pro překlad do jiných jazyků (angličtiny) 32 - Network: Udělat fond IP adres, zobrazit jejich užití, umožnit automatické přiřazení volných 33 - Network: Vytvořit třídy pro práci s Mikrotik RouterOS API 34 - Network: Automatické zálohování nastavení z routerů 35 - TrafficFlow: Přidat prohlížeč záznamu spojení 36 - SMS: Automatické zasílání SMS informací 37 - Chart: Vytvořit modul pro záznam a vykreslování časových grafů 38 - News: Předělat přílohy na odkazy do tabulky File 39 - News: Opravit v automaticky generovaných aktualitách zapisování uživatele automatu 40 - System: Přidat podporu pro překlad do jiných jazyků (angličtiny) 41 - User: Řešit nějak lépe obecně systém oprávnění. 33 42 34 43 ==Pro zveřejnění přepracovat== 35 - chybějící kontrola oprávnění pro stahování souborů 44 - chybějící kontrola oprávnění pro stahování souborů. 36 45 - anti-bot kontrolu pro registrace 37 46 - u modulů jako tv, networkshare podporu pro volitelné lokální položky. Nebo přidat novou skupinu oprávnění místní uživatelé. -
trunk/style/new/global.js
r529 r536 51 51 var left = (screen.width / 2) - (w / 2); 52 52 var top = (screen.height / 2) - (h / 2); 53 return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars= no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);53 return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); 54 54 } 55 56 function set_return(id, obj) 57 { 58 window.opener.document.getElementById(obj).value = id; 59 } -
trunk/temp/Bills.php
r486 r536 1 1 <?php 2 3 die(); 2 4 3 5 include('../Common/Global.php'); … … 37 39 { 38 40 $System->Database->insert('FinanceInvoiceItem', array('FinanceInvoice' => $Invoice['Id'], 39 'Price' => ));41 'Price' => 0)); 40 42 } 41 43 echo($Invoice['Text'].' '.$Bill['Id'].'<br>');
Note:
See TracChangeset
for help on using the changeset viewer.