Changeset 888 for trunk/Modules/Export/Export.php
- Timestamp:
- Dec 27, 2022, 7:50:23 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/Export.php
r882 r888 1 1 <?php 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 } 2 64 3 65 class Export extends Model … … 601 663 '<table cellspacing="10"><tr><td valign="top">'. 602 664 603 '<p>Texty přebírány z projektu <a href="http ://wowpreklad.zdechov.net/">wowpreklad.zdechov.net</a><br>'.604 '<a href="http://wowpreklad.zdechov.net /export/?Action=View&ExportId='.$this->Id.'&Tab=0">Export '.$this->Id.'</a></p><br>'.665 '<p>Texty přebírány z projektu <a href="https://wowpreklad.zdechov.net/">wowpreklad.zdechov.net</a><br>'. 666 '<a href="http://wowpreklad.zdechov.nets/export/?Action=View&ExportId='.$this->Id.'&Tab=0">Export '.$this->Id.'</a></p><br>'. 605 667 606 668 … … 609 671 '<li>Požadovaná verze klienta: '.$this->ClientVersion['Version'].'</li>'. 610 672 '<li>Datum uvolnění: '.date('d.m.Y h:m',time()).'</li>'. 611 '<li>Sestaveno automaticky překladovým systémem <a href="http ://wowpreklad.zdechov.net/">WoW překlad</a></li>'.673 '<li>Sestaveno automaticky překladovým systémem <a href="https://wowpreklad.zdechov.net/">WoW překlad</a></li>'. 612 674 //'<li>Tento soubor se generuje každý den. Pokud se zapojíte do překladu, zítra můžete stáhnout tento soubor znovu včetně svých překladů</li>'. 613 675 //'<li>Sestavil: Maron</li>'. … … 716 778 include_once(dirname(__FILE__).'/ExportOutput.php'); 717 779 718 class ModuleExport extends AppModule719 {720 function __construct(System $System)721 {722 parent::__construct($System);723 $this->Name = 'Export';724 $this->Version = '1.0';725 $this->Creator = 'Chronos';726 $this->License = 'GNU/GPL';727 $this->Description = 'Allow parametric export of translated texts to various supported output formats';728 $this->Dependencies = array('Translation');729 }730 731 function DoStart()732 {733 $this->System->RegisterPage('export', 'PageExport');734 $this->System->RegisterPage(array('export', 'progress'), 'PageExportProgress');735 $this->System->RegisterMenuItem(array(736 'Title' => 'Exporty',737 'Hint' => 'Zde si můžete stáhnout přeložené texty',738 'Link' => $this->System->Link('/export/'),739 'Permission' => LICENCE_ANONYMOUS,740 'Icon' => '',741 ), 2);742 }743 744 function GetTaskProgress($TaskId)745 {746 $Output = '';747 $DbResult = $this->Database->query('SELECT * FROM `ExportTask` '.748 'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '.749 '((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '.750 '(`TimeFinish` IS NULL) OR (`Export` ='.$TaskId.') ORDER BY `TimeQueued`'); // `Export`='.$Export->Id751 while ($Task = $DbResult->fetch_assoc())752 {753 $Export = '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>';754 if ($TaskId == $Task['Export'])755 $Export = ''.$Export.' (tento)';756 757 // Show progress bar758 $Output .= ' <strong>Export '.$Export.':</strong> <div id="progress'.$Task['Export'].'">'.759 '<strong>'.ProgressBar(300, $Task['Progress']).'</strong> ';760 761 // Show estimated time to complete762 $PrefixMultiplier = new PrefixMultiplier();763 if ($Task['Progress'] > 0) {764 $ElapsedTime = time() - MysqlDateTimeToTime($Task['TimeStart']);765 $Output .= T('Elapsed time').': <strong>'.$PrefixMultiplier->Add($ElapsedTime, '', 4, 'Time').'</strong> / ';766 $EstimatedTime = (time() - MysqlDateTimeToTime($Task['TimeStart'])) / $Task['Progress'] * (100 - $Task['Progress']);767 $Output .= T('Estimated remaining time').': <strong>'.$PrefixMultiplier->Add($EstimatedTime, '', 4, 'Time').'</strong><br/>';768 }769 $Output .= '</div>';770 771 if ($Task['Progress'] > 99)772 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'.773 'setTimeout("parent.location.href=\''.$this->System->Link('/export/?Action=View&Tab=7&ExportId='.$TaskId).'\'", 500)'.774 '</script>';775 }776 return $Output;777 }778 }
Note:
See TracChangeset
for help on using the changeset viewer.