Changeset 737 for trunk/Modules/Portal


Ignore:
Timestamp:
Apr 14, 2015, 10:16:16 PM (10 years ago)
Author:
chronos
Message:
  • Added: Experimental models internal database structure regeneration.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Portal/Portal.php

    r686 r737  
    1414    $this->Description = 'Community portal.';
    1515    $this->Dependencies = array('News');
    16   } 
     16  }
    1717
    1818  function DoInstall()
    1919  {
    2020  }
    21  
     21
    2222  function DoUninstall()
    23   {     
    24   }
    25  
     23  {
     24  }
     25
    2626  function DoStart()
    2727  {
     
    2929    $this->System->FormManager->RegisterClass('MemberOptions', array(
    3030      'Title' => 'Nastavení domácnosti',
    31       'Table' => '(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)',
     31      '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)',
     32      'Table' => 'MemberOptions',
    3233      'Items' => array(
    3334        'Name' => array('Type' => 'String', 'Caption' => 'Fakturační jméno', 'Default' => ''),
     
    4344    ));
    4445    $this->System->ModuleManager->Modules['User']->UserPanel[] = array('PagePortal', 'UserPanel');
    45   } 
    46  
     46  }
     47
    4748  function DoStop()
    48   { 
    49   } 
     49  {
     50  }
    5051}
    5152
     
    5455  var $FullTitle = 'Zděchovský rozcestník';
    5556  var $ShortTitle = 'Rozcestník';
    56  
     57
    5758  function ShowActions($ActionGroup)
    5859  {
    59     $Output = '';   
    60     $DbResult = $this->Database->query('SELECT `Id` FROM `Action` '.     
     60    $Output = '';
     61    $DbResult = $this->Database->query('SELECT `Id` FROM `Action` '.
    6162      'WHERE (`Action`.`Group`='.$ActionGroup['Id'].') AND (`Action`.`Enable` = 1)');
    6263    while($Action = $DbResult->fetch_assoc())
     
    7677
    7778    $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE (NetworkDeviceType.ShowOnline = 1) AND (NetworkDevice.Online = 1)');
    78     $DbRow = $DbResult->fetch_array();   
     79    $DbRow = $DbResult->fetch_array();
    7980    $OnlineComputers = $DbRow[0];
    8081
     
    115116  {
    116117    $Output = '<a href="'.$this->System->Link('/user/?Action=UserOptions').'">Profil</a><br />';
    117     if($this->System->User->CheckPermission('Finance', 'MemberOptions')) 
     118    if($this->System->User->CheckPermission('Finance', 'MemberOptions'))
    118119      $Output .= '<a href="'.$this->System->Link('/?Action=MemberOptions').'">Domácnost</a><br />';
    119     if($this->System->User->CheckPermission('Finance', 'DisplaySubjectState')) 
     120    if($this->System->User->CheckPermission('Finance', 'DisplaySubjectState'))
    120121      $Output .= '<a href="'.$this->System->Link('/finance/platby/').'">Finance</a><br />';
    121     if($this->System->User->CheckPermission('Network', 'RegistredHostList')) 
     122    if($this->System->User->CheckPermission('Network', 'RegistredHostList'))
    122123      $Output .= '<a href="'.$this->System->Link('/network/user-hosts/').'">Počítače</a><br />';
    123     if($this->System->User->CheckPermission('News', 'Insert')) 
     124    if($this->System->User->CheckPermission('News', 'Insert'))
    124125      $Output .= '<a href="'.$this->System->Link('/aktuality/?action=add').'">Vložení aktuality</a><br />';
    125126    if($this->System->User->CheckPermission('EatingPlace', 'Edit'))
     
    143144    return($Output);
    144145  }
    145  
     146
    146147  function OnlineHostList()
    147148  {
     
    167168    return($Output);
    168169  }
    169    
     170
    170171  function Panel($Title, $Content, $Menu = array())
    171172  {
    172     if(count($Menu) > 0) 
     173    if(count($Menu) > 0)
    173174      foreach($Menu as $Item)
    174175        $Title .= '<div class="Action">'.$Item.'</div>';
     
    197198            'Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, '.
    198199            'Subject.AddressTown, Subject.AddressPSC, Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
    199            'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerUserRel['Customer']);       
     200           'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerUserRel['Customer']);
    200201          $DbRow = $DbResult->fetch_array();
    201202          foreach($Form->Definition['Items'] as $Index => $Item)
     
    216217        if($Form->Values['BillingPeriodNext'] < 2)
    217218          $Form->Values['BillingPeriodNext'] = 2;
    218          
    219         $DbResult = $this->Database->update('Member', 'Id='.$this->System->User->User['Member'], 
    220            array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'], 
     219
     220        $DbResult = $this->Database->update('Member', 'Id='.$this->System->User->User['Member'],
     221           array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'],
    221222           'BillingPeriodNext' => $Form->Values['BillingPeriodNext']));
    222223        $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->User->User['Member']);
    223224        $Member = $DbResult->fetch_assoc();
    224         $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'], 
    225           array('Name' => $Form->Values['Name'], 'AddressStreet' => $Form->Values['AddressStreet'], 
     225        $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'],
     226          array('Name' => $Form->Values['Name'], 'AddressStreet' => $Form->Values['AddressStreet'],
    226227          'AddressTown' => $Form->Values['AddressTown'], 'AddressCountry' => $Form->Values['AddressCountry'],
    227           'AddressPSC' => $Form->Values['AddressPSC'], 'IC' => $Form->Values['IC'], 
     228          'AddressPSC' => $Form->Values['AddressPSC'], 'IC' => $Form->Values['IC'],
    228229          'DIC' => $Form->Values['DIC']));
    229230        $Output .= $this->SystemMessage('Nastavení', 'Nastavení domácnosti uloženo.');
    230         $this->System->ModuleManager->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno', 
     231        $this->System->ModuleManager->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno',
    231232          $Form->Values['Name']);
    232233        $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, Member.BillingPeriodNext, '.
     
    241242        $Form->OnSubmit = '?Action=MemberOptionsSave';
    242243        $Output .= $Form->ShowEditForm();
    243       } 
     244      }
    244245    } else $Output = $this->ShowMain();
    245246    return($Output);
    246247  }
    247    
     248
    248249  function ShowMain()
    249250  {
     
    260261    while($PanelColumn =  $DbResult->fetch_assoc())
    261262    {
    262       if($PanelColumn != '') $Width = ' width="'.$PanelColumn['Width'].'"'; 
     263      if($PanelColumn != '') $Width = ' width="'.$PanelColumn['Width'].'"';
    263264        else $Width = '';
    264265      $Output .= '<td valign="top"'.$Width.'>';
     
    268269        if($Panel['Module'] == 'ActionGroup') $Output .= $this->ShowActions($ActionGroups[$Panel['Parameters']]);
    269270        else if($Panel['Module'] == 'OnlineHostList') $Output .= $this->Panel('Online počítače', $this->OnlineHostList());
    270         else if($Panel['Module'] == 'UserOptions') 
     271        else if($Panel['Module'] == 'UserOptions')
    271272        {
    272273          //if($this->System->User->User['Id'] != null) $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel());
     
    274275        if($Panel['Module'] == 'Webcam') $Output .= $this->Panel('Kamery', $this->WebcamPanel());
    275276        if($Panel['Module'] == 'Meteo') $Output .= $this->Panel('Meteostanice', $this->MeteoPanel());
    276         else if($Panel['Module'] == 'NewsGroupList') 
     277        else if($Panel['Module'] == 'NewsGroupList')
    277278          $Output .= $this->Panel('Aktuality', $this->System->ModuleManager->Modules['News']->Show(), array('<a href="?Action=CustomizeNews">Upravit</a>'));
    278279      }
    279280      $Output .= '</td>';
    280     } 
     281    }
    281282    $Output .= '</tr></table>';
    282283    return($Output);
    283   } 
     284  }
    284285}
Note: See TracChangeset for help on using the changeset viewer.