Changeset 647 for trunk/Modules/IS/IS.php
- Timestamp:
- Mar 25, 2014, 7:09:47 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/IS/IS.php
r646 r647 74 74 function ShowEdit($Table, $Id) 75 75 { 76 $this->ShortTitle .= ' - Úprava '.$Table; 76 77 $Output = ''; 77 78 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write')) … … 84 85 $Form->SetClass($Table); 85 86 $Form->LoadValuesFromForm(); 87 $this->ShortTitle .= ' - úprava '.$Form->Definition['Title']; 86 88 try { 87 89 $Form->Validate(); … … 111 113 $Form->SetClass($Table); 112 114 $Form->LoadValuesFromDatabase($Id); 115 $this->ShortTitle .= ' - úprava '.$Form->Definition['Title']; 113 116 $Form->OnSubmit = '?a=edit&t='.$Table.'&i='.$_GET['i'].'&o=save'; 114 117 $Output .= $Form->ShowEditForm(); … … 130 133 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write')) 131 134 return('Nemáte oprávnění'); 135 $this->ShortTitle .= ' - odstranění '.$Table; 132 136 $DbResult = $this->Database->select($Table, '*', '`Id`='.$Id); 133 137 if($DbResult->num_rows > 0) … … 160 164 $Form->SetClass($Table); 161 165 $Form->LoadValuesFromForm(); 166 $this->ShortTitle .= ' - přidání '.$Form->Definition['Title']; 162 167 try { 163 168 $Form->Validate(); … … 209 214 $Form = new Form($this->System->FormManager); 210 215 $Form->SetClass($Table); 216 $this->ShortTitle .= ' - přidání '.$Form->Definition['Title']; 211 217 // Load presets from URL 212 218 foreach($_GET as $Key => $Value) … … 252 258 $Form = new Form($this->System->FormManager); 253 259 $Form->SetClass($Table); 260 $this->ShortTitle .= ' - položka '.$Form->Definition['Title']; 254 261 $Form->LoadValuesFromDatabase($Id); 255 262 $Form->OnSubmit = '?a=view'; … … 302 309 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; 303 310 else return($this->SystemMessage('Chyba', 'Tabulka nenalezena')); 311 312 if(array_key_exists('SQL', $FormClass)) 313 $SourceTable = '('.$FormClass['SQL'].') AS `TX`'; 314 else $SourceTable = '`'.$FormClass['Table'].'` AS `TX`'; 304 315 305 316 // Build user filter … … 359 370 360 371 if(!array_key_exists('SQL', $FormItem)) $FormItem['SQL'] = ''; 361 else $FormItem['SQL'] = str_replace('#Id', '` '.$FormClass['Table'].'`.`Id`', $FormItem['SQL']);372 else $FormItem['SQL'] = str_replace('#Id', '`TX`.`Id`', $FormItem['SQL']); 362 373 $Columns[] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterNameQuery', 363 374 array('Value' => $Value, 'Name' => $ItemIndex, … … 366 377 367 378 // Get total item count in database 368 $Query = 'SELECT COUNT(*) FROM `'.$FormClass['Table'].'`';379 $Query = 'SELECT COUNT(*) FROM '.$SourceTable; 369 380 $DbResult = $this->Database->query($Query); 370 381 $DbRow = $DbResult->fetch_assoc(); … … 375 386 if($Filter != '') 376 387 { 377 $Query = 'SELECT COUNT(*) FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '.$Filter;388 $Query = 'SELECT COUNT(*) FROM (SELECT '.$Columns.' FROM '.$SourceTable.') AS `TS` '.$Filter; 378 389 $DbResult = $this->Database->query($Query); 379 390 $DbRow = $DbResult->fetch_row(); … … 410 421 411 422 // Load and show items 412 $Query = 'SELECT * FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '.423 $Query = 'SELECT * FROM (SELECT '.$Columns.' FROM '.$SourceTable.') AS `TS` '. 413 424 $Filter.' '.$Order['SQL'].$PageList['SQLLimit']; 414 425 $VisibleItemCount = 0;
Note:
See TracChangeset
for help on using the changeset viewer.