Ignore:
Timestamp:
Jan 3, 2014, 11:09:37 AM (11 years ago)
Author:
maron
Message:
  • Added: selection groupitems in export
File:
1 edited

Legend:

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

    r686 r695  
    7272  }
    7373 
    74   function BuildQuery($Group, $Columns = '', $Version = '')
     74  function BuildQuery($Group, $Version = '')
    7575  {
    7676    global $TranslationTree;
     
    8080    else
    8181      $ExportVersion = $this->ClientVersion['BuildNumber'];
    82    
    83     $Query = 'SELECT * FROM (SELECT `T`.*, '.$Columns.'`User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'.
     82
     83          $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$this->Id);
     84                while($GroupItem = $DbResultItem->fetch_assoc())
     85                {
     86                  $GroupItems[$GroupItem['GroupItem']] = 1;
     87    }
     88    // Build selected columns
     89    $Columns = '';
     90    foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
     91      if (!isset($GroupItems[$Column['Id']])) $Columns .= ' `T`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, ';
     92    }
     93  //  $Columns = substr($Columns, 0, -2);
     94
     95   
     96    $Query = 'SELECT * FROM (SELECT '.$Columns.' T.`ID`,T.`Language`,T.`User`,T.`Entry`,T.`VersionEnd`,T.`VersionStart`, `User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'.
    8497    ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '.
    8598    ' JOIN `User` ON `User`.`ID`=`T`.`User`'.
     
    90103    // Build columns for english texts
    91104    $OriginalColumns = '';
    92     foreach($TranslationTree[$Group['Id']]['Items'] as $Column)
     105    foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
    93106      $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, ';
     107      if (isset($GroupItems[$Column['Id']]))
     108        $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, ';
     109    }
    94110    $OriginalColumns = substr($OriginalColumns, 0, -2);
    95111   
Note: See TracChangeset for help on using the changeset viewer.