Ignore:
Timestamp:
Jan 12, 2021, 10:29:50 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Setup is now AppModule and it is installed and stated as first module.
  • Modified: Improved modular system.
File:
1 edited

Legend:

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

    r893 r895  
    1414    $this->Description = 'Community portal.';
    1515    $this->Dependencies = array('News', 'User');
     16  }
     17
     18  function GetModels(): array
     19  {
     20    return array(Panel::GetClassName(), PanelColumn::GetClassName());
     21  }
     22
     23  function DoInstall(): void
     24  {
     25   /* $this->Database->query("INSERT INTO `PanelColumn` (`Id`, `Width`) VALUES
     26    (1, ''),
     27    (2, ''),
     28    (3, '70%');");
     29    $this->Database->query("INSERT INTO `Panel` (`Id`, `Module`, `Parameters`, `Order`, `PanelColumn`) VALUES
     30    (1, 'ActionGroup', 1, 2, 1),
     31    (2, 'ActionGroup', 4, 1, 2),
     32    (3, 'ActionGroup', 5, 2, 2),
     33    (4, 'ActionGroup', 6, 3, 2),
     34    (5, 'ActionGroup', 2, 4, 2),
     35    (6, 'ActionGroup', 3, 5, 2),
     36    (7, 'NewsGroupList', '', 2, 3),
     37    (8, 'Webcam', '', 3, 1),
     38    (9, 'UserOptions', '', 1, 3),
     39    (10, 'ActionGroup', 9, 1, 1),
     40    (11, 'Meteo', '', 4, 1);");*/
    1641  }
    1742
     
    3560    ));
    3661    ModuleUser::Cast($this->System->GetModule('User'))->UserPanel[] = array('PagePortal', 'UserPanel');
     62  }
     63}
     64
     65class PanelColumn extends Model
     66{
     67  static function GetDesc(): ModelDesc
     68  {
     69    $Desc = new ModelDesc(self::GetClassName());
     70    $Desc->AddString('Width');
     71    return $Desc;
     72  }
     73}
     74
     75class Panel extends Model
     76{
     77  static function GetDesc(): ModelDesc
     78  {
     79    $Desc = new ModelDesc(self::GetClassName());
     80    $Desc->AddString('Module');
     81    $Desc->AddString('Parameters');
     82    $Desc->AddInteger('Order');
     83    $Desc->AddInteger('PanelColumn');
     84    return $Desc;
    3785  }
    3886}
     
    216264
    217265        $User = &ModuleUser::Cast($this->System->GetModule('User'))->User;
    218         $DbResult = $this->Database->update('Member', 'Id='.$User->User['Member'],
     266        $DbResult = $this->Database->query('SELECT `Customer` FROM `UserCustomerRel` '.
     267          'WHERE `User`='.ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id']);
     268        $CustomerUserRel = $DbResult->fetch_assoc();
     269        $CustomerId = $CustomerUserRel['Member'];
     270
     271        $DbResult = $this->Database->update('Member', 'Id='.$CustomerId,
    219272           array('FamilyMemberCount' => $Form->Values['FamilyMemberCount']));
    220         $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$User->User['Member']);
     273        $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$CustomerId);
    221274        $Member = $DbResult->fetch_assoc();
    222275        $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'],
     
    231284          'Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, '.
    232285          'Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
    233           'ON Subject.Id = Member.Subject WHERE Member.Id='.$User->User['Member']);
     286          'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerId);
    234287        $DbRow = $DbResult->fetch_array();
    235288        foreach ($Form->Definition['Items'] as $Index => $Item)
Note: See TracChangeset for help on using the changeset viewer.