Ignore:
Timestamp:
Apr 14, 2015, 10:20:16 PM (9 years ago)
Author:
chronos
Message:
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
File:
1 edited

Legend:

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

    r731 r738  
    22
    33class PageModules extends Page
    4 { 
     4{
    55  function __construct($System)
    66  {
     
    1010    $this->ParentClass = 'PagePortal';
    1111  }
    12  
     12
    1313  function ShowList()
    1414  {
     
    1717    $DbRow = $DbResult->fetch_row();
    1818    $PageList = GetPageList($DbRow[0]);
    19    
     19
    2020    $Output .= $PageList['Output'];
    2121    $Output .= '<table class="WideTable" style="font-size: small;">';
    22      
     22
    2323    $TableColumns = array(
    2424      array('Name' => 'Name', 'Title' => 'Jméno'),
     
    3737        'WHERE `ModuleLink`.`Module` = `Module`.`Id`) AS `Dependencies` '.
    3838        'FROM `Module` '.$Order['SQL'].$PageList['SQLLimit'];
    39    
     39
    4040    $DbResult = $this->Database->query($Query);
    4141    while($Module = $DbResult->fetch_assoc())
     
    5959    $Output .= $PageList['Output'];
    6060    $Output .= '<p><a href="?A=SaveToDb">Uložit do databáze</a></p>';
    61     return($Output);   
    62   }
    63  
     61    return($Output);
     62  }
     63
    6464  function Show()
    65   {   
     65  {
    6666    $Output = '';
    6767    if(array_key_exists('A', $_GET))
    6868    {
    69       if($_GET['A'] == 'SaveToDb') 
     69      if($_GET['A'] == 'SaveToDb')
    7070      {
    7171        $Output .= $this->System->ModuleManager->Modules['System']->SaveToDatabase();
    72         $Output .= $this->SystemMessage('Načtení modulů', 'Seznam modulů v databázi zaktualizován');   
     72        $Output .= $this->SystemMessage('Načtení modulů', 'Seznam modulů v databázi zaktualizován');
    7373      } else
    74       if($_GET['A'] == 'Install') 
     74      if($_GET['A'] == 'Install')
    7575      {
    7676        $this->System->ModuleManager->LoadModules(false);
    7777        $ModuleName = $this->System->ModuleManager->SearchModuleById($_GET['Id']);
    78         if($ModuleName != '') 
     78        if($ModuleName != '')
    7979        {
    8080          $this->System->Modules[$ModuleName]->Install();
    8181          $this->System->ModuleManager->Init();
    8282        } else $Output .= 'Modul id '.$_GET['Id'].' nenalezen';
    83        
     83
    8484      } else
    85       if($_GET['A'] == 'Uninstall') 
     85      if($_GET['A'] == 'Uninstall')
    8686      {
    8787        $ModuleName = $this->System->ModuleManager->SearchModuleById($_GET['Id']);
    88         if($ModuleName != '') 
     88        if($ModuleName != '')
    8989        {
    9090          $this->System->ModuleManager->Modules[$ModuleName]->UnInstall();
    9191          $this->System->ModuleManager->Init();
    9292        } else $Output .= 'Modul id '.$_GET['Id'].' nenalezen';
    93       } else $Output .= 'Neplatná akce';         
     93      } else $Output .= 'Neplatná akce';
    9494    }
    9595    $Output .= $this->ShowList();
    96     return($Output);   
    97   }
    98 } 
     96    return($Output);
     97  }
     98}
    9999
    100100class ModuleSystem extends AppModule
    101101{
    102102  var $InstalledChecked;
    103        
     103
    104104  function __construct($System)
    105105  {
     
    112112    $this->Dependencies = array();
    113113  }
    114  
     114
    115115  function DoInstall()
    116116  {
     
    131131  PRIMARY KEY (`Id`)
    132132) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;');
    133    
     133
    134134    $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModuleDependency` (
    135135  `Id` int(11) NOT NULL AUTO_INCREMENT,
     
    143143    $this->Database->query('ALTER TABLE `SystemModuleDependency` ADD CONSTRAINT `SystemModuleDependency_ibfk_1` FOREIGN KEY ( `Module` ) REFERENCES `SystemModule` (`Id`)');
    144144    $this->Database->query('ALTER TABLE `SystemModuleDependency` ADD CONSTRAINT `SystemModuleDependency_ibfk_2` FOREIGN KEY ( `DependencyModule` ) REFERENCES `SystemModule` (`Id`)');
    145    
     145
    146146    $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModel` (
    147147  `Id` int(11) NOT NULL AUTO_INCREMENT,
     
    152152) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;');
    153153    $this->Database->query('ALTER TABLE `SystemModel` ADD CONSTRAINT `SystemModel_ibfk_1` FOREIGN KEY ( `Module` ) REFERENCES `SystemModule` (`Id`)');
    154    
     154
    155155    $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModelProperty` (
    156156  `Id` int(11) NOT NULL AUTO_INCREMENT,
     
    163163    $this->Database->query('ALTER TABLE `SystemModelProperty` ADD CONSTRAINT `SystemModelProperty_ibfk_1` FOREIGN KEY ( `Model` ) REFERENCES `SystemModel` (`Id`)');
    164164  }
    165  
     165
    166166  function DoUnInstall()
    167167  {
     
    220220    ));
    221221    $this->System->FormManager->RegisterClass('Module', array(
    222         'Title' => 'Moduly',
    223           'Table' => 'Module',
    224           'Items' => array(
    225                 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
    226                   'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    227                 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
    228                 'Version' => array('Type' => 'String', 'Caption' => 'Verze', 'Default' => ''),
    229                 'License' => array('Type' => 'String', 'Caption' => 'Licence', 'Default' => ''),
    230                 'Creator' => array('Type' => 'String', 'Caption' => 'Tvůrce', 'Default' => ''),
    231         'HomePage' => array('Type' => 'Hyperlink', 'Caption' => 'Domovské stránky', 'Default' => ''),           
    232                 'Installed' => array('Type' => 'Boolean', 'Caption' => 'Instalováno', 'Default' => '', 'ReadOnly' => true),
    233                 'Models' => array('Type' => 'TModelListModule', 'Caption' => 'Modely', 'Default' => ''),
    234                 'Links' => array('Type' => 'TModuleLinkListModule', 'Caption' => 'Vazby', 'Default' => ''),
    235           ),
    236         'Actions' => array(
    237                 array('Caption' => 'Aktualizovat z disku', 'URL' => '/module/?A=SaveToDb'),
    238           ),
     222      'Title' => 'Moduly',
     223      'Table' => 'Module',
     224      'Items' => array(
     225        'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
     226        'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     227        'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
     228        'Version' => array('Type' => 'String', 'Caption' => 'Verze', 'Default' => ''),
     229        'License' => array('Type' => 'String', 'Caption' => 'Licence', 'Default' => ''),
     230        'Creator' => array('Type' => 'String', 'Caption' => 'Tvůrce', 'Default' => ''),
     231        'HomePage' => array('Type' => 'Hyperlink', 'Caption' => 'Domovské stránky', 'Default' => ''),
     232        'Installed' => array('Type' => 'Boolean', 'Caption' => 'Instalováno', 'Default' => '', 'ReadOnly' => true),
     233        'Models' => array('Type' => 'TModelListModule', 'Caption' => 'Modely', 'Default' => ''),
     234        'Links' => array('Type' => 'TModuleLinkListModule', 'Caption' => 'Vazby', 'Default' => ''),
     235      ),
     236      'Actions' => array(
     237        array('Caption' => 'Aktualizovat z disku', 'URL' => '/module/?A=SaveToDb'),
     238      ),
    239239    ));
    240240    $this->System->FormManager->RegisterFormType('TModule', array(
    241         'Type' => 'Reference',
    242         'Table' => 'Module',
    243         'Id' => 'Id',
    244         'Name' => 'Title',
    245         'Filter' => '1',
     241      'Type' => 'Reference',
     242      'Table' => 'Module',
     243      'Id' => 'Id',
     244      'Name' => 'Title',
     245      'Filter' => '1',
    246246    ));
    247247    $this->System->FormManager->RegisterFormType('TModelListModule', array(
     
    253253    ));
    254254    $this->System->FormManager->RegisterClass('Model', array(
    255         'Title' => 'Modely',
    256           'Table' => 'Model',
    257           'Items' => array(
    258                 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
    259                   'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    260                 'Module' => array('Type' => 'TModule', 'Caption' => 'Module', 'Default' => ''),
    261             'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''),
    262                 'DefaultSortColumn' => array('Type' => 'String', 'Caption' => 'Výchozí sloupce řazení', 'Default' => ''),
    263                 'DefaultSortOrder' => array('Type' => 'Text', 'Caption' => 'Výchozí směr řazení', 'Default' => ''),
    264                 'Fields' => array('Type' => 'TModelFieldListModel', 'Caption' => 'Pole', 'Default' => ''),
    265           ),
     255      'Title' => 'Modely',
     256      'Table' => 'Model',
     257      'Items' => array(
     258        'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
     259        'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     260        'Module' => array('Type' => 'TModule', 'Caption' => 'Module', 'Default' => ''),
     261        'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''),
     262        'DefaultSortColumn' => array('Type' => 'String', 'Caption' => 'Výchozí sloupce řazení', 'Default' => ''),
     263        'DefaultSortOrder' => array('Type' => 'Text', 'Caption' => 'Výchozí směr řazení', 'Default' => ''),
     264        'Fields' => array('Type' => 'TModelFieldListModel', 'Caption' => 'Pole', 'Default' => ''),
     265      ),
    266266    ));
    267267    $this->System->FormManager->RegisterFormType('TModel', array(
    268         'Type' => 'Reference',
    269         'Table' => 'Model',
    270         'Id' => 'Id',
    271         'Name' => 'Title',
    272         'Filter' => '1',
     268      'Type' => 'Reference',
     269      'Table' => 'Model',
     270      'Id' => 'Id',
     271      'Name' => 'Title',
     272      'Filter' => '1',
    273273    ));
    274274    $this->System->FormManager->RegisterFormType('TModelFieldListModel', array(
     
    280280    ));
    281281    $this->System->FormManager->RegisterClass('ModelField', array(
    282         'Title' => 'Pole modelu',
    283           'Table' => 'ModelField',
    284           'Items' => array(
    285                 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
    286                   'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    287                 'Model' => array('Type' => 'TModel', 'Caption' => 'Model', 'Default' => ''),
    288             'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''),
    289                 'Type' => array('Type' => 'String', 'Caption' => 'Typ', 'Default' => ''),
    290                 'DefaultValue' => array('Type' => 'String', 'Caption' => 'Výchozí hodnota', 'Default' => ''),
    291                 'IsNull' => array('Type' => 'Boolean', 'Caption' => 'Také nulová hodnota', 'Default' => ''),
    292                 'Suffix' => array('Type' => 'String', 'Caption' => 'Text za', 'Default' => ''),
    293           ),
     282      'Title' => 'Pole modelu',
     283      'Table' => 'ModelField',
     284      'Items' => array(
     285        'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
     286        'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     287        'Model' => array('Type' => 'TModel', 'Caption' => 'Model', 'Default' => ''),
     288        'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''),
     289        'Type' => array('Type' => 'String', 'Caption' => 'Typ', 'Default' => ''),
     290        'DefaultValue' => array('Type' => 'String', 'Caption' => 'Výchozí hodnota', 'Default' => ''),
     291        'IsNull' => array('Type' => 'Boolean', 'Caption' => 'Také nulová hodnota', 'Default' => ''),
     292        'Suffix' => array('Type' => 'String', 'Caption' => 'Text za', 'Default' => ''),
     293      ),
    294294    ));
    295295    $this->System->FormManager->RegisterFormType('TModuleLink', array(
    296         'Type' => 'Reference',
    297         'Table' => 'ModuleLink',
    298         'Id' => 'Id',
    299         'Name' => 'Module',
    300         'Filter' => '1',
     296      'Type' => 'Reference',
     297      'Table' => 'ModuleLink',
     298      'Id' => 'Id',
     299      'Name' => 'Module',
     300      'Filter' => '1',
    301301    ));
    302302    $this->System->FormManager->RegisterFormType('TModuleLinkListModule', array(
     
    308308    ));
    309309    $this->System->FormManager->RegisterClass('ModuleLink', array(
    310         'Title' => 'Vazby modulu',
    311           'Table' => 'ModuleLink',
    312           'Items' => array(
    313                 'Module' => array('Type' => 'TModule', 'Caption' => 'Modul', 'Default' => ''),
    314                 'LinkedModule' => array('Type' => 'TModule', 'Caption' => 'Vázaný modul', 'Default' => ''),
    315             'Type' => array('Type' => 'String', 'Caption' => 'Typ vazby', 'Default' => ''),
    316           ),
     310      'Title' => 'Vazby modulu',
     311      'Table' => 'ModuleLink',
     312      'Items' => array(
     313        'Module' => array('Type' => 'TModule', 'Caption' => 'Modul', 'Default' => ''),
     314        'LinkedModule' => array('Type' => 'TModule', 'Caption' => 'Vázaný modul', 'Default' => ''),
     315        'Type' => array('Type' => 'String', 'Caption' => 'Typ vazby', 'Default' => ''),
     316      ),
    317317    ));
    318318    $this->System->FormManager->RegisterClass('Language', array(
    319         'Title' => 'Jazyky',
    320           'Table' => 'Language',
    321           'DefaultSortColumn' => 'Name',
    322           'Items' => array(
    323                 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),                     
    324           ),
     319      'Title' => 'Jazyky',
     320      'Table' => 'Language',
     321      'DefaultSortColumn' => 'Name',
     322      'Items' => array(
     323        'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
     324      ),
    325325    ));
    326326    $this->System->FormManager->RegisterClass('UnitOfMeasure', array(
    327         'Title' => 'Měrné jednotky',
    328           'Table' => 'UnitOfMeasure',
    329           'DefaultSortColumn' => 'Name',
    330           'Items' => array(
    331                         'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
    332                         'Unit' => array('Type' => 'String', 'Caption' => 'Jednotka', 'Default' => ''),
    333           ),
     327      'Title' => 'Měrné jednotky',
     328      'Table' => 'UnitOfMeasure',
     329      'DefaultSortColumn' => 'Name',
     330      'Items' => array(
     331        'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
     332        'Unit' => array('Type' => 'String', 'Caption' => 'Jednotka', 'Default' => ''),
     333      ),
    334334    ));
    335335    $this->System->FormManager->RegisterClass('Country', array(
    336         'Title' => 'Země',
    337           'Table' => 'Country',
    338           'DefaultSortColumn' => 'Name',
    339           'Items' => array(
    340                 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
    341           ),
     336      'Title' => 'Země',
     337      'Table' => 'Country',
     338      'DefaultSortColumn' => 'Name',
     339      'Items' => array(
     340        'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
     341      ),
    342342    ));
    343343    $this->System->FormManager->RegisterFormType('TCountry', array(
    344         'Type' => 'Reference',
    345         'Table' => 'Country',
    346         'Id' => 'Id',
    347         'Name' => 'Name',
    348         'Filter' => '1',
     344      'Type' => 'Reference',
     345      'Table' => 'Country',
     346      'Id' => 'Id',
     347      'Name' => 'Name',
     348      'Filter' => '1',
    349349    ));
    350350    $this->System->FormManager->RegisterFormType('TUnitOfMeasure', array(
    351         'Type' => 'Reference',
    352         'Table' => 'UnitOfMeasure',
    353         'Id' => 'Id',
    354         'Name' => 'Name',
    355         'Filter' => '1',
     351      'Type' => 'Reference',
     352      'Table' => 'UnitOfMeasure',
     353      'Id' => 'Id',
     354      'Name' => 'Name',
     355      'Filter' => '1',
    356356    ));
    357357    $this->System->FormManager->RegisterFormType('TLanguage', array(
    358         'Type' => 'Reference',
    359         'Table' => 'Language',
    360         'Id' => 'Id',
    361         'Name' => 'Name',
    362         'Filter' => '1',
     358      'Type' => 'Reference',
     359      'Table' => 'Language',
     360      'Id' => 'Id',
     361      'Name' => 'Name',
     362      'Filter' => '1',
    363363    ));
    364364    $this->System->FormManager->RegisterFormType('TAction', array(
    365         'Type' => 'Reference',
    366         'Table' => 'Action',
    367         'Id' => 'Id',
    368         'Name' => 'Title',
    369         'Filter' => '1',
     365      'Type' => 'Reference',
     366      'Table' => 'Action',
     367      'Id' => 'Id',
     368      'Name' => 'Title',
     369      'Filter' => '1',
    370370    ));
    371371    $this->System->FormManager->RegisterFormType('TActionIcon', array(
    372         'Type' => 'Reference',
    373         'Table' => 'ActionIcon',
    374         'Id' => 'Id',
    375         'Name' => 'Name',
    376         'Filter' => '1',
     372      'Type' => 'Reference',
     373      'Table' => 'ActionIcon',
     374      'Id' => 'Id',
     375      'Name' => 'Name',
     376      'Filter' => '1',
    377377    ));
    378378    $this->System->FormManager->RegisterFormType('TActionType', array(
    379         'Type' => 'Reference',
    380         'Table' => 'ActionType',
    381         'Id' => 'Id',
    382         'Name' => 'Name',
    383         'Filter' => '1',
     379      'Type' => 'Reference',
     380      'Table' => 'ActionType',
     381      'Id' => 'Id',
     382      'Name' => 'Name',
     383      'Filter' => '1',
    384384    ));
    385385    $this->System->FormManager->RegisterFormType('TActionGroup', array(
    386         'Type' => 'Reference',
    387         'Table' => 'ActionGroup',
    388         'Id' => 'Id',
    389         'Name' => 'Name',
    390         'Filter' => '1',
    391     ));   
     386      'Type' => 'Reference',
     387      'Table' => 'ActionGroup',
     388      'Id' => 'Id',
     389      'Name' => 'Name',
     390      'Filter' => '1',
     391    ));
    392392    $this->System->FormManager->RegisterFormType('TModule', array(
    393         'Type' => 'Reference',
    394         'Table' => 'Module',
    395         'Id' => 'Id',
    396         'Name' => 'Name',
    397         'Filter' => '1',
    398     ));
    399    
     393      'Type' => 'Reference',
     394      'Table' => 'Module',
     395      'Id' => 'Id',
     396      'Name' => 'Name',
     397      'Filter' => '1',
     398    ));
     399
    400400    //$this->Manager->OnModuleChange = array($this, 'ModuleChange');
    401401    //$this->LoadFromDatabase();
    402402  }
    403  
     403
    404404  function DoStop()
    405405  {
    406406  }
    407  
     407
    408408  function IsInstalled()
    409409  {
     
    411411    {
    412412      $DbResult = $this->Database->query('SELECT table_name FROM information_schema.tables
    413 WHERE table_schema = "'.$this->Database->Database.'" AND table_name = "SystemVersion";');   
     413WHERE table_schema = "'.$this->Database->Database.'" AND table_name = "SystemVersion";');
    414414      if($DbResult->num_rows > 0) $this->Installed = true;
    415415        else $this->Installed = false;
    416416      $this->InstalledChecked = true;
    417417    }
    418     return($this->Installed); 
    419   }
    420  
     418    return($this->Installed);
     419  }
     420
    421421  function ModuleChange($Module)
    422422  {
    423423    //if($this->IsInstalled())
    424424    {
    425        
     425
    426426      if($Module->IsInstalled()) $Installed = 1;
    427         else $Installed = 0; 
     427        else $Installed = 0;
    428428      $this->Database->query('UPDATE `Module` SET `Installed`=1 WHERE `Name`="'.$Module->Name.'"');
    429429    }
    430430  }
    431  
     431
    432432  function LoadFromDatabase()
    433433  {
     
    441441      include_once('Modules/'.$Module['Name'].'/'.$Module['Name'].'.php');
    442442      $ModuleClassName = 'Module'.$Module['Name'];
    443       $NewModule = new $ModuleClassName($this->Database, $this->Manager);     
     443      $NewModule = new $ModuleClassName($this->Database, $this->Manager);
    444444      $NewModule->Id = $Module['Id'];
    445       $NewModule->Installed = $Module['Installed'];     
     445      $NewModule->Installed = $Module['Installed'];
    446446      $this->Manager->RegisterModule($NewModule);
    447     }     
    448   }
    449  
     447    }
     448  }
     449
    450450  function SaveToDatabase()
    451451  {
    452         $Output = '';
     452    $Output = '';
    453453    $Modules = array();
    454454    $DbResult = $this->Database->query('SELECT * FROM `Module`');
     
    461461
    462462    // Add missing
    463     foreach($this->System->ModuleManager->Modules as $Module)   
    464     {     
     463    foreach($this->System->ModuleManager->Modules as $Module)
     464    {
    465465      if(!array_key_exists($Module->Name, $Modules))
    466466      {
    467         $this->Database->insert('Module', array('Name' => $Module->Name, 
     467        $this->Database->insert('Module', array('Name' => $Module->Name,
    468468          'Version' => $Module->Version, 'Creator' => $Module->Creator,
    469                 'HomePage' => $Module->HomePage, 'Title' => $Module->Title,
     469          'HomePage' => $Module->HomePage, 'Title' => $Module->Title,
    470470          'Description' => $Module->Description, 'License' => $Module->License,
    471471          'Installed' => $Module->Installed));
     
    474474      else $this->Database->update('Module', 'Name = "'.$Module->Name.'"', array(
    475475        'Version' => $Module->Version, 'Creator' => $Module->Creator,
    476         'HomePage' => $Module->HomePage, 'Title' => $Module->Title,
     476        'HomePage' => $Module->HomePage, 'Title' => $Module->Title,
    477477        'Description' => $Module->Description, 'License' => $Module->License,
    478478        'Installed' => $Module->Installed));
    479479    }
    480    
     480
    481481    // Remove exceeding
    482     foreach($Modules as $Module)   
     482    foreach($Modules as $Module)
    483483    if(!$this->System->ModuleManager->ModulePresent($Module['Name']))
    484484    {
     
    487487      $this->Database->query('DELETE FROM `ModuleLink` WHERE `LinkedModule` = '.$Module['Id']);
    488488      $DbResult = $this->Database->query('SELECT Id FROM `PermissionOperation` WHERE `Module` = '.$Module['Id']);
    489       while($DbRow = $DbResult->fetch_assoc()) 
     489      while($DbRow = $DbResult->fetch_assoc())
    490490      {
    491491        $this->Database->query('DELETE FROM `PermissionGroupAssignment` WHERE `AssignedOperation` = '.$DbRow['Id']);
     
    498498        $this->Database->query('DELETE FROM `ModelField` WHERE `Model` = '.$DbRow['Id']);
    499499      $this->Database->query('DELETE FROM `Module` WHERE `Id` = '.$Module['Id']);
    500     }   
    501    
     500    }
     501
    502502    // Reload dependencies
    503503    $DbDependency = array();
     
    505505    while($DbRow = $DbResult->fetch_assoc())
    506506      $DbDependency[$DbRow['Module']][] = $DbRow['LinkedModule'];
    507    
     507
    508508    foreach($this->System->ModuleManager->Modules as $Module)
    509509    {
     
    517517            $DependencyId = $this->System->ModuleManager->Modules[$Dependency]->Id;
    518518            else throw new Exception('Dependent module '.$Dependency.' not found');
    519           $this->Database->insert('ModuleLink', array('Module' => $Module->Id, 
     519          $this->Database->insert('ModuleLink', array('Module' => $Module->Id,
    520520            'LinkedModule' => $DependencyId, 'Type' => 'DependOn'));
    521         }       
     521        }
    522522      }
    523      
     523
    524524      // Remove exceeding
    525525      if(array_key_exists($Module->Id, $DbDependency))
     
    530530        $this->Database->query('DELETE FROM `ModuleLink` WHERE `Module` = '.
    531531          $Module->Id.' AND LinkedModule='.$Dep);
    532       }     
     532      }
    533533    }
    534534    return($Output);
    535   } 
     535  }
    536536}
Note: See TracChangeset for help on using the changeset viewer.