DataObjects/Person.php
authorAlan Knowles <alan@akbkhome.com>
Fri, 25 Feb 2011 08:42:27 +0000 (16:42 +0800)
committerAlan Knowles <alan@akbkhome.com>
Fri, 25 Feb 2011 08:42:27 +0000 (16:42 +0800)
DataObjects/Person.php

index 6d914f0..592a1a1 100644 (file)
@@ -453,6 +453,26 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
             }
         }
         
+        
+        if (!empty($q['query']['project_member_of'])) {
+               // this is also a flag to return if they are a member..
+            DB_DataObject::debugLevel(1);
+            $do = DB_DataObject::Factory('ProjectDirectory');
+            $this->joinAdd('LEFT', $do);
+            $this->selectAdd('ProjectDirectory.id as is_member');
+                
+                
+            if (!empty($q['query']['project_member_filter'])) {
+                $this->whereAdd('id IN (
+                    SELECT person_id from 
+                        ProjectDirectory 
+                    WHERE project_id = ' . ((int) $q['query']['project_member_of']) .')');
+            
+            }
+            
+        }
+        
+        
         if (!empty($q['query']['search'])) {
             $s = $this->escape($q['query']['search']);
                     $this->whereAdd("