Changeset 738 for trunk/Modules/IS/IS.php
- Timestamp:
- Apr 14, 2015, 10:20:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/IS/IS.php
r736 r738 32 32 if(array_key_exists('t', $_GET)) $Table = $_GET['t']; 33 33 else $Table = ''; 34 // i - index of item 34 // i - index of item 35 35 if(array_key_exists('i', $_GET)) $ItemId = $_GET['i']; 36 36 else $ItemId = 0; 37 // fc - preset colum 37 // fc - preset colum 38 38 if(array_key_exists('fn', $_GET)) $FilterName = $_GET['fn']; 39 39 else $FilterName = ''; … … 46 46 47 47 if($Action == 'list') { 48 49 48 if($FilterName == '') $Content = $this->ShowList($Table); 49 else $Content = $this->ShowList($Table, '', '', $FilterName, $FilterValue); 50 50 } 51 51 else if($Action == 'select') $Content = $this->ShowSelect($Table); … … 84 84 $DbRow = $DbResult->fetch_row(); 85 85 $Output .= 'Nedokončených úkolů: '.$DbRow['0'].'<br/>'; 86 86 87 87 $DbResult = $this->Database->select('Member', 'COUNT(*)', '1'); 88 88 $DbRow = $DbResult->fetch_row(); 89 89 $Output .= 'Zákazníků: '.$DbRow['0'].'<br/>'; 90 90 91 91 $DbResult = $this->Database->select('Subject', 'COUNT(*)', '1'); 92 92 $DbRow = $DbResult->fetch_row(); 93 93 $Output .= 'Subjektů: '.$DbRow['0'].'<br/>'; 94 94 95 95 $DbResult = $this->Database->select('User', 'COUNT(*)', '1'); 96 96 $DbRow = $DbResult->fetch_row(); 97 97 $Output .= 'Uživatelů: '.$DbRow['0'].'<br/>'; 98 98 99 99 $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '1'); 100 100 $DbRow = $DbResult->fetch_row(); 101 101 $Output .= 'Registrovaných zařízení: '.$DbRow['0'].'<br/>'; 102 102 103 103 $DbResult = $this->Database->select('FinanceOperation', 'SUM(`Value` * `Direction`)', '1'); 104 104 $DbRow = $DbResult->fetch_row(); 105 105 $Output .= 'Stav placení: '.$DbRow['0'].'<br/>'; 106 106 107 107 $DbResult = $this->Database->select('FinanceBankImport', 'COUNT(*)', '`FinanceOperation` IS NULL'); 108 108 $DbRow = $DbResult->fetch_row(); … … 142 142 function LogChange($Form, $Action, $NewId, $OldId) 143 143 { 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 144 $Values = $Form->Definition['Table'].' (Id: '.$OldId.' => '.$NewId.'):'."\n"; 145 // Compare old values loaded from database with new values in Form variable 146 $NewValues = $Form->Values; 147 if($OldId != 0) 148 { 149 $FormOld = new Form($this->System->FormManager); 150 $FormOld->SetClass($Form->Definition['Table']); 151 $FormOld->LoadValuesFromDatabase($OldId); 152 $OldValues = $FormOld->Values; 153 // Keep only changes values 154 foreach($NewValues as $Index => $Value) 155 { 156 if($OldValues[$Index] != $NewValues[$Index]) 157 { 158 $Values .= $Index.': '.$FormOld->GetValue($Index); 159 if($NewId != 0) $Values .= ' => '.$Form->GetValue($Index); 160 $Values .= "\n"; 161 } 162 } 163 } else { 164 foreach($NewValues as $Index => $Value) 165 { 166 $Values .= $Index.': '.$Form->GetValue($Index)."\n"; 167 } 168 } 169 $this->System->ModuleManager->Modules['Log']->NewRecord('IS', $Action, $Values); 170 170 } 171 171 … … 179 179 if($_GET['o'] == 'save') 180 180 { 181 if(!array_key_exists('submit', $_POST))182 181 if(!array_key_exists('submit', $_POST)) 182 return($this->SystemMessage('Formulář', 'Formulář nebyl řádně odeslán. Vraťte se zpět a odešlete formulář znovu.')); 183 183 $Form = new Form($this->System->FormManager); 184 184 $Form->SetClass($Table); … … 193 193 } catch (Exception $E) 194 194 { 195 195 $Output .= $this->SystemMessage('Úprava položky', 'Položku se nepodařilo uložit. Opravte problém a opakujte akci.<br/>'.$E->getMessage()); 196 196 $Form->OnSubmit = '?a=edit&t='.$Table.'&i='.$_GET['i'].'&o=save'; 197 197 $Output .= $Form->ShowEditForm(); … … 230 230 $Output = ''; 231 231 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write')) 232 return('Nemáte oprávnění'); 232 return('Nemáte oprávnění'); 233 233 $DbResult = $this->Database->select($Table, '*', '`Id`='.$Id); 234 234 if($DbResult->num_rows > 0) 235 235 { 236 237 236 $DbRow = $DbResult->fetch_assoc(); 237 try { 238 238 $Form = new Form($this->System->FormManager); 239 239 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' odstranění'; … … 244 244 } catch (Exception $E) 245 245 { 246 246 $Output .= $this->SystemMessage('Smazání položky', 'Položku se nepodařilo smazat. Pravděpodobně na ni závisejí další položky.'); 247 247 } 248 248 } else $Output .= $this->SystemMessage('Smazání položky', 'Položka nenalezena'); … … 301 301 } catch (Exception $E) 302 302 { 303 304 303 $Output .= $this->SystemMessage('Přidání položky', 'Položku se nepodařilo přidat. Opravte problém a opakujte akci.<br/>'.$E->getMessage()); 304 $Form->OnSubmit = '?a=add&t='.$Table.'&o=save'; 305 305 $Output .= $Form->ShowEditForm(); 306 306 $Actions[] = '<a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. … … 353 353 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read')) 354 354 return('Nemáte oprávnění'); 355 355 356 356 $FormClass = $this->System->FormManager->Classes[$Table]; 357 357 if(array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable']; 358 358 else $TableModify = $Table; 359 359 360 360 $Form = new Form($this->System->FormManager); 361 361 $Form->SetClass($Table); … … 407 407 function ShowTable($Table, $Filter = '', $Title = '', $RowActions = array(), $ExcludeColumn = '') 408 408 { 409 409 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; 410 410 else return($this->SystemMessage('Chyba', 'Tabulka nenalezena')); 411 411 … … 416 416 // Build form type filter 417 417 $TypeFilter = ''; 418 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 418 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 419 419 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 420 420 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and … … 422 422 if(array_key_exists('Filter', $FormItem) and ($FormItem['Filter'] == true)) 423 423 { 424 if($TypeFilter != '') $TypeFilter .= ' AND ';425 426 } 424 if($TypeFilter != '') $TypeFilter .= ' AND '; 425 $TypeFilter .= '('.$ItemIndex.' = "'.$FormItem['Default'].'")'; 426 } 427 427 if($TypeFilter != '') 428 428 { 429 430 431 } 432 429 if($Filter != '') $Filter = ' AND'; 430 $Filter .= ' '.$TypeFilter; 431 } 432 433 433 // Build user filter 434 434 $UserFilter = ''; … … 470 470 if($Filter != '') $Filter = ' HAVING '.$Filter; 471 471 472 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 472 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 473 473 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 474 474 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 475 475 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 476 476 { 477 478 477 if($ExcludeColumn != $ItemIndex) 478 if(!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false)) 479 479 $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']); 480 480 $UseType = $UseType = $FormItem['Type']; … … 563 563 ($ExcludeColumn != $ItemIndex)) 564 564 { 565 565 //$Output .= '<td>'.$Row[$ItemIndex].'</td>'; 566 566 $UseType = $UseType = $FormItem['Type']; 567 567 if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) … … 632 632 if(array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable']; 633 633 else $TableModify = $Table; 634 634 635 635 $RowActions = '<a href="?a=view&t='.$Table.'&i=#RowId"><img alt="Ukázat" title="Ukázat" src="'. 636 636 $this->System->Link('/images/view.png').'"/></a>'. … … 755 755 $Confirm = ' onclick="return confirmAction(\''.$Confirm.'\');"'; 756 756 $Output = '<a href="'.$Target.'"'.$Confirm.'>'.$Output.'</a>'; 757 757 return($Output); 758 758 } 759 759 }
Note:
See TracChangeset
for help on using the changeset viewer.