X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fincludes%2Fplc_objects.php;h=0fd9a1f72dea755e691f4dd8e8e824cc80fc6878;hb=6348bd961b5e5644edf9009ac992827eece9a233;hp=de085e987d4747cfe3478e07c430daf2c09b2512;hpb=a2b51b3f49397e991376eb4fe738177d7f588e74;p=plewww.git diff --git a/planetlab/includes/plc_objects.php b/planetlab/includes/plc_objects.php index de085e9..0fd9a1f 100644 --- a/planetlab/includes/plc_objects.php +++ b/planetlab/includes/plc_objects.php @@ -27,21 +27,21 @@ function timeDiff ($timestamp,$detailed=false,$n = 0) { $time = ""; # The string we will hold our times in while($i > $n) { # if the difference is greater than the length we are checking... continue - if ($diff > $lengths[$i-1]) { + if ($diff > $lengths[$i-1]) { # 65 / 60 = 1. That means one minute. 130 / 60 = 2. Two minutes.. etc - $val = floor($diff / $lengths[$i-1]); + $val = floor($diff / $lengths[$i-1]); # The value, then the name associated, then add 's' if plural - $time .= $val ." ". $periods[$i-1].($val > 1 ? 's ' : ' '); -# subtract the values we just used from the overall diff so we can + $time .= $val ." ". $periods[$i-1].($val > 1 ? 's ' : ' '); +# subtract the values we just used from the overall diff so we can # find the rest of the information - $diff -= ($val * $lengths[$i-1]); -# if detailed is turn off (default) only show the first set found, + $diff -= ($val * $lengths[$i-1]); +# if detailed is turn off (default) only show the first set found, # else show all information - if(!$detailed) { $i = 0; } + if(!$detailed) { $i = 0; } } $i--; } - + # Basic error checking. if ($time == "") { return "error: bad time"; @@ -64,7 +64,7 @@ class PlcObject { class Person { var $roles; var $person_id; - var $first_name; + var $first_name; var $last_name; var $email; var $enabled; @@ -141,14 +141,14 @@ class PCU { } function deletePCUlink($node) { - return " Remove from PCU"; } function pcu_name() { if ( $this->data['hostname'] != NULL and $this->data['hostname'] != "" ): return $this->data['hostname']; - else: + else: if ( $this->data['ip'] != NULL and $this->data['ip'] != "" ): return $this->data['ip']; else: @@ -176,7 +176,7 @@ class Address { function link($str) { return "" . $str . ""; } - + function label() { $label = ""; $comma= sizeof( $this->data['address_types'] ); @@ -221,18 +221,18 @@ class Node extends PlcObject { $this->nn = $api->GetInterfaces($node['interface_ids']); foreach ($this->nn as $nnet) { - if ( $nnet['is_primary'] == true ) - { - $this->ip = $nnet['ip']; - $this->netmask = $nnet['netmask']; - $this->network = $nnet['network']; - $this->gateway= $nnet['gateway']; - $this->broadcast = $nnet['broadcast']; - $this->dns1 = $nnet['dns1']; - $this->dns2 = $nnet['dns2']; - $this->method = $nnet['method']; - $this->interface_id = $nnet['interface_id']; - } + if ( $nnet['is_primary'] == true ) + { + $this->ip = $nnet['ip']; + $this->netmask = $nnet['netmask']; + $this->network = $nnet['network']; + $this->gateway= $nnet['gateway']; + $this->broadcast = $nnet['broadcast']; + $this->dns1 = $nnet['dns1']; + $this->dns2 = $nnet['dns2']; + $this->method = $nnet['method']; + $this->interface_id = $nnet['interface_id']; + } } } @@ -284,7 +284,7 @@ class Node extends PlcObject { return $ret; } - // code needs to be accessible from outside an object too + // code needs to be accessible from outside an object too // b/c of the performance overhead of creating as many objects as nodes static function status_label_class__ ($boot_state, $run_level, $last_contact, $peer_id) { $label= $run_level ? $run_level : ( $boot_state . '*' ) ; @@ -301,7 +301,7 @@ class Node extends PlcObject { static function status_footnote () { return "state; * if node doesn't have an observed state; ... if status is stale (" . Node::stale_text() . ")"; } - + // ditto static function stale_ ($last_contact, $peer_id) { // remote nodes don't have a last_contact @@ -372,7 +372,7 @@ class Site extends PlcObject { $adm->GetPCUs( $this->pcu_ids ); $adm->GetNodes( $this->node_ids, array( "node_id", "hostname", "boot_state", "date_created", "last_updated", "last_contact", "site_id", "pcu_ids" ) ); - $adm->GetPersons( $this->person_ids, array( "role_ids", "person_id", "first_name", + $adm->GetPersons( $this->person_ids, array( "role_ids", "person_id", "first_name", "last_name", "email", "enabled" ) ); $adm->GetSlices( $this->slice_ids, array( "name", "slice_id", "instantiation", "created", "expires" ) ); return $adm->commit();