Changeset 501 for trunk/Modules/IS/IS.php
- Timestamp:
- Mar 10, 2013, 8:15:46 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/IS/IS.php
r498 r501 1 1 <?php 2 2 3 include_once( 'Common/Global.php');3 include_once(dirname(__FILE__).'/../../Common/Global.php'); 4 4 5 5 class PageIS extends Page … … 11 11 function Show() 12 12 { 13 global $FormClasses;14 15 13 if(!$this->System->Modules['User']->CheckPermission('IS', 'Manage')) 16 14 return('Nemáte oprávnění'); … … 55 53 if($_GET['o'] == 'save') 56 54 { 57 $Form = new Form($Table); 55 $Form = new Form($this->System->FormManager); 56 $Form->SetClass($Table); 58 57 $Form->LoadValuesFromForm(); 59 58 $Form->SaveValuesToDatabase($Id); … … 64 63 } else 65 64 { 66 $Form = new Form($Table); 65 $Form = new Form($this->System->FormManager); 66 $Form->SetClass($Table); 67 67 $Form->LoadValuesFromDatabase($Id); 68 68 $Form->OnSubmit = '?a=edit&o=save'; … … 97 97 if($_GET['o'] == 'save') 98 98 { 99 $Form = new Form($Table); 99 $Form = new Form($this->System->FormManager); 100 $Form->SetClass($Table); 100 101 $Form->LoadValuesFromForm(); 101 102 $Form->SaveValuesToDatabase(0); … … 111 112 } else 112 113 { 113 $Form = new Form($Table); 114 $Form = new Form($this->System->FormManager); 115 $Form->SetClass($Table); 114 116 $Form->OnSubmit = '?a=add&o=save'; 115 117 $Output .= $Form->ShowEditForm(); … … 124 126 function ShowView($Table, $Id) 125 127 { 126 global $FormTypes; 127 128 $Form = new Form($Table); 128 $Form = new Form($this->System->FormManager); 129 $Form->SetClass($Table); 129 130 $Form->LoadValuesFromDatabase($Id); 130 131 $Form->OnSubmit = '?a=view'; … … 143 144 // Show ManyToOne relations 144 145 foreach($Form->Definition['Items'] as $Index => $Item) 145 if((array_key_exists($Item['Type'], $FormTypes) and ($FormTypes[$Item['Type']]['Type'] == 'ManyToOne'))) 146 { 147 $Output .= $this->ShowList($FormTypes[$Item['Type']]['Table'], '`'.$FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption']).'<br/>'; 146 if((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and 147 ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne'))) 148 { 149 $Output .= $this->ShowList($this->System->FormManager->FormTypes[$Item['Type']]['Table'], '`'. 150 $this->System->FormManager->FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption']).'<br/>'; 148 151 } 149 152 return($Output); … … 152 155 function ShowList($Table, $Filter = '', $Title = '') 153 156 { 154 global $Type, $FormTypes, $FormClasses; 155 156 if($Table != '') $FormClass = $FormClasses[$Table]; 157 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; 157 158 else return($this->SystemMessage('Chyba', 'Tabulka nenalezena')); 158 159 if($Filter != '') $Filter = ' WHERE '.$Filter; … … 166 167 167 168 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 168 if(!array_key_exists($FormItem['Type'], $FormTypes) or 169 (array_key_exists($FormItem['Type'], $FormTypes) and ($FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 169 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type) or 170 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 171 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 170 172 $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']); 171 173 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); … … 182 184 $Output .= '<tr>'; 183 185 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 184 if(!array_key_exists($FormItem['Type'], $FormTypes) or 185 (array_key_exists($FormItem['Type'], $FormTypes) and ($FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 186 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 187 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 188 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 186 189 { 187 190 //$Output .= '<td>'.$Row[$ItemIndex].'</td>'; 188 191 $UseType = $UseType = $FormItem['Type']; 189 if(array_key_exists($FormItem['Type'], $ FormTypes))192 if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 190 193 { 191 if(!array_key_exists($FormItem['Type'], $this->System-> Type->TypeDefinitionList))192 $this->System-> Type->RegisterType($FormItem['Type'], '',193 $ FormTypes[$FormItem['Type']]);194 if($ FormTypes[$FormItem['Type']]['Type'] == 'Reference')194 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 195 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 196 $this->System->FormManager->FormTypes[$FormItem['Type']]); 197 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 195 198 $UseType = 'OneToMany'; 196 199 else 197 if($ FormTypes[$FormItem['Type']]['Type'] == 'Enumeration')200 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 198 201 $UseType = 'Enumeration'; 199 202 } 200 $Row[$ItemIndex] = $this->System-> Type->ExecuteTypeEvent($UseType, 'OnLoadDb',203 $Row[$ItemIndex] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 201 204 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 202 205 'Type' => $FormItem['Type'])); 203 $Value = $this->System-> Type->ExecuteTypeEvent($UseType, 'OnView',206 $Value = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 204 207 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 205 208 'Type' => $FormItem['Type']));
Note:
See TracChangeset
for help on using the changeset viewer.