Ignore:
Timestamp:
Oct 10, 2012, 12:21:38 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Automatické spouštění instalovaných modulů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Modular/Common/Module.php

    r424 r425  
    1818  var $Installed;
    1919  var $Running;
     20  var $System;
    2021  /** @var ModularSystem */
    21   var $ModularSystem;
     22  var $Manager;
    2223 
    2324 
     
    3839    // Install dependencies first
    3940    foreach($this->Dependencies as $Dependency) 
    40       $this->ModularSystem->Modules[$Dependency]->Install();
     41      $this->Manager->Modules[$Dependency]->Install();
    4142    $this->DoChange();
    4243  }
     
    6869    $this->Running = true;
    6970    foreach($this->Dependencies as $Dependency) 
    70       $this->System->Modules[$Dependency]->Start();
     71      $this->Manager->Modules[$Dependency]->Start();
    7172    $this->LoadModels();
    7273    $this->DoChange();
     
    8687  private function DoChange()
    8788  {
    88     if($this->ModularSystem->OnModuleChange)
    89       call_user_func_array($this->ModularSystem->OnModuleChange, array($this));
     89    if($this->Manager->OnModuleChange)
     90      call_user_func_array($this->Manager->OnModuleChange, array($this));
    9091  }
    9192 
     
    102103  function LoadModels()
    103104  {
     105    //echo($this->Name.'... ');
    104106    $this->Models = array();
    105107    foreach($this->SupportedModels as $ModelName)
     
    108110      $NewModel->Module = &$this;
    109111      $this->Models[$ModelName] = $NewModel;
     112      //DebugLog($ModelName.'.LoadModels()');
    110113    }       
    111114  }
     
    136139  }
    137140 
     141  function StartInstalled()
     142  {
     143    foreach($this->Modules as $Index => $Module)
     144    {     
     145      //DebugLog('Init module '.$Module->Name);
     146      if($Module->IsInstalled()) $this->Modules[$Index]->Start();
     147    }
     148  }
     149
    138150  function StopAll()
    139151  {
     
    187199  {
    188200    $this->Modules[$Module->Name] = &$Module; 
    189     $Module->ModularSystem = $this;
     201    $Module->Manager = &$this;
    190202    $Module->OnChange = &$this->OnModuleChange;
    191203  }
     
    224236    if(array_key_exists($Module->Name, $ModulesOnDisk))
    225237    {
    226       $this->ModularSystem->UnregisterModule($Module);
     238      $this->Manager->UnregisterModule($Module);
    227239    }
    228240  } 
Note: See TracChangeset for help on using the changeset viewer.