Changeset 9 for trunk/Packages/Common


Ignore:
Timestamp:
Jun 1, 2023, 1:01:38 AM (19 months ago)
Author:
chronos
Message:
  • Fixed: Modules initialization.
Location:
trunk/Packages/Common
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Modules/ModuleAdmin.php

    r8 r9  
    88  {
    99    parent::__construct($System);
    10     $this->Name = 'ModuleManager';
     10    $this->Name = 'Admin';
    1111    $this->Version = '1.0';
    1212    $this->Creator = 'Chronos';
     
    4949      ),
    5050    ));
    51     $this->System->FormManager->RegisterFormType('TModule', array(
     51    Core::Cast($this->System)->FormManager->RegisterFormType('TModule', array(
    5252      'Type' => 'Reference',
    5353      'Table' => 'Module',
     
    5656      'Filter' => '1',
    5757    ));
    58     $this->System->FormManager->RegisterFormType('TModelListModule', array(
     58    Core::Cast($this->System)->FormManager->RegisterFormType('TModelListModule', array(
    5959      'Type' => 'ManyToOne',
    6060      'Table' => 'Model',
     
    6363      'Filter' => '1',
    6464    ));
    65     $this->System->FormManager->RegisterClass('Model', array(
     65    Core::Cast($this->System)->FormManager->RegisterClass('Model', array(
    6666      'Title' => 'Modely',
    6767      'Table' => 'Model',
     
    7676      ),
    7777    ));
    78     $this->System->FormManager->RegisterFormType('TModel', array(
     78    Core::Cast($this->System)->FormManager->RegisterFormType('TModel', array(
    7979      'Type' => 'Reference',
    8080      'Table' => 'Model',
     
    8383      'Filter' => '1',
    8484    ));
    85     $this->System->FormManager->RegisterFormType('TModelFieldListModel', array(
     85    Core::Cast($this->System)->FormManager->RegisterFormType('TModelFieldListModel', array(
    8686      'Type' => 'ManyToOne',
    8787      'Table' => 'ModelField',
     
    9090      'Filter' => '1',
    9191    ));
    92     $this->System->FormManager->RegisterClass('ModelField', array(
     92    Core::Cast($this->System)->FormManager->RegisterClass('ModelField', array(
    9393      'Title' => 'Pole modelu',
    9494      'Table' => 'ModelField',
     
    104104      ),
    105105    ));
    106     $this->System->FormManager->RegisterFormType('TModuleLink', array(
     106    Core::Cast($this->System)->FormManager->RegisterFormType('TModuleLink', array(
    107107      'Type' => 'Reference',
    108108      'Table' => 'ModuleLink',
     
    111111      'Filter' => '1',
    112112    ));
    113     $this->System->FormManager->RegisterFormType('TModuleLinkListModule', array(
     113    Core::Cast($this->System)->FormManager->RegisterFormType('TModuleLinkListModule', array(
    114114      'Type' => 'ManyToOne',
    115115      'Table' => 'ModuleLink',
     
    118118      'Filter' => '1',
    119119    ));
    120     $this->System->FormManager->RegisterClass('ModuleLink', array(
     120    Core::Cast($this->System)->FormManager->RegisterClass('ModuleLink', array(
    121121      'Title' => 'Vazby modulu',
    122122      'Table' => 'ModuleLink',
     
    127127      ),
    128128    ));
    129     $this->System->FormManager->RegisterFormType('TModule', array(
     129    Core::Cast($this->System)->FormManager->RegisterFormType('TModule', array(
    130130      'Type' => 'Reference',
    131131      'Table' => 'Module',
     
    250250        'Type' => ModelColumnType::GetName($Field->Type), 'Nullable' => (int)$Field->Nullable));
    251251    }
    252     if ($ModelDesc->DefaultValues != null)
    253     {
    254       $Values = call_user_func('self::'.$ModelDesc->DefaultValues);
     252    if ($ModelDesc->DefaultValuesMethod != null)
     253    {
     254      $Values = call_user_func('self::'.$ModelDesc->DefaultValuesMethod);
    255255      foreach ($Values as $Value)
    256256      {
     
    303303  {
    304304    //DebugLog('Loading modules...');
    305     $this->Modules = array();
    306305    $Query = 'SELECT `Id`, `Name`,`Installed` FROM `Module`';
    307306    $DbResult = $this->Database->query($Query);
     
    492491    $Output = '';
    493492
    494     $Pageing = new Paging();
     493    $Pageing = new Paging($this->System);
    495494    $Pageing->TotalCount = count($this->System->ModuleManager->Modules);
    496     $Table = new VisualTable();
     495    $Table = new VisualTable($this->System);
    497496    $Table->SetColumns(array(
    498497      array('Name' => 'Name', 'Title' => T('Name')),
  • trunk/Packages/Common/Paging.php

    r8 r9  
    88  public string $SQLLimit;
    99  public int $Page;
     10  private System $System;
    1011
    11   function __construct()
     12  function __construct(System $System)
    1213  {
    13     global $System;
    14 
    15     $this->ItemPerPage = $System->Config['Web']['ItemsPerPage'];
    16     $this->Around = $System->Config['Web']['VisiblePagingItems'];
     14    $this->System = $System;
     15    $this->ItemPerPage = Core::Cast($this->System)->Config['Web']['ItemsPerPage'];
     16    $this->Around = Core::Cast($this->System)->Config['Web']['VisiblePagingItems'];
    1717  }
    1818
  • trunk/Packages/Common/System.php

    r8 r9  
    3939  {
    4040    if (array_key_exists($Name, $this->ModuleManager->Modules))
     41    {
    4142      return $this->ModuleManager->Modules[$Name];
    42       else return null;
     43    }
     44    else
     45    {
     46      echo('Module '.$Name.' not registered.');
     47    }
    4348  }
    4449
  • trunk/Packages/Common/Table.php

    r8 r9  
    9999  private array $OrderDirSQL;
    100100
    101   function __construct()
     101  function __construct(System $System)
    102102  {
    103     global $System;
    104 
    105103    $this->Columns = array();
    106104    $this->Table = new TableMemory();
    107105    $this->OrderDirSQL = array('ASC', 'DESC');
    108     $this->OrderArrowImage = array($System->Link('/images/sort_asc.png'),
     106    $this->OrderArrowImage = array(Core::Cast($System)->Link('/images/sort_asc.png'),
    109107      $System->Link('/images/sort_desc.png'));
    110108    $this->DefaultOrder = 0;
Note: See TracChangeset for help on using the changeset viewer.