// Common functions
require_once 'plc_functions.php';
require_once 'plc_peers.php';
-require_once 'plc_minitabs.php';
-require_once 'plc_tables.php';
-
-//fix the memory limit for this page
-ini_set("memory_limit","48M");
+require_once 'linetabs.php';
+require_once 'table.php';
+require_once 'nifty.php';
// --------------------
// recognized URL arguments
$tabs=array();
$tabs []= tab_persons_mysite();
-if (plc_is_admin())
+if (plc_is_admin()) {
$tabs []= tab_persons_local();
+ $tabs []= tab_persons();
+}
// --------------------
$person_filter=array();
// check that the person has keys
if ( count($person['key_ids']) == 0)
$messages [] = "No Key";
+ if ( count($person['site_ids']) == 0)
+ $messages [] = "No Site";
if ( ! $person['enabled'] )
$messages[] = "Disabled";
+ if ( count ($person['roles']) == 0)
+ $messages []= "No role!";
// for tech-only people: outline user if in a slice
if ( ( count($person['roles'])==1 ) &&
( in_array('tech',$person['roles']) ) ) {
// go
$persons=$api->GetPersons($person_filter,$person_columns);
-// build site_ids
+// build site_ids - take all site_ids into account
$site_ids=array();
-if ($persons) foreach ($persons as $person)
- if ($person['site_ids'][0])
- $site_ids []= $person['site_ids'][0];
+if ($persons) foreach ($persons as $person) {
+ if ($person['site_ids']) foreach ($person['site_ids'] as $person_site_id) {
+ $site_ids []= $person_site_id;
+ }
+ }
// fetch related sites
$site_columns=array('site_id','login_base');
// --------------------
drupal_set_title($title);
-//plc_tabs($tabs);
+plekit_linetabs($tabs);
if ( ! $persons ) {
drupal_set_message ('No account found');
return;
}
-$headers = array ("Peer"=>"string",
- "First"=>"string",
- "Last"=>"string",
- "Email"=>"string",
- "Site" => "string",
- "Roles"=>"string",
- "S" => "int",
- "Status"=>"string",
- );
-
-// initial sort on email
-$table=new PlcTable("persons",$headers,4);
+$nifty=new PlekitNifty ('','objects-list','big');
+$nifty->start();
+$headers=array();
+if (plc_is_admin()) $headers["I"]='int';
+$headers["Peer"]="string";
+$headers["First"]="string";
+$headers["Last"]="string";
+$headers["Email"]="string";
+$headers["Site(s)" ]= "string";
+$headers["R"]="string";
+$headers["S" ]= "int";
+$headers["Status"]="string";
+
+// sort on email
+if (! plc_is_admin()) $sort_column=3;
+// but turn off initial sort for admins as this slows stuff down terribly
+else $sort_column =-1;
+$table=new PlekitTable("persons",$headers,$sort_column);
$table->start();
$peers=new Peers ($api);
+
// write rows
foreach ($persons as $person) {
$person_id=$person['person_id'];
$email=$person['email'];
- $shortname = $peers->shortname($person['peer_id']);
- $site_id=$person['site_ids'][0];
- $site=$site_hash[$site_id];
- $login_base = $site['login_base'];
+ $site_ids = $person['site_ids'];
$roles = plc_vertical_table ($person['roles']);
+ $peer_id=$person['peer_id'];
$table->row_start();
- $table->cell($shortname);
- $table->cell ($person['first_name']);
- $table->cell ($person['last_name']);
+ if (plc_is_admin()) $table->cell(href(l_person($person_id),$person_id));
+ $peers->cell($table,$peer_id);
+ $table->cell (href(l_person($person_id),$person['first_name']));
+ $table->cell (href(l_person($person_id),$person['last_name']));
$table->cell(l_person_t($person_id,$email));
- $table->cell(l_site_t($site_id,$login_base));
- $table->cell($roles);
+ $site_links = array();
+ foreach ($site_ids as $site_id) {
+ $site=$site_hash[$site_id];
+ $login_base = $site['login_base'];
+ $site_links []= l_site_t($site_id,$login_base);
+ }
+ $table->cell(plc_vertical_table($site_links),array('only-if'=>!$peer_id));
+ $table->cell($roles,array('only-if'=>!$peer_id));
$table->cell(count($person['slice_ids']));
$table->cell(person_status($person));
$table->row_end();
}
-$notes=array("The S column shows the number of slices for the given user");
+$notes = array();
+if (plc_is_admin()) $notes[]= "I = person_id";
+$notes []= "R = roles";
+$notes []= "S = number of slices";
$table->end(array('notes'=>$notes));
+$nifty->end();
-//plc_tabs ($tabs,"bottom");
+//plekit_linetabs ($tabs,"bottom");
// Print footer
include 'plc_footer.php';