/** * @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; } }
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; } }
protected function init($contactType = null) { if (parent::init()) { $this->_contactType = $contactType; return true; } else { return false; } }
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; } } }
/** * @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; } }