Name = 'Translation'; $this->Version = '1.0'; $this->Creator = 'Chronos'; $this->License = 'GNU/GPL'; $this->Description = 'Translation of text items and groups from original language to other languages.'; $this->Dependencies = array('News', 'Search'); } function DoStart(): void { $this->System->RegisterPage(['comparison.php'], 'PageTranslationComparison'); $this->System->RegisterPage(['form.php'], 'PageTranslationForm'); $this->System->RegisterPage(['save.php'], 'PageTranslationSave'); $this->System->RegisterPage(['progress'], 'PageProgress'); $this->System->RegisterPage(['translation-groups'], 'PageTranslationGroups'); $this->System->RegisterPage(['TranslationList.php'], 'PageTranslationList'); $this->System->RegisterPage(['LoadNames.php'], 'PageLoadNames'); $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => T('Last translations'), 'Channel' => 'translation', 'Callback' => array($this, 'ShowRSS'), 'Permission' => LICENCE_ANONYMOUS)); Core::Cast($this->System)->RegisterMenuItem(array( 'Title' => T('Completion status'), 'Hint' => 'Stav dokončení překládů', 'Link' => $this->System->Link('/progress/'), 'Permission' => LICENCE_ANONYMOUS, 'Icon' => '', ), 1); Core::Cast($this->System)->RegisterMenuItem(array( 'Title' => T('Data source'), 'Hint' => 'Informace o překladových skupinách', 'Link' => $this->System->Link('/translation-groups/'), 'Permission' => LICENCE_ANONYMOUS, 'Icon' => '', )); if (array_key_exists('Search', $this->System->ModuleManager->Modules)) { $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); foreach ($TranslationTree as $Group) { $Table = $Group['TablePrefix']; $Columns = array('ID', 'Entry'); foreach ($Group['Items'] as $Item) { if ($Item['Column'] != '') $Columns[] = $Item['Column']; } $this->System->ModuleManager->Modules['Search']->RegisterSearch('group'.$Group['Id'], sprintf(T('Translation group "%s"'), $Group['Name']), $Columns, '`'.$Table.'`', $this->System->Link('/TranslationList.php?group='. $Group['Id'].'&user=0&state=0&entry=&text=')); } } Core::Cast($this->System)->RegisterPageBarItem('Right', 'TranslatedMenu', array($this, 'ShowTranslatedMenu')); } function ShowRSS() { $Items = array(); $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '. 'JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100'); while ($DbRow = $DbResult->fetch_assoc()) { $Items[] = array ( 'Title' => strip_tags($DbRow['Text'].' ('.$DbRow['UserName'].')'), 'Link' => 'http://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/'), 'Description' => $DbRow['Text'], 'Time' => $DbRow['Date'], ); } $Output = GenerateRSS(array ( 'Title' => Core::Cast($this->System)->Config['Web']['Title'].' - '.T('Last translations'), 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/'), 'Description' => Core::Cast($this->System)->Config['Web']['Description'], 'WebmasterEmail' => Core::Cast($this->System)->Config['Web']['AdminEmail'], 'Items' => $Items, )); return $Output; } function ShowBox() { $Count = 40; $Output = ''.T('Last translated').':'; $Output .= '
'.T('Date').' | '.T('Who').' | '.T('New').' | '.T('Source').' | '.T('Group').' |
---|---|---|---|---|
'.HumanDate($DbRow['ModifyTime']).' | '. ''.$DbRow['UserName'].' | '. ''.$DbRow['ID'].' | '. ''.$DbRow['Take'].' | '. ''.T($DbRow['GroupName']).' |