add support for checking advanced tag for person
[plewww.git] / planetlab / includes / plc_functions.php
index 678de29..2de3085 100644 (file)
@@ -102,6 +102,7 @@ function l_sites_peer ($peer_id)    { return "/db/sites/index.php?peerscope=$peer_i
 function l_site ($site_id)             { return "/db/sites/index.php?id=$site_id"; }
 function l_site_t ($site_id,$text)     { return href (l_site($site_id),$text); }
 function l_site_obj($site)             { return href (l_site($site['site_id']),$site['name']); }
+function l_site_tags ($site_id)                { return "/db/sites/site.php?id=$site_id&show_tags=1"; }
 
 function l_slices ()                   { return "/db/slices/index.php"; }
 function l_slices_peer ($peer_id)      { return "/db/slices/index.php?peerscope=$peer_id"; }
@@ -128,6 +129,7 @@ function l_person_t ($person_id,$text)      { return href (l_person($person_id),$text
 function l_persons_site ($site_id)     { return "/db/persons/index.php?site_id=$site_id"; }
 function l_persons_slice ($slice_id)   { return "/db/persons/index.php?slice_id=$slice_id"; }
 function l_person_obj ($person)                { return l_person_t($person['person_id'],$person['email']); }
+function l_person_tags ($person_id)    { return "/db/persons/person.php?id=$person_id&show_tags=1"; }
 
 function l_tags ()                     { return "/db/tags/index.php"; }
 function l_tag ($tag_type_id)          { return "/db/tags/index.php?id=$tag_type_id"; }
@@ -599,5 +601,35 @@ function count_english_warning ($objs, $name) {
 function reservable_mark () { return "-R-";}
 function reservable_legend () { return "reservable nodes are marked with " . reservable_mark (); }
 
+//////////////////// Vicci simplified portal support
+function plc_advanced() {
+    global $plc, $api;
+
+    if ((!$plc) || (!$api)) {
+        return FALSE;
+    }
+
+    $person_id = $plc->person['person_id'];
+    $tags = $api->GetPersonTags(array("person_id" => $person_id, "tagname" => "advanced"));
+    if (!$tags) {
+        return FALSE;
+    }
+    return (bool) $tags[0]['value'];
+}
+
+function plc_set_advanced($value) {
+    global $plc, $api;
+
+    $person_id = $plc->person['person_id'];
+    $tags = $api->GetPersonTags(array("person_id" => $person_id, "tagname" => "advanced"));
+    if ($tags) {
+        $result = $api->UpdatePersonTag($tags[0]["person_tag_id"], $value);
+        //print "update " . $tags[0]["person_tag_id"] . " " . $value . " " . $result . "<br>";
+    } else {
+        $api->AddPersonTag($person_id, "advanced", $value);
+        //print "add";
+    }
+}
+
 
 ?>