Name = 'Export'; $this->Version = '1.0'; $this->Creator = 'Chronos'; $this->License = 'GNU/GPL'; $this->Description = 'Allow parametric export of translated texts to various supported output formats'; $this->Dependencies = array('Translation'); } function DoStart(): void { $this->System->RegisterPage(['export'], 'PageExport'); $this->System->RegisterPage(['export', 'progress'], 'PageExportProgress'); Core::Cast($this->System)->RegisterMenuItem(array( 'Title' => 'Exporty', 'Hint' => 'Zde si můžete stáhnout přeložené texty', 'Link' => $this->System->Link('/export/'), 'Permission' => LICENCE_ANONYMOUS, 'Icon' => '', ), 2); } function GetTaskProgress($TaskId) { $Output = ''; $DbResult = $this->Database->query('SELECT * FROM `ExportTask` '. 'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '. '((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '. '(`TimeFinish` IS NULL) OR (`Export` ='.$TaskId.') ORDER BY `TimeQueued`'); // `Export`='.$Export->Id while ($Task = $DbResult->fetch_assoc()) { $Export = ''.$Task['Export'].''; if ($TaskId == $Task['Export']) $Export = ''.$Export.' (tento)'; // Show progress bar $Output .= ' Export '.$Export.':
'. ''.ProgressBar(300, $Task['Progress']).' '; // Show estimated time to complete $PrefixMultiplier = new PrefixMultiplier(); if ($Task['Progress'] > 0) { $ElapsedTime = time() - MysqlDateTimeToTime($Task['TimeStart']); $Output .= T('Elapsed time').': '.$PrefixMultiplier->Add($ElapsedTime, '', 4, 'Time').' / '; $EstimatedTime = (time() - MysqlDateTimeToTime($Task['TimeStart'])) / $Task['Progress'] * (100 - $Task['Progress']); $Output .= T('Estimated remaining time').': '.$PrefixMultiplier->Add($EstimatedTime, '', 4, 'Time').'
'; } $Output .= '
'; if ($Task['Progress'] > 99) $Output .= ''; } return $Output; } }