DataObjects/Core_domain.php
[Pman.Core] / DataObjects / Projects.php
index 869cfc9..e29664d 100644 (file)
@@ -112,11 +112,10 @@ class Pman_Core_DataObjects_Projects extends DB_DataObject
             
                
             $pf = empty($q['query']['project_filter']) ? 'P,N,U' : $q['query']['project_filter'];
-            $bits= explode(',' ,$pf);
-            foreach($bits as $i=>$k) {
-                $bits[$i] = $this->escape($k);
-            }
-            $this->whereAdd("Projects.type in ('". implode("','", $bits) . "')");
+        
+         
+        
+            $this->whereAddIn("Projects.type", explode(',', $pf), 'string');
         }
          // user projects!!!! - make sure they can only see project they are suppsed to..
          // only applies to document stuff..
@@ -167,16 +166,7 @@ class Pman_Core_DataObjects_Projects extends DB_DataObject
         
         
     }
-    function whereAddIn($key, $list, $type) {
-        $ar = array();
-        foreach($list as $k) {
-            $ar[] = $type =='int' ? (int)$k : $this->escape($k);
-        }
-        if (!$ar) {
-            return;
-        }
-        $this->whereAdd("$key IN (". implode(',', $ar). ')');
-    }
     function onInsert()
     {
         $oo = clone($this);
@@ -208,7 +198,7 @@ class Pman_Core_DataObjects_Projects extends DB_DataObject
         $olddir =  $opts['storedir'] . '/' . $old->code;
         $newdir =  $opts['storedir'] . '/' . $this->code;
         if ( file_exists($olddir)) {
-            move ($olddir, $newdir);
+            move($olddir, $newdir);
         }
          
         
@@ -249,50 +239,10 @@ class Pman_Core_DataObjects_Projects extends DB_DataObject
         
     }
     
-    
-    function i18toArray($type, $str) 
-    {
-        if (empty($str)) {
-            return array();
-        }
-        static $au;
-        static $langs;
-        static $cts;
-        
-        if (!$au) {
-            $u = DB_DataObject::factory('Person');
-            $au =$u->getAuthUser();
-            $lang = empty($au->lang ) ? 'en' : $au->lang;
-            $lbits = explode('_', strtoupper($lang));
-            // no validation here!!!!
-            require_once 'I18Nv2/Language.php';
-            require_once 'I18Nv2/Country.php';
-            $langs = new I18Nv2_Language($lbits[0]); // locale support not there??
-            $cts = new I18Nv2_Country($lbits[0]); // lo
-            
-        }
-        $lk = $type == 'c' ? $cts : $langs;
-        $ar  =explode(',', $str);
-        $ret = array();
-        foreach($ar as $k) {
-            $ret[] = array('code'=>$k, 'title' => $lk->getName($k));
-        }
-        return $ret;
-        // work out locale...
-        
-        
-        
-        
-    }
+   
     
     
-    function toRooArray($req= array()) {
-        $ret = parent::toArray();
-        // sor tout 
-        $ret['countrylist'] = $this->I18toArray('c',$ret['countries']);
-        $ret['languagelist'] = $this->I18toArray('l',$ret['languages']);
-        return $ret;
-    }
+   
     function setFromRoo($q) 
     {
         $this->setFrom($q);
@@ -347,4 +297,5 @@ class Pman_Core_DataObjects_Projects extends DB_DataObject
     {
         return $au->hasPerm("Core.Projects_Member_Of",$lvl) || $au->hasPerm("Core.Projects_All",$lvl);
     }
+    
 }