Changeset 859 for trunk/includes


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.
Location:
trunk/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/Global.php

    r858 r859  
    336336}
    337337
    338 function GetTranslationTree()
    339 {
    340   global $System;
    341 
    342   $Result = array();
    343   $Groups = array();
    344   $DbResult = $System->Database->query('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group`');
    345   while($DbRow = $DbResult->fetch_assoc())
    346     $Groups[T($DbRow['Name'])] = $DbRow;
    347   ksort($Groups);
    348   foreach($Groups as $Group)
    349   {
    350     $Group['Items'] = array();
    351     $Group['Game'] = T($Group['Name']);
    352     $Result[$Group['Id']] = $Group;
    353   }
    354   $DbResult = $System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`');
    355   while($DbRow = $DbResult->fetch_assoc())
    356   {
    357     $Result[$DbRow['Group']]['Items'][] = $DbRow;
    358   }
    359   return($Result);
    360 }
    361 
    362338$Moderators = array('Překladatel', 'Moderátor', 'Administrátor');
    363339
     
    459435function LoadGroupIdParameter()
    460436{
    461   global $TranslationTree;
     437  global $System;
     438  $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    462439
    463440  if(array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1;
     
    556533function GetIDbyName($Table)
    557534{
    558   global $TranslationTree;
     535  global $System;
     536
     537  $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    559538
    560539  foreach($TranslationTree as $TableID => $Value)
  • trunk/includes/System.php

    r858 r859  
    9191  function Run()
    9292  {
    93     global $ScriptStartTime, $TranslationTree, $StopAfterUpdateManager,
     93    global $ScriptStartTime, $StopAfterUpdateManager,
    9494      $UpdateManager;
    9595
     
    116116      $this->ModuleManager->Start();
    117117    }
    118 
    119     // TODO: Global initialized variable should be removed
    120     $TranslationTree = GetTranslationTree();
    121118
    122119    // Initialize application modules
     
    450447  function ShowTranslatedMenu()
    451448  {
    452     global $TranslationTree;
     449    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    453450
    454451    $Output = '<strong>'.T('Translate groups').':</strong><br /><div id="TranslationMenu">';
     
    522519    $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2);
    523520
    524     $Output = '</td>'.
    525       '<td class="menu2">';
    526     $Output .= $this->ShowTranslatedMenu();
    527     $Output .= '</td>'.
    528       '</tr><tr>'.
     521    $Output = '</td>';
     522    if($this->System->ModuleManager->ModulePresent('Translation'))
     523    {
     524      $Output .= '<td class="menu2">';
     525      $Output .= $this->ShowTranslatedMenu();
     526      $Output .= '</td>';
     527    }
     528    $Output .= '</tr><tr>'.
    529529      '<td colspan="4" class="page-bottom">'.T('Version').': '.$Version.' '.T('Revision').': '.$Revision.' ('.HumanDate($ReleaseTime).')'.
    530530      ' &nbsp; <a href="http://svn.zdechov.net/trac/wowpreklad/browser/trunk">'.T('Source code').'</a> &nbsp; '.
Note: See TracChangeset for help on using the changeset viewer.