Ignore:
Timestamp:
Jan 18, 2012, 8:23:18 AM (13 years ago)
Author:
chronos
Message:
  • Upraveno: Doplněny použité modely v modulu FrontPage.
  • Upraveno: Optimalizováno načítání skupin odkazů v modulu FrontPage.
File:
1 edited

Legend:

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

    r351 r352  
    77  var $ShortTitle = '';
    88 
    9   function ShowLinks($GroupId)
    10   {
    11     global $Database;
    12    
    13     $DbResult = $Database->query('SELECT * FROM `HyperlinkGroup` WHERE `Id`='.$GroupId);
    14     $HyperlinkGroup = $DbResult->fetch_assoc();
    15 
     9  function ShowLinks($HyperlinkGroup)
     10  {
    1611    $Output = '';
    17     $DbResult = $Database->query('SELECT * FROM `Hyperlink` WHERE (`Group`='.$GroupId.') AND (`Enable` = 1)');
     12    $DbResult = $this->Database->query('SELECT * FROM `Hyperlink` WHERE (`Group`='.$HyperlinkGroup['Id'].') AND (`Enable` = 1)');
    1813    while($HyperLink = $DbResult->fetch_assoc())
    1914    {
     
    270265
    271266    $Database->select_db($Config['Database']['Database']);
    272 
     267     
     268    $DbResult = $Database->query('SELECT * FROM `HyperlinkGroup`');
     269    while($DbRow = $DbResult->fetch_assoc())
     270      $HyperlinkGroups[$DbRow['Id']] = $DbRow;
     271
     272   
    273273    // Show pannels
    274274    //if(IsInternetAddr()) echo('Internet'); else echo('LAN');
    275275    //$Output .= $this->InfoBar();
    276276    $Output .= '<table id="MainTable"><tr>';
    277     $DbResult = $Database->select('PanelColumn', '*');
     277    $DbResult = $this->Database->select('PanelColumn', '*');
    278278    while($PanelColumn =  $DbResult->fetch_assoc())
    279279    {
     
    284284      while($Panel = $DbResult2->fetch_assoc())
    285285      {
    286         if($Panel['Module'] == 'HyperlinkGroup') $Output .= $this->ShowLinks($Panel['Parameters']);
     286        if($Panel['Module'] == 'HyperlinkGroup') $Output .= $this->ShowLinks($HyperlinkGroups[$Panel['Parameters']]);
    287287        else if($Panel['Module'] == 'OnlineHostList') $Output .= $this->Panel('Online počítače', $this->OnlineHostList());
    288288        else if($Panel['Module'] == 'UserOptions')
     
    302302}
    303303
     304class Hyperlink extends Model
     305{
     306  function __construct($Database, $System)
     307  {
     308    parent::__construct($Database, $System);
     309    $this->Name = 'Hyperlink';
     310    $this->AddPropertyString('Name');
     311    $this->AddPropertyString('URL');
     312    $this->AddPropertyOneToMany('Group', 'HyperlinkGroup');
     313    $this->AddPropertyString('IconFile');
     314    $this->AddPropertyString('PermissionModule');
     315    $this->AddPropertyString('PermissionOperation');
     316    $this->AddPropertyBoolean('Enable');
     317  }
     318}
     319
     320class HyperlinkGroup extends Model
     321{
     322  function __construct($Database, $System)
     323  {
     324    parent::__construct($Database, $System);
     325    $this->Name = 'HyperlinkGroup';
     326    $this->AddPropertyString('Name');
     327  }
     328}
     329
     330class Panel extends Model
     331{
     332  function __construct($Database, $System)
     333  {
     334    parent::__construct($Database, $System);
     335    $this->Name = 'Panel';
     336    $this->AddPropertyString('Module');
     337    $this->AddPropertyString('Parameters');
     338    $this->AddPropertyInteger('Order');
     339    $this->AddPropertyOneToMany('PanelColumn', 'PanelColumn');
     340  }
     341}
     342
     343class PanelColumn extends Model
     344{
     345  function __construct($Database, $System)
     346  {
     347    parent::__construct($Database, $System);
     348    $this->Name = 'PanelColumn';
     349    $this->AddPropertyString('Width');
     350  }
     351}
     352
    304353class ModuleFrontPage extends Module
    305354{
     
    313362    $this->Description = 'Main page of community network portal';
    314363    $this->Dependencies = array('User', 'News', 'TV', 'Map', 'Chat', 'WebCam');
    315     $this->Models = array();
     364    $this->Models = array('Hyperlink', 'HyperlinkGroup', 'Panel', 'PanelColumn');
    316365  }
    317366 
Note: See TracChangeset for help on using the changeset viewer.