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     function getAuth()
26     {
27         
28         return true;
29     }
30     
31     
32     function get($module)
33     {
34         
35         if (empty($module)) {
36             $this->jerr("no module selected");
37         }
38         $this->init();
39         //DB_DataObject::debugLevel(1);
40         require_once 'Services/JSON.php';
41         $d = DB_DataObject::factory('translations');
42         $d->module = $module;
43         $d->selectAdd();
44         $d->selectAdd('distinct(tlang) as tlang');
45         header('Content-type: text/javascript');
46         $langs= $d->fetchAll('tlang');
47         foreach($langs as $lang) {
48             // output the translations strings file..
49             
50                 
51             $this->loadOriginalStrings($module);
52             
53             $data = $this->loadTranslateDB($lang,$module);
54             
55             $j = new Services_JSON();
56             echo "_T.{$lang}= Roo.apply( _T.{$lang} || { }, " .  $j->stringify($data, null, 4) . ");\n";
57             
58         }
59         exit;
60                
61     }
62     
63     function post() 
64     {
65         $this->jerr("invalid url"); 
66      
67     }
68 }