Ignore:
Timestamp:
Jan 21, 2016, 10:20:04 AM (9 years ago)
Author:
chronos
Message:
  • Modified: Function GetTranslationTree moved from global to Translation module where it belongs.
File:
1 edited

Legend:

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

    r854 r859  
    2424  function DoStart()
    2525  {
    26     global $TranslationTree;
     26    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    2727
    2828    $this->System->RegisterPage('comparison.php', 'PageTranslationComparison');
     
    135135    return($Output);
    136136  }
     137
     138  function GetTranslationTree()
     139  {
     140    if(isset($this->TranslationTree)) return($this->TranslationTree);
     141    else {
     142      $Result = array();
     143      $Groups = array();
     144      $DbResult = $this->System->Database->query('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group`');
     145      while($DbRow = $DbResult->fetch_assoc())
     146        $Groups[T($DbRow['Name'])] = $DbRow;
     147      ksort($Groups);
     148      foreach($Groups as $Group)
     149      {
     150        $Group['Items'] = array();
     151        $Group['Game'] = T($Group['Name']);
     152        $Result[$Group['Id']] = $Group;
     153      }
     154      $DbResult = $this->System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`');
     155      while($DbRow = $DbResult->fetch_assoc())
     156      {
     157        $Result[$DbRow['Group']]['Items'][] = $DbRow;
     158      }
     159      $this->TranslationTree = $Result;
     160      return($Result);
     161    }
     162  }
    137163}
Note: See TracChangeset for help on using the changeset viewer.