Changeset 558 for trunk/Modules/Export


Ignore:
Timestamp:
Jul 29, 2013, 11:48:14 PM (11 years ago)
Author:
chronos
Message:
  • Modified: Export transformed to application module.
Location:
trunk/Modules/Export
Files:
8 deleted
6 copied
1 moved

Legend:

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

    r553 r558  
    11<?php
    2 
    3 include_once('export.php');
    42
    53class ExportAddon extends Export
  • trunk/Modules/Export/Export.php

    r553 r558  
    11<?php
    22
    3 include_once('../includes/system.php');
     3include_once(dirname(__FILE__).'/Page.php');
     4include_once(dirname(__FILE__).'/ExportOutput.php');
     5
     6class ModuleExport extends AppModule
     7{
     8  function __construct($System)
     9  {
     10    parent::__construct($System);
     11    $this->Name = 'Export';
     12    $this->Version = '1.0';
     13    $this->Creator = 'Chronos';
     14    $this->License = 'GNU/GPL';
     15    $this->Description = 'Allow parametric export translated texts to various supported output formats';
     16    $this->Dependencies = array();
     17  }
     18 
     19  function Start()
     20  {
     21        $this->System->RegisterPage('export', 'PageExport');
     22        $this->System->RegisterMenuItem(array(
     23        'Title' => 'Exporty',
     24        'Hint' => 'Zde si můžete stáhnout přeložené texty',
     25        'Link' => $this->System->Link('/export/'),
     26        'Permission' => LICENCE_ANONYMOUS,
     27        'Icon' => '',
     28    ), 2);
     29  }
     30}
    431
    532class Export extends Module
     
    1643  function Init()
    1744  {
    18     $this->TempDir = $this->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';
     45    $this->TempDir = dirname(__FILE__).'/../../'.$this->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';
     46    $this->TempDirRelative = $this->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';
    1947    if(!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
    2048  }
  • trunk/Modules/Export/ExportOutput.php

    r553 r558  
    11<?php
    22
    3 //include_once('../includes/global.php');
    4 include_once('../includes/zip.lib.php');
    5 include_once('../includes/dbc.php');
    6 include_once('export.php');   
    7 include_once('create_addon.php');
     3include_once(dirname(__FILE__).'/../../includes/zip.lib.php');
     4include_once(dirname(__FILE__).'/../../includes/dbc.php');
     5include_once(dirname(__FILE__).'/CreateAddon.php');
    86
    97//ini_set('memory_limit', '100M');
     
    4745     
    4846  $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '.
    49     '<a href="'.$SaveFilename.'">'.$SQLFilename.'</a><br />'.
     47    '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzAoWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'.
    5048    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    5149  return($Output);
     
    8886     
    8987  $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '.
    90     '<a href="'.$SaveFilename.'">'.$SQLFilename.'</a><br />'.
     88    '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'.
    9189    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    9290  return($Output); 
     
    121119    $Zip = new zipfile();
    122120    CreateZipFromDir($Zip, $Addon->TempDir.'CzWoW/', 'CzWoW/');
    123     $Zip->addFile(file_get_contents('files/'.$Addon->ClientVersion['Version'].'/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml');
    124     $Zip->addFile(file_get_contents('files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml');
    125     $Zip->addFile(file_get_contents('files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc');
    126     $Zip->addFile(file_get_contents('files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua');
    127     $Zip->addFile(file_get_contents('files/'.$Addon->ClientVersion['Version'].'/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml');
    128     $Zip->addFile(file_get_contents('files/'.$Addon->ClientVersion['Version'].'/CzWoW/Localization.lua'), 'CzWoW/Localization.lua');
     121    $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml');
     122    $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml');
     123    $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc');
     124    $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua');
     125    $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml');
     126    $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/Localization.lua'), 'CzWoW/Localization.lua');
    129127    $Buffer = $Zip->file();
    130128    file_put_contents($SaveFilename, $Buffer);
     
    136134     
    137135  $Output .= 'Soubor ke stažení: '.
    138     '<a href="'.$SaveFilename.'">CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip</a><br />'.
     136    '<a href="'.$System->Link('/'.$Addon->TempDirRelative.'CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip').'">CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip</a><br />'.
    139137    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    140138  $Output .= '<br /><strong>Použití ve hře</strong><br />Menu addonu ve hře vyvoláte povelem /czwow.';
     
    165163     
    166164  $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '.
    167     '<a href="'.$SaveFilename.'">CzWoW_SQL.zip</a><br />'.
     165    '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_XML.zip').'">CzWoW_SQL.zip</a><br />'.
    168166    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    169167  return($Output);
  • trunk/Modules/Export/Page.php

    r554 r558  
    11<?php
    22
    3 include_once('../includes/global.php');
    4 include_once('export_output.php');
    5 
     3include_once('ExportOutput.php');
     4
     5class PageExport extends Page
     6{
    67function ExportList()
    78{
    8   global $System, $User;
     9  global $User;
    910 
    1011  $Output = '<a href="?Action=ViewList">Všechny</a>';
     
    2223  }
    2324 
    24   $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Export` '.$Filter);
     25  $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` '.$Filter);
    2526  $DbRow = $DbResult->fetch_row();
    2627  $PageList = GetPageList($DbRow[0]);   
     
    4445    $Order['Output'];
    4546
    46   $DbResult = $System->Database->query('SELECT `User`.`Name` AS `UserName`, `Export`.`Id`, `Export`.`TimeCreate`, `Export`.`Title`, `Export`.`User`, `Export`.`UsedCount`, (SELECT Version FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersion`,(SELECT Name FROM `ExportOutputType` WHERE `ExportOutputType`.`Id`=`Export`.`OutputType`) AS `OutputType`, (SELECT COUNT(*) FROM `ExportGroup` WHERE `ExportGroup`.`Export`=`Export`.`Id`) AS `GroupCount`, (SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']);
     47  $DbResult = $this->System->Database->query('SELECT `User`.`Name` AS `UserName`, `Export`.`Id`, `Export`.`TimeCreate`, `Export`.`Title`, `Export`.`User`, `Export`.`UsedCount`, (SELECT Version FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersion`,(SELECT Name FROM `ExportOutputType` WHERE `ExportOutputType`.`Id`=`Export`.`OutputType`) AS `OutputType`, (SELECT COUNT(*) FROM `ExportGroup` WHERE `ExportGroup`.`Export`=`Export`.`Id`) AS `GroupCount`, (SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']);
    4748  while($Export = $DbResult->fetch_assoc())
    4849  {
     
    5051    if($Export['User'] == $User->Id) $Action .= ' <a href="?Action=Delete&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>';
    5152    $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'.
    52       '<td><a href="'.$System->Link('/user.php?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'.
     53      '<td><a href="'.$this->System->Link('/user.php?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'.
    5354      '<td>'.$Export['Title'].'</td>'.
    5455      '<td>'.$Export['OutputType'].'</td>'.
     
    6768function ExportCreate()
    6869{
    69   global $System, $User;
     70  global $User;
    7071 
    7172  if($User->Licence(LICENCE_USER))
    7273  {   
    73     $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id);
     74    $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id);
    7475    $DbRow = $DbResult->fetch_row();
    75     if($DbRow[0] < $System->Config['MaxExportPerUser'])
     76    if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    7677    {
    7778      $Output = '<form action="?Action=CreateFinish" method="post">'.
     
    8182      '<tr><td colspan="2"><input type="submit" value="Vytvořit" /></td></tr>'.
    8283      '</table></fieldset></form>';
    83     } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.$System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL);
     84    } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.$this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL);
    8485  } else $Output = ShowMessage('Nemáte oprávnění.', MESSAGE_CRITICAL);
    8586  return($Output);
     
    8889function ExportCreateFinish()
    8990{
    90   global $User, $System;
     91  global $User;
    9192 
    9293  if($User->Licence(LICENCE_USER))
     
    9495    if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
    9596    {
    96       $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id);
     97      $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id);
    9798      $DbRow = $DbResult->fetch_row();
    98       if($DbRow[0] < $System->Config['MaxExportPerUser'])
     99      if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    99100      {
    100         $System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$User->Id.', NOW(), 1, "'.$_POST['Description'].'")');
    101         $ExportId = $System->Database->insert_id;
     101        $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$User->Id.', NOW(), 1, "'.$_POST['Description'].'")');
     102        $ExportId = $this->System->Database->insert_id;
    102103        $Output = ShowMessage('Nový export vytvořen.<br/>Přímý odkaz na tento export: <a href="?Action=View&amp;ExportId='.$ExportId.'">zde</a>');
    103         WriteLog('Vytvořen nový export <a href="'.$System->Link('/export/?Action=View&amp;ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT);
     104        WriteLog('Vytvořen nový export <a href="'.$this->System->Link('/export/?Action=View&amp;ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT);
    104105        $_GET['Filter'] = 'my';
    105106        ExportList();
    106       } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.$System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL);
     107      } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.$this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL);
    107108    } else $Output = ShowMessage('Chybí údaje formuláře.', MESSAGE_CRITICAL);
    108109  } else $Output = ShowMessage('Nemáte oprávnění.', MESSAGE_CRITICAL);
     
    112113function ExportDelete()
    113114{
    114   global $System, $User;
     115  global $User;
    115116 
    116117  if($User->Licence(LICENCE_USER))
    117118  {   
    118     $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$User->Id.')');
     119    $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$User->Id.')');
    119120    if($DbResult->num_rows > 0)
    120121    {
    121       $System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']);
    122       $System->Database->query('DELETE FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId']);
    123       $System->Database->query('DELETE FROM `ExportTask` WHERE `Export`='.$_GET['ExportId']);
    124       $System->Database->query('DELETE FROM `ExportUser` WHERE `Export`='.$_GET['ExportId']);
    125       $System->Database->query('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     122      $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']);
     123      $this->System->Database->query('DELETE FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId']);
     124      $this->System->Database->query('DELETE FROM `ExportTask` WHERE `Export`='.$_GET['ExportId']);
     125      $this->System->Database->query('DELETE FROM `ExportUser` WHERE `Export`='.$_GET['ExportId']);
     126      $this->System->Database->query('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    126127      DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/');
    127128      $Output = ShowMessage('Export smazán.');
     
    136137function ExportViewTranslators()
    137138{
    138   global $TranslationTree, $User, $System;
     139  global $TranslationTree, $User;
    139140
    140141  $Output = '';
    141142  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    142   $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     143  $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    143144  $Export = $DbResult->fetch_assoc();
    144145  if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
     
    159160            else $Selected = false;
    160161          $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId;
    161           $DbResult = $System->Database->query('SELECT * FROM `ExportUser` '.$Condition);
     162          $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition);
    162163          if($DbResult->num_rows > 0)
    163164          {
    164             if(!$Selected) $System->Database->query('DELETE FROM `ExportUser` '.$Condition);
    165               else $System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
     165            if(!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);
     166              else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
    166167          } else
    167168          {
    168             if($Selected) $System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
     169            if($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
    169170          }         
    170171        }
     
    172173     
    173174      // Recalculate sequence number
    174       $System->Database->query('SET @I = 0');
    175       $System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
     175      $this->System->Database->query('SET @I = 0');
     176      $this->System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
    176177      $Output .= ShowMessage('Výběr uložen.');
    177178    }
     
    194195  $Query .=' WHERE `T`.`TranslatedCount` > 0 ORDER BY COALESCE(`ExportUser`.`Sequence`, 100000000)'.$InitialOrder.') AS `TT`';
    195196
    196   $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
     197  $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
    197198  $DbRow = $DbResult->fetch_row();
    198199  $PageList = GetPageList($DbRow[0]);   
     
    215216
    216217  $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit'];
    217   $System->Database->query('SET @I = 0');
    218   $DbResult = $System->Database->query($Query);
     218  $this->System->Database->query('SET @I = 0');
     219  $DbResult = $this->System->Database->query($Query);
    219220  while($UserLine = $DbResult->fetch_assoc())
    220221  {
     
    224225    $Sequence = '<input type="text" name="seq'.$UserLine['ID'].'" style="text-align: center; width: 40px;" value="'.$UserLine['Sequence2'].'"'.$DisabledInput[$Editable].'/>';
    225226    $Output .= '<tr>'.
    226     '<td><a href="'.$System->Link('/TranslationList.php?user='.$UserLine['ID'].'&amp;state=2&amp;group=0').'" title="Zobrazit všechny jeho přeložené texty">'.$UserLine['Name'].'</a></td>'.
     227    '<td><a href="'.$this->System->Link('/TranslationList.php?user='.$UserLine['ID'].'&amp;state=2&amp;group=0').'" title="Zobrazit všechny jeho přeložené texty">'.$UserLine['Name'].'</a></td>'.
    227228    '<td>'.$UserLine['TranslatedCount'].'</td>'.
    228229    '<td>'.$XP['Level'].'</td>'.
     
    238239function ExportViewGeneral()
    239240{
    240   global $System, $User;
     241  global $User;
    241242 
    242243  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    243244  $DisabledTextArea = array(false => ' readonly="yes"', true => '');
    244245  $Output = '<h3>Obecná nastavení</h3>';
    245   $DbRows = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     246  $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    246247  $Export = $DbRows->fetch_assoc();
    247248  if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
     
    253254    if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1;
    254255      else $WithDiacritic = 0;
    255     $System->Database->query('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']);
     256    $this->System->Database->query('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']);
    256257    $Export['Title'] = $_POST['Title'];
    257258    $Export['Description'] = $_POST['Description'];
     
    278279function ExportViewLanguages()
    279280{
    280   global $System, $TranslationTree, $User;
    281 
     281  global $TranslationTree, $User;
     282
     283  $Output = '';
    282284  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    283   $DbRows = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     285  $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    284286  $Export = $DbRows->fetch_assoc();
    285287  if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
     
    300302            else $Selected = false;
    301303          $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId;
    302           $DbResult = $System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition);
     304          $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition);
    303305          if($DbResult->num_rows > 0)
    304306          {
    305             if(!$Selected) $System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);
    306               else $System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition);
     307            if(!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);
     308              else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition);
    307309          } else
    308310          {
    309             if($Selected) $System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
     311            if($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
    310312          }         
    311313        }
     
    313315     
    314316      // Recalculate sequence number
    315       $System->Database->query('SET @I = 0');
    316       $System->Database->query('UPDATE `ExportLanguage` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
    317       ShowMessage('Výběr uložen.');
     317      $this->System->Database->query('SET @I = 0');
     318      $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
     319      $Output .= ShowMessage('Výběr uložen.');
    318320    }
    319321  }
     
    323325  $Query .=' WHERE `Language`.`Enabled` = 1 ORDER BY COALESCE(`Sequence`, 100)';
    324326
    325   $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X');
     327  $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X');
    326328  $DbRow = $DbResult->fetch_row();
    327329  $PageList = GetPageList($DbRow[0]);   
     
    333335  ); 
    334336  $Order = GetOrderTableHeader($TableColumns, 'Sequence2');
    335   $Output = '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
     337  $Output .= '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
    336338    '<h3>Jazyky</h3>';
    337339  if($Editable)
     
    349351
    350352  $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
    351   $System->Database->query('SET @I = 0');
    352   $DbResult = $System->Database->query($Query);
     353  $this->System->Database->query('SET @I = 0');
     354  $DbResult = $this->System->Database->query($Query);
    353355  while($Langugage = $DbResult->fetch_assoc())
    354356  {
     
    368370function ExportViewGroups()
    369371{
    370   global $System, $TranslationTree, $User;
     372  global $TranslationTree, $User;
    371373
    372374  $Output = '';
    373375  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    374   $DbRows = $System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
     376  $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
    375377  $Export = $DbRows->fetch_assoc();
    376378  if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
     
    391393            else $Selected = false;
    392394          $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId;
    393           $DbResult = $System->Database->query('SELECT * FROM `ExportGroup` '.$Condition);
     395          $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition);
    394396          if($DbResult->num_rows > 0)
    395397          {
    396             if(!$Selected) $System->Database->query('DELETE FROM `ExportGroup` '.$Condition);
     398            if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);
    397399          } else
    398400          {
    399             if($Selected) $System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
     401            if($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
    400402          }         
    401403        }
     
    407409  $Query = 'SELECT `Group`.*, `ExportGroup`.`Id` AS `ExportGroupId` FROM `Group` LEFT JOIN `ExportGroup` ON `ExportGroup`.`Export`='.$_GET['ExportId'].' AND `Group`=`Group`.`Id`';
    408410
    409   $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X');
     411  $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X');
    410412  $DbRow = $DbResult->fetch_row();
    411413  $PageList = GetPageList($DbRow[0]);   
     
    435437
    436438  $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
    437   $DbResult = $System->Database->query($Query);
     439  $DbResult = $this->System->Database->query($Query);
    438440  while($Group = $DbResult->fetch_assoc())
    439441  {
     
    455457function ExportViewOutputFormat()
    456458{
    457   global $System, $User;
     459  global $User;
    458460 
    459461  $Output = '';
     
    461463  if(array_key_exists('ExportId', $_GET))
    462464  {
    463     $DbRows = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     465    $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    464466    if($DbRows->num_rows > 0)
    465467    {   
     
    471473  if($_POST['Operation'] == 'Save')
    472474  {
    473     $System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']);
     475    $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']);
    474476    $Output .= ShowMessage('Výběr uložen.');
    475477  }
    476478
    477   $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     479  $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    478480  $Export = $DbResult->fetch_assoc();
    479481 
     
    486488    '<br />';
    487489  }
    488   $DbResult = $System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`');
     490  $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`');
    489491  while($ExportFormat = $DbResult->fetch_assoc())
    490492  {
     
    499501function ExportViewVersion()
    500502{
    501   global $System, $User;
     503  global $User;
    502504
    503505  $Output = '';
    504506  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    505   $DbRows = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     507  $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    506508  $Export = $DbRows->fetch_assoc();
    507509  if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
     
    511513  if(($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST)))
    512514  {
    513     $System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']);
     515    $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']);
    514516    $Output .= ShowMessage('Výběr uložen.');
    515517  }
    516518
    517   $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     519  $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    518520  $Export = $DbResult->fetch_assoc();
    519521
     
    522524  $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id`=`ExportVersion`.`ClientVersion` WHERE `ExportType`='.$Export['OutputType'];
    523525
    524   $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
     526  $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
    525527  $DbRow = $DbResult->fetch_row();
    526528  $PageList = GetPageList($DbRow[0]);   
     
    549551
    550552  $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit'];
    551   $DbResult = $System->Database->query($Query);
     553  $DbResult = $this->System->Database->query($Query);
    552554  while($Version = $DbResult->fetch_assoc())
    553555  {
    554     $Output .= '<tr><td><a href="http://www.wowwiki.com/Patch_'.$Version['Version'].'">'.$Version['Version'].'</a></td><td>'.$Version['BuildNumber'].'</td><td>'.HumanDate($Version['ReleaseDate']).'</td><td>'.$Version['Title'].'</td><td>'.RadioButton('ClientVersion', $Version['Id'], $Export['ClientVersion'] == $Version['Id'], '', !$Editable
     556    $Output .= '<tr><td><a href="http://www.wowwiki.com/Patch_'.$Version['Version'].'">'.
     557      $Version['Version'].'</a></td><td>'.$Version['BuildNumber'].'</td><td>'.
     558      HumanDate($Version['ReleaseDate']).'</td><td>'.$Version['Title'].'</td><td>'.
     559      RadioButton('ClientVersion', $Version['Id'], $Export['ClientVersion'] == $Version['Id'], '', !$Editable
    555560    ).'</td></tr>';
    556561
     
    565570function ExportViewOutput()
    566571{
    567   global $System;
    568  
    569572  $Output = '';
    570   $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     573  $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    571574  $Export = $DbResult->fetch_assoc();
    572575  if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
    573576  else if($Export['ClientVersion'] == '') $Output .= ShowMessage('Export nemá vybránu verzi klienta', MESSAGE_CRITICAL);
    574577  else {
    575         $DbResult = $System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']);
     578        $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']);
    576579  if($DbResult->num_rows > 0)
    577580  {
    578     $DbResult = $System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')');
     581    $DbResult = $this->System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')');
    579582    if($DbResult->num_rows > 0)
    580583    { 
    581       $System->Database->query('UPDATE `Export` SET `UsedCount` = `UsedCount` + 1 WHERE `Id`='.$Export['Id']);
     584      $this->System->Database->query('UPDATE `Export` SET `UsedCount` = `UsedCount` + 1 WHERE `Id`='.$Export['Id']);
    582585      $Output = ExportOutput($Export['Id'], $Export['OutputType']);
    583586    } else $Output = ShowMessage('Nebyla vybrána požadovaná verze klienta.', MESSAGE_CRITICAL);
     
    589592function ExportViewStat()
    590593{
    591   global $System, $Config;
    592 
    593   $Export = new Export($System);
     594  global $Config;
     595
     596  $Export = new Export($this->System);
    594597  $Export->Id = $_GET['ExportId'];
    595598  $Export->Init();
     
    603606  $Query = '';
    604607  $UnionItems = array();
    605   $DbResult = $System->Database->query($GroupListQuery);
     608  $DbResult = $this->System->Database->query($GroupListQuery);
    606609  while($DbRow = $DbResult->fetch_assoc())
    607610  {
     
    619622  $Query = substr($Query, 0, - 6);
    620623
    621   $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
     624  $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
    622625  $DbRow = $DbResult->fetch_row();
    623626  $PageList = GetPageList($DbRow[0]); 
     
    640643  if(count($UnionItems) > 0)
    641644  {
    642     $ID = $System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
     645    $ID = $this->System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
    643646    while($Group = $ID->fetch_assoc())
    644647    {
     
    659662function ExportView()
    660663{
    661   global $System;
    662 
    663664  $Output = '';
    664665  if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
    665666  {
    666     $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     667    $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    667668    if($DbResult->num_rows > 0)
    668669    {   
    669670      $Export = $DbResult->fetch_assoc();
    670671 
    671       $DbResult = $System->Database->query('SELECT * FROM `User` WHERE `ID`='.$Export['User']);
     672      $DbResult = $this->System->Database->query('SELECT * FROM `User` WHERE `ID`='.$Export['User']);
    672673      $UserLine = $DbResult->fetch_assoc();
    673674      $Output .= 'Export <strong><a href="?Action=View&amp;Tab=6&amp;ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$UserLine['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>';
    674675      $Output .= ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Statistika', 'Výstup'));
    675676      $Output .= '<div id="content">';
    676       if($_SESSION['Tab'] == 0) $Output .= ExportViewGeneral();
    677       else if($_SESSION['Tab'] == 1) $Output .= ExportViewTranslators();
    678       else if($_SESSION['Tab'] == 2) $Output .= ExportViewGroups();
    679       else if($_SESSION['Tab'] == 3) $Output .= ExportViewLanguages();
    680       else if($_SESSION['Tab'] == 4) $Output .= ExportViewOutputFormat();
    681       else if($_SESSION['Tab'] == 5) $Output .= ExportViewVersion();
    682       else if($_SESSION['Tab'] == 6) $Output .= ExportViewStat();
    683       else if($_SESSION['Tab'] == 7) $Output .= ExportViewOutput();
    684       else $Output .= ExportViewGeneral();
     677      if($_SESSION['Tab'] == 0) $Output .= $this->ExportViewGeneral();
     678      else if($_SESSION['Tab'] == 1) $Output .= $this->ExportViewTranslators();
     679      else if($_SESSION['Tab'] == 2) $Output .= $this->ExportViewGroups();
     680      else if($_SESSION['Tab'] == 3) $Output .= $this->ExportViewLanguages();
     681      else if($_SESSION['Tab'] == 4) $Output .= $this->ExportViewOutputFormat();
     682      else if($_SESSION['Tab'] == 5) $Output .= $this->ExportViewVersion();
     683      else if($_SESSION['Tab'] == 6) $Output .= $this->ExportViewStat();
     684      else if($_SESSION['Tab'] == 7) $Output .= $this->ExportViewOutput();
     685      else $Output .= $this->ExportViewGeneral();
    685686 
    686687      $Output .= '</div>';
     
    690691}
    691692
    692 if(array_key_exists('Action', $_GET))
    693 {
    694   if($_GET['Action'] == 'Create') $Output = ExportCreate();
    695   else if($_GET['Action'] == 'CreateFinish') $Output = ExportCreateFinish();
    696   else if($_GET['Action'] == 'View') $Output = ExportView();
    697   else if($_GET['Action'] == 'Delete') $Output = ExportDelete();
    698   else $Output = ExportList();
    699 } else $Output = ExportList();
    700 
    701 ShowPage($Output);
     693  function Show()
     694  {
     695    if(array_key_exists('Action', $_GET))
     696    {
     697      if($_GET['Action'] == 'Create') $Output = $this->ExportCreate();
     698      else if($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish();
     699      else if($_GET['Action'] == 'View') $Output = $this->ExportView();
     700      else if($_GET['Action'] == 'Delete') $Output = $this->ExportDelete();
     701      else $Output = $this->ExportList();
     702    } else $Output = $this->ExportList();
     703    return($Output);
     704  }
     705}
     706
  • trunk/Modules/Export/ProcessAoWoWExport.php

    r553 r558  
    44
    55include_once('../includes/global.php');
    6 include_once('export.php');   
    7 include_once('export_output.php');   
     6include_once('Export.php');   
     7include_once('ExportOutput.php');   
    88
    99LoadCommandLineParameters();
  • trunk/Modules/Export/ProcessTask.php

    r553 r558  
    55include_once('../includes/global.php');
    66include_once('../includes/zip.lib.php');
    7 include_once('export.php');   
    8 include_once('export_output.php');   
     7include_once('Export.php');   
     8include_once('ExportOutput.php');   
    99
    1010//LoadCommandLineParameters();
Note: See TracChangeset for help on using the changeset viewer.