Changeset 379 for trunk


Ignore:
Timestamp:
Jan 20, 2012, 9:17:37 PM (13 years ago)
Author:
chronos
Message:
  • Opraveno: Odkazy mezi modely.
  • Přidáno: Definice NetworkAP.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Global.php

    r377 r379  
    6262  $System->Config = &$Config;
    6363  $System->Install();
    64   $System->ReloadList();
    65   $System->Install();
    6664  $System->Init();
    6765}
  • trunk/Common/Module.php

    r378 r379  
    9090  function LoadModules($Installed = true)
    9191  {
     92    //DebugLog('Loading modules...');
     93    $this->Modules = array();
    9294    $Query = 'SELECT `Id`, `Name` FROM `SystemModule`';
    9395    if($Installed) $Query .= ' WHERE `Installed`=1';
     
    9698    while($Module = $DbResult->fetch_array())
    9799    {
     100      //echo($Module['Name'].',');
    98101      include_once('Modules/'.$Module['Name'].'/'.$Module['Name'].'.php');
    99102      $ModuleClassName = 'Module'.$Module['Name'];
    100       $this->Modules[$Module['Name']] = new $ModuleClassName($this->Database, $this);
    101       $this->Modules[$Module['Name']]->Id = $Module['Id'];
     103      $NewModule = new $ModuleClassName($this->Database, $this);     
     104      $NewModule->Id = $Module['Id'];
     105      $this->Modules[$Module['Name']] = $NewModule;
    102106    }     
    103107  }
     
    105109  function Init()
    106110  {
     111    $this->LoadModules();
    107112    foreach($this->Modules as $Index => $Module)
    108113      $this->Modules[$Index]->Init();
  • trunk/Modules/Finance/Finance.php

    r378 r379  
    398398   
    399399    $this->SpravaUsers = $this->InternetUsers;
    400     $DbResult = $this->Database->query('SELECT SUM(`Consumption`) FROM `NetworkSegments`');
     400    $DbResult = $this->Database->query('SELECT SUM(`Consumption`) FROM `NetworkSegment`');
    401401    $TotalConsumption = $DbResult->fetch_array();
    402402    $this->TotalConsumption = $TotalConsumption[0];
     
    459459      while($ID != 0)
    460460      {
    461         $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegments` WHERE `Id`='.$ID);
     461        $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment` WHERE `Id`='.$ID);
    462462        $Device = $DbResult2->fetch_assoc();
    463463        $NetworkDevice += $Device['Price'] / $Device['Users'];
     
    497497  {
    498498    $Output = 'Aktualizuji parametry segmentů...<br />';
    499     $this->Database->query('UPDATE `NetworkSegments` SET `Users` = 0, `UsersOverheads` = 0');     // Vynulovat počty uživatelů
    500     $DbResult = $this->Database->query('SELECT * FROM `NetworkSegments`');
     499    $this->Database->query('UPDATE `NetworkSegment` SET `Users` = 0, `UsersOverheads` = 0');     // Vynulovat počty uživatelů
     500    $DbResult = $this->Database->query('SELECT * FROM `NetworkSegment`');
    501501    while($NetworkSegment = $DbResult->fetch_array())
    502502    {
    503503      //echo('Segment '.$Row['name'].'<br>');
    504       $DbResult2 = $this->Database->query('SELECT `Users` FROM `NetworkSegments` WHERE `Id`='.$NetworkSegment['Id']);
     504      $DbResult2 = $this->Database->query('SELECT `Users` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']);
    505505      $RowP = $DbResult2->fetch_array();
    506       $DbResult2 = $this->Database->query('SELECT `UsersOverheads` FROM `NetworkSegments` WHERE `Id`='.$NetworkSegment['Id']);
     506      $DbResult2 = $this->Database->query('SELECT `UsersOverheads` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']);
    507507      $RowP2 = $DbResult2->fetch_array();
    508508
     
    515515      {
    516516        //echo($ID.', ');
    517         $DbResult2 = $this->Database->query('SELECT * FROM NetworkSegments WHERE Id='.$ID);
     517        $DbResult2 = $this->Database->query('SELECT * FROM NetworkSegment WHERE Id='.$ID);
    518518        $Row4 = $DbResult2->fetch_array();
    519         $this->Database->update('NetworkSegments', 'Id='.$Row4['Id'], array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0])));
     519        $this->Database->update('NetworkSegment', 'Id='.$Row4['Id'], array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0])));
    520520        $ID = $Row4['Parent'];
    521521      }
    522       $this->Database->update('NetworkSegments', 'Id='.$NetworkSegment['Id'], array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads'])));
     522      $this->Database->update('NetworkSegment', 'Id='.$NetworkSegment['Id'], array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads'])));
    523523    }
    524524
     
    526526    $DbResult = $this->Database->select('Member', 'COUNT(*)');
    527527    $Row = $DbResult->fetch_array();
    528     $DbResult = $this->Database->update('NetworkSegments', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));
     528    $DbResult = $this->Database->update('NetworkSegment', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));
    529529    $this->System->Modules['Log']->NewRecord('Finance', 'RecalculateSegmentParameters');
    530530    return($Output);
  • trunk/Modules/Member/Member.php

    r378 r379  
    2626    parent::__construct($Database, $System);
    2727    $this->Name = 'Member';
    28     $this->AddPropertyDateTime('Time');
    29     $this->AddPropertyOneToMany('User', 'User');
    30     $this->AddPropertyString('Module');
    31     $this->AddPropertyString('Operation');
    32     $this->AddPropertyString('Value');
     28    $this->AddPropertyOneToMany('Subject', 'Subject');
     29    $this->AddPropertyOneToMany('ResponsibleUser', 'User');
     30    $this->AddPropertyInteger('FamilyMemberCount');
     31    $this->AddPropertyDate('MembershipDate');
     32    $this->AddPropertyInteger('MemberState');
     33    $this->AddPropertyOneToMany('InternetTariffCurrentMonth', 'FinanceTariff');
     34    $this->AddPropertyOneToMany('InternetTariffNextMonth', 'FinanceTariff');
     35    $this->AddPropertyInteger('GPS');
     36    $this->AddPropertyOneToMany('BillingPeriod', 'FinanceBillingPeriod');
     37    $this->AddPropertyOneToMany('NetworkSegment', 'NetworkSegment');
     38    $this->AddPropertyOneToMany('BillingPeriodNext', 'FinanceBillingPeriod');
     39    $this->AddPropertyFloat('Hire');
     40    $this->AddPropertyBoolean('Blocked');
    3341  }
    3442}
     
    4048    parent::__construct($Database, $System);
    4149    $this->Name = 'MemberPayment';
    42     $this->AddPropertyDateTime('Time');
    43     $this->AddPropertyOneToMany('User', 'User');
    44     $this->AddPropertyString('Module');
    45     $this->AddPropertyString('Operation');
    46     $this->AddPropertyString('Value');
     50    $this->AddPropertyOneToMany('Member', 'Member');
     51    $this->AddPropertyFloat('MonthlyTotal');
     52    $this->AddPropertyFloat('MonthlyInternet');
     53    $this->AddPropertyFloat('MonthlyConsumption');
     54    $this->AddPropertyFloat('NetworkDevice');
     55    $this->AddPropertyFloat('MonthlyPlus');
     56    $this->AddPropertyFloat('Cash');
    4757  }
    4858}
  • trunk/Modules/Network/Network.php

    r378 r379  
    169169}
    170170
     171class NetworkAP extends Model
     172{
     173  function __construct($Database, $System)
     174  {
     175    parent::__construct($Database, $System);
     176    $this->Name = 'NetworkAP';
     177    $this->AddPropertyString('SSID');
     178    $this->AddPropertyInteger('Frequency');
     179    $this->AddPropertyInteger('ChannelWidth');
     180    $this->AddPropertyOneToMany('NetworkDevice', 'NetworkDevice');
     181  }
     182}
     183
     184
    171185
    172186class EmailView extends ViewForm
     
    239253    $this->SupportedModels = array('NetworkDevice', 'NetworkDeviceType', 'NetworkInterface',
    240254      'NetworkInterfaceType', 'NetworkPoint', 'NetworkLink', 'NetworkSubnet',
    241       'NetworkSegment');
     255      'NetworkSegment', 'NetworkAP');
    242256  }
    243257 
  • trunk/index.php

    r377 r379  
    33include_once('Common/Global.php');
    44GlobalInit();
    5 
    65$System->PathItems = ProcessURL();
    76//print_r($_GET);
Note: See TracChangeset for help on using the changeset viewer.