DataObjects/Person.php
authorEdward <edward@roojs.com>
Tue, 8 Jul 2014 10:36:45 +0000 (18:36 +0800)
committerEdward <edward@roojs.com>
Tue, 8 Jul 2014 10:36:45 +0000 (18:36 +0800)
DataObjects/Person.php

index e967b67..99d85fa 100644 (file)
@@ -224,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();
@@ -1031,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;
+    }
  }