DataObjects/I18n.php
[Pman.Core] / DataObjects / Person.php
index a1f2544..99d85fa 100644 (file)
@@ -42,6 +42,7 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
     public $url_blog; // VARCHAR(256) NULL ;
     public $url_twitter; // VARCHAR(256) NULL ;
     public $url_linkedin; // VARCHAR(256) NULL ;
+    public $linkedin_id; // VARCHAR(256) NULL ;
     
     public $phone_mobile; // varchar(32)  NOT NULL  DEFAULT '';
     public $phone_direct; // varchar(32)  NOT NULL  DEFAULT '';
@@ -223,10 +224,12 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
         }
         return '"' . addslashes($this->name) . '" <' . $this->email . '>';
     }
+    
     function toEventString() 
     {
         return empty($this->name) ? $this->email : $this->name;
     } 
+    
     function verifyAuth()
     { 
         $ff= HTML_FlexyFramework::get();
@@ -742,27 +745,7 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
         if (!empty($q['query']['in_country'])) {
             // DB_DataObject::debugLevel(1);
             $inc = $q['query']['in_country'];
-            
             $this->whereAdd("$tn_p.countries LIKE '%{$inc}%'");
-            
-//            if ($q['query']['in_group'] == -1) {
-//             
-//                // list all staff who are not in a group.
-//                $this->whereAdd("Person.id NOT IN (
-//                    SELECT distinct(user_id) FROM $tn_gm LEFT JOIN
-//                        $tn_g ON $tn_g.id = $tn_gm.group_id
-//                        WHERE $tn_g.type = ".$q['query']['type']."
-//                    )");
-//                
-//                
-//            } else {
-//                
-//                $this->whereAdd("$tn_p.id IN (
-//                    SELECT distinct(user_id) FROM $tn_gm
-//                        WHERE group_id = $ing
-//                    )");
-//               }
-            
         }
         
         if (!empty($q['query']['not_in_directory'])) { 
@@ -866,8 +849,6 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
                     ");*/
         }
         
-        
-        //
     }
     function setFromRoo($ar, $roo)
     {
@@ -975,7 +956,8 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
         }
         return false;
     }
-    function onInsert($req, $roo)  
+    
+    function onInsert($req, $roo)
     {
          
         $p = DB_DataObject::factory('person');
@@ -1051,4 +1033,30 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
             $p->onInsert(array(), $roo);
         }
     }
+    
+    function getEmailName()
+    {
+        $name = array();
+        
+        if(!empty($this->honor)){
+            array_push($name, $this->honor);
+        }
+        
+        if(!empty($this->name)){
+            array_push($name, $this->name);
+            
+            return implode(' ', $name);
+        }
+        
+        if(!empty($this->firstname) || !empty($this->lastname)){
+            array_push($name, $this->firstname);
+            array_push($name, $this->lastname);
+            
+            $name = array_filter($name);
+            
+            return $name;
+        }
+        
+        return $this->email;
+    }
  }