Ignore:
Timestamp:
Mar 28, 2010, 6:09:33 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Exportování addonu. Funkce BuildQuery rozšířena pro načítání anglických originálů. Názvy sloupců s anglickými texty jsou prefixovýny pomocí En.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/export.php

    r403 r407  
    4141  function BuildQuery($Group, $Columns = '')
    4242  {
     43    global $TranslationTree;
     44   
    4345    $Query = 'SELECT * FROM (SELECT `T`.*, '.$Columns.'`User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'.
    4446    ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '.
     
    4648    ' JOIN `ExportLanguage` ON (`ExportLanguage`.`Export`='.$this->Id.')'.
    4749    ' WHERE (`Complete` = 1) AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].')'.
    48     ' ORDER BY `ExportLanguage`.`Sequence`, `ExportUser`.`Sequence`) AS `TT` GROUP BY `TT`.`Entry`'; 
     50    ' ORDER BY `ExportLanguage`.`Sequence`, `ExportUser`.`Sequence`) AS `TT` GROUP BY `TT`.`Entry`';
     51   
     52    $OriginalColumns = '';
     53    foreach($TranslationTree[$Group['Id']]['Items'] as $Column)
     54      $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, ';
     55    $OriginalColumns = substr($OriginalColumns, 0, -2);
     56   
     57    $Query = 'SELECT `T4`.*, '.$OriginalColumns.' FROM ('.$Query.') AS `T4` '.
     58    ' LEFT JOIN `'.$Group['TablePrefix'].'` AS `T3` ON (`T3`.`Entry` = `T4`.`Entry`) AND (`T3`.`Language` = 0) AND (`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 
     59    echo($Query);
    4960    return($Query);
    5061  }
    51 
     62 
    5263  function ExportToMangosSQL()
    5364  {
     
    8293        $Buffer .= "\n\n-- ".$Group['Name']."\n\n";
    8394        $DbResult2 = $this->Database->query($this->BuildQuery($Group));
     95        if($DbResult2->num_rows > 0)
    8496        while($Line = $DbResult2->fetch_array())
    8597        {
     
    269281      if(!file_exists($this->TempDir.'lua/')) mkdir($this->TempDir.'lua/', 0777, true);
    270282      $File2->CreateFile($this->TempDir.'lua/'.$Group['LuaFileName'].'.lua');
    271  
     283     
     284      $DbResult2 = $this->Database->query($this->BuildQuery($Group));
     285       
    272286      while(!$File->EOF())
    273287      {
     
    281295          $Value['Comment'] = substr(trim($LineParts[1]), 3);
    282296
    283           $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    284297          if($DbResult2->num_rows > 0)
    285298          {
Note: See TracChangeset for help on using the changeset viewer.