Pman/Images.php
[Pman.Base] / Pman / I18N.php
index f8084f2..39ceee4 100644 (file)
@@ -1,26 +1,14 @@
 <?php
 
 /// provide language data!!!
-// THIS IS PUBLICALLY ACCESSABLE..
+// DEPRECIATED - moved to Pman_I18N
 /**
  * 
- * Either we load this as a standard array at start??
- * eg. after login...
- * 
- * or we treat it like a regular pulldown... - on demand...
- * 
- * big snag is that we can not include these until the user has specified their interface language.
- * 
- * If we do a global jS array?
- * Pman.Lang.en = [ 'en' , 'English']
- * 
- * If we do a standard 'store' version..
- * { total:  x, data [ { code: 'en', title: 'English' }] }
  * 
  */
 
-require_once 'Pman.php';
-class Pman_I18N extends Pman
+require_once 'Pman/Core/I18n.php';
+class Pman_I18N extends Pman_Core_I18n
 {
     
     // these are the languages we support.
@@ -58,13 +46,15 @@ class Pman_I18N extends Pman
         
         $opts = PEAR::getStaticProperty('Pman_I18N', 'options');
         $opts = empty($opts)  ?  array() : $opts;
+        
+        
         foreach($opts as $k=>$v) {
             
             if ($v == '*') {
                 $this->cfg[$k] = $this->getDefaultCfg($k);
                 continue;
             }
-            $this->cfg[$k] = explode(',', $v);
+            $this->cfg[$k] = is_array($v) ? $v  : explode(',', $v);
         }
         
         
@@ -72,7 +62,7 @@ class Pman_I18N extends Pman
         
         return true;
     }
-    
+    // returns a list of all countries..
     function getDefaultCfg($t) {
         $ret = array();
         switch ($t) {
@@ -81,16 +71,19 @@ class Pman_I18N extends Pman
                 
                 $c = new I18Nv2_Country('en');
                 $ret =  array_keys($c->codes);
+                $ret[] = '**';
                 break;
             case 'l':
                 require_once 'I18Nv2/Language.php';
                 $c = new I18Nv2_Language('en');
                 $ret =  array_keys($c->codes);
+                $ret[] = '**';
                 break;
             case 'm':
                 require_once 'I18Nv2/Currency.php';
                 $c = new I18Nv2_Currency('en');
                 $ret =  array_keys($c->codes);
+                $ret[] = '**';
                 break;
         }
         foreach ($ret as $k=>$v) {
@@ -194,7 +187,8 @@ class Pman_I18N extends Pman
              case 'Currency':
                 $ret = $this->getList('m', $lbits[0],empty($_REQUEST['filter']) ? false : $_REQUEST['filter']);
                 break;
-              
+            // part of parent!!!!
+            /*
             case 'BuildDB':
             // by admin only?!?
                 //DB_DataObject::debugLevel(1);
@@ -203,7 +197,7 @@ class Pman_I18N extends Pman
                 $this->buildDb('m');
                 die("DONE!");
                 break;
-                  
+            */      
             default: 
                 $this->jerr("ERROR");
         }
@@ -318,43 +312,6 @@ class Pman_I18N extends Pman
         
     }
     
-    
-    
-    function buildDB($ltype= false, $inlang= false )
-    {
-        if ($ltype === false) {
-            
-            die("OOPS NO LTYPE");
-        }
-        
-        if ($inlang === false) {
-            foreach( $this->cfg['l'] as $l) {
-                $this->buildDB($ltype, $l);
-            }
-            return;
-        }
-        
-        $list = $this->cfg[$ltype];
-        
-        foreach($list as $lkey) {
-            $x = DB_DataObject::factory('i18n');
-            $x->ltype = $ltype;
-            $x->lkey = $lkey;
-            $x->inlang= $inlang;
-            if ($x->find(true)) {
-                $xx= clone($x);
-                $x->lval = $this->translate($inlang, $ltype, $lkey);
-                $x->update($xx);
-                continue;
-            }
-            $x->lval = $this->translate($inlang, $ltype, $lkey);
-            $x->insert();
-            
-        }
-        
-        
-        
-        
-    }
+     
     
 }