GetPersons( array($person_id)); if (empty($persons)) { drupal_set_message ("Person " . $person_id . " not found"); } else { $person=$persons[0]; // vars from api $first_name= $person['first_name']; $last_name= $person['last_name']; $title= $person['title']; $url= $person['url']; $phone= $person['phone']; $email= $person['email']; $enabled= $person['enabled']; $peer_id=$person['peer_id']; // arrays from api $role_ids= $person['role_ids']; $roles= $person['roles']; $site_ids= $person['site_ids']; $slice_ids= $person['slice_ids']; $key_ids= $person['key_ids']; // gets more data from API calls $sites= $api->GetSites( $site_ids, array( "site_id", "name", "login_base" ) ); $slices= $api->GetSlices( $slice_ids, array( "slice_id", "name" ) ); $keys= $api->GetKeys( $key_ids ); drupal_set_title("Details for account " . $first_name . " " . $last_name); $plc_hash=plc_peer_get_hash($api); $local_peer = plc_peer_block_start ($peer_hash,$peer_id); $is_my_account = plc_my_person_id() == $person_id; $privileges = plc_is_admin () || ( plc_in_site($site_id) && plc_is_pi()); $tabs=array(); if ($local_peer && $privileges) { if (plc_is_admin()) $tabs['Events'] = array('url'=>l_events(), 'values'=>array('type'=>'Person','person'=>$person_id), 'bubble'=>'Related events', 'image'=>'/planetlab/icons/event.png', 'height'=>18); if ($enabled) $tabs['Disable'] = array ('method'=>'POST', 'url'=>'/db/persons/person_actions.php', 'values'=> array ('person_id'=>$person_id, 'action'=>'disable'), 'bubble'=>"Disable $first_name", 'confirm'=>"Are you sure you want to disable $first_name $last_name"); else $tabs['Enable'] = array ('method'=>'POST', 'url'=>'/db/persons/person_actions.php', 'values'=> array ('person_id'=>$person_id, 'action'=>'enable'), 'bubble'=>"Enable $first_name"); $tabs['Delete'] = array ('method'=>'POST', 'url'=>'/db/persons/person_actions.php', 'values'=> array ('person_id'=>$person_id, 'action'=>'delete'), 'bubble'=>"Delete $first_name", 'confirm'=>"Are you sure to delete $first_name $last_name"); } if ($privileges || $is_my_account) $tabs['Update'] = array('url'=>'/db/persons/update.php', 'values'=>array('id'=>$person_id), 'bubble'=>"Update $first_name"); $tabs['All Users'] = array ('url'=>l_persons()); plc_tabs($tabs); plc_details_start(); plc_details_line("First Name",$first_name); plc_details_line("Last Name",$last_name); plc_details_line("Title",$title); plc_details_line("Email",href("mailto:$email",$email)); plc_details_line("Phone",$phone); plc_details_line("URL",$url); plc_details_end(); echo "
Type | Key | "; if ( $can_manage_keys ) echo "Remove | "; echo "
---|---|---|
$key_type | $key_text"; if ( $can_manage_keys ) echo " | "; echo " |
\n";
}
if( $can_manage_keys ){
echo "
Upload new key: \n
\n
Select a site to add this user to: "; echo ""; } echo "
Role | "; if( plc_is_admin()) echo "Remove | "; echo "|
---|---|---|
$role_name"; if( plc_is_admin()) { echo " | "; if ( ! $button_shown ) { $rowspan=count($roles); echo " |
Add role: \n"; } } echo "