source: trunk/Modules/IS/IS.php@ 888

Last change on this file since 888 was 888, checked in by chronos, 5 years ago
  • Modified: More static types added.
File size: 40.8 KB
Line 
1<?php
2
3include_once(dirname(__FILE__).'/../../Common/Global.php');
4
5class PageIS extends Page
6{
7 public array $MenuItems;
8 public bool $HideMenu;
9 public bool $ShowActionName;
10
11 function __construct($System)
12 {
13 parent::__construct($System);
14 $this->FullTitle = 'Správa dat';
15 $this->ShortTitle = 'Správa dat';
16 $this->ParentClass = 'PagePortal';
17
18 $this->MenuItems = array();
19 $this->HideMenu = false;
20 $this->ShowActionName = false;
21 }
22
23 function Show(): string
24 {
25 if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('IS', 'Manage'))
26 return 'Nemáte oprávnění';
27 $this->System->FormManager->ShowRelation = true;
28
29 // a - action
30 if (array_key_exists('a', $_GET)) $Action = $_GET['a'];
31 else $Action = '';
32 // t - table
33 if (array_key_exists('t', $_GET)) $Table = $_GET['t'];
34 else $Table = '';
35 // i - index of item
36 if (array_key_exists('i', $_GET)) $ItemId = $_GET['i'];
37 else $ItemId = 0;
38 // fc - preset colum
39 if (array_key_exists('fn', $_GET)) $FilterName = $_GET['fn'];
40 else $FilterName = '';
41 if (array_key_exists('fv', $_GET)) $FilterValue = $_GET['fv'];
42 else $FilterValue = '';
43 if (array_key_exists('menutype', $_COOKIE)) $MenuType = $_COOKIE['menutype'];
44 else $MenuType = 0;
45 if (array_key_exists('menutype', $_GET)) $MenuType = $_GET['menutype'] * 1;
46 setcookie('menutype', $MenuType, time() + 60 * 60 * 24 * 365);
47
48 if ($Action == 'list') {
49 if ($FilterName == '') $Content = $this->ShowList($Table);
50 else $Content = $this->ShowList($Table, '', '', $FilterName, $FilterValue);
51 }
52 else if ($Action == 'select') $Content = $this->ShowSelect($Table);
53 else if ($Action == 'mapselect') $Content = $this->ShowMapSelect($Table);
54 else if ($Action == 'edit') $Content = $this->ShowEdit($Table, $ItemId);
55 else if ($Action == 'add') $Content = $this->ShowAdd($Table);
56 else if ($Action == 'addsub') $Content = $this->ShowAddSub($Table);
57 else if ($Action == 'view') $Content = $this->ShowView($Table, $ItemId);
58 else if ($Action == 'delete') $Content = $this->ShowDelete($Table, $ItemId);
59 else if ($Action == 'fav_add') $Content = $this->ShowFavoriteAdd($Table, $ItemId);
60 else if ($Action == 'fav_del') $Content = $this->ShowFavoriteDel($Table, $ItemId);
61 else $Content = $this->Dashboard();
62 if ($this->HideMenu == false)
63 {
64 $Output = '<table style="width: 100%"><tr><td style="width: 20%; vertical-align: top;">';
65 $MenuTypeText = '<a href="?menutype=0">Nabídka</a>';
66 if ($MenuType == 0) $MenuTypeText = '<strong>'.$MenuTypeText.'</strong>';
67 $Output .= $MenuTypeText.' ';
68 $MenuTypeText = '<a href="?menutype=1">Oblíbené</a>';
69 if ($MenuType == 1) $MenuTypeText = '<strong>'.$MenuTypeText.'</strong>';
70 $Output .= $MenuTypeText.' ';
71 if ($MenuType == 0) $Output .= $this->ShowMenu();
72 if ($MenuType == 1) $Output .= $this->ShowFavorites();
73 $Output .= '</td><td style="width: 80%; vertical-align: top;">';
74 $Output .= $Content;
75 $Output .= '</td></tr></table>';
76 } else $Output = $Content;
77
78 return $Output;
79 }
80
81 function Dashboard(): string
82 {
83 $Output = '<strong>Nástěnka:</strong><br/>';
84 foreach (ModuleIS::Cast($this->System->GetModule('IS'))->DashboardItems as $Item)
85 {
86 if (is_string($Item['Callback'][0]))
87 {
88 $Class = new $Item['Callback'][0]($this->System);
89 $Method = $Item['Callback'][1];
90 $Output .= $Class->$Method();
91 } else $Output .= call_user_func($Item['Callback']);
92 }
93 return $Output;
94 }
95
96 function ShowFavoriteAdd(string $Table, string $ItemId): string
97 {
98 $DbResult = $this->Database->select('MenuItemFavorite', 'Id', '(`MenuItem`='.($_GET['i'] * 1).') AND (`User`='.$this->ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'].')');
99 if ($DbResult->num_rows > 0)
100 {
101 $Output = $this->SystemMessage('Oblíbené', 'Již existuje v oblíbených');
102 } else
103 {
104 $this->Database->insert('MenuItemFavorite', array('MenuItem' => ($_GET['i'] * 1), 'User' => ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id']));
105 $Output = $this->SystemMessage('Oblíbené', 'Přidáno do oblíbených');
106 }
107 $Output .= $this->ShowList($Table);
108 return $Output;
109 }
110
111 function ShowFavoriteDel(string $Table, string $ItemId): string
112 {
113 $DbResult = $this->Database->select('MenuItemFavorite', 'Id', '(`MenuItem`='.($_GET['i'] * 1).') AND (`User`='.ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'].')');
114 if ($DbResult->num_rows > 0)
115 {
116 $DbRow = $DbResult->fetch_assoc();
117 $this->Database->delete('MenuItemFavorite', '`Id`= '.$DbRow['Id']);
118 $Output = $this->SystemMessage('Oblíbené', 'Odstraněno z oblíbených');
119 } else
120 {
121 $Output = $this->SystemMessage('Oblíbené', 'Nenalezeno v oblíbených');
122 }
123 $Output .= $this->ShowList($Table);
124 return $Output;
125 }
126
127 function LogChange(Form $Form, string $Action, string $NewId, string $OldId): void
128 {
129 $Values = $Form->Definition['Table'].' (Id: '.$OldId.' => '.$NewId.'):'."\n";
130 // Compare old values loaded from database with new values in Form variable
131 $NewValues = $Form->Values;
132 if ($OldId != 0)
133 {
134 $FormOld = new Form($this->System->FormManager);
135 $FormOld->SetClass($Form->Definition['Table']);
136 $FormOld->LoadValuesFromDatabase($OldId);
137 $OldValues = $FormOld->Values;
138 // Keep only changes values
139 foreach ($NewValues as $Index => $Value)
140 {
141 if ($OldValues[$Index] != $NewValues[$Index])
142 {
143 $Values .= $Index.': '.$FormOld->GetValue($Index);
144 if ($NewId != 0) $Values .= ' => '.$Form->GetValue($Index);
145 $Values .= "\n";
146 }
147 }
148 } else
149 {
150 foreach ($NewValues as $Index => $Value)
151 {
152 $Values .= $Index.': '.$Form->GetValue($Index)."\n";
153 }
154 }
155 ModuleLog::Cast($this->System->GetModule('Log'))->NewRecord('IS', $Action, $Values);
156 }
157
158 function ShowEdit(string $Table, string $Id): string
159 {
160 $Output = '';
161 if (!array_key_exists($Table, $this->System->FormManager->Classes))
162 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena');
163 if (defined('NEW_PERMISSION') and !ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission($this->TableToModule($Table), 'Write'))
164 return $this->SystemMessage('Oprávnění', 'Nemáte oprávnění');
165 if (array_key_exists('o', $_GET))
166 {
167 if ($_GET['o'] == 'save')
168 {
169 if (!array_key_exists('submit', $_POST))
170 return $this->SystemMessage('Formulář', 'Formulář nebyl řádně odeslán. Vraťte se zpět a odešlete formulář znovu.');
171 $Form = new Form($this->System->FormManager);
172 $Form->SetClass($Table);
173 $Form->LoadValuesFromForm();
174 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' úprava';
175 try
176 {
177 $Form->Validate();
178 if (array_key_exists('BeforeModify', $Form->Definition))
179 {
180 $Class = $Form->Definition['BeforeModify'][0];
181 $Method = $Form->Definition['BeforeModify'][1];
182 $Form->Values = $Class->$Method($Form, $Id);
183 }
184 $this->LogChange($Form, 'Edit', $Id, $Id);
185 $Form->SaveValuesToDatabase($Id);
186 $Output .= $this->SystemMessage('Úprava položky', 'Položka upravena');
187 $Output .= $this->ShowView($Table, $Id);
188 if (array_key_exists('AfterModify', $Form->Definition))
189 {
190 $Class = $Form->Definition['AfterModify'][0];
191 $Method = $Form->Definition['AfterModify'][1];
192 $Form->Values = $Class->$Method($Form, $Id);
193 }
194 } catch (Exception $E)
195 {
196 $Output .= $this->SystemMessage('Úprava položky', 'Položku se nepodařilo uložit. Opravte problém a opakujte akci.<br/>'.$E->getMessage());
197 $Form->OnSubmit = '?a=edit&amp;t='.$Table.'&amp;i='.$_GET['i'].'&amp;o=save';
198 $Output .= $Form->ShowEditForm();
199 $Output .= '<ul class="ActionMenu">';
200 $Output .= '<li>'.$this->ShowAction('Prohlížet', '?a=view&amp;t='.$Table.'&amp;i='.$Id,
201 $this->System->Link('/images/view.png'));
202 $Output .= '<li>'.$this->ShowAction('Seznam', '?a=list&amp;t='.$Table,
203 $this->System->Link('/images/list.png'));
204 $Output .= '<li>'.$this->ShowAction('Odstranit', '?a=delete&amp;t='.$Table.'&amp;i='.$Id,
205 $this->System->Link('/images/delete.png'), 'Opravdu smazat položku');
206 $Output .= '</ul>';
207 }
208 }
209 } else
210 {
211 $Form = new Form($this->System->FormManager);
212 $Form->SetClass($Table);
213 $Form->LoadValuesFromDatabase($Id);
214 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' úprava';
215 $Form->OnSubmit = '?a=edit&amp;t='.$Table.'&amp;i='.$_GET['i'].'&amp;o=save';
216 $Output .= $Form->ShowEditForm();
217 $Output .= '<ul class="ActionMenu">';
218 $Output .= '<li>'.$this->ShowAction('Prohlížet', '?a=view&amp;t='.$Table.'&amp;i='.$Id,
219 $this->System->Link('/images/view.png'));
220 $Output .= '<li>'.$this->ShowAction('Seznam', '?a=list&amp;t='.$Table,
221 $this->System->Link('/images/list.png'));
222 $Output .= '<li>'.$this->ShowAction('Odstranit', '?a=delete&amp;t='.$Table.'&amp;i='.$Id,
223 $this->System->Link('/images/delete.png'), 'Opravdu smazat položku?');
224 $Output .= '</ul>';
225 }
226 return $Output;
227 }
228
229 function ShowDelete(string $Table, string $Id): string
230 {
231 $Output = '';
232 if (!array_key_exists($Table, $this->System->FormManager->Classes))
233 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena');
234 $FormClass = $this->System->FormManager->Classes[$Table];
235 if (defined('NEW_PERMISSION') and !ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission($this->TableToModule($Table), 'Write'))
236 return 'Nemáte oprávnění';
237 $DbResult = $this->Database->select($Table, '*', '`Id`='.$Id);
238 if ($DbResult->num_rows > 0)
239 {
240 $DbRow = $DbResult->fetch_assoc();
241 try
242 {
243 $Form = new Form($this->System->FormManager);
244 $Form->SetClass($Table);
245 $Form->LoadValuesFromDatabase($Id);
246 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' odstranění';
247 if (array_key_exists('BeforeDelete', $Form->Definition))
248 {
249 call_user_func($Form->Definition['BeforeDelete'], $Form, $Id);
250 }
251 $this->LogChange($Form, 'Delete', 0, $Id);
252 $this->Database->delete($Table, '`Id`='.$Id);
253 $Output .= $this->SystemMessage('Smazání položky', 'Položka odstraněna');
254 if (array_key_exists('AfterDelete', $Form->Definition))
255 {
256 $Class = $Form->Definition['AfterDelete'][0];
257 $Method = $Form->Definition['AfterDelete'][1];
258 $Class->$Method($Form, $Id);
259 }
260 } catch (Exception $E)
261 {
262 $Output .= $this->SystemMessage('Smazání položky', 'Položku se nepodařilo smazat. Pravděpodobně na ni závisejí další položky.<br/>'.$E->getMessage());
263 }
264 } else $Output .= $this->SystemMessage('Smazání položky', 'Položka nenalezena');
265 $Output .= $this->ShowList($Table);
266 return $Output;
267 }
268
269 function ShowAdd(string $Table, array $Actions = array()): string
270 {
271 $Output = '';
272 if (!array_key_exists($Table, $this->System->FormManager->Classes))
273 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena');
274 if (defined('NEW_PERMISSION') and !ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission($this->TableToModule($Table), 'Write'))
275 return 'Nemáte oprávnění';
276 if (array_key_exists('o', $_GET))
277 {
278 if ($_GET['o'] == 'save')
279 {
280 $Form = new Form($this->System->FormManager);
281 $Form->SetClass($Table);
282 $Form->LoadValuesFromForm();
283 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' přidání';
284 try
285 {
286 $Form->Validate();
287 if (array_key_exists('BeforeInsert', $Form->Definition))
288 {
289 $Class = $Form->Definition['BeforeInsert'][0];
290 $Method = $Form->Definition['BeforeInsert'][1];
291 $Form->Values = $Class->$Method($Form);
292 }
293 $Form->Validate();
294 $Form->SaveValuesToDatabase(0);
295 $Id = $this->Database->insert_id;
296 $this->LogChange($Form, 'Add', $Id, 0);
297 $Output .= $this->SystemMessage('Přidání položky', 'Nová položka vytvořena');
298 $Output .= $this->ShowView($Table, $Id, $_GET['a'] == 'addsub');
299 if (array_key_exists('AfterInsert', $Form->Definition))
300 {
301 $Class = $Form->Definition['AfterInsert'][0];
302 $Method = $Form->Definition['AfterInsert'][1];
303 $Form->Values = $Class->$Method($Form, $Id);
304 }
305 // Add action to update caller form
306 if ($_GET['a'] == 'addsub')
307 {
308 $Type = $this->System->FormManager->FormTypes[$_GET['rt']];
309 $DbResult = $this->Database->select($Table, '('.$Type['Name'].') AS Name', 'Id='.$Id);
310 $DbRow = $DbResult->fetch_assoc();
311 $Actions[] = '<a href="javascript:window.close();" onclick="add_select_item('.$Id.',&quot;'.$DbRow['Name'].'&quot;,&quot;'.
312 $_GET['r'].'&quot;); set_return ('.$Id.',&quot;'.
313 $_GET['r'].'&quot;);"><img alt="Vybrat" title="Vybrat" src="'.
314 $this->System->Link('/images/select.png').'"/> Vybrat</a>';
315 }
316
317 //$this->Database->update($Table, 'Id='.$Id,
318 // array('UserCreate' => ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'],
319 // 'TimeCreate' => 'NOW()'));
320 } catch (Exception $E)
321 {
322 $Output .= $this->SystemMessage('Přidání položky', 'Položku se nepodařilo přidat. Opravte problém a opakujte akci.<br/>'.$E->getMessage());
323 $Form->OnSubmit = '?a=add&amp;t='.$Table.'&amp;o=save';
324 $Output .= $Form->ShowEditForm();
325 $Actions[] = '<a href="?a=list&amp;t='.$Table.'"><img alt="Seznam" title="Seznam" src="'.
326 $this->System->Link('/images/list.png').'"/>Seznam</a>';
327 }
328 }
329 } else
330 {
331 $Form = new Form($this->System->FormManager);
332 $Form->SetClass($Table);
333 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' přidání';
334 // Load presets from URL
335 foreach ($_GET as $Key => $Value)
336 {
337 if (substr($Key, 0, 6) == 'preset')
338 {
339 $Key = substr($Key, 6);
340 if (($Key != '') and array_key_exists($Key, $Form->Values))
341 $Form->Values[$Key] = $Value;
342 }
343 }
344 if (array_key_exists('r', $_GET)) $URL = '&amp;r='.$_GET['r'].'&amp;rt='.$_GET['rt'];
345 else $URL = '';
346 $Form->OnSubmit = '?a='.$_GET['a'].'&amp;t='.$Table.'&amp;o=save'.$URL;
347 $Output .= $Form->ShowEditForm();
348 $Actions[] = $this->ShowAction('Seznam', '?a=list&amp;t='.$Table,
349 $this->System->Link('/images/list.png'));
350 }
351 $Output .= '<ul class="ActionMenu">';
352 foreach ($Actions as $Action)
353 {
354 $Output .= '<li>'.$Action.'</li>';
355 }
356 $Output .= '</ul>';
357 return $Output;
358 }
359
360 function ShowAddSub(string $Table, string $Filter = '', string $Title = ''): string
361 {
362 if (defined('NEW_PERMISSION') and !ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission($this->TableToModule($Table), 'Write'))
363 return 'Nemáte oprávnění';
364 $this->BasicHTML = true;
365 $this->HideMenu = true;
366 $Output = $this->ShowAdd($Table);
367 return $Output;
368 }
369
370 function ShowTabs(array $Tabs, string $QueryParamName, string $TabContent): string
371 {
372 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']);
373 $QueryItems['a'] = 'view';
374
375 if (array_key_exists($QueryParamName, $_GET)) $TabIndex = $_GET[$QueryParamName];
376 else $TabIndex = 0;
377
378 $Output = '<div class="Tab">'.
379 '<ul>';
380 foreach ($Tabs as $Index => $Tab)
381 {
382 $QueryItems[$QueryParamName] = $Index;
383 if ($Index == $TabIndex) $Selected = ' id="selected"';
384 else $Selected = '';
385 $Output .= '<li'.$Selected.'><a href="?'.SetQueryStringArray($QueryItems).'">'.$Tab.'</a></li>';
386 }
387 $Output .= '</ul></div><div class="TabContent">'.$TabContent.'</div>';
388 return $Output;
389 }
390
391 function ShowView(string $Table, string $Id, bool $WithoutActions = false): string
392 {
393 if (!array_key_exists($Table, $this->System->FormManager->Classes))
394 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena');
395 $FormClass = $this->System->FormManager->Classes[$Table];
396 if (defined('NEW_PERMISSION') and !ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission($this->TableToModule($Table), 'Read'))
397 return 'Nemáte oprávnění';
398
399 $FormClass = $this->System->FormManager->Classes[$Table];
400 if (array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable'];
401 else $TableModify = $Table;
402
403 $Form = new Form($this->System->FormManager);
404 $Form->SetClass($Table);
405 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' položka';
406 $Form->LoadValuesFromDatabase($Id);
407 $Form->OnSubmit = '?a=view';
408 $Output = $Form->ShowViewForm();
409 if ($WithoutActions == false)
410 {
411 $Actions = array(
412 $this->ShowAction('Upravit', '?a=edit&amp;t='.$TableModify.'&amp;i='.$Id,
413 $this->System->Link('/images/edit.png')),
414 $this->ShowAction('Seznam', '?a=list&amp;t='.$Table,
415 $this->System->Link('/images/list.png')),
416 $this->ShowAction('Odstranit', '?a=delete&amp;t='.$Table.'&amp;i='.$Id,
417 $this->System->Link('/images/delete.png'), 'Opravdu smazat položku?'),
418 $this->ShowAction('Přidat', '?a=add&amp;t='.$TableModify,
419 $this->System->Link('/images/add.png'))
420 );
421 if (array_key_exists('ItemActions', $FormClass))
422 {
423 foreach ($FormClass['ItemActions'] as $Action)
424 {
425 $URL = str_replace('#RowId', $Id, $this->System->Link($Action['URL']));
426 $Actions[] = $this->ShowAction($Action['Caption'], $URL,
427 $this->System->Link('/images/action.png'));
428 }
429 }
430 $Output .= '<ul class="ActionMenu">';
431 foreach ($Actions as $Action)
432 {
433 $Output .= '<li>'.$Action.'</li>';
434 }
435 $Output .= '</ul><br/>';
436 }
437
438 // Show ManyToOne relations
439 $Tabs = array();
440 foreach ($Form->Definition['Items'] as $Index => $Item)
441 if ((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and
442 ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne')))
443 {
444 $Tabs[] = $Item['Caption'];
445 }
446 $Tabs[] = 'Vše';
447 if (array_key_exists('tab', $_GET)) $TabIndex = $_GET['tab'];
448 else $TabIndex = 0;
449
450 $TabContent = '';
451 $I = 0;
452 foreach ($Form->Definition['Items'] as $Index => $Item)
453 if ((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and
454 ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne')))
455 {
456 $TypeItem = $this->System->FormManager->FormTypes[$Item['Type']];
457 if (($TabIndex == $I) or ($TabIndex == (count($Tabs) - 1)))
458 {
459 if ($TypeItem['Ref'] == null)
460 {
461 $Filter = $TypeItem['Filter'];
462 $Filter = str_replace('#Id', $Id, $Filter);
463 $TabContent .= $this->ShowList($TypeItem['Table'],
464 $Filter, $Item['Caption']).'<br/>';
465 } else $TabContent .= $this->ShowList($TypeItem['Table'], '`'.
466 $TypeItem['Ref'].'`='.$Id, $Item['Caption'],
467 $TypeItem['Ref'], $Id).'<br/>';
468 }
469 $I++;
470 }
471
472 $Output .= $this->ShowTabs($Tabs, 'tab', $TabContent);
473 return $Output;
474 }
475
476 function ShowTable(string $Table, string $Filter = '', string $Title = '', string $RowActions = '', string $ExcludeColumn = ''): string
477 {
478 if (!array_key_exists($Table, $this->System->FormManager->Classes))
479 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena');
480 $FormClass = $this->System->FormManager->Classes[$Table];
481
482 if (array_key_exists('SQL', $FormClass))
483 $SourceTable = '('.$FormClass['SQL'].') AS `TX`';
484 else $SourceTable = '`'.$FormClass['Table'].'` AS `TX`';
485
486 $WhereFilter = $Filter;
487 $HavingFilter = '';
488
489 // Build form type filter
490 $TypeFilter = '';
491 foreach ($FormClass['Items'] as $ItemIndex => $FormItem)
492 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
493 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
494 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))
495 if (array_key_exists('Filter', $FormItem) and ($FormItem['Filter'] == true))
496 {
497 if ($TypeFilter != '') $TypeFilter .= ' AND ';
498 $TypeFilter .= '(`'.$ItemIndex.'` = "'.$FormItem['Default'].'")';
499 }
500 if ($TypeFilter != '')
501 {
502 if ($HavingFilter != '') $HavingFilter = ' AND';
503 $HavingFilter .= ' '.$TypeFilter;
504 }
505
506 // Build user filter
507 $UserFilter = '';
508 $Columns = array('Id' => '`Id`');
509 if (array_key_exists('filter', $_GET) and ($_GET['filter'] == 1))
510 {
511 foreach ($FormClass['Items'] as $ItemIndex => $FormItem)
512 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
513 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
514 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
515 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))
516 {
517 $UseType = $UseType = $FormItem['Type'];
518 if (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes))
519 {
520 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList))
521 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '',
522 $this->System->FormManager->FormTypes[$FormItem['Type']]);
523 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference')
524 $UseType = 'OneToMany';
525 else
526 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration')
527 $UseType = 'Enumeration';
528 }
529 $FilterName = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterName',
530 array('Name' => $ItemIndex, 'Type' => $FormItem['Type']));
531 if (array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != ''))
532 {
533 if ($UserFilter != '') $UserFilter .= ' AND ';
534 $UserFilter .= '('.$FilterName.' LIKE "%'.$_POST['Filter'.$ItemIndex].'%")';
535 }
536 }
537 }
538 if ($UserFilter != '')
539 {
540 if ($HavingFilter != '') $HavingFilter .= ' AND';
541 $HavingFilter .= ' '.$UserFilter;
542 }
543 if ($WhereFilter != '') $Filter = ' WHERE '.$WhereFilter;
544 if ($HavingFilter != '') $Filter = ' HAVING '.$HavingFilter;
545
546
547 foreach ($FormClass['Items'] as $ItemIndex => $FormItem)
548 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
549 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
550 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))
551 {
552 if ($ExcludeColumn != $ItemIndex)
553 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
554 if (!array_key_exists('NotInList', $FormItem) or ($FormItem['NotInList'] == false))
555 $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']);
556 $UseType = $UseType = $FormItem['Type'];
557 if (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes))
558 {
559 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList))
560 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '',
561 $this->System->FormManager->FormTypes[$FormItem['Type']]);
562 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference')
563 $UseType = 'OneToMany';
564 else
565 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration')
566 $UseType = 'Enumeration';
567 }
568 if (array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != ''))
569 $Value = $_POST['Filter'.$ItemIndex];
570 else $Value = '';
571 if ($ItemIndex == 'Id') unset($Columns['Id']);
572
573 if (!array_key_exists('SQL', $FormItem)) $FormItem['SQL'] = '';
574 else $FormItem['SQL'] = str_replace('#Id', '`TX`.`Id`', $FormItem['SQL']);
575 $Columns[] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterNameQuery',
576 array('Value' => $Value, 'Name' => $ItemIndex,
577 'Type' => $FormItem['Type'], 'SQL' => $FormItem['SQL']));
578 }
579
580 // Get total item count in database
581 $Query = 'SELECT COUNT(*) FROM '.$SourceTable;
582 $DbResult = $this->Database->query($Query);
583 $DbRow = $DbResult->fetch_assoc();
584 $TotalCount = $DbRow['COUNT(*)'];
585
586 // Get total filtered item count in database
587 $Columns = implode(',', $Columns);
588 if ($Filter != '')
589 {
590 $Query = 'SELECT COUNT(*) FROM (SELECT '.$Columns.' FROM '.$SourceTable.' '.$Filter.') AS `TS`';
591 $DbResult = $this->Database->query($Query);
592 $DbRow = $DbResult->fetch_row();
593 $TotalFilteredCount = $DbRow[0];
594 } else $TotalFilteredCount = $TotalCount;
595 $PageList = GetPageList($Table, $TotalFilteredCount);
596
597 $Output = $PageList['Output'];
598 $Output .= '<table class="WideTable" style="font-size: small;">';
599
600 $TableColumns[] = array('Name' => '', 'Title' => 'Akce');
601 if (!array_key_exists('DefaultSortColumn', $FormClass))
602 $FormClass['DefaultSortColumn'] = 'Id';
603 if (!array_key_exists('DefaultSortOrder', $FormClass))
604 $FormClass['DefaultSortOrder'] = 0;
605 $Order = GetOrderTableHeader($Table, $TableColumns, $FormClass['DefaultSortColumn'], $FormClass['DefaultSortOrder']);
606 $Output .= $Order['Output'];
607
608 // Show search fields
609 if (array_key_exists('r', $_GET)) $Addition = '&amp;r='.$_GET['r'];
610 else $Addition = '';
611 $Output .= '<tr><form action="?a='.$_GET['a'].'&amp;t='.$Table.'&amp;filter=1'.$Addition.'" method="post">';
612 foreach ($FormClass['Items'] as $ItemIndex => $FormItem)
613 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
614 if (!array_key_exists('NotInList', $FormItem) or ($FormItem['NotInList'] == false))
615 if ((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
616 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
617 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) and
618 ($ExcludeColumn != $ItemIndex))
619 {
620 if (array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != ''))
621 $Value = $_POST['Filter'.$ItemIndex];
622 else $Value = '';
623 $Output .= '<td><input type="text" name="Filter'.$ItemIndex.'" value="'.$Value.'" style="width: 100%"/></td>';
624 }
625 $Output .= '<td><input type="Submit" value="Hledat"/></td></form></tr>';
626
627 // Load and show items
628 $Query = 'SELECT '.$Columns.' FROM '.$SourceTable.' '.
629 $Filter.' '.$Order['SQL'].$PageList['SQLLimit'];
630 $VisibleItemCount = 0;
631 $DbResult = $this->Database->query($Query);
632 while ($Row = $DbResult->fetch_assoc())
633 {
634 $Output .= '<tr>';
635 foreach ($FormClass['Items'] as $ItemIndex => $FormItem)
636 if (!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
637 if (!array_key_exists('NotInList', $FormItem) or ($FormItem['NotInList'] == false))
638 if ((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
639 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
640 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) and
641 ($ExcludeColumn != $ItemIndex))
642 {
643 //$Output .= '<td>'.$Row[$ItemIndex].'</td>';
644 $UseType = $UseType = $FormItem['Type'];
645 if (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes))
646 {
647 if (!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList))
648 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '',
649 $this->System->FormManager->FormTypes[$FormItem['Type']]);
650 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference')
651 $UseType = 'OneToMany';
652 else
653 if ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration')
654 $UseType = 'Enumeration';
655 }
656 $Row[$ItemIndex] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb',
657 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex,
658 'Type' => $FormItem['Type']));
659 $Value = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView',
660 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex,
661 'Type' => $FormItem['Type'], 'Filter' => $Row[$ItemIndex.'_Filter']));
662 if ($Value == '') $Value = '&nbsp;';
663 $Output .= '<td>'.$Value.'</td>';
664 }
665 $Output .= '<td>'.str_replace('#RowId', $Row['Id'], $RowActions).'</td></tr>';
666 $VisibleItemCount = $VisibleItemCount + 1;
667 }
668 $Output .= '<tr><td colspan="'.count($TableColumns).'" style="text-align: right;">Zobrazeno <strong>'.$VisibleItemCount.'</strong>';
669 if ($UserFilter != '') $Output .= ' z filtrovaných <strong>'.$TotalFilteredCount.'</strong>';
670 $Output .= ' z celkem <strong>'.$TotalCount.'</strong></td></tr>';
671 $Output .= '</table>';
672 $Output .= $PageList['Output'];
673 return $Output;
674 }
675
676 function ShowSelect(string $Table, string $Filter = '', string $Title = ''): string
677 {
678 if (defined('NEW_PERMISSION') and !ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission($this->TableToModule($Table), 'Read'))
679 return 'Nemáte oprávnění';
680 $this->BasicHTML = true;
681 $this->HideMenu = true;
682 $RowActions = '<a href="javascript:window.close();" onclick="set_return (#RowId,&quot;'.
683 $_GET['r'].'&quot;);"><img alt="Vybrat" title="Vybrat" src="'.
684 $this->System->Link('/images/select.png').'"/></a>';
685 $Output = $this->ShowTable($Table, $Filter, $Title, $RowActions);
686 return $Output;
687 }
688
689 function ShowMapSelect(string $Table, string $Filter = '', string $Title = ''): string
690 {
691 if (defined('NEW_PERMISSION') and !ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission($this->TableToModule($Table), 'Write'))
692 return 'Nemáte oprávnění';
693 $Map = new MapOpenStreetMaps($this->System);
694 $Map->Position = array('Lat' => $this->System->Config['Map']['DefaultLatitude'],
695 'Lng' => $this->System->Config['Map']['DefaultLongitude']);
696 $Map->Zoom = $this->System->Config['Map']['DefaultZoom'];
697 $Map->Key = $this->System->Config['Map']['GoogleMapsApiKey'];
698 $Map->OnClickObject = $_GET['r'];
699 //$MapApi->ShowMarker = true;
700 $Output = $Map->ShowPage($this);
701 return $Output;
702 }
703
704 function ShowList(string $Table, string $Filter = '', string $Title = '', string $ExcludeColumn = '', string $ExcludeValue = ''): string
705 {
706 $Output = '';
707 if (defined('NEW_PERMISSION') and !ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission($this->TableToModule($Table), 'Read'))
708 return 'Nemáte oprávnění';
709 if (!array_key_exists($Table, $this->System->FormManager->Classes))
710 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena');
711 $FormClass = $this->System->FormManager->Classes[$Table];
712 if (array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable'];
713 else $TableModify = $Table;
714
715 $RowActions = '<a href="?a=view&amp;t='.$Table.'&amp;i=#RowId"><img alt="Ukázat" title="Ukázat" src="'.
716 $this->System->Link('/images/view.png').'"/></a>'.
717 '<a href="?a=edit&amp;t='.$TableModify.'&amp;i=#RowId"><img alt="Upravit" title="Upravit" src="'.
718 $this->System->Link('/images/edit.png').'"/></a>'.
719 '<a href="?a=delete&amp;t='.$Table.'&amp;i=#RowId"><img alt="Smazat" title="Smazat" src="'.
720 $this->System->Link('/images/delete.png').'" onclick="return confirmAction(\'Opravdu smazat položku?\');"/></a>';
721 if (($Table != '') and (array_key_exists($Table, $this->System->FormManager->Classes)))
722 $FormClass = $this->System->FormManager->Classes[$Table];
723 else return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena');
724 if ($ExcludeColumn == '') $this->ShortTitle .= ' - '.$FormClass['Title'];
725 if (array_key_exists('ItemActions', $FormClass))
726 {
727 foreach ($FormClass['ItemActions'] as $Action)
728 {
729 $URL = $this->System->Link($Action['URL']);
730 $RowActions .= '<a href="'.$URL.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'.
731 $this->System->Link('/images/action.png').'"/></a>';
732 }
733 }
734 $Output .= '<div style="text-align: center;">'.$FormClass['Title'].'</div>';
735 $Output .= '<ul class="ActionMenu">';
736 $Output .= '<li>'.$this->ShowAction('Přidat', '?a=add&amp;t='.$TableModify.'&amp;preset'.$ExcludeColumn.'='.$ExcludeValue, $this->System->Link('/images/add.png')).'</li>';
737 $Output .= '<li>'.$this->ShowAction('Seznam', '?a=list&amp;t='.$Table, $this->System->Link('/images/list.png')).'</li>';
738 $MI = 0;
739 if (array_key_exists('mi', $_GET))
740 {
741 $DbResult = $this->Database->select('MenuItemFavorite', 'Id', '(`MenuItem`='.($_GET['mi'] * 1).') AND (`User`='.ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'].')');
742 if ($DbResult->num_rows > 0)
743 {
744 $DbRow = $DbResult->fetch_assoc();
745 $Fav = $DbRow['Id'];
746 $Output .= '<li>'.$this->ShowAction('Odebrat z oblíbených', '?a=fav_del&amp;t='.$Table.'&amp;i='.$_GET['mi'].'&amp;mi='.$_GET['mi'],
747 $this->System->Link('/images/Favorite-Del.png')).'</li>';
748 } else $Output .= '<li>'.$this->ShowAction('Přidat do oblíbených', '?a=fav_add&amp;t='.$Table.'&amp;i='.$_GET['mi'].'&amp;mi='.$_GET['mi'],
749 $this->System->Link('/images/Favorite-Add.png')).'</li>';
750 }
751 if (array_key_exists('Actions', $FormClass))
752 {
753 foreach ($FormClass['Actions'] as $Action)
754 {
755 $Output .= '<li>'.$this->ShowAction($Action['Caption'], $this->System->Link($Action['URL']),
756 $this->System->Link('/images/action.png')).'</li>';
757 }
758 }
759 $Output .= '</ul>';
760 $Output .= $this->ShowTable($Table, $Filter, $Title, $RowActions, $ExcludeColumn);
761 return $Output;
762 }
763
764 function ShowFavorites(): string
765 {
766 $this->MenuItems = array();
767 $DbResult = $this->Database->query('SELECT `MenuItem`.`Id`, `MenuItem`.`Name`, `MenuItem`.`Parent`, `Action`.`URL` AS `URL`, `ActionIcon`.`Name` AS `IconName`, `Action`.`PermissionOperation` AS `Permission` FROM `MenuItemFavorite` ' .
768 'LEFT JOIN `MenuItem` ON `MenuItem`.`Id` = `MenuItemFavorite`.`MenuItem` '.
769 'LEFT JOIN `Action` ON `Action`.`Id` = `MenuItem`.`Action` '.
770 'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
771 'WHERE `MenuItemFavorite`.`User`='.ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'].' '.
772 'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`');
773 while ($DbRow = $DbResult->fetch_assoc())
774 {
775 //if ($DbRow['Permission'] != '')
776 $this->MenuItems[$DbRow['Id']] = $DbRow;
777 }
778 return $this->ShowMenuItem('', true);
779 }
780
781 function ShowMenu(): string
782 {
783 $this->MenuItems = array();
784 $DbResult = $this->Database->query('SELECT `MenuItem`.`Id`, `MenuItem`.`Name`, `MenuItem`.`Parent`, `Action`.`URL` AS `URL`, `ActionIcon`.`Name` AS `IconName`, `Action`.`PermissionOperation` AS `Permission` FROM `MenuItem` '.
785 'LEFT JOIN `Action` ON `Action`.`Id` = `MenuItem`.`Action` '.
786 'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
787 'WHERE `MenuItem`.`Menu`=1 '.
788 'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`');
789 while ($DbRow = $DbResult->fetch_assoc())
790 {
791 //if ($DbRow['Permission'] != '')
792 $this->MenuItems[$DbRow['Id']] = $DbRow;
793 }
794 return $this->ShowMenuItem('');
795 }
796
797 function ShowMenuItem(string $Parent, bool $All = false): string
798 {
799 $Output = '<ul style="list-style: none; margin-left:1em; padding-left:0em;">';
800 foreach ($this->MenuItems as $MenuItem)
801 {
802 if (($MenuItem['Parent'] == $Parent) or $All)
803 {
804 $LinkTitle = $MenuItem['Name'];
805 if ($MenuItem['URL'] != '')
806 {
807 $Icon = 'Device.png';
808 if (substr($MenuItem['URL'], 0, 4) != 'http') $MenuItem['URL'] = $this->System->Link($MenuItem['URL']);
809 $LinkTitle = MakeLink($MenuItem['URL'].'&amp;mi='.$MenuItem['Id'], $LinkTitle);
810 } else $Icon = 'Folder.png';
811 if ($MenuItem['IconName'] != '') $Image = '<img src="'.$this->System->Link('/images/favicons/'.$MenuItem['IconName']).'"/>&nbsp;';
812 else $Image = '<img src="'.$this->System->Link('/images/favicons/'.$Icon).'"/>&nbsp;';
813 //if (ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission($this->TableToModule($Table), 'Write') or !defined('NEW_PERMISSION'))
814 $Output .= '<li>'.$Image.$LinkTitle.'</li>';
815 if ($All == false) $Output .= $this->ShowMenuItem($MenuItem['Id']);
816 }
817 }
818 $Output .= '</ul>';
819 return $Output;
820 }
821
822 function TableToModule(string $Table): string
823 {
824 $DbResult = $this->Database->query('SELECT (SELECT `Name` FROM `Module` '.
825 'WHERE `Module`.`Id`=`Model`.`Module`) AS `Name` FROM `Model` WHERE `Name`="'.$Table.'"');
826 if ($DbResult->num_rows == 1)
827 {
828 $DbRow = $DbResult->fetch_assoc();
829 return $DbRow['Name'];
830 } else return '';
831 }
832
833 function ShowAction(string $Name, string $Target, string $Icon, string $Confirm = ''): string
834 {
835 $Output = '<img alt="'.$Name.'" title="'.$Name.'" src="'.
836 $Icon.'"/>';
837 if ($this->ShowActionName) $Output .= $Name;
838 if ($Confirm != '')
839 $Confirm = ' onclick="return confirmAction(\''.$Confirm.'\');"';
840 $Output = '<a href="'.$Target.'"'.$Confirm.'>'.$Output.'</a>';
841 return $Output;
842 }
843}
844
845class ModuleIS extends AppModule
846{
847 public array $DashboardItems;
848
849 function __construct(System $System)
850 {
851 parent::__construct($System);
852 $this->Name = 'IS';
853 $this->Title = 'Information system';
854 $this->Version = '1.0';
855 $this->Creator = 'Chronos';
856 $this->License = 'GNU/GPLv3';
857 $this->Description = 'User interface for generic information system';
858 $this->Dependencies = array('User');
859
860 $this->DashboardItems = array();
861 }
862
863 function DoInstall(): void
864 {
865 }
866
867 function DoUninstall(): void
868 {
869 }
870
871 function DoStart(): void
872 {
873 $this->System->RegisterPage(['is'], 'PageIS');
874 $this->System->FormManager->RegisterClass('MenuItem', array(
875 'Title' => 'Položky nabídky',
876 'Table' => 'MenuItem',
877 'Items' => array(
878 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
879 'Parent' => array('Type' => 'TMenuItem', 'Caption' => 'Rodič', 'Default' => '', 'Null' => true),
880 'Action' => array('Type' => 'TAction', 'Caption' => 'Akce', 'Default' => ''),
881 'Menu' => array('Type' => 'TMenu', 'Caption' => 'Nabídka', 'Default' => ''),
882 'Items' => array('Type' => 'TMenuItemListParent', 'Caption' => 'Položky'),
883 ),
884 ));
885 $this->System->FormManager->RegisterClass('MenuItemFavorite', array(
886 'Title' => 'Oblíbené položky nabídky',
887 'Table' => 'MenuItemFavorite',
888 'Items' => array(
889 'User' => array('Type' => 'TUser', 'Caption' => 'Uživatele', 'Default' => '0'),
890 'MenuItem' => array('Type' => 'TMenuItem', 'Caption' => 'Položka nabídky', 'Default' => '0'),
891 ),
892 ));
893 $this->System->FormManager->RegisterClass('Menu', array(
894 'Title' => 'Nabídky',
895 'Table' => 'Menu',
896 'Items' => array(
897 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
898 'Items' => array('Type' => 'TMenuItemListMenu', 'Caption' => 'Položky'),
899 ),
900 ));
901 $this->System->FormManager->RegisterFormType('TMenuItem', array(
902 'Type' => 'Reference',
903 'Table' => 'MenuItem',
904 'Id' => 'Id',
905 'Name' => 'Name',
906 'Filter' => '1',
907 ));
908 $this->System->FormManager->RegisterFormType('TMenu', array(
909 'Type' => 'Reference',
910 'Table' => 'Menu',
911 'Id' => 'Id',
912 'Name' => 'Name',
913 'Filter' => '1',
914 ));
915 }
916
917 function DoStop(): void
918 {
919 }
920
921 function RegisterDashboardItem(string $Name, callable $Callback): void
922 {
923 $this->DashboardItems[$Name] = array('Callback' => $Callback);
924 }
925
926 function UnregisterDashboardItem(string $Name): void
927 {
928 unset($this->DashboardItems[$Name]);
929 }
930
931 static function Cast(AppModule $AppModule): ModuleIS
932 {
933 if ($AppModule instanceof ModuleIS)
934 {
935 return $AppModule;
936 }
937 throw new Exception('Expected ModuleIS type but '.gettype($AppModule));
938 }
939}
Note: See TracBrowser for help on using the repository browser.