include all slices for which a user is a PI in the account selector
smbaker [Wed, 19 Sep 2012 02:00:06 +0000 (19:00 -0700)]
apps/gacksadmin/gacks_functions.php

index 19db481..dd2c2d8 100644 (file)
@@ -341,11 +341,9 @@ function date_picker($name, $y, $m, $d)
 
 function get_account_names($plcapi, $person_id)
 {
-    // $person_id=intval($_GET['person_id']);
-    $slice_filter = array();
-    $persons = $plcapi->GetPersons(array('person_id'=>$person_id),array('person_id','email','slice_ids'));
+    $persons = $plcapi->GetPersons(array('person_id'=>$person_id),array('person_id','email','slice_ids','role_ids','site_ids'));
     $person=$persons[0];\r
-    $slice_filter['slice_id']=$person['slice_ids'];\r
+    $slice_filter=array('slice_id' => $person['slice_ids']);\r
     $slices=$plcapi->GetSlices($slice_filter,array("name"));\r
 \r
     $slicenames = array();\r
@@ -353,6 +351,21 @@ function get_account_names($plcapi, $person_id)
         $slicenames []= $slice['name'];\r
     }\r
 \r
+    $is_pi = in_array( 20, $person['role_ids']);\r
+    if ($is_pi) {\r
+        $slice_filter=array('site_id'=>$person['site_ids'][0]);\r
+        $slices = $plcapi->GetSlices($slice_filter, array("name"));\r
+\r
+        //print "<br>filter:"; print_r($slice_filter);\r
+        //print "<br>slices:"; print_r($slices);\r
+\r
+        foreach ($slices as $slice) {\r
+            if (!in_array($slice['name'], $slicenames)) {\r
+                $slicenames []= $slice['name'];\r
+            }\r
+        }\r
+    }\r
+\r
     return $slicenames;\r
 }