DataObjects/core.sql
[Pman.Core] / DataObjects / I18n.php
index 378edee..073441c 100644 (file)
@@ -74,14 +74,15 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject
         // since our opts array changed alot..
         $opts = empty($ff->Pman_Core_I18N) ? (empty($ff->Pman_I18N) ? array() : $ff->Pman_I18N)  : $ff->Pman_Core_I18N;
         
-        print_r($opts);
+         
+       //  var_dump($opts);exit;
         
         $i = DB_DataObject::Factory('I18n');
         // load the cofiguration
         foreach($opts as $k=>$v) {
             
             if ($v == '*') { // everything..
-                self::$cfg[$k] = $i->availableCodes($k);
+                self::$cfg[$k] = $i->availableCodes($k, false);
                 continue;
             }
             self::$cfg[$k] = is_array($v) ? $v  : explode(',', $v);
@@ -112,6 +113,14 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject
         
             $this->whereAdd("lval LIKE '". $this->escape($q['query']['name']). "%'");
         }
+        
+        if (!empty($q['_filtered']) && !empty($this->ltype)) {
+            $cfg = $this->cfg();
+            $filter = $cfg[$this->ltype];
+            $this->whereAddIn('lkey', $filter, 'string'); 
+            
+            
+        }
     }
     
     function translate($inlang,$ltype,$kval)
@@ -165,7 +174,7 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject
     
     
     // returns a list of all countries/languages etc.. (with '*')
-    function availableCodes($t)
+    function availableCodes($t, $filtered = true)
     {
         $ret = array();
         $cfg = $this->cfg();
@@ -217,7 +226,10 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject
                 $ret[] = '**';
                 break;
         }
-        if (!empty($cfg[$t]) && is_array($cfg[$t])) {
+        
+        
+        
+        if ($filtered  && !empty($cfg[$t]) && is_array($cfg[$t])) {
             // then there is a filter. - we should include all of them, even if they are not relivatn??
             return $cfg[$t]; //array_intersect($cfg[$t], $ret);
             
@@ -236,6 +248,8 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject
     function buildDB($ltype= false, $inlang= false )
     {
         $cfg = $this->cfg();
+        
+        //print_r($cfg);
         if ($ltype === false) {
             // trigger all builds.
             //DB_DataObject::debugLevel(1);