Changeset 658 for trunk/Modules/Export


Ignore:
Timestamp:
Dec 19, 2013, 11:23:12 PM (11 years ago)
Author:
maron
Message:
  • Fixed: Export dbc text only, if varible ($s1,$t1..) is keep
  • Added: Filter translation where varibles are bad translated
Location:
trunk/Modules/Export
Files:
2 edited

Legend:

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

    r646 r658  
    278278  "</document>";
    279279    return($Buffer);
    280   }     
     280  }   
     281 
     282  function HaveVarible($String1, $String2)
     283  {
     284          //Export only if translate have same varible %
     285            if (strpos($String1,'$')) {
     286              while (strpos($String1,'$')) {
     287                $String1 = substr($String1,strpos($String1,'$'));
     288                $varible = $String1;
     289                if (strpos($varible,' ')) $varible = substr($varible,0,strpos($varible,' '));
     290                if (strpos($varible,'.')) $varible = substr($varible,0,strpos($varible,'.'));
     291                if (strpos($varible,'%')) $varible = substr($varible,0,strpos($varible,'%'));
     292                if (strpos($varible,chr(10))) $varible = substr($varible,0,strpos($varible,chr(10)));
     293                if (false == strpos($String2,$varible)) {
     294
     295                 return(false);
     296                }
     297              }
     298            }
     299          return (true);
     300  } 
    281301
    282302  function ExportToDBC()
     
    309329        $LookupTable = array();
    310330        $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    311         while($DbRow = $DbResult2->fetch_assoc())
    312           $LookupTable[$DbRow[$Group['PrimaryKeyItem']]] = $DbRow;
     331        while($DbRow = $DbResult2->fetch_assoc()) {
     332          //Export only if translate have same varible %
     333          $CanExport = true;
     334          foreach($TranslationTree[$Group['Id']]['Items'] as $Column)  {
     335            $DbRow[$Column['Column']] = str_replace ( '$ ','$',$DbRow[$Column['Column']]);
     336            if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']])) {
     337              $CanExport = false;
     338            } 
     339            if (!$this->HaveVarible($DbRow[$Column['Column']],$DbRow['En'.$Column['Column']])) {
     340              $CanExport = false;
     341            } 
     342          }
     343
     344          if ($CanExport)
     345            $LookupTable[$DbRow[$Group['PrimaryKeyItem']]] = $DbRow;
     346          else echo 'NE='.$DbRow[$Column['ID']].',';
     347        }
    313348     
    314349        // Open original DBC file
     
    348383            $LookupTableItem = $LookupTable[$PrimaryKeyItem];         
    349384            foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
    350             {
     385            { 
    351386              if(array_key_exists($GroupItem['Id'], $ColumnIndexes))
    352387                $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']];
  • trunk/Modules/Export/cmdmpqexport.php

    r657 r658  
    3636  }
    3737}
    38 
     38if(!array_key_exists('ExportId', $_GET) and !array_key_exists('dbc', $_GET) and !array_key_exists('lua', $_GET) and !array_key_exists('addon', $_GET)) {
     39  $Output .= 'Usage type_export=id_export -for export<br />';
     40  $Output .= 'Usage ExportId=id_export - for write export info<br />';
     41 
     42  $Output .= 'type_export={lua,dbc,addon} <br />';
     43  $Output = str_replace('<br />','
     44',$Output);
     45}
    3946                     //37
    4047if(array_key_exists('lua', $_GET)) {
Note: See TracChangeset for help on using the changeset viewer.