/** * @overrides get() from RestResource */ public function get() { if (parent::get() !== false) { $users = new Default_Model_Researchers(); $username = $this->getParam("username"); // if ( $username != '' ) { // $users->filter->username->equals($username); // } else { // $users->filter->id->equals($this->getParam("userid")); // } $users->filter->id->equals($this->_userid); $users->refresh("xml"); if (count($users->items) > 0) { return new XMLFragmentRestResponse($users->items[0]); } else { // this should never happen, the call should have failed the // authentication $this->setError(RestErrorEnum::RE_ITEM_NOT_FOUND); return false; } } else { return false; } }
/** * @overrides get() from RestResource */ public function get() { if (parent::get() !== false) { $pars = $this->_pars; $res = new RestAppHistoryItem($this->_pars, $this); $res->startLogging($this->_logfile); $xml = $res->get(); if ($xml != '') { $xml = new SimpleXMLElement(strval($xml->finalize())); $xml = $xml->xpath('//history:oldvalue/application:application'); if (count($xml) > 0) { $this->_pars['routeXslt'] = 'applications'; $xml = RestAPIHelper::wrapResponse($xml[0]->asXML()); $this->_pars['data'] = $xml; $res = new RestAppList($this->_pars); $res->startLogging($this->_logfile); $ret = $res->post("rollback"); if ($res->getError() !== RestErrorEnum::RE_OK) { $this->setError($res->getError()); } return $ret; } else { $this->setError(RestErrorEnum::RE_BACKEND_ERROR); return false; } } else { if ($res->getError() !== RestErrorEnum::RE_OK) { $this->setError($res->getError()); } else { $this->setError(RestErrorEnum::RE_BACKEND_ERROR); } return false; } } else { return false; } }