$peers = new Peers ($api);
+if (count($site_ids))
+ $site_id = $site_ids[0];
$is_my_account = plc_my_person_id() == $person_id;
-$privileges = plc_is_admin () || ( plc_in_site($site_id) && plc_is_pi());
+$privileges = plc_is_admin () || ( plc_in_site($site_ids[0]) && plc_is_pi());
$tabs=array();
-$tabs []= tab_persons();
// enable / disable
+// become
+if (plc_is_admin() && ! $is_my_account && $local_peer)
+ $tabs['Become'] = array('method'=>'POST',
+ 'url'=>l_actions(),
+ 'values'=>array('action'=>'become-person',
+ 'person_id'=>$person_id),
+ 'bubble'=>"Become $first_name $last_name",
+ 'confirm'=>"Are you sure you want to become $first_name $last_name");
+
if ($local_peer && $privileges)
if ($enabled)
$tabs['Disable'] = array ('method'=>'POST',
'bubble'=>"Enable $first_name $last_name",
'confirm'=>"Are you sure you want to enable $first_name $last_name");
-// become
-if (plc_is_admin() && ! $is_my_account && $local_peer)
- $tabs['Become'] = array('method'=>'POST',
- 'url'=>l_actions(),
- 'values'=>array('action'=>'become-person',
- 'person_id'=>$person_id),
- 'bubble'=>"Become $first_name $last_name",
- 'confirm'=>"Are you sure you want to su $first_name $last_name");
-
// delete
if ($local_peer && $privileges && $local_peer)
$tabs['Delete'] = array ('method'=>'POST',
// get list of local sites that the person is not in
function get_site_id ($site) { return $site['site_id'];}
$person_site_ids=array_map("get_site_id",$sites);
- $relevant_sites= $api->GetSites( array("peer_id"=>NULL,"~site_id"=>$person_site_ids), $site_columns);
+ $relevant_sites= $api->GetSites( array("peer_id"=>NULL,"~site_id"=>$person_site_ids, '-SORT'=>'name'), $site_columns);
// xxx cannot use onchange=submit() - would need to somehow pass action name
function site_selector($site) { return array('display'=>$site['name'],"value"=>$site['site_id']); }
$selectors = array_map ("site_selector",$relevant_sites);