InterfaceTranslations.php
[Pman.Admin] / InterfaceTranslations.php
1 <?php
2
3
4 /**
5  * Pman_Admin_Translation:
6  * - the latest version of this....
7  *
8  * Files:
9  *   output / current state:    ROOT/_translations_/MODULE.js
10  *   input:       Pman::moduleJavascriptFilesInfo($MODULE)->translation_data
11  * 
12  * 
13  * see:
14  * Pman->modulesList()
15  *
16  * Note: at present the front end does not query this to get a list of modules..
17  * 
18  */
19
20 require_once 'Pman/Admin/Translations.php';
21
22 class Pman_Admin_InterfaceTranslations extends Pman_Admin_Translations 
23 {
24     
25      
26     function getAuth()
27     {
28         
29         return true;
30     }
31     
32     
33     function get($module)
34     {
35         
36         if (empty($module)) {
37             $this->jerr("no module selected");
38         }
39         $this->init();
40         //DB_DataObject::debugLevel(1);
41         require_once 'Services/JSON.php';
42         $d = DB_DataObject::factory('translations');
43         $d->module = $module;
44         $d->selectAdd();
45         $d->selectAdd('distinct(tlang) as tlang');
46         header('Content-type: text/javascript');
47         $langs= $d->fetchAll('tlang');
48         foreach($langs as $lang) {
49             // output the translations strings file..
50             
51                 
52             $this->loadOriginalStrings($module);
53             
54             $data = $this->loadTranslateDB($lang,$module);
55             
56             $j = new Services_JSON();
57             echo "_T.{$lang}= Roo.apply( _T.{$lang} || { }, " .  $j->stringify($data, null, 4) . ");\n";
58             
59         }
60         exit;
61                
62     }
63     
64     function post() 
65     {
66         $this->jerr("invalid url"); 
67      
68     
69 }