Changeset 9 for Common/Application.php


Ignore:
Timestamp:
Apr 7, 2020, 8:50:42 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Various improvements.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/Application.php

    r7 r9  
    11<?php
     2
     3class ModelDef
     4{
     5  var $OnChange;
     6 
     7  function __construct()
     8  {
     9    $this->OnChange = array();
     10  }
     11 
     12  function DoOnChange()
     13  {
     14    foreach($this->OnChange as $Callback)
     15    {
     16      call_user_func($Callback);
     17    }
     18  }
     19 
     20  function RegisterOnChange($SysName, $Callback)
     21  {
     22    $this->OnChange[$SysName] = $Callback;
     23  }
     24 
     25  function UnregisterOnChange($SysName)
     26  {
     27    unset($this->OnChange[$SysName]);
     28  }
     29}
    230
    331class Application extends System
     
    735  var $ModuleManager;
    836  var $Modules;
    9 
     37  var $Models;
     38 
    1039  function __construct()
    1140  {
     
    1443    $this->ModuleManager = new AppModuleManager($this);
    1544    $this->Modules = array();
     45    $this->Models = array();
     46  }
     47 
     48  function RegisterModel($SysName, $Model)
     49  {
     50    $NewModelDef = new ModelDef();
     51    $NewModelDef->Title = $Model['Title'];
     52    $this->Models[$SysName] = $NewModelDef;
    1653  }
    1754
     55  function UnregisterModel($SysName)
     56  {
     57    unset($this->Models[$SysName]);
     58  }
     59 
    1860  function Run()
    1961  {
Note: See TracChangeset for help on using the changeset viewer.