[550] | 1 | <?php
|
---|
| 2 |
|
---|
[816] | 3 | include_once(dirname(__FILE__).'/Comparison.php');
|
---|
| 4 | include_once(dirname(__FILE__).'/Form.php');
|
---|
| 5 | include_once(dirname(__FILE__).'/Save.php');
|
---|
| 6 | include_once(dirname(__FILE__).'/TranslationList.php');
|
---|
| 7 | include_once(dirname(__FILE__).'/Progress.php');
|
---|
[806] | 8 | include_once(dirname(__FILE__).'/LoadNames.php');
|
---|
[826] | 9 | include_once(dirname(__FILE__).'/UserLevel.php');
|
---|
[550] | 10 |
|
---|
| 11 | class ModuleTranslation extends AppModule
|
---|
| 12 | {
|
---|
[838] | 13 | function __construct(System $System)
|
---|
[550] | 14 | {
|
---|
| 15 | parent::__construct($System);
|
---|
| 16 | $this->Name = 'Translation';
|
---|
| 17 | $this->Version = '1.0';
|
---|
| 18 | $this->Creator = 'Chronos';
|
---|
| 19 | $this->License = 'GNU/GPL';
|
---|
| 20 | $this->Description = 'Translation of text items and groups from original language to other languages.';
|
---|
[846] | 21 | $this->Dependencies = array('News', 'Search');
|
---|
[550] | 22 | }
|
---|
[815] | 23 |
|
---|
[838] | 24 | function DoStart()
|
---|
[550] | 25 | {
|
---|
[816] | 26 | global $TranslationTree;
|
---|
[815] | 27 |
|
---|
[816] | 28 | $this->System->RegisterPage('comparison.php', 'PageTranslationComparison');
|
---|
| 29 | $this->System->RegisterPage('form.php', 'PageTranslationForm');
|
---|
| 30 | $this->System->RegisterPage('save.php', 'PageTranslationSave');
|
---|
| 31 | $this->System->RegisterPage('progress', 'PageProgress');
|
---|
[843] | 32 | $this->System->RegisterPage('translation-groups', 'PageTranslationGroups');
|
---|
[550] | 33 | $this->System->RegisterPage('TranslationList.php', 'PageTranslationList');
|
---|
[806] | 34 | $this->System->RegisterPage('LoadNames.php', 'PageLoadNames');
|
---|
[815] | 35 | $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => T('Last translations'),
|
---|
[581] | 36 | 'Channel' => 'translation', 'Callback' => array($this, 'ShowRSS'), 'Permission' => LICENCE_ANONYMOUS));
|
---|
[816] | 37 | $this->System->RegisterMenuItem(array(
|
---|
[842] | 38 | 'Title' => T('Completion status'),
|
---|
| 39 | 'Hint' => 'Stav dokončení překládů',
|
---|
| 40 | 'Link' => $this->System->Link('/progress/'),
|
---|
| 41 | 'Permission' => LICENCE_ANONYMOUS,
|
---|
| 42 | 'Icon' => '',
|
---|
[815] | 43 | ), 1);
|
---|
[842] | 44 | $this->System->RegisterMenuItem(array(
|
---|
| 45 | 'Title' => T('Data source'),
|
---|
| 46 | 'Hint' => 'Informace o překladových skupinách',
|
---|
[843] | 47 | 'Link' => $this->System->Link('/translation-groups/'),
|
---|
[842] | 48 | 'Permission' => LICENCE_ANONYMOUS,
|
---|
| 49 | 'Icon' => '',
|
---|
| 50 | ));
|
---|
[846] | 51 | /*
|
---|
[626] | 52 | if(array_key_exists('Search', $this->System->ModuleManager->Modules))
|
---|
| 53 | {
|
---|
[816] | 54 | foreach($TranslationTree as $Group)
|
---|
| 55 | {
|
---|
| 56 | $Table = $Group['TablePrefix'];
|
---|
[815] | 57 |
|
---|
[816] | 58 | $Columns = array('ID', 'Entry');
|
---|
| 59 | foreach($Group['Items'] as $Item)
|
---|
| 60 | {
|
---|
| 61 | if($Item['Column'] != '') $Columns[] = $Item['Column'];
|
---|
| 62 | }
|
---|
[626] | 63 |
|
---|
| 64 | $this->System->ModuleManager->Modules['Search']->RegisterSearch('group'.$Group['Id'],
|
---|
[846] | 65 | sprintf(T('Translation group "%s"'), $Group['Name']), $Columns, '`'.$Table.'`',
|
---|
| 66 | $this->System->Link('/TranslationList.php?group='.
|
---|
| 67 | $Group['Id'].'&user=0&state=0&entry=&text='));
|
---|
[816] | 68 | }
|
---|
[815] | 69 | }
|
---|
[846] | 70 | */
|
---|
[550] | 71 | }
|
---|
[815] | 72 |
|
---|
[581] | 73 | function ShowRSS()
|
---|
| 74 | {
|
---|
[816] | 75 | $Items = array();
|
---|
[725] | 76 | $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '.
|
---|
[816] | 77 | 'JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100');
|
---|
| 78 | while($DbRow = $DbResult->fetch_assoc())
|
---|
| 79 | {
|
---|
| 80 | $Items[] = array
|
---|
| 81 | (
|
---|
| 82 | 'Title' => strip_tags($DbRow['Text'].' ('.$DbRow['UserName'].')'),
|
---|
| 83 | 'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
|
---|
| 84 | 'Description' => $DbRow['Text'],
|
---|
| 85 | 'Time' => $DbRow['Date'],
|
---|
| 86 | );
|
---|
| 87 | }
|
---|
| 88 | $Output = GenerateRSS(array
|
---|
| 89 | (
|
---|
| 90 | 'Title' => $this->System->Config['Web']['Title'].' - '.T('Last translations'),
|
---|
| 91 | 'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
|
---|
| 92 | 'Description' => $this->System->Config['Web']['Description'],
|
---|
| 93 | 'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
|
---|
| 94 | 'Items' => $Items,
|
---|
| 95 | ));
|
---|
[581] | 96 | return($Output);
|
---|
| 97 | }
|
---|
[550] | 98 | }
|
---|