source: trunk/Modules/Translation/Translation.php@ 846

Last change on this file since 846 was 846, checked in by chronos, 9 years ago
  • Modified: Now translation groups are also localized.
  • Modified: Translated team page.
File size: 3.7 KB
Line 
1<?php
2
3include_once(dirname(__FILE__).'/Comparison.php');
4include_once(dirname(__FILE__).'/Form.php');
5include_once(dirname(__FILE__).'/Save.php');
6include_once(dirname(__FILE__).'/TranslationList.php');
7include_once(dirname(__FILE__).'/Progress.php');
8include_once(dirname(__FILE__).'/LoadNames.php');
9include_once(dirname(__FILE__).'/UserLevel.php');
10
11class ModuleTranslation extends AppModule
12{
13 function __construct(System $System)
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.';
21 $this->Dependencies = array('News', 'Search');
22 }
23
24 function DoStart()
25 {
26 global $TranslationTree;
27
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');
32 $this->System->RegisterPage('translation-groups', 'PageTranslationGroups');
33 $this->System->RegisterPage('TranslationList.php', 'PageTranslationList');
34 $this->System->RegisterPage('LoadNames.php', 'PageLoadNames');
35 $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => T('Last translations'),
36 'Channel' => 'translation', 'Callback' => array($this, 'ShowRSS'), 'Permission' => LICENCE_ANONYMOUS));
37 $this->System->RegisterMenuItem(array(
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' => '',
43 ), 1);
44 $this->System->RegisterMenuItem(array(
45 'Title' => T('Data source'),
46 'Hint' => 'Informace o překladových skupinách',
47 'Link' => $this->System->Link('/translation-groups/'),
48 'Permission' => LICENCE_ANONYMOUS,
49 'Icon' => '',
50 ));
51 /*
52 if(array_key_exists('Search', $this->System->ModuleManager->Modules))
53 {
54 foreach($TranslationTree as $Group)
55 {
56 $Table = $Group['TablePrefix'];
57
58 $Columns = array('ID', 'Entry');
59 foreach($Group['Items'] as $Item)
60 {
61 if($Item['Column'] != '') $Columns[] = $Item['Column'];
62 }
63
64 $this->System->ModuleManager->Modules['Search']->RegisterSearch('group'.$Group['Id'],
65 sprintf(T('Translation group "%s"'), $Group['Name']), $Columns, '`'.$Table.'`',
66 $this->System->Link('/TranslationList.php?group='.
67 $Group['Id'].'&amp;user=0&amp;state=0&amp;entry=&amp;text='));
68 }
69 }
70 */
71 }
72
73 function ShowRSS()
74 {
75 $Items = array();
76 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '.
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 ));
96 return($Output);
97 }
98}
Note: See TracBrowser for help on using the repository browser.