Changeset 581


Ignore:
Timestamp:
Oct 14, 2013, 12:26:30 AM (11 years ago)
Author:
chronos
Message:
  • Přidáno: Možnost určovat položky formulářových typů jako virtuální zadané jako SQL poddotaz.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Form/Form.php

    r570 r581  
    136136            $UseType = 'Enumeration';
    137137        } else $UseType = $Item['Type'];
     138      if(!array_key_exists('SQL', $Item)) $Item['SQL'] = '';
     139        else $Item['SQL'] = str_replace('#Id', $Id, $Item['SQL']);
    138140      $Columns[] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterNameQuery',
    139         array('Name' => $Index, 'Type' => $Item['Type']));
     141        array('Name' => $Index, 'Type' => $Item['Type'], 'SQL' => $Item['SQL']));
    140142    }
    141143    $Columns = implode(',', $Columns);
     
    227229            $this->FormManager->Type->RegisterType($Item['Type'], '',
    228230              $this->FormManager->FormTypes[$Item['Type']]);
    229           if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    230             $UseType = 'OneToMany';
    231           else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     231          $CustomType = $this->FormManager->FormTypes[$Item['Type']]['Type'];
     232          if($CustomType == 'Reference')
     233            $UseType = 'OneToMany';
     234          else if($CustomType == 'Enumeration')
    232235            $UseType = 'Enumeration';
    233236        } else $UseType = $Item['Type'];
  • trunk/Common/Form/Types/Base.php

    r548 r581  
    4747  function OnFilterName($Item)
    4848  {
    49     return('`'.$Item['Name'].'`');
     49    if($Item['SQL'] != '') $SQL = '('.$Item['SQL'].') AS ';
     50      else $SQL = '';
     51    return($SQL.'`'.$Item['Name'].'`');
    5052  }
    5153
    5254  function OnFilterNameQuery($Item)
    5355  {
    54     return('`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`');
     56    if($Item['SQL'] != '')
     57      $Output = '('.$Item['SQL'].') AS `'.$Item['Name'].'`, ('.$Item['SQL'].') AS `'.$Item['Name'].'_Filter`';
     58      else $Output = '`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`';
     59    return($Output);
    5560  }
    5661}
  • trunk/Common/System.php

    r578 r581  
    137137    //$this->ModuleManager->Modules['Setup']->Start();
    138138    $this->ModuleManager->LoadModules();
     139    $this->ModuleManager->Modules['Setup']->Start();
    139140    $this->ModuleManager->StartAll();
    140141    if($this->ShowPage)
  • trunk/Common/Version.php

    r578 r581  
    11<?php
    22
    3 $Revision = 578; // Subversion revision
     3$Revision = 581; // Subversion revision
    44$DatabaseRevision = 574; // SQL structure revision
    5 $ReleaseTime = '2013-10-10';
     5$ReleaseTime = '2013-10-14';
  • trunk/Modules/Finance/Finance.php

    r573 r581  
    408408        'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
    409409        'TimeCreate' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),
     410        'State' => array('Type' => 'Float', 'Caption' => 'Stav', 'Default' => '',
     411          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value`) FROM `FinanceOperation` '.
     412          'WHERE `FinanceOperation`.`Treasury`=#Id)'),
    410413      ),
    411414    ));
     
    427430        'LastImportDate' => array('Type' => 'Date', 'Caption' => 'Datum posledního importu', 'Default' => ''),
    428431        'LastImportId' => array('Type' => 'String', 'Caption' => 'Id posledního importu', 'Default' => ''),
     432        'State' => array('Type' => 'Float', 'Caption' => 'Stav', 'Default' => '',
     433          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value`) FROM `FinanceOperation` '.
     434          'WHERE `FinanceOperation`.`BankAccount`=#Id)'),
    429435      ),
    430436      'ItemActions' => array(
  • trunk/Modules/IS/IS.php

    r574 r581  
    282282          else $Value = '';       
    283283        if($ItemIndex == 'Id') unset($Columns['Id']);
     284       
     285        if(!array_key_exists('SQL', $FormItem)) $FormItem['SQL'] = '';
     286          else $FormItem['SQL'] = str_replace('#Id', '`'.$FormClass['Table'].'`.`Id`', $FormItem['SQL']);
    284287        $Columns[] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterNameQuery',
    285288          array('Value' => $Value, 'Name' => $ItemIndex,
    286               'Type' => $FormItem['Type']));
     289            'Type' => $FormItem['Type'], 'SQL' => $FormItem['SQL']));
    287290      }
    288291     
     
    332335   
    333336    // Load and show items
    334     $Query = 'SELECT * FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '.$Filter.' '.$Order['SQL'].$PageList['SQLLimit'];   
     337    $Query = 'SELECT * FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '.
     338      $Filter.' '.$Order['SQL'].$PageList['SQLLimit'];   
    335339    $VisibleItemCount = 0;
    336340    $DbResult = $this->Database->query($Query);
     
    465469      }
    466470      if($MenuItem['IconName'] != '') $Image = '<img src="../images/favicons/'.$MenuItem['IconName'].'"/>&nbsp;';
    467         else $Image = '';
     471        else $Image = '<img src="../images/favicons/blank.png"/>&nbsp;';
    468472      $Output .= '<li>'.$Image.$LinkTitle.'</li>';
    469473      $Output .= $this->ShowMenuItem($MenuItem['Id']);
  • trunk/Modules/Network/Network.php

    r572 r581  
    132132   
    133133    $this->System->FormManager->RegisterClass('Subject', array(
    134         'Title' => 'Subjekty',
    135         'Table' => 'Subject',
    136         'DefaultSortColumn' => 'Name',
    137         'Items' => array(
    138             'Id' => array('Type' => 'Integer', 'Caption' => 'Identifikace', 'Default' => '', 'ReadOnly' => true),
    139             'Name' => array('Type' => 'String', 'Caption' => 'Celé jméno', 'Default' => ''),
    140             'AddressStreet' => array('Type' => 'String', 'Caption' => 'Ulice', 'Default' => ''),
    141             'AddressTown' => array('Type' => 'String', 'Caption' => 'Město', 'Default' => ''),
    142             'AddressPSC' => array('Type' => 'String', 'Caption' => 'PSČ', 'Default' => ''),
    143             'AddressCountry' => array('Type' => 'TCountry', 'Caption' => 'Země', 'Default' => ''),
    144             'IC' => array('Type' => 'String', 'Caption' => 'IČ', 'Default' => ''),
    145             'DIC' => array('Type' => 'String', 'Caption' => 'DIČ', 'Default' => ''),
    146             'MapPosition' => array('Type' => 'TMapPosition', 'Caption' => 'Pozice na mapě', 'Default' => '', 'Null' => true),
    147             'WWW' => array('Type' => 'Hyperlink', 'Caption' => 'WWW', 'Default' => ''),
    148             'Note' => array('Type' => 'String', 'Caption' => 'Poznámka', 'Default' => ''),
    149             'Customer' => array('Type' => 'TMemberListSubject', 'Caption' => 'Členové', 'Default' => ''),
    150             'Operations' => array('Type' => 'TFinanceOperationListSubject', 'Caption' => 'Platby', 'Default' => ''),
    151             'Invoices' => array('Type' => 'TFinanceInvoiceListSubject', 'Caption' => 'Faktury', 'Default' => ''),
    152         ),
     134      'Title' => 'Subjekty',
     135      'Table' => 'Subject',
     136      'DefaultSortColumn' => 'Name',
     137      'Items' => array(
     138        'Id' => array('Type' => 'Integer', 'Caption' => 'Identifikace', 'Default' => '', 'ReadOnly' => true),
     139        'Name' => array('Type' => 'String', 'Caption' => 'Celé jméno', 'Default' => ''),
     140        'AddressStreet' => array('Type' => 'String', 'Caption' => 'Ulice', 'Default' => ''),
     141        'AddressTown' => array('Type' => 'String', 'Caption' => 'Město', 'Default' => ''),
     142        'AddressPSC' => array('Type' => 'String', 'Caption' => 'PSČ', 'Default' => ''),
     143        'AddressCountry' => array('Type' => 'TCountry', 'Caption' => 'Země', 'Default' => ''),
     144        'IC' => array('Type' => 'String', 'Caption' => 'IČ', 'Default' => ''),
     145        'DIC' => array('Type' => 'String', 'Caption' => 'DIČ', 'Default' => ''),
     146        'MapPosition' => array('Type' => 'TMapPosition', 'Caption' => 'Pozice na mapě', 'Default' => '', 'Null' => true),
     147        'WWW' => array('Type' => 'Hyperlink', 'Caption' => 'WWW', 'Default' => ''),
     148        'Note' => array('Type' => 'String', 'Caption' => 'Poznámka', 'Default' => ''),
     149        'Customer' => array('Type' => 'TMemberListSubject', 'Caption' => 'Členové', 'Default' => ''),
     150        'Operations' => array('Type' => 'TFinanceOperationListSubject', 'Caption' => 'Platby', 'Default' => ''),
     151        'Invoices' => array('Type' => 'TFinanceInvoiceListSubject', 'Caption' => 'Faktury', 'Default' => ''),
     152        'Payment' => array('Type' => 'Float', 'Caption' => 'Placení', 'Default' => '',
     153          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value`) FROM `FinanceOperation` '.
     154          'WHERE `FinanceOperation`.`Subject`=#Id) - (SELECT SUM(`FinanceInvoice`.`Value`) FROM `FinanceInvoice` '.
     155          'WHERE `FinanceInvoice`.`Subject`=#Id)'),
     156      ),
    153157    ));
    154158    $this->System->FormManager->RegisterClass('NetworkDomainAlias', array(
  • trunk/Modules/Portal/Portal.php

    r568 r581  
    22
    33include_once(dirname(__FILE__).'/../../Common/Global.php');
    4 
    5 class PagePortal extends Page
    6 {
    7   var $FullTitle = 'Zděchovský rozcestník';
    8   var $ShortTitle = 'Rozcestník';
    9  
    10   function ShowActions($ActionGroup)
    11   {
    12     $Output = '';
    13     $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
    14       'WHERE (`Group`='.$ActionGroup['Id'].') AND (`Enable` = 1)');
    15     while($Action = $DbResult->fetch_assoc())
    16     {
    17       if($Action['Icon'] == '') $Action['Icon'] = 'clear.png';
    18         if(substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = $this->System->Link($Action['URL']);
    19         if(($Action['PermissionModule'] == '') or (($Action['PermissionModule'] != '') and $this->System->User->User->CheckPermission($Action['PermissionModule'], $Action['PermissionOperation'])))       
    20         $Output .= '<img alt="'.$Action['Title'].'" src="images/favicons/'.$Action['Icon'].'" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a><br />';
    21     }
    22     return($this->Panel($ActionGroup['Name'], $Output));
    23   }
    24 
    25   function InfoBar()
    26   {
    27     $Output2 = '';
    28 
    29     $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDeviceType.ShowOnline = 1');
    30     $DbRow = $DbResult->fetch_array();
    31     $TotalComputers = $DbRow[0];
    32 
    33     $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE (NetworkDeviceType.ShowOnline = 1) AND (NetworkDevice.Online = 1)');
    34     $DbRow = $DbResult->fetch_array();   
    35     $OnlineComputers = $DbRow[0];
    36 
    37     $Output = '<img alt="" src="images/favicons/comp.png" width="16" height="16" /> '.$OnlineComputers.' / '.$TotalComputers.' &nbsp;  &nbsp; ';
    38 
    39     $DbResult = $this->Database->select('Member', 'COUNT(*)', '1');
    40     $DbRow = $DbResult->fetch_array();
    41     $TotalUser = $DbRow[0];
    42 
    43     $DbResult = $this->Database->query('SELECT COUNT(DISTINCT(Member)) FROM NetworkDevice '.
    44       'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type '.
    45       'WHERE NetworkDeviceType.ShowOnline = 1 AND NetworkDevice.Online = 1');
    46     $DbRow = $DbResult->fetch_array();
    47     $OnlineUser = $DbRow[0];
    48 
    49     $Output .= '<img alt="" src="images/favicons/house.png" width="16" height="16" /> '.$OnlineUser.' / '.$TotalUser.' &nbsp;  &nbsp; ';
    50 
    51     $NetworkUsage = 0;
    52     $Output .= '<img alt="" src="images/favicons/usage.png" width="16" height="16" /> '.$NetworkUsage.' % &nbsp;  &nbsp; ';
    53 
    54     //$Output .= 'Server běží: '.$this->GetServerUptime().' &nbsp;  &nbsp; ';
    55 
    56     if($this->System->User->CheckPermission('Finance', 'DisplaySubjectState'))
    57     {
    58       $DbResult = $this->Database->select('MemberPayment', 'Cash', 'Member=(SELECT Customer FROM UserCustomerRel WHERE Id='.$this->System->User->User['Id'].')');
    59       if($DbResult->num_rows > 0)
    60       {
    61         $DbRow = $DbResult->fetch_assoc();
    62         $Output2 .= ' &nbsp;  &nbsp; <img alt="" src="images/favicons/money.png" width="16" height="16" /> '.$DbRow['Cash'].' Kč';
    63       }
    64     }
    65 
    66     $Output = '<div class="Navigation"><span class="MenuItem">'.$Output.'</span><div class="MenuItem2">&nbsp;'.$Output2.'</div></div>';
    67     return($Output);
    68   }
    69 
    70   function UserPanel()
    71   {
    72     $Output = '<a href="'.$this->System->Link('/?Action=UserOptions').'">Profil</a><br />';
    73     if($this->System->User->CheckPermission('Finance', 'MemberOptions'))
    74       $Output .= '<a href="'.$this->System->Link('/?Action=MemberOptions').'">Domácnost</a><br />';
    75     if($this->System->User->CheckPermission('Finance', 'DisplaySubjectState'))
    76       $Output .= '<a href="'.$this->System->Link('/finance/platby/').'">Finance</a><br />';
    77     if($this->System->User->CheckPermission('Network', 'RegistredHostList'))
    78       $Output .= '<a href="'.$this->System->Link('/network/user-hosts/').'">Počítače</a><br />';
    79     if($this->System->User->CheckPermission('News', 'Insert'))
    80       $Output .= '<a href="'.$this->System->Link('/aktuality/?action=add').'">Vložení aktuality</a><br />';
    81     if($this->System->User->CheckPermission('EatingPlace', 'Edit'))
    82       $Output .= '<a href="'.$this->System->Link('/jidelna/menuedit.php').'">Úprava jídelníčků</a><br />';
    83     if($this->System->User->CheckPermission('Finance', 'Manage'))
    84       $Output .= '<a href="'.$this->System->Link('/finance/sprava/').'">Správa financí</a><br />';
    85     if($this->System->User->CheckPermission('IS', 'Manage'))
    86       $Output .= '<a href="'.$this->System->Link('/is/').'">Správa dat</a><br />';
    87     return($Output);
    88   }
    89 
    90   function WebcamPanel()
    91   {
    92     $Output = $this->System->ModuleManager->Modules['WebCam']->ShowImage();
    93     return($Output);
    94   }
    95 
    96   function OnlineHostList()
    97   {
    98     $Output = '<span style="font-size: smaller;">';
    99     $DbResult = $this->Database->query('SELECT NetworkDevice.Name FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE (NetworkDeviceType.ShowOnline = 1) AND (NetworkDevice.Online = 1) ORDER BY NetworkDevice.Name');
    100     while($Device = $DbResult->fetch_array())
    101     {
    102       $Output .= $Device['Name'].'<br />';
    103     }
    104     $Output .= '</span>';
    105     return($Output);
    106   }
    107 
    108   function ShowBadPayerList()
    109   {
    110     $Output .= '<div class="PanelTitle">Dlužníci:</div><span style="font-size: smaller;">';
    111     $DbResult = $Database->select('Subject', 'Name', 'Money < 0 ORDER BY Money');
    112     while($Row = $DbResult->fetch_array())
    113     {
    114       $Output .= $Row['Name'].'<br />';
    115     }
    116     $Output .= '</span>';
    117     return($Output);
    118   }
    119    
    120   function Panel($Title, $Content, $Menu = array())
    121   {
    122     if(count($Menu) > 0)
    123       foreach($Menu as $Item)
    124         $Title .= '<div class="Action">'.$Item.'</div>';
    125     return('<div class="Panel"><div class="Title">'.$Title.'</div><div class="Content">'.$Content.'</div></div>');
    126   }
    127 
    128   function Show()
    129   {
    130     $Output = '';
    131     if(array_key_exists('Action', $_GET))
    132     {
    133       $Action = $_GET['Action'];
    134       if($Action == 'CustomizeNewsSave')
    135       {
    136         $Output .= $this->System->ModuleManager->Modules['News']->CustomizeSave();
    137       } else
    138       if($Action == 'LoginForm')
    139       {
    140         $Form = new Form($this->System->FormManager);
    141         $Form->SetClass('UserLogin');
    142         $Form->OnSubmit = '?Action=Login';
    143         $Output .= $Form->ShowEditForm();
    144         $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.
    145         '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
    146       } else
    147       if($Action == 'Login')
    148       {
    149         if(array_key_exists('Username', $_POST) and array_key_exists('Password', $_POST))
    150         {
    151           $Form = new Form($this->System->FormManager);
    152           $Form->SetClass('UserLogin');
    153           $Form->OnSubmit = '?Action=Login';
    154           $Result = $this->System->User->Login($_POST['Username'], $_POST['Password']);
    155           $Output .= $this->SystemMessage('Přihlášení', $Result);
    156           if($Result <> USER_LOGGED_IN)
    157           {
    158             $Form->LoadValuesFromForm();
    159             $Form->Values['Password'] = '';
    160             $Output .= $Form->ShowEditForm();
    161             $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.
    162               '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
    163           } else {
    164             //$Output .= '<div class="Centred">Za 5 sekund budete přesměrováni na <a href="?Action=UserMenu">nabídku uživatele</a></div>';
    165             //Header('refresh:5;url=?Action=UserMenu');
    166             Header('Location: ?Action=UserMenu');
    167           }
    168         } else $Output .= $this->SystemMessage('Přihlášení', 'Nezadány přihlašovací údaje');
    169       } else
    170       if($Action == 'Logout')
    171       {
    172         if($this->System->User->User['Id'] != null)
    173         {
    174           $Output .= $this->SystemMessage('Odhlášení', $this->System->User->Logout());
    175         } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');
    176       } else
    177       if($Action == 'UserOptions')
    178       {
    179         if($this->System->User->User['Id'] != null)
    180         {
    181           $Form = new Form($this->System->FormManager);
    182           $Form->SetClass('UserOptions');
    183           $Form->LoadValuesFromDatabase($this->System->User->User['Id']);
    184           $Form->OnSubmit = '?Action=UserOptionsSave';
    185           $Output .= $Form->ShowEditForm();
    186         } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');
    187       } else
    188       if($Action == 'UserOptionsSave')
    189       {
    190         $Form = new Form($this->System->FormManager);
    191         $Form->SetClass('UserOptions');
    192         $Form->LoadValuesFromForm();
    193         $Form->SaveValuesToDatabase($this->System->User->User['Id']);
    194         $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.');
    195         $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $Form->Values['Name']);
    196         $Form->LoadValuesFromDatabase($this->System->User->User['Id']);
    197         $Form->OnSubmit = '?Action=UserOptionsSave';
    198         $Output .= $Form->ShowEditForm();
    199       } else
    200       if($Action == 'UserRegister')
    201       {
    202         $Form = new Form($this->System->FormManager);
    203         $Form->SetClass('UserRegister');
    204         //$Form->LoadValuesFromForm();
    205         $Form->OnSubmit = '?Action=UserRegisterSave';
    206         $Output .= $Form->ShowEditForm();
    207       } else
    208       if($Action == 'UserRegisterConfirm')
    209       {
    210         $Output .= $this->SystemMessage('Potvrzení registrace',
    211           $this->System->User->RegisterConfirm($_GET['User'], $_GET['H']));
    212       } else
    213       if($Action == 'PasswordRecovery')
    214       {
    215         $Form = new Form($this->System->FormManager);
    216         $Form->SetClass('PasswordRecovery');
    217         $Form->OnSubmit = '?Action=PasswordRecovery2';
    218         $Output .= $Form->ShowEditForm();
    219       } else
    220       if($Action == 'PasswordRecovery2')
    221       {
    222         $Form = new Form($this->System->FormManager);
    223         $Form->SetClass('PasswordRecovery');
    224         $Form->LoadValuesFromForm();
    225         $Result = $this->System->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
    226         $Output .= $this->SystemMessage('Obnova hesla', $Result);
    227         if($Result <> USER_PASSWORD_RECOVERY_SUCCESS)
    228         {
    229           $Output .= $Form->ShowEditForm();
    230         }       
    231       } else
    232       if($Action == 'PasswordRecoveryConfirm')
    233       {
    234         $Output .= $this->SystemMessage('Obnova hesla', $this->System->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));
    235       } else
    236       if($Action == 'UserRegisterSave')
    237       {
    238         $Form = new Form($this->System->FormManager);
    239         $Form->SetClass('UserRegister');
    240         $Form->LoadValuesFromForm();
    241         $Result = $this->System->User->Register($Form->Values['Login'], $Form->Values['Password'],
    242           $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']);
    243         $Output .= $this->SystemMessage('Registrace nového účtu', $Result);
    244         if($Result <> USER_REGISTRATED)
    245         {
    246           $Form->OnSubmit = '?Action=UserRegisterSave';
    247           $Output .= $Form->ShowEditForm();
    248         }
    249       } else
    250       if($Action == 'MemberOptions')
    251       {
    252         $Form = new Form($this->System->FormManager);
    253         $Form->SetClass('MemberOptions');
    254         $DbResult = $this->Database->query('SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->User->User['Id']);
    255         if($DbResult->num_rows > 0)
    256         {
    257           $CustomerUserRel = $DbResult->fetch_assoc();
    258           $DbResult = $this->Database->query('SELECT Member.Id, '.
    259             'Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, '.
    260             'Subject.AddressTown, Subject.AddressPSC, Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
    261            'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerUserRel['Customer']);       
    262           $DbRow = $DbResult->fetch_array();
    263           foreach($Form->Definition['Items'] as $Index => $Item)
    264           {
    265             $Form->Values[$Index] = $DbRow[$Index];
    266           }
    267           $Form->OnSubmit = '?Action=MemberOptionsSave';
    268           $Output .= $Form->ShowEditForm();
    269         } else $Output .= $this->SystemMessage('Chyba', 'Nejste zákazníkem');
    270       } else
    271       if($Action == 'MemberOptionsSave')
    272       {
    273         $Form = new Form($this->System->FormManager);
    274         $Form->SetClass('MemberOptions');
    275         $Form->LoadValuesFromForm();
    276         if($Form->Values['FamilyMemberCount'] < 0)
    277           $Form->Values['FamilyMemberCount'] = 0;
    278         if($Form->Values['BillingPeriodNext'] < 2)
    279           $Form->Values['BillingPeriodNext'] = 2;
    280          
    281         $DbResult = $this->Database->update('Member', 'Id='.$this->System->User->User['Member'],
    282            array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'],
    283            'BillingPeriodNext' => $Form->Values['BillingPeriodNext']));
    284         $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->User->User['Member']);
    285         $Member = $DbResult->fetch_assoc();
    286         $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'],
    287           array('Name' => $Form->Values['Name'], 'AddressStreet' => $Form->Values['AddressStreet'],
    288           'AddressTown' => $Form->Values['AddressTown'], 'AddressCountry' => $Form->Values['AddressCountry'],
    289           'AddressPSC' => $Form->Values['AddressPSC'], 'IC' => $Form->Values['IC'],
    290           'DIC' => $Form->Values['DIC']));
    291         $Output .= $this->SystemMessage('Nastavení', 'Nastavení domácnosti uloženo.');
    292         $this->System->ModuleManager->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno',
    293           $Form->Values['Name']);
    294         $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, Member.BillingPeriodNext, '.
    295           'Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, '.
    296           'Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
    297           'ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->User->User['Member']);
    298         $DbRow = $DbResult->fetch_array();
    299         foreach($Form->Definition['Items'] as $Index => $Item)
    300         {
    301           $Form->Values[$Index] = $DbRow[$Index];
    302         }
    303         $Form->OnSubmit = '?Action=MemberOptionsSave';
    304         $Output .= $Form->ShowEditForm();
    305       } else
    306       if($Action == 'UserMenu')
    307       {
    308         $Output = $this->ShowUserPanel();
    309       } else $Output = $this->ShowMain();
    310     } else $Output = $this->ShowMain();
    311     return($Output);
    312   }
    313    
    314   function ShowMain()
    315   {
    316     $Output = '';
    317     $DbResult = $this->Database->query('SELECT * FROM `ActionGroup`');
    318     while($DbRow = $DbResult->fetch_assoc())
    319       $ActionGroups[$DbRow['Id']] = $DbRow;
    320 
    321     // Show pannels
    322     //if(IsInternetAddr()) echo('Internet'); else echo('LAN');
    323     //$Output .= $this->InfoBar();
    324     $Output .= '<table id="MainTable"><tr>';
    325     $DbResult = $this->Database->select('PanelColumn', '*');
    326     while($PanelColumn =  $DbResult->fetch_assoc())
    327     {
    328       if($PanelColumn != '') $Width = ' width="'.$PanelColumn['Width'].'"';
    329         else $Width = '';
    330       $Output .= '<td valign="top"'.$Width.'>';
    331       $DbResult2 = $this->Database->query('SELECT * FROM `Panel` WHERE `PanelColumn`='.$PanelColumn['Id'].' ORDER BY `Order`');
    332       while($Panel = $DbResult2->fetch_assoc())
    333       {
    334         if($Panel['Module'] == 'ActionGroup') $Output .= $this->ShowActions($ActionGroups[$Panel['Parameters']]);
    335         else if($Panel['Module'] == 'OnlineHostList') $Output .= $this->Panel('Online počítače', $this->OnlineHostList());
    336         else if($Panel['Module'] == 'UserOptions')
    337         {
    338           //if($this->System->User->User['Id'] != null) $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel());
    339         } else
    340         if($Panel['Module'] == 'Webcam') $Output .= $this->Panel('Kamery', $this->WebcamPanel());
    341         else if($Panel['Module'] == 'NewsGroupList')
    342           $Output .= $this->Panel('Aktuality', $this->System->ModuleManager->Modules['News']->Show(), array('<a href="?Action=CustomizeNews">Upravit</a>'));
    343       }
    344       $Output .= '</td>';
    345     } 
    346     $Output .= '</tr></table>';
    347     return($Output);
    348   }
    349  
    350   function ShowUserPanel()
    351   {
    352     $Output = '';
    353     if($this->System->User->User['Id'] != null)
    354     {
    355       $Output .= '<div class="Centred"><table id="MainTable"><tr><td>';
    356       $Output .= $this->Panel('Nabídka uživatele', $this->UserPanel());
    357       $Output .= '</td><td>';
    358       //$Output .= $this->Panel('Přehled', $this->UserPanel());
    359       $Output .= '</td></tr></table></div>';
    360     } else $Output .= $this->SystemMessage('Oprávnění', 'Nejste přihlášen');
    361     return($Output);
    362   }
    363 }
    3644
    3655class ModulePortal extends AppModule
     
    45696  }
    45797}
     98
     99class PagePortal extends Page
     100{
     101  var $FullTitle = 'Zděchovský rozcestník';
     102  var $ShortTitle = 'Rozcestník';
     103 
     104  function ShowActions($ActionGroup)
     105  {
     106    $Output = '';
     107    $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
     108      'WHERE (`Group`='.$ActionGroup['Id'].') AND (`Enable` = 1)');
     109    while($Action = $DbResult->fetch_assoc())
     110    {
     111      if($Action['Icon'] == '') $Action['Icon'] = 'clear.png';
     112        if(substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = $this->System->Link($Action['URL']);
     113        if(($Action['PermissionModule'] == '') or (($Action['PermissionModule'] != '') and $this->System->User->User->CheckPermission($Action['PermissionModule'], $Action['PermissionOperation'])))       
     114        $Output .= '<img alt="'.$Action['Title'].'" src="images/favicons/'.$Action['Icon'].'" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a><br />';
     115    }
     116    return($this->Panel($ActionGroup['Name'], $Output));
     117  }
     118
     119  function InfoBar()
     120  {
     121    $Output2 = '';
     122
     123    $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDeviceType.ShowOnline = 1');
     124    $DbRow = $DbResult->fetch_array();
     125    $TotalComputers = $DbRow[0];
     126
     127    $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE (NetworkDeviceType.ShowOnline = 1) AND (NetworkDevice.Online = 1)');
     128    $DbRow = $DbResult->fetch_array();   
     129    $OnlineComputers = $DbRow[0];
     130
     131    $Output = '<img alt="" src="images/favicons/comp.png" width="16" height="16" /> '.$OnlineComputers.' / '.$TotalComputers.' &nbsp;  &nbsp; ';
     132
     133    $DbResult = $this->Database->select('Member', 'COUNT(*)', '1');
     134    $DbRow = $DbResult->fetch_array();
     135    $TotalUser = $DbRow[0];
     136
     137    $DbResult = $this->Database->query('SELECT COUNT(DISTINCT(Member)) FROM NetworkDevice '.
     138      'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type '.
     139      'WHERE NetworkDeviceType.ShowOnline = 1 AND NetworkDevice.Online = 1');
     140    $DbRow = $DbResult->fetch_array();
     141    $OnlineUser = $DbRow[0];
     142
     143    $Output .= '<img alt="" src="images/favicons/house.png" width="16" height="16" /> '.$OnlineUser.' / '.$TotalUser.' &nbsp;  &nbsp; ';
     144
     145    $NetworkUsage = 0;
     146    $Output .= '<img alt="" src="images/favicons/usage.png" width="16" height="16" /> '.$NetworkUsage.' % &nbsp;  &nbsp; ';
     147
     148    //$Output .= 'Server běží: '.$this->GetServerUptime().' &nbsp;  &nbsp; ';
     149
     150    if($this->System->User->CheckPermission('Finance', 'DisplaySubjectState'))
     151    {
     152      $DbResult = $this->Database->select('MemberPayment', 'Cash', 'Member=(SELECT Customer FROM UserCustomerRel WHERE Id='.$this->System->User->User['Id'].')');
     153      if($DbResult->num_rows > 0)
     154      {
     155        $DbRow = $DbResult->fetch_assoc();
     156        $Output2 .= ' &nbsp;  &nbsp; <img alt="" src="images/favicons/money.png" width="16" height="16" /> '.$DbRow['Cash'].' Kč';
     157      }
     158    }
     159
     160    $Output = '<div class="Navigation"><span class="MenuItem">'.$Output.'</span><div class="MenuItem2">&nbsp;'.$Output2.'</div></div>';
     161    return($Output);
     162  }
     163
     164  function UserPanel()
     165  {
     166    $Output = '<a href="'.$this->System->Link('/?Action=UserOptions').'">Profil</a><br />';
     167    if($this->System->User->CheckPermission('Finance', 'MemberOptions'))
     168      $Output .= '<a href="'.$this->System->Link('/?Action=MemberOptions').'">Domácnost</a><br />';
     169    if($this->System->User->CheckPermission('Finance', 'DisplaySubjectState'))
     170      $Output .= '<a href="'.$this->System->Link('/finance/platby/').'">Finance</a><br />';
     171    if($this->System->User->CheckPermission('Network', 'RegistredHostList'))
     172      $Output .= '<a href="'.$this->System->Link('/network/user-hosts/').'">Počítače</a><br />';
     173    if($this->System->User->CheckPermission('News', 'Insert'))
     174      $Output .= '<a href="'.$this->System->Link('/aktuality/?action=add').'">Vložení aktuality</a><br />';
     175    if($this->System->User->CheckPermission('EatingPlace', 'Edit'))
     176      $Output .= '<a href="'.$this->System->Link('/jidelna/menuedit.php').'">Úprava jídelníčků</a><br />';
     177    if($this->System->User->CheckPermission('Finance', 'Manage'))
     178      $Output .= '<a href="'.$this->System->Link('/finance/sprava/').'">Správa financí</a><br />';
     179    if($this->System->User->CheckPermission('IS', 'Manage'))
     180      $Output .= '<a href="'.$this->System->Link('/is/').'">Správa dat</a><br />';
     181    return($Output);
     182  }
     183
     184  function WebcamPanel()
     185  {
     186    $Output = $this->System->ModuleManager->Modules['WebCam']->ShowImage();
     187    return($Output);
     188  }
     189
     190  function OnlineHostList()
     191  {
     192    $Output = '<span style="font-size: smaller;">';
     193    $DbResult = $this->Database->query('SELECT NetworkDevice.Name FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE (NetworkDeviceType.ShowOnline = 1) AND (NetworkDevice.Online = 1) ORDER BY NetworkDevice.Name');
     194    while($Device = $DbResult->fetch_array())
     195    {
     196      $Output .= $Device['Name'].'<br />';
     197    }
     198    $Output .= '</span>';
     199    return($Output);
     200  }
     201
     202  function ShowBadPayerList()
     203  {
     204    $Output .= '<div class="PanelTitle">Dlužníci:</div><span style="font-size: smaller;">';
     205    $DbResult = $Database->select('Subject', 'Name', 'Money < 0 ORDER BY Money');
     206    while($Row = $DbResult->fetch_array())
     207    {
     208      $Output .= $Row['Name'].'<br />';
     209    }
     210    $Output .= '</span>';
     211    return($Output);
     212  }
     213   
     214  function Panel($Title, $Content, $Menu = array())
     215  {
     216    if(count($Menu) > 0)
     217      foreach($Menu as $Item)
     218        $Title .= '<div class="Action">'.$Item.'</div>';
     219    return('<div class="Panel"><div class="Title">'.$Title.'</div><div class="Content">'.$Content.'</div></div>');
     220  }
     221
     222  function Show()
     223  {
     224    $Output = '';
     225    if(array_key_exists('Action', $_GET))
     226    {
     227      $Action = $_GET['Action'];
     228      if($Action == 'CustomizeNewsSave')
     229      {
     230        $Output .= $this->System->ModuleManager->Modules['News']->CustomizeSave();
     231      } else
     232      if($Action == 'LoginForm')
     233      {
     234        $Form = new Form($this->System->FormManager);
     235        $Form->SetClass('UserLogin');
     236        $Form->OnSubmit = '?Action=Login';
     237        $Output .= $Form->ShowEditForm();
     238        $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.
     239        '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
     240      } else
     241      if($Action == 'Login')
     242      {
     243        if(array_key_exists('Username', $_POST) and array_key_exists('Password', $_POST))
     244        {
     245          $Form = new Form($this->System->FormManager);
     246          $Form->SetClass('UserLogin');
     247          $Form->OnSubmit = '?Action=Login';
     248          $Result = $this->System->User->Login($_POST['Username'], $_POST['Password']);
     249          $Output .= $this->SystemMessage('Přihlášení', $Result);
     250          if($Result <> USER_LOGGED_IN)
     251          {
     252            $Form->LoadValuesFromForm();
     253            $Form->Values['Password'] = '';
     254            $Output .= $Form->ShowEditForm();
     255            $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.
     256              '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
     257          } else {
     258            //$Output .= '<div class="Centred">Za 5 sekund budete přesměrováni na <a href="?Action=UserMenu">nabídku uživatele</a></div>';
     259            //Header('refresh:5;url=?Action=UserMenu');
     260            Header('Location: ?Action=UserMenu');
     261          }
     262        } else $Output .= $this->SystemMessage('Přihlášení', 'Nezadány přihlašovací údaje');
     263      } else
     264      if($Action == 'Logout')
     265      {
     266        if($this->System->User->User['Id'] != null)
     267        {
     268          $Output .= $this->SystemMessage('Odhlášení', $this->System->User->Logout());
     269        } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');
     270      } else
     271      if($Action == 'UserOptions')
     272      {
     273        if($this->System->User->User['Id'] != null)
     274        {
     275          $Form = new Form($this->System->FormManager);
     276          $Form->SetClass('UserOptions');
     277          $Form->LoadValuesFromDatabase($this->System->User->User['Id']);
     278          $Form->OnSubmit = '?Action=UserOptionsSave';
     279          $Output .= $Form->ShowEditForm();
     280        } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');
     281      } else
     282      if($Action == 'UserOptionsSave')
     283      {
     284        $Form = new Form($this->System->FormManager);
     285        $Form->SetClass('UserOptions');
     286        $Form->LoadValuesFromForm();
     287        $Form->SaveValuesToDatabase($this->System->User->User['Id']);
     288        $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.');
     289        $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $Form->Values['Name']);
     290        $Form->LoadValuesFromDatabase($this->System->User->User['Id']);
     291        $Form->OnSubmit = '?Action=UserOptionsSave';
     292        $Output .= $Form->ShowEditForm();
     293      } else
     294      if($Action == 'UserRegister')
     295      {
     296        $Form = new Form($this->System->FormManager);
     297        $Form->SetClass('UserRegister');
     298        //$Form->LoadValuesFromForm();
     299        $Form->OnSubmit = '?Action=UserRegisterSave';
     300        $Output .= $Form->ShowEditForm();
     301      } else
     302      if($Action == 'UserRegisterConfirm')
     303      {
     304        $Output .= $this->SystemMessage('Potvrzení registrace',
     305          $this->System->User->RegisterConfirm($_GET['User'], $_GET['H']));
     306      } else
     307      if($Action == 'PasswordRecovery')
     308      {
     309        $Form = new Form($this->System->FormManager);
     310        $Form->SetClass('PasswordRecovery');
     311        $Form->OnSubmit = '?Action=PasswordRecovery2';
     312        $Output .= $Form->ShowEditForm();
     313      } else
     314      if($Action == 'PasswordRecovery2')
     315      {
     316        $Form = new Form($this->System->FormManager);
     317        $Form->SetClass('PasswordRecovery');
     318        $Form->LoadValuesFromForm();
     319        $Result = $this->System->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
     320        $Output .= $this->SystemMessage('Obnova hesla', $Result);
     321        if($Result <> USER_PASSWORD_RECOVERY_SUCCESS)
     322        {
     323          $Output .= $Form->ShowEditForm();
     324        }       
     325      } else
     326      if($Action == 'PasswordRecoveryConfirm')
     327      {
     328        $Output .= $this->SystemMessage('Obnova hesla', $this->System->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));
     329      } else
     330      if($Action == 'UserRegisterSave')
     331      {
     332        $Form = new Form($this->System->FormManager);
     333        $Form->SetClass('UserRegister');
     334        $Form->LoadValuesFromForm();
     335        $Result = $this->System->User->Register($Form->Values['Login'], $Form->Values['Password'],
     336          $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']);
     337        $Output .= $this->SystemMessage('Registrace nového účtu', $Result);
     338        if($Result <> USER_REGISTRATED)
     339        {
     340          $Form->OnSubmit = '?Action=UserRegisterSave';
     341          $Output .= $Form->ShowEditForm();
     342        }
     343      } else
     344      if($Action == 'MemberOptions')
     345      {
     346        $Form = new Form($this->System->FormManager);
     347        $Form->SetClass('MemberOptions');
     348        $DbResult = $this->Database->query('SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->User->User['Id']);
     349        if($DbResult->num_rows > 0)
     350        {
     351          $CustomerUserRel = $DbResult->fetch_assoc();
     352          $DbResult = $this->Database->query('SELECT Member.Id, '.
     353            'Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, '.
     354            'Subject.AddressTown, Subject.AddressPSC, Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
     355           'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerUserRel['Customer']);       
     356          $DbRow = $DbResult->fetch_array();
     357          foreach($Form->Definition['Items'] as $Index => $Item)
     358          {
     359            $Form->Values[$Index] = $DbRow[$Index];
     360          }
     361          $Form->OnSubmit = '?Action=MemberOptionsSave';
     362          $Output .= $Form->ShowEditForm();
     363        } else $Output .= $this->SystemMessage('Chyba', 'Nejste zákazníkem');
     364      } else
     365      if($Action == 'MemberOptionsSave')
     366      {
     367        $Form = new Form($this->System->FormManager);
     368        $Form->SetClass('MemberOptions');
     369        $Form->LoadValuesFromForm();
     370        if($Form->Values['FamilyMemberCount'] < 0)
     371          $Form->Values['FamilyMemberCount'] = 0;
     372        if($Form->Values['BillingPeriodNext'] < 2)
     373          $Form->Values['BillingPeriodNext'] = 2;
     374         
     375        $DbResult = $this->Database->update('Member', 'Id='.$this->System->User->User['Member'],
     376           array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'],
     377           'BillingPeriodNext' => $Form->Values['BillingPeriodNext']));
     378        $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->User->User['Member']);
     379        $Member = $DbResult->fetch_assoc();
     380        $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'],
     381          array('Name' => $Form->Values['Name'], 'AddressStreet' => $Form->Values['AddressStreet'],
     382          'AddressTown' => $Form->Values['AddressTown'], 'AddressCountry' => $Form->Values['AddressCountry'],
     383          'AddressPSC' => $Form->Values['AddressPSC'], 'IC' => $Form->Values['IC'],
     384          'DIC' => $Form->Values['DIC']));
     385        $Output .= $this->SystemMessage('Nastavení', 'Nastavení domácnosti uloženo.');
     386        $this->System->ModuleManager->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno',
     387          $Form->Values['Name']);
     388        $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, Member.BillingPeriodNext, '.
     389          'Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, '.
     390          'Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
     391          'ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->User->User['Member']);
     392        $DbRow = $DbResult->fetch_array();
     393        foreach($Form->Definition['Items'] as $Index => $Item)
     394        {
     395          $Form->Values[$Index] = $DbRow[$Index];
     396        }
     397        $Form->OnSubmit = '?Action=MemberOptionsSave';
     398        $Output .= $Form->ShowEditForm();
     399      } else
     400      if($Action == 'UserMenu')
     401      {
     402        $Output = $this->ShowUserPanel();
     403      } else $Output = $this->ShowMain();
     404    } else $Output = $this->ShowMain();
     405    return($Output);
     406  }
     407   
     408  function ShowMain()
     409  {
     410    $Output = '';
     411    $DbResult = $this->Database->query('SELECT * FROM `ActionGroup`');
     412    while($DbRow = $DbResult->fetch_assoc())
     413      $ActionGroups[$DbRow['Id']] = $DbRow;
     414
     415    // Show pannels
     416    //if(IsInternetAddr()) echo('Internet'); else echo('LAN');
     417    //$Output .= $this->InfoBar();
     418    $Output .= '<table id="MainTable"><tr>';
     419    $DbResult = $this->Database->select('PanelColumn', '*');
     420    while($PanelColumn =  $DbResult->fetch_assoc())
     421    {
     422      if($PanelColumn != '') $Width = ' width="'.$PanelColumn['Width'].'"';
     423        else $Width = '';
     424      $Output .= '<td valign="top"'.$Width.'>';
     425      $DbResult2 = $this->Database->query('SELECT * FROM `Panel` WHERE `PanelColumn`='.$PanelColumn['Id'].' ORDER BY `Order`');
     426      while($Panel = $DbResult2->fetch_assoc())
     427      {
     428        if($Panel['Module'] == 'ActionGroup') $Output .= $this->ShowActions($ActionGroups[$Panel['Parameters']]);
     429        else if($Panel['Module'] == 'OnlineHostList') $Output .= $this->Panel('Online počítače', $this->OnlineHostList());
     430        else if($Panel['Module'] == 'UserOptions')
     431        {
     432          //if($this->System->User->User['Id'] != null) $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel());
     433        } else
     434        if($Panel['Module'] == 'Webcam') $Output .= $this->Panel('Kamery', $this->WebcamPanel());
     435        else if($Panel['Module'] == 'NewsGroupList')
     436          $Output .= $this->Panel('Aktuality', $this->System->ModuleManager->Modules['News']->Show(), array('<a href="?Action=CustomizeNews">Upravit</a>'));
     437      }
     438      $Output .= '</td>';
     439    } 
     440    $Output .= '</tr></table>';
     441    return($Output);
     442  }
     443 
     444  function ShowUserPanel()
     445  {
     446    $Output = '';
     447    if($this->System->User->User['Id'] != null)
     448    {
     449      $Output .= '<div class="Centred"><table id="MainTable"><tr><td>';
     450      $Output .= $this->Panel('Nabídka uživatele', $this->UserPanel());
     451      $Output .= '</td><td>';
     452      //$Output .= $this->Panel('Přehled', $this->UserPanel());
     453      $Output .= '</td></tr></table></div>';
     454    } else $Output .= $this->SystemMessage('Oprávnění', 'Nejste přihlášen');
     455    return($Output);
     456  }
     457}
  • trunk/ToDo.txt

    r557 r581  
    22======
    33
     4- Map: Aktualizovat na google maps api v3
    45- Meteostation: Čtení dat z meteostanice
    56- Finance: umožnit uzavření účetního roku
Note: See TracChangeset for help on using the changeset viewer.