Beispiel #1
0
 public static function fieldsToXML($flds, $base, $n = 0)
 {
     $a = explode(" ", $flds);
     sort($a);
     if ($n > 0) {
         array_unshift($a, "any:string");
     }
     $s = '';
     foreach ($a as $i) {
         $end = "/>";
         if ($n === 0) {
             switch ($i) {
                 case "site":
                     $fltstr = "id:string name:string description:string tier:numeric roc:string subgrid:string supports:string";
                     if ($base === $i) {
                         $fltstr = $fltstr . " country:complex";
                     }
                     $end = '>' . FilterParser::fieldsToXML($fltstr, $base, $n + 1) . '</filter:field>';
                     break;
                 case "dissemination":
                     $fltstr = "id:numeric date:string subject:string message:string";
                     if ($base === "dissemination") {
                         $fltstr = $fltstr . " sender:complex";
                     }
                     $end = '>' . FilterParser::fieldsToXML($fltstr, $base, $n + 1) . '</filter:field>';
                     break;
                 case "application":
                     $fltstr = "id:numeric name:string description:string abstract:string registeredon:datetime lastupdated:datetime tool:boolean rating:numeric tag:string validated:boolean owner:numeric addedby:numeric deleted:boolean releasecount:numeric arch:string os:string language:string status:string phonebook:string license:complex published:boolean hypervisor:string osfamily:string imageformat:string metatype:integer sitecount:integer year:integer month:integer day:integer";
                     if ($base === $i) {
                         $fltstr = $fltstr . " person:complex country:complex middleware:complex vo:complex discipline:complex category:complex";
                     }
                     $end = '>' . FilterParser::fieldsToXML($fltstr, $base, $n + 1) . '</filter:field>';
                     break;
                 case "sender":
                 case "person":
                     $fltstr = "id:numeric firstname:string lastname:string name:string registeredon:datetime institute:string activated:boolean lastlogin:datetime lastupdated:datetime gender:string nodissemination:boolean contact:string role:string roleid:numeric language:string os:string arch:string phonebook:string license:complex accessgroup:complex";
                     if ($base === $i) {
                         $fltstr = $fltstr . " country:complex application:complex middleware:complex vo:complex discipline:complex category:complex";
                     }
                     $end = '>' . FilterParser::fieldsToXML($fltstr, $base, $n + 1) . '</filter:field>';
                     break;
                 case "category":
                     $end = '>' . FilterParser::fieldsToXML("id:numeric name:string", $base, $n + 1) . '</filter:field>';
                     break;
                 case "discipline":
                     $end = '>' . FilterParser::fieldsToXML("id:numeric name:string", $base, $n + 1) . '</filter:field>';
                     break;
                 case "accessgroup":
                     $end = '>' . FilterParser::fieldsToXML("id:numeric name:string payload:string", $base, $n + 1) . '</filter:field>';
                     break;
                 case "license":
                     $end = '>' . FilterParser::fieldsToXML("id:numeric name:string title:string group:string", $base, $n + 1) . '</filter:field>';
                     break;
                 case "vo":
                     $fltstr = "id:numeric name:string description:string";
                     if ($base === $i) {
                         $fltstr = $fltstr . " country:complex application:complex middleware:complex vo:complex discipline:complex category:complex storetype:string phonebook:string scope:string";
                     }
                     $end = '>' . FilterParser::fieldsToXML($fltstr, $base, $n + 1) . '</filter:field>';
                     break;
                 case "country":
                     $end = '>' . FilterParser::fieldsToXML("id:numeric name:string isocode:string", $base, $n + 1) . '</filter:field>';
                     break;
                 case "middleware":
                     $end = '>' . FilterParser::fieldsToXML("id:numeric name:string", $base, $n + 1) . '</filter:field>';
                     break;
                 case "any":
                     $end = '>' . FilterParser::fieldsToXML("", $base, $n + 1) . '</filter:field>';
                     break;
             }
         } else {
             // HACK
             if ($i === "xcountry") {
                 $i = "countryname:string";
             }
         }
         $ii = explode(":", $i);
         if (count($ii) > 1) {
             $name = $ii[0];
             $type = $ii[1];
         } else {
             $name = $i;
             $type = "complex";
         }
         if ($name != "") {
             $s .= '<filter:field level="' . $n . '" name="' . $name . '" type="' . $type . '"' . $end;
         }
     }
     return $s;
 }
Beispiel #2
0
 /**
  * @overrides get() from RestResource
  */
 public function get()
 {
     if (parent::get() !== false) {
         $s = '<dissemination:filter>';
         $s .= FilterParser::fieldsToXML("any dissemination application sender country vo discipline middleware category", "dissemination");
         $s .= '</dissemination:filter>';
         return new XMLFragmentRestResponse($s, $this);
     } else {
         return false;
     }
 }
Beispiel #3
0
 /**
  * @overrides get() from RestResource
  */
 public function get()
 {
     if (parent::get() !== false) {
         $s = '<person:filter>';
         $s .= FilterParser::fieldsToXML("any person country application vo discipline middleware category license accessgroup", "person");
         $s .= '</person:filter>';
         return new XMLFragmentRestResponse($s, $this);
     } else {
         return false;
     }
 }
Beispiel #4
0
 /**
  * @overrides get() from RestResource
  */
 public function get()
 {
     if (parent::get() !== false) {
         $s = '<vo:filter>';
         $s .= FilterParser::fieldsToXML("any application person country vo discipline middleware category", "vo");
         $s .= '</vo:filter>';
         return new XMLFragmentRestResponse($s, $this);
     } else {
         return false;
     }
 }
 public function reflectfilterAction()
 {
     $s = '<person:filter xmlns:person="http://appdb.egi.eu/api/0.2/person" xmlns:filter="http://appdb.egi.eu/api/0.2/filter">';
     $s .= FilterParser::fieldsToXML("any person country application vo discipline subdiscipline middleware", "person");
     $s .= '</person:filter>';
     $this->view->entries = $s;
 }