| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include_once(dirname(__FILE__).'/../../Common/Global.php');
|
|---|
| 4 |
|
|---|
| 5 | class ModulePortal extends Module
|
|---|
| 6 | {
|
|---|
| 7 | function __construct(System $System)
|
|---|
| 8 | {
|
|---|
| 9 | parent::__construct($System);
|
|---|
| 10 | $this->Name = 'Portal';
|
|---|
| 11 | $this->Version = '1.0';
|
|---|
| 12 | $this->Creator = 'Chronos';
|
|---|
| 13 | $this->License = 'GNU/GPLv3';
|
|---|
| 14 | $this->Description = 'Community portal.';
|
|---|
| 15 | $this->Dependencies = array(ModuleNews::GetName(), ModuleUser::GetName());
|
|---|
| 16 | $this->Models = array(Panel::GetClassName(), PanelColumn::GetClassName());
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | function DoInsertSampleData(): void
|
|---|
| 20 | {
|
|---|
| 21 | $ActionGroup1 = $this->Database->insert('ActionGroup', array('Name' => 'Síť'));
|
|---|
| 22 | $ActionGroup2 = $this->Database->insert('ActionGroup', array('Name' => 'Místní organizace'));
|
|---|
| 23 | $ActionGroup3 = $this->Database->insert('ActionGroup', array('Name' => 'Stránky občanů'));
|
|---|
| 24 | $ActionGroup4 = $this->Database->insert('ActionGroup', array('Name' => 'Vyhledávání'));
|
|---|
| 25 | $ActionGroup5 = $this->Database->insert('ActionGroup', array('Name' => 'Užitečné'));
|
|---|
| 26 | $ActionGroup6 = $this->Database->insert('ActionGroup', array('Name' => 'Zábava'));
|
|---|
| 27 | $ActionGroup7 = $this->Database->insert('ActionGroup', array('Name' => 'Hostované stránky'));
|
|---|
| 28 | $ActionGroup8 = $this->Database->insert('ActionGroup', array('Name' => 'Prodej počítačů'));
|
|---|
| 29 | $ActionGroup9 = $this->Database->insert('ActionGroup', array('Name' => 'Různé'));
|
|---|
| 30 |
|
|---|
| 31 | $PanelColumn1 = $this->Database->insert('PanelColumn', array('Width' => ''));
|
|---|
| 32 | $PanelColumn2 = $this->Database->insert('PanelColumn', array('Width' => ''));
|
|---|
| 33 | $PanelColumn3 = $this->Database->insert('PanelColumn', array('Width' => '70%'));
|
|---|
| 34 |
|
|---|
| 35 | $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup1, 'Order' => 2, 'PanelColumn' => $PanelColumn1));
|
|---|
| 36 | $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup4, 'Order' => 1, 'PanelColumn' => $PanelColumn2));
|
|---|
| 37 | $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup5, 'Order' => 2, 'PanelColumn' => $PanelColumn2));
|
|---|
| 38 | $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup6, 'Order' => 3, 'PanelColumn' => $PanelColumn2));
|
|---|
| 39 | $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup2, 'Order' => 4, 'PanelColumn' => $PanelColumn2));
|
|---|
| 40 | $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup3, 'Order' => 5, 'PanelColumn' => $PanelColumn2));
|
|---|
| 41 | $this->Database->insert('Panel', array('Module' => 'NewsGroupList', 'Parameters' => '', 'Order' => 2, 'PanelColumn' => $PanelColumn3));
|
|---|
| 42 | $this->Database->insert('Panel', array('Module' => 'Webcam', 'Parameters' => '', 'Order' => 3, 'PanelColumn' => $PanelColumn1));
|
|---|
| 43 | $this->Database->insert('Panel', array('Module' => 'UserOptions', 'Parameters' => '', 'Order' => 1, 'PanelColumn' => $PanelColumn3));
|
|---|
| 44 | $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup9, 'Order' => 1, 'PanelColumn' => $PanelColumn1));
|
|---|
| 45 | $this->Database->insert('Panel', array('Module' => 'Meteo', 'Parameters' => '', 'Order' => 4, 'PanelColumn' => $PanelColumn1));
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | function DoStart(): void
|
|---|
| 49 | {
|
|---|
| 50 | Core::Cast($this->System)->RegisterPage([''], 'PagePortal');
|
|---|
| 51 | $this->System->FormManager->RegisterClass('MemberOptions', array(
|
|---|
| 52 | 'Title' => 'Nastavení zákazníka',
|
|---|
| 53 | 'SQL' => '(SELECT Member.Id, Member.FamilyMemberCount, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject)',
|
|---|
| 54 | 'Table' => 'MemberOptions',
|
|---|
| 55 | 'Items' => array(
|
|---|
| 56 | 'Name' => array('Type' => 'String', 'Caption' => 'Fakturační jméno', 'Default' => ''),
|
|---|
| 57 | 'AddressStreet' => array('Type' => 'String', 'Caption' => 'Ulice', 'Default' => 'Zděchov'),
|
|---|
| 58 | 'AddressTown' => array('Type' => 'String', 'Caption' => 'Město', 'Default' => 'Zděchov'),
|
|---|
| 59 | 'AddressPSC' => array('Type' => 'String', 'Caption' => 'PSČ', 'Default' => '75607'),
|
|---|
| 60 | 'AddressCountry' => array('Type' => 'TCountry', 'Caption' => 'Země', 'Default' => '1'),
|
|---|
| 61 | 'IC' => array('Type' => 'String', 'Caption' => 'IČ', 'Default' => ''),
|
|---|
| 62 | 'DIC' => array('Type' => 'String', 'Caption' => 'DIČ', 'Default' => ''),
|
|---|
| 63 | 'FamilyMemberCount' => array('Type' => 'Integer', 'Caption' => 'Počet bydlících osob', 'Default' => '', 'Suffix' => 'osob'),
|
|---|
| 64 | ),
|
|---|
| 65 | ));
|
|---|
| 66 | ModuleUser::Cast(Core::Cast($this->System)->GetModule('User'))->UserPanel[] = array('PagePortal', 'UserPanel');
|
|---|
| 67 | }
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | class PanelColumn extends Model
|
|---|
| 71 | {
|
|---|
| 72 | static function GetModelDesc(): ModelDesc
|
|---|
| 73 | {
|
|---|
| 74 | $Desc = new ModelDesc(self::GetClassName());
|
|---|
| 75 | $Desc->AddString('Width');
|
|---|
| 76 | return $Desc;
|
|---|
| 77 | }
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | class Panel extends Model
|
|---|
| 81 | {
|
|---|
| 82 | static function GetModelDesc(): ModelDesc
|
|---|
| 83 | {
|
|---|
| 84 | $Desc = new ModelDesc(self::GetClassName());
|
|---|
| 85 | $Desc->AddString('Module');
|
|---|
| 86 | $Desc->AddString('Parameters');
|
|---|
| 87 | $Desc->AddInteger('Order');
|
|---|
| 88 | $Desc->AddInteger('PanelColumn');
|
|---|
| 89 | return $Desc;
|
|---|
| 90 | }
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | class PagePortal extends Page
|
|---|
| 94 | {
|
|---|
| 95 | function __construct(System $System)
|
|---|
| 96 | {
|
|---|
| 97 | parent::__construct($System);
|
|---|
| 98 | $this->Title = 'Rozcestník';
|
|---|
| 99 | $this->Description = 'Zděchovský rozcestník';
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | function ShowActions(array $ActionGroup): string
|
|---|
| 103 | {
|
|---|
| 104 | $Output = '';
|
|---|
| 105 | $DbResult = $this->Database->query('SELECT `Id` FROM `Action` '.
|
|---|
| 106 | 'WHERE (`Action`.`Group`='.$ActionGroup['Id'].') AND (`Action`.`Enable` = 1)');
|
|---|
| 107 | while ($Action = $DbResult->fetch_assoc())
|
|---|
| 108 | {
|
|---|
| 109 | $Output .= ModuleSystem::Cast($this->System->GetModule('System'))->ShowAction($Action['Id']).'<br/>';
|
|---|
| 110 | }
|
|---|
| 111 | return $this->Panel($ActionGroup['Name'], $Output);
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | function InfoBar(): string
|
|---|
| 115 | {
|
|---|
| 116 | $Output2 = '';
|
|---|
| 117 |
|
|---|
| 118 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDeviceType.ShowOnline = 1');
|
|---|
| 119 | $DbRow = $DbResult->fetch_array();
|
|---|
| 120 | $TotalComputers = $DbRow[0];
|
|---|
| 121 |
|
|---|
| 122 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE (NetworkDeviceType.ShowOnline = 1) AND (NetworkDevice.Online = 1)');
|
|---|
| 123 | $DbRow = $DbResult->fetch_array();
|
|---|
| 124 | $OnlineComputers = $DbRow[0];
|
|---|
| 125 |
|
|---|
| 126 | $Output = '<img alt="" src="images/favicons/comp.png" width="16" height="16" /> '.$OnlineComputers.' / '.$TotalComputers.' ';
|
|---|
| 127 |
|
|---|
| 128 | $DbResult = $this->Database->select('Member', 'COUNT(*)', '1');
|
|---|
| 129 | $DbRow = $DbResult->fetch_array();
|
|---|
| 130 | $TotalUser = $DbRow[0];
|
|---|
| 131 |
|
|---|
| 132 | $DbResult = $this->Database->query('SELECT COUNT(DISTINCT(Member)) FROM NetworkDevice '.
|
|---|
| 133 | 'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type '.
|
|---|
| 134 | 'WHERE NetworkDeviceType.ShowOnline = 1 AND NetworkDevice.Online = 1');
|
|---|
| 135 | $DbRow = $DbResult->fetch_array();
|
|---|
| 136 | $OnlineUser = $DbRow[0];
|
|---|
| 137 |
|
|---|
| 138 | $Output .= '<img alt="" src="images/favicons/house.png" width="16" height="16" /> '.$OnlineUser.' / '.$TotalUser.' ';
|
|---|
| 139 |
|
|---|
| 140 | $NetworkUsage = 0;
|
|---|
| 141 | $Output .= '<img alt="" src="images/favicons/usage.png" width="16" height="16" /> '.$NetworkUsage.' % ';
|
|---|
| 142 |
|
|---|
| 143 | //$Output .= 'Server běží: '.$this->GetServerUptime().' ';
|
|---|
| 144 |
|
|---|
| 145 | if (ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Finance', 'DisplaySubjectState'))
|
|---|
| 146 | {
|
|---|
| 147 | $DbResult = $this->Database->select('MemberPayment', 'Cash', 'Member=(SELECT Customer FROM UserCustomerRel WHERE Id='.ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'].')');
|
|---|
| 148 | if ($DbResult->num_rows > 0)
|
|---|
| 149 | {
|
|---|
| 150 | $DbRow = $DbResult->fetch_assoc();
|
|---|
| 151 | $Output2 .= ' <img alt="" src="images/favicons/money.png" width="16" height="16" /> '.$DbRow['Cash'].' Kč';
|
|---|
| 152 | }
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | $Output = '<div class="Navigation"><span class="MenuItem">'.$Output.'</span><div class="MenuItem2"> '.$Output2.'</div></div>';
|
|---|
| 156 | return $Output;
|
|---|
| 157 | }
|
|---|
| 158 |
|
|---|
| 159 | function UserPanel(): string
|
|---|
| 160 | {
|
|---|
| 161 | $User = &ModuleUser::Cast($this->System->GetModule('User'))->User;
|
|---|
| 162 | $Output = '<a href="'.$this->System->Link('/user/?Action=UserOptions').'">Profil</a><br />';
|
|---|
| 163 | if ($User->CheckPermission('Finance', 'MemberOptions'))
|
|---|
| 164 | $Output .= '<a href="'.$this->System->Link('/?Action=MemberOptions').'">Fakturační adresa</a><br />';
|
|---|
| 165 | if ($User->CheckPermission('Finance', 'DisplaySubjectState'))
|
|---|
| 166 | $Output .= '<a href="'.$this->System->Link('/finance/platby/').'">Finance</a><br />';
|
|---|
| 167 | if ($User->CheckPermission('Customer', 'DisplayCustomerDocuments'))
|
|---|
| 168 | $Output .= '<a href="'.$this->System->Link('/user/dokumenty/').'">Dokumenty</a><br />';
|
|---|
| 169 | if ($User->CheckPermission('Network', 'RegistredHostList'))
|
|---|
| 170 | $Output .= '<a href="'.$this->System->Link('/network/user-hosts/').'">Počítače</a><br />';
|
|---|
| 171 | if ($User->CheckPermission('News', 'Insert'))
|
|---|
| 172 | $Output .= '<a href="'.$this->System->Link('/aktuality/?action=add').'">Vložení aktuality</a><br />';
|
|---|
| 173 | if ($User->CheckPermission('EatingPlace', 'Edit'))
|
|---|
| 174 | $Output .= '<a href="'.$this->System->Link('/jidelna/menuedit.php').'">Úprava jídelníčků</a><br />';
|
|---|
| 175 | if ($User->CheckPermission('Finance', 'Manage'))
|
|---|
| 176 | $Output .= '<a href="'.$this->System->Link('/finance/sprava/').'">Správa financí</a><br />';
|
|---|
| 177 | if ($User->CheckPermission('IS', 'Manage'))
|
|---|
| 178 | $Output .= '<a href="'.$this->System->Link('/is/').'">Správa dat</a><br />';
|
|---|
| 179 | return $Output;
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| 182 | function WebcamPanel(): string
|
|---|
| 183 | {
|
|---|
| 184 | $Output = ModuleWebCam::Cast($this->System->GetModule('WebCam'))->ShowImage();
|
|---|
| 185 | return $Output;
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 | function MeteoPanel(): string
|
|---|
| 189 | {
|
|---|
| 190 | $Output = '<a href="https://stat.zdechov.net/meteo/?Measure=28" title="Klikněte pro detailní informace a předpověď"><img src="https://www.zdechov.net/meteo/koliba.png" border="0" alt="Počasí - Meteostanice Zděchov" width="150" height="150" /></a>';
|
|---|
| 191 | return $Output;
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 | function OnlineHostList(): string
|
|---|
| 195 | {
|
|---|
| 196 | $Output = '<span style="font-size: smaller;">';
|
|---|
| 197 | $DbResult = $this->Database->query('SELECT `NetworkDevice`.`Name` FROM `NetworkDevice` '.
|
|---|
| 198 | 'LEFT JOIN `NetworkDeviceType` ON `NetworkDeviceType`.`Id` = `NetworkDevice`.`Type` '.
|
|---|
| 199 | 'WHERE (`NetworkDeviceType`.`ShowOnline` = 1) AND (`NetworkDevice`.`Online` = 1) ORDER BY `NetworkDevice`.`Name`');
|
|---|
| 200 | while ($Device = $DbResult->fetch_array())
|
|---|
| 201 | {
|
|---|
| 202 | $Output .= $Device['Name'].'<br />';
|
|---|
| 203 | }
|
|---|
| 204 | $Output .= '</span>';
|
|---|
| 205 | return $Output;
|
|---|
| 206 | }
|
|---|
| 207 |
|
|---|
| 208 | function ShowBadPayerList(): string
|
|---|
| 209 | {
|
|---|
| 210 | $Output = '<div class="PanelTitle">Dlužníci:</div><span style="font-size: smaller;">';
|
|---|
| 211 | $DbResult = $this->Database->select('Subject', 'Name', 'Money < 0 ORDER BY Money');
|
|---|
| 212 | while ($Row = $DbResult->fetch_array())
|
|---|
| 213 | {
|
|---|
| 214 | $Output .= $Row['Name'].'<br />';
|
|---|
| 215 | }
|
|---|
| 216 | $Output .= '</span>';
|
|---|
| 217 | return $Output;
|
|---|
| 218 | }
|
|---|
| 219 |
|
|---|
| 220 | function Panel(string $Title, string $Content, array $Menu = array()): string
|
|---|
| 221 | {
|
|---|
| 222 | if (count($Menu) > 0)
|
|---|
| 223 | {
|
|---|
| 224 | foreach ($Menu as $Item)
|
|---|
| 225 | {
|
|---|
| 226 | $Title .= '<div class="Action">'.$Item.'</div>';
|
|---|
| 227 | }
|
|---|
| 228 | }
|
|---|
| 229 | return '<div class="Panel"><div class="Title">'.$Title.'</div><div class="Content">'.$Content.'</div></div>';
|
|---|
| 230 | }
|
|---|
| 231 |
|
|---|
| 232 | function Show(): string
|
|---|
| 233 | {
|
|---|
| 234 | $Output = '';
|
|---|
| 235 | if (array_key_exists('Action', $_GET))
|
|---|
| 236 | {
|
|---|
| 237 | $Action = $_GET['Action'];
|
|---|
| 238 | if ($Action == 'CustomizeNewsSave')
|
|---|
| 239 | {
|
|---|
| 240 | $Output .= ModuleNews::Cast($this->System->GetModule('News'))->CustomizeSave();
|
|---|
| 241 | } else
|
|---|
| 242 | if ($Action == 'MemberOptions')
|
|---|
| 243 | {
|
|---|
| 244 | $DbResult = $this->Database->query('SELECT `Customer` FROM `UserCustomerRel` '.
|
|---|
| 245 | 'WHERE `User`='.ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id']);
|
|---|
| 246 | while ($CustomerUserRel = $DbResult->fetch_assoc())
|
|---|
| 247 | {
|
|---|
| 248 | $DbResult2 = $this->Database->query('SELECT `Member`.`Id`, '.
|
|---|
| 249 | '`Member`.`FamilyMemberCount`, `Subject`.`Name`, `Subject`.`AddressStreet`, '.
|
|---|
| 250 | '`Subject`.`AddressTown`, `Subject`.`AddressPSC`, `Subject`.`AddressCountry`, '.
|
|---|
| 251 | '`Subject`.`IC`, `Subject`.`DIC` FROM `Member` JOIN `Subject` '.
|
|---|
| 252 | 'ON `Subject`.`Id` = `Member`.`Subject` WHERE `Member`.`Id`='.$CustomerUserRel['Customer']);
|
|---|
| 253 | $Form = new Form($this->System->FormManager);
|
|---|
| 254 | $Form->SetClass('MemberOptions');
|
|---|
| 255 | $DbRow = $DbResult2->fetch_array();
|
|---|
| 256 | foreach ($Form->Definition['Items'] as $Index => $Item)
|
|---|
| 257 | {
|
|---|
| 258 | $Form->Values[$Index] = $DbRow[$Index];
|
|---|
| 259 | }
|
|---|
| 260 | $Form->OnSubmit = '?Action=MemberOptionsSave&Id='.$CustomerUserRel['Customer'];
|
|---|
| 261 | $Output .= $Form->ShowEditForm();
|
|---|
| 262 | }
|
|---|
| 263 | } else
|
|---|
| 264 | if ($Action == 'MemberOptionsSave')
|
|---|
| 265 | {
|
|---|
| 266 | $Form = new Form($this->System->FormManager);
|
|---|
| 267 | $Form->SetClass('MemberOptions');
|
|---|
| 268 | $Form->LoadValuesFromForm();
|
|---|
| 269 | if ($Form->Values['FamilyMemberCount'] < 0)
|
|---|
| 270 | $Form->Values['FamilyMemberCount'] = 0;
|
|---|
| 271 |
|
|---|
| 272 | $User = &ModuleUser::Cast($this->System->GetModule('User'))->User;
|
|---|
| 273 | $DbResult = $this->Database->query('SELECT `Customer` FROM `UserCustomerRel` '.
|
|---|
| 274 | 'WHERE `User`='.ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id']);
|
|---|
| 275 | $CustomerUserRel = $DbResult->fetch_assoc();
|
|---|
| 276 | $CustomerId = $CustomerUserRel['Customer'];
|
|---|
| 277 |
|
|---|
| 278 | $DbResult = $this->Database->update('Member', 'Id='.$CustomerId,
|
|---|
| 279 | array('FamilyMemberCount' => $Form->Values['FamilyMemberCount']));
|
|---|
| 280 | $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$CustomerId);
|
|---|
| 281 | $Member = $DbResult->fetch_assoc();
|
|---|
| 282 | $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'],
|
|---|
| 283 | array('Name' => $Form->Values['Name'], 'AddressStreet' => $Form->Values['AddressStreet'],
|
|---|
| 284 | 'AddressTown' => $Form->Values['AddressTown'], 'AddressCountry' => $Form->Values['AddressCountry'],
|
|---|
| 285 | 'AddressPSC' => $Form->Values['AddressPSC'], 'IC' => $Form->Values['IC'],
|
|---|
| 286 | 'DIC' => $Form->Values['DIC']));
|
|---|
| 287 | $Output .= $this->SystemMessage('Nastavení', 'Nastavení zákazníka uloženo.');
|
|---|
| 288 | ModuleLog::Cast($this->System->GetModule('Log'))->NewRecord('Member+Subject', 'Nastavení zákazníka/subjektu změněno',
|
|---|
| 289 | $Form->Values['Name']);
|
|---|
| 290 | $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, '.
|
|---|
| 291 | 'Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, '.
|
|---|
| 292 | 'Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
|
|---|
| 293 | 'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerId);
|
|---|
| 294 | $DbRow = $DbResult->fetch_array();
|
|---|
| 295 | foreach ($Form->Definition['Items'] as $Index => $Item)
|
|---|
| 296 | {
|
|---|
| 297 | $Form->Values[$Index] = $DbRow[$Index];
|
|---|
| 298 | }
|
|---|
| 299 | $Form->OnSubmit = '?Action=MemberOptionsSave';
|
|---|
| 300 | $Output .= $Form->ShowEditForm();
|
|---|
| 301 | }
|
|---|
| 302 | } else $Output = $this->ShowMain();
|
|---|
| 303 | return $Output;
|
|---|
| 304 | }
|
|---|
| 305 |
|
|---|
| 306 | function ShowMain(): string
|
|---|
| 307 | {
|
|---|
| 308 | $Output = '';
|
|---|
| 309 | $DbResult = $this->Database->query('SELECT * FROM `ActionGroup`');
|
|---|
| 310 | $ActionGroups = array();
|
|---|
| 311 | while ($DbRow = $DbResult->fetch_assoc())
|
|---|
| 312 | $ActionGroups[$DbRow['Id']] = $DbRow;
|
|---|
| 313 |
|
|---|
| 314 | // Show pannels
|
|---|
| 315 | //if (IsInternetAddr()) echo('Internet'); else echo('LAN');
|
|---|
| 316 | //$Output .= $this->InfoBar();
|
|---|
| 317 | $Output .= '<table id="MainTable"><tr>';
|
|---|
| 318 | $DbResult = $this->Database->select('PanelColumn', '*');
|
|---|
| 319 | while ($PanelColumn = $DbResult->fetch_assoc())
|
|---|
| 320 | {
|
|---|
| 321 | if ($PanelColumn != '') $Width = ' width="'.$PanelColumn['Width'].'"';
|
|---|
| 322 | else $Width = '';
|
|---|
| 323 | $Output .= '<td valign="top"'.$Width.'>';
|
|---|
| 324 | $DbResult2 = $this->Database->query('SELECT * FROM `Panel` WHERE `PanelColumn`='.$PanelColumn['Id'].' ORDER BY `Order`');
|
|---|
| 325 | while ($Panel = $DbResult2->fetch_assoc())
|
|---|
| 326 | {
|
|---|
| 327 | if ($Panel['Module'] == 'ActionGroup') $Output .= $this->ShowActions($ActionGroups[$Panel['Parameters']]);
|
|---|
| 328 | else if ($Panel['Module'] == 'OnlineHostList') $Output .= $this->Panel('Online počítače', $this->OnlineHostList());
|
|---|
| 329 | else if ($Panel['Module'] == 'UserOptions')
|
|---|
| 330 | {
|
|---|
| 331 | //if (ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'] != null) $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel());
|
|---|
| 332 | } else
|
|---|
| 333 | if ($Panel['Module'] == 'Webcam') $Output .= $this->Panel('Kamery', $this->WebcamPanel());
|
|---|
| 334 | if ($Panel['Module'] == 'Meteo') $Output .= $this->Panel('Meteostanice', $this->MeteoPanel());
|
|---|
| 335 | else if ($Panel['Module'] == 'NewsGroupList')
|
|---|
| 336 | $Output .= $this->Panel('Aktuality', ModuleNews::Cast($this->System->GetModule('News'))->Show(), array('<a href="?Action=CustomizeNews">Upravit</a>'));
|
|---|
| 337 | }
|
|---|
| 338 | $Output .= '</td>';
|
|---|
| 339 | }
|
|---|
| 340 | $Output .= '</tr></table>';
|
|---|
| 341 | return $Output;
|
|---|
| 342 | }
|
|---|
| 343 | }
|
|---|