Changeset 893 for trunk/Modules/Export
- Timestamp:
- Mar 6, 2023, 1:48:45 AM (22 months ago)
- Location:
- trunk/Modules/Export
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/CreateAddon.php
r888 r893 5 5 class ExportAddon extends Export 6 6 { 7 8 7 // Replace special codes by lua functions 9 8 function ReplaceVarInText($string, $strlower = 'strlower') 10 9 { 11 12 10 $string = str_replace('$N', '"..'.$strlower.'(UnitName("player")).."', $string); 13 11 $string = str_replace('$n', '"..'.$strlower.'(UnitName("player")).."', $string); … … 149 147 $ID = $this->Database->query('SELECT `BuildNumber` FROM `ClientVersion` WHERE '. 150 148 ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY `BuildNumber` DESC LIMIT 1'); 151 if ($ID->num_rows > 0) { 149 if ($ID->num_rows > 0) 150 { 152 151 $ExportVersionOld = $ID->fetch_assoc(); 153 152 $ExportVersionOld = $ExportVersionOld['BuildNumber']; … … 164 163 } 165 164 } 166 165 //last version 167 166 168 167 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion)); … … 177 176 } 178 177 179 foreach ($TableTexts as $key => $value) { 180 $Buffer .= "\n".'["'.$key.'"]="'.$value.'",'; 181 $i++; 178 foreach ($TableTexts as $key => $value) 179 { 180 $Buffer .= "\n".'["'.$key.'"]="'.$value.'",'; 181 $i++; 182 182 } 183 184 183 185 184 $Buffer = $Buffer."\n};if not CZWOW_".$Column['AddonFileName']." then CZWOW_".$Column['AddonFileName']."=0; end; CZWOW_".$Column['AddonFileName']."=CZWOW_".$Column['AddonFileName']."+".$i.";\n"; … … 189 188 } 190 189 } 191 192 190 193 191 // Generete list file of translated … … 195 193 $Buffer = ''; 196 194 foreach ($CreatedFileList as $CreatedFile) 195 { 197 196 $Buffer .= 'CZWOW_'.str_replace('_','_count=',$CreatedFile).';'."\n"; 197 } 198 198 foreach ($TranslationTree as $Group) 199 { 199 200 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) 200 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList)))201 201 { 202 $Buffer .= 'CZWOW_'.$Column['AddonFileName'].'_count=0;'."\n"; 202 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList))) 203 { 204 $Buffer .= 'CZWOW_'.$Column['AddonFileName'].'_count=0;'."\n"; 205 } 206 } 203 207 } 204 208 205 209 file_put_contents($this->TempDir.'CzWoW/'.$CountFiles, $Buffer); 206 207 210 208 211 // Generate file Translates.xml … … 210 213 $Buffer .= '<script file="'.$CountFiles.'"/>'."\n"; 211 214 foreach ($CreatedFileList as $CreatedFile) 215 { 212 216 $Buffer .= '<script file="'.$CreatedFile.'.lua"/>'."\n"; 217 } 213 218 $Buffer .= '</Ui>'; 214 219 file_put_contents($this->TempDir.'CzWoW/Translates.xml', $Buffer); 215 220 return $Output; 216 221 } 217 218 222 219 223 function MakeClientStrings() … … 282 286 283 287 '; 284 $DbResult = $ System->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC');288 $DbResult = $this->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC'); 285 289 while ($Line = $DbResult->fetch_assoc()) 286 290 { -
trunk/Modules/Export/Export.php
r891 r893 1 1 <?php 2 2 3 class ModuleExport extends Module 4 { 5 function __construct(System $System) 6 { 7 parent::__construct($System); 8 $this->Name = 'Export'; 9 $this->Version = '1.0'; 10 $this->Creator = 'Chronos'; 11 $this->License = 'GNU/GPL'; 12 $this->Description = 'Allow parametric export of translated texts to various supported output formats'; 13 $this->Dependencies = array('Translation'); 14 } 15 16 function DoStart(): void 17 { 18 $this->System->RegisterPage(['export'], 'PageExport'); 19 $this->System->RegisterPage(['export', 'progress'], 'PageExportProgress'); 20 Core::Cast($this->System)->RegisterMenuItem(array( 21 'Title' => 'Exporty', 22 'Hint' => 'Zde si můžete stáhnout přeložené texty', 23 'Link' => $this->System->Link('/export/'), 24 'Permission' => LICENCE_ANONYMOUS, 25 'Icon' => '', 26 ), 2); 27 } 28 29 function GetTaskProgress($TaskId) 30 { 31 $Output = ''; 32 $DbResult = $this->Database->query('SELECT * FROM `ExportTask` '. 33 'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '. 34 '((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '. 35 '(`TimeFinish` IS NULL) OR (`Export` ='.$TaskId.') ORDER BY `TimeQueued`'); // `Export`='.$Export->Id 36 while ($Task = $DbResult->fetch_assoc()) 37 { 38 $Export = '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>'; 39 if ($TaskId == $Task['Export']) 40 $Export = ''.$Export.' (tento)'; 41 42 // Show progress bar 43 $Output .= ' <strong>Export '.$Export.':</strong> <div id="progress'.$Task['Export'].'">'. 44 '<strong>'.ProgressBar(300, $Task['Progress']).'</strong> '; 45 46 // Show estimated time to complete 47 $PrefixMultiplier = new PrefixMultiplier(); 48 if ($Task['Progress'] > 0) { 49 $ElapsedTime = time() - MysqlDateTimeToTime($Task['TimeStart']); 50 $Output .= T('Elapsed time').': <strong>'.$PrefixMultiplier->Add($ElapsedTime, '', 4, 'Time').'</strong> / '; 51 $EstimatedTime = (time() - MysqlDateTimeToTime($Task['TimeStart'])) / $Task['Progress'] * (100 - $Task['Progress']); 52 $Output .= T('Estimated remaining time').': <strong>'.$PrefixMultiplier->Add($EstimatedTime, '', 4, 'Time').'</strong><br/>'; 53 } 54 $Output .= '</div>'; 55 56 if ($Task['Progress'] > 99) 57 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 58 'setTimeout("parent.location.href=\''.$this->System->Link('/export/?Action=View&Tab=7&ExportId='.$TaskId).'\'", 500)'. 59 '</script>'; 60 } 61 return $Output; 62 } 63 } 3 include_once(dirname(__FILE__).'/ModuleExport.php'); 4 include_once(dirname(__FILE__).'/Page.php'); 5 include_once(dirname(__FILE__).'/ExportOutput.php'); 64 6 65 7 class Export extends Model 66 8 { 67 var$Id;68 var$AnoNe = array('Ne', 'Ano');9 public int $Id; 10 public array $AnoNe = array('Ne', 'Ano'); 69 11 var $WhereLang; 70 12 var $WhereUsers; … … 73 15 var $ClientVersion; 74 16 var $OrderByUserList; 75 var $TempDir; 76 var $SourceDir; 17 public string $TempDir; 18 public string $TempDirRelative; 19 public string $SourceDir; 20 public string $SourceDirRelative; 21 public array $Export; 77 22 78 23 function Init() 79 24 { 80 $this->TempDir = dirname(__FILE__).'/../../'. $this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';25 $this->TempDir = dirname(__FILE__).'/../../'.Core::Cast($this->System)->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 81 26 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true); 82 $this->TempDirRelative = $this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';83 $this->SourceDir = dirname(__FILE__).'/../../'. $this->System->Config['Web']['SourceFolder'];84 $this->SourceDirRelative = $this->System->Config['Web']['SourceFolder'];27 $this->TempDirRelative = Core::Cast($this->System)->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 28 $this->SourceDir = dirname(__FILE__).'/../../'.Core::Cast($this->System)->Config['Web']['SourceFolder']; 29 $this->SourceDirRelative = Core::Cast($this->System)->Config['Web']['SourceFolder']; 85 30 if (!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true); 86 31 } … … 158 103 // $Columns = substr($Columns, 0, -2); 159 104 160 $Query = 'SELECT * FROM (SELECT ANY_VALUE(`TT`.`ID`) AS `TTID` FROM (SELECT '.$Columns.' T.`ID`,T.`Language`,T.`User`,T.`Entry`,T.`VersionEnd`,T.`VersionStart`, `User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'. 105 $Query = 'SELECT * FROM (SELECT MIN(`TT`.`ID`) AS `TTID` FROM 106 (SELECT '.$Columns.' T.`ID`,T.`Language`,T.`User`,T.`Entry`,T.`VersionEnd`,T.`VersionStart`, `User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'. 161 107 ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '. 162 108 ' JOIN `User` ON `User`.`ID`=`T`.`User`'. … … 179 125 $Query = 'SELECT `T4`.*, '.$OriginalColumns.' FROM ('.$Query.') AS `T4` '. 180 126 ' LEFT JOIN `'.$Group['TablePrefix'].'` AS `T3` ON (`T3`.`Entry` = `T4`.`Entry`) '. 181 'AND (`T3`.`Language` = '. $this->System->Config['OriginalLanguage'].') AND '.127 'AND (`T3`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND '. 182 128 '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 183 129 … … 219 165 function ExportToMangosSQL() 220 166 { 167 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 221 168 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 222 169 … … 227 174 "-- ===========================================\n". 228 175 "--\n". 229 "-- Web projektu: ". $this->System->Config['Web']['Host'].$this->System->Link('/')."\n".176 "-- Web projektu: ".Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/')."\n". 230 177 "-- Datum exportu: ".date("j.n.Y H:i:s")."\n". 231 "-- Znaková sada: ". $this->System->Config['Database']['Charset']." / ".$this->System->Config['Web']['Charset']."\n".178 "-- Znaková sada: ".Core::Cast($this->System)->Config['Database']['Charset']." / ".Core::Cast($this->System)->Config['Web']['Charset']."\n". 232 179 "-- Diakritika: ".$this->AnoNe[$this->Export['WithDiacritic']]."\n". 233 "-- Vygeneroval uživatel: ".$ this->System->User->Name."\n".180 "-- Vygeneroval uživatel: ".$User->Name."\n". 234 181 "-- Vzato od uživatelů: ".$this->UserNames."\n". 235 182 "-- Generované tabulky: "; … … 370 317 } 371 318 372 function AddProgress($add = 1) 373 { 374 $DbResult = $this->System->Database->query('SELECT Progress FROM `ExportTask` WHERE `Export`='.$this->Id); 375 $Task = $DbResult->fetch_assoc(); 376 $per = $Task['Progress']+$add; 377 $this->System->Database->query('UPDATE `ExportTask` SET `Progress`='.$per.' WHERE `Export`='.$this->Id); 319 function AddProgress($Add = 1) 320 { 321 $DbResult = $this->System->Database->query('SELECT `Progress` FROM `ExportTask` WHERE `Export`='.$this->Id); 322 if ($DbResult->num_rows > 0) 323 { 324 $Task = $DbResult->fetch_assoc(); 325 $Progress = $Task['Progress'] + $Add; 326 $this->System->Database->query('UPDATE `ExportTask` SET `Progress`='.$Progress.' WHERE `Export`='.$this->Id); 327 } 378 328 } 379 329 … … 723 673 function ExportToXML() 724 674 { 675 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 725 676 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 726 677 … … 730 681 "<document>\n". 731 682 " <meta>\n". 732 " <projecturl>". $this->System->Config['Web']['Host'].$this->System->Link('/')."</projecturl>\n".683 " <projecturl>".Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/')."</projecturl>\n". 733 684 " <time>".date('r')."</time>\n". 734 685 " <diacritics mode=".'"'.$this->Export['WithDiacritic'].'"'." />\n". 735 " <author>".$ this->System->User->Name."</author>\n".686 " <author>".$User->Name."</author>\n". 736 687 " <contributors>\n"; 737 688 foreach (explode(',', $this->UserNames) as $UserName) 738 $Buffer .= " <user>".$UserName."</user>\n"; 689 { 690 $Buffer .= " <user>".trim($UserName)."</user>\n"; 691 } 739 692 $Buffer .= 740 693 " </contributors>\n". … … 755 708 while ($Line = $DbResult2->fetch_assoc()) 756 709 { 757 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n"; 758 $Values = ''; 710 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['User'].'">'."\n"; 759 711 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 760 712 { … … 774 726 } 775 727 } 776 777 include_once(dirname(__FILE__).'/Page.php');778 include_once(dirname(__FILE__).'/ExportOutput.php');779 -
trunk/Modules/Export/ExportOutput.php
r880 r893 22 22 function OutputAoWoWToFile($ExportId) 23 23 { 24 global $System , $Config;24 global $System; 25 25 26 26 $Output = ''; … … 50 50 function OutputAoWoWToHTML($ExportId) 51 51 { 52 global $System , $Config;52 global $System; 53 53 54 54 $Export = new Export($System); … … 63 63 function OutputMangosSQLToFile($ExportId) 64 64 { 65 global $System , $Config;65 global $System; 66 66 67 67 $Output = ''; … … 140 140 function OutputXMLToFile($ExportId) 141 141 { 142 global $ Config, $System;142 global $System; 143 143 144 144 $Output = ''; … … 318 318 function OutputLua($ExportId) 319 319 { 320 global $System , $Config;320 global $System; 321 321 322 322 $Export = new Export($System); -
trunk/Modules/Export/Page.php
r888 r893 16 16 function ExportList() 17 17 { 18 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 18 19 $Output = '<a href="?Action=ViewList">'.T('All').'</a>'; 19 if ($ this->System->User->Licence(LICENCE_USER))20 if ($User->Licence(LICENCE_USER)) 20 21 { 21 22 $Output .= ' <a href="?Action=ViewList&Filter=Others">'.T('Others').'</a>'. … … 23 24 } 24 25 25 if ($ this->System->User->Licence(LICENCE_USER))26 if ($User->Licence(LICENCE_USER)) 26 27 $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>'; 27 28 … … 29 30 if (array_key_exists('Filter', $_GET)) 30 31 { 31 if ($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$ this->System->User->Id;32 if ($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$ this->System->User->Id;32 if ($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$User->Id; 33 if ($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$User->Id; 33 34 } 34 35 … … 66 67 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">'.T('View').'</a> '. 67 68 '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=7">'.T('Make export').'</a>'; 68 if ($Export['User'] == $ this->System->User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy delete item?').'\');">'.T('Delete').'</a>';69 if ($ this->System->User->Id != null) $Action .= ' <a href="?Action=Clone&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>';69 if ($Export['User'] == $User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy delete item?').'\');">'.T('Delete').'</a>'; 70 if ($User->Id != null) $Action .= ' <a href="?Action=Clone&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>'; 70 71 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 71 72 '<td><a href="'.$this->System->Link('/user/?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. … … 84 85 function ExportCreate() 85 86 { 86 if ($this->System->User->Licence(LICENCE_USER)) 87 { 88 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 87 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 88 if ($User->Licence(LICENCE_USER)) 89 { 90 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 89 91 $DbRow = $DbResult->fetch_row(); 90 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])92 if ($DbRow[0] < Core::Cast($this->System)->Config['MaxExportPerUser']) 91 93 { 92 94 $Output = '<form action="?Action=CreateFinish" method="post">'. … … 96 98 '<tr><td colspan="2"><input type="submit" value="'.T('Create').'" /></td></tr>'. 97 99 '</table></fieldset></form>'; 98 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL);100 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), Core::Cast($this->System)->Config['MaxExportPerUser']), MESSAGE_CRITICAL); 99 101 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 100 102 return $Output; … … 103 105 function ExportCreateFinish() 104 106 { 105 if ($this->System->User->Licence(LICENCE_USER)) 107 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 108 if ($User->Licence(LICENCE_USER)) 106 109 { 107 110 if (array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 108 111 { 109 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$ this->System->User->Id);112 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 110 113 $DbRow = $DbResult->fetch_row(); 111 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])114 if ($DbRow[0] < Core::Cast($this->System)->Config['MaxExportPerUser']) 112 115 { 113 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$ this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")');116 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); 114 117 $ExportId = $this->System->Database->insert_id; 115 118 $Output = ShowMessage(T('New export created.<br />Direct link to export').': <a href="?Action=View&ExportId='.$ExportId.'">'.T('here').'</a>'); … … 117 120 $_GET['Filter'] = 'my'; 118 121 $this->ExportList(); 119 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL);122 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), Core::Cast($this->System)->Config['MaxExportPerUser']), MESSAGE_CRITICAL); 120 123 } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL); 121 124 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); … … 125 128 function ExportDelete() 126 129 { 127 if ($this->System->User->Licence(LICENCE_USER)) 128 { 129 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$this->System->User->Id.')'); 130 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 131 if ($User->Licence(LICENCE_USER)) 132 { 133 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$User->Id.')'); 130 134 if ($DbResult->num_rows > 0) 131 135 { … … 157 161 function ExportViewTranslators() 158 162 { 163 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 159 164 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 160 165 … … 163 168 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 164 169 $Export = $DbResult->fetch_assoc(); 165 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;170 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 166 171 else $Editable = false; 167 172 … … 273 278 function ExportViewGeneral() 274 279 { 280 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 275 281 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 276 282 $DisabledTextArea = array(false => ' readonly="yes"', true => ''); … … 278 284 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 279 285 $Export = $DbRows->fetch_assoc(); 280 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;286 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 281 287 else $Editable = false; 282 288 … … 300 306 $Output .= '<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'. 301 307 '<table>'; 302 if ($ this->System->User->Id != null)308 if ($User->Id != null) 303 309 { 304 310 $Output .= '<input type="hidden" name="Operation" value="Save"/>'. … … 306 312 if ($Editable) $Output .= ' <input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'; 307 313 $Output .= ' <a href="?Action=Clone&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a> '; 308 if ($ this->System->User->Licence(LICENCE_ADMIN))314 if ($User->Licence(LICENCE_ADMIN)) 309 315 $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' '; 310 316 $Output .= '</td></tr>'; … … 319 325 function ExportViewLanguages() 320 326 { 327 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 321 328 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 322 329 … … 325 332 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 326 333 $Export = $DbRows->fetch_assoc(); 327 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;334 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 328 335 else $Editable = false; 329 336 … … 410 417 function ExportViewGroups() 411 418 { 419 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 412 420 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 413 421 … … 416 424 $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 417 425 $Export = $DbRows->fetch_assoc(); 418 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;426 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 419 427 else $Editable = false; 420 428 … … 538 546 function ExportViewOutputFormat() 539 547 { 548 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 540 549 $Output = ''; 541 550 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 546 555 { 547 556 $Export = $DbRows->fetch_assoc(); 548 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;557 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 549 558 else $Editable = false; 550 559 … … 583 592 function ExportViewVersion() 584 593 { 594 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 585 595 $Output = ''; 586 596 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 587 597 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 588 598 $Export = $DbRows->fetch_assoc(); 589 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;599 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 590 600 else $Editable = false; 591 601 … … 697 707 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 698 708 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 699 ' WHERE (`Language` = '. $this->System->Config['OriginalLanguage'].') AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'.709 ' WHERE (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'. 700 710 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name`'; 701 711 } … … 777 787 function ExportClone() 778 788 { 779 if ($this->System->User->Licence(LICENCE_USER)) 789 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 790 if ($User->Licence(LICENCE_USER)) 780 791 { 781 792 if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 782 793 { 783 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$ this->System->User->Id);794 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 784 795 $DbRow = $DbResult->fetch_row(); 785 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])796 if ($DbRow[0] < Core::Cast($this->System)->Config['MaxExportPerUser']) 786 797 { 787 798 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); … … 791 802 unset($DbRow['Id']); 792 803 $DbRow['UsedCount'] = '0'; 793 $DbRow['User'] = $ this->System->User->Id;804 $DbRow['User'] = $User->Id; 794 805 $DbRow['TimeCreate'] = 'NOW()'; 795 806 $DbRow['Title'] .= ' - '.T('clone'); … … 807 818 } else $Output = ShowMessage('Zdrojový export nenalezen', MESSAGE_CRITICAL); 808 819 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), 809 $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL);820 Core::Cast($this->System)->Config['MaxExportPerUser']), MESSAGE_CRITICAL); 810 821 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 811 822 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
Note:
See TracChangeset
for help on using the changeset viewer.