OutputTranslations.php
[Pman.Cms] / OutputTranslations.php
1 <?php
2
3 require_once 'Pman.php'; /// needed as we might not be included from pman..
4
5 class Pman_Cms_OutputTranslations extends Pman
6 {
7     var $cms_template = '';
8     var $on_table = '';
9     var $on_id = '';
10     var $on_col = '';
11     var $lang = '';
12     
13     function get()
14     {
15         
16         if(!empty($this->template)){
17             return $this->templateTranslations();
18         }
19         
20         if(!empty($this->on_table) && !empty($this->on_id) && !empty($this->on_col)){
21             return $this->tableTranslations();
22         }
23         
24         return array();
25         
26     }
27     
28     function templateTranslations()
29     {
30         $ret = array();
31         
32         $template = DB_DataObject::factory('cms_template');
33         if(!$template->get('template', $this->cms_template)){
34             return $ret;
35         }
36         
37         $base = DB_DataObject::factory('cms_templatestr');
38         $base->setFrom(array(
39             'template_id' => $template->id,
40             'lang' => '',
41             'active' => 1
42         ));
43         
44         $base = $base->fetchAll('id', 'mdsum');
45         
46         $translation = DB_DataObject::factory('cms_templatestr');
47         $translation->setFrom(array(
48             'template_id' => $template->id,
49             'lang' => $this->lang,
50             'active' => 1
51         ));
52         $translation->whereAddIn('src_id', array_keys($base), 'int');
53         
54         $translation = $translation->fetchAll('id', 'txt');
55         
56         print_R($translation);exit;
57         
58         
59     }
60     
61     function tableTranslations()
62     {
63         
64     }
65 }