コード例 #1
0
 /**
  * @overrides getModel() from RestResource
  */
 public function get()
 {
     if (parent::get() !== false) {
         db()->setFetchMode(Zend_Db::FETCH_OBJ);
         $res = db()->query("SELECT sci_class.toxml(version) as x FROM sci_class.cverids")->fetchAll();
         $x = array();
         foreach ($res as $r) {
             $x[] = $r->x;
         }
         if ($this->getParam("format") === "json") {
             return new JSONRestResponse(new XMLFragmentRestResponse($x, $this), $this);
         } else {
             return new XMLFragmentRestResponse($x, $this);
         }
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: restapi_misc.php プロジェクト: IASA-GR/appdb-core
 public function get()
 {
     if (parent::get() !== false) {
         $res = new Default_Model_ContextFormats();
         $xml = array();
         foreach ($res->items as $i) {
             $xml[] = "<contextualization:format id='" . $i->id . "' name='" . $i->name . "'>" . htmlspecialchars($i->description, HTML_SPECIALCHARS) . "</contextualization:format>";
         }
         return new XMLFragmentRestResponse($xml, $this);
     } else {
         return false;
     }
 }
コード例 #3
0
ファイル: restapi_vo.php プロジェクト: IASA-GR/appdb-core
 protected function init($contactType = null)
 {
     if (parent::init()) {
         $this->_contactType = $contactType;
         return true;
     } else {
         return false;
     }
 }
コード例 #4
0
ファイル: restapi_repo.php プロジェクト: IASA-GR/appdb-core
 public function get()
 {
     if (parent::get() !== false) {
         $rs = $this->getParam("data");
         if (!$rs) {
             $rs = $this->getRawData();
         }
         $s = '';
         if (count($rs->items) > 0) {
             $s1 = '';
             $s2 = '';
             foreach ($rs->items as $rel) {
                 $s2 = $rel->toXML(true);
                 $releases = $rel->getReleases();
                 if (count($releases) > 0) {
                     $s3 = '';
                     foreach ($releases as $release) {
                         $s3 .= $release->toXML(true);
                     }
                     $s2 = str_replace("</MetaProductRepoArea>", $s3 . "</MetaProductRepoArea>", $s2);
                 }
                 $s2 = str_replace("</MetaProductRepoArea>", "<utclastproductiondate>" . $rel->getUTCLastProductionBuild() . "</utclastproductiondate></MetaProductRepoArea>", $s2);
                 $s2 = str_replace("</MetaProductRepoArea>", "<utcservertime>" . gmdate("Y-m-d H:i:s", (int) gmdate('U')) . "</utcservertime></MetaProductRepoArea>", $s2);
                 $s1 .= $s2;
             }
             $s = '<repository datatype="list" content="repositoryarea">' . $s1 . '</repository>';
             return RepositoryXSLT::transform($s, "repoareas");
         } else {
             $this->setError(RestErrorEnum::RE_ITEM_NOT_FOUND);
             return false;
         }
     }
 }
コード例 #5
0
ファイル: restapi_app.php プロジェクト: IASA-GR/appdb-core
 /**
  * @overrides get from RestResource
  */
 public function get()
 {
     if (parent::get() !== false) {
         db()->setFetchMode(Zend_Db::FETCH_OBJ);
         $res = db()->query("SELECT vapps_of_swapps_to_xml.xml from vapps_of_swapps_to_xml")->fetchAll();
         $ret = array();
         foreach ($res as $r) {
             $ret[] = $r->xml;
         }
         return new XMLFragmentRestResponse($ret, $this);
     } else {
         return false;
     }
 }