public static function getErrorFeed(&$service, $status, $message) { $service->setStatus($status); $feed = new KT_cmis_atom_responseFeed_GET(CMIS_APP_BASE_URI); $feed->newField('title', 'Error: ' . $status, $feed); $entry = $feed->newEntry(); $feed->newField('error', $message, $entry); return $feed; }
/** * Deals with GET actions for checkedout documents. */ public function GET_action() { $RepositoryService = new RepositoryService(); $NavigationService = new NavigationService(KT_cmis_atom_service_helper::getKt()); $repositories = $RepositoryService->getRepositories(); $repositoryId = $repositories[0]['repositoryId']; $checkedout = $NavigationService->getCheckedOutDocs($repositoryId); //print_r($checkedout);exit; //Create a new response feed $feed = new KT_cmis_atom_responseFeed_GET(CMIS_APP_BASE_URI); $workspace = $feed->getWorkspace(); $feed->newField('title', 'Checked out Documents', $feed); // TODO dynamic? $feedElement = $feed->newField('author'); $element = $feed->newField('name', 'admin', $feedElement); $feed->appendChild($feedElement); $feed->appendChild($feed->newElement('id', 'urn:uuid:checkedout')); // TODO get actual most recent update time, only use current if no other available $feed->appendChild($feed->newElement('updated', KT_cmis_atom_service_helper::formatDatestamp())); $link = $feed->newElement('link'); $link->appendChild($feed->newAttr('rel', 'self')); $link->appendChild($feed->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/checkedout')); $feed->appendChild($link); $link = $feed->newElement('link'); $link->appendChild($feed->newAttr('rel', 'first')); $link->appendChild($feed->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/checkedout/pageNo=1&pageSize=0')); $link->appendChild($feed->newAttr('type', 'application/atom+xml;type=feed')); $feed->appendChild($link); $link = $feed->newElement('link'); $link->appendChild($feed->newAttr('rel', 'last')); // TODO set page number correctly - to be done when we support paging the the API $link->appendChild($feed->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/checkedout/pageNo=1&pageSize=0')); $link->appendChild($feed->newAttr('type', 'application/atom+xml;type=feed')); $feed->appendChild($link); foreach ($checkedout as $cmisEntry) { KT_cmis_atom_service_helper::createObjectEntry($feed, $cmisEntry, $folderName, true); // // after each entry, add app:edited tag // $feed->newField('app:edited', KT_cmis_atom_service_helper::formatDatestamp(), $feed); } $feed->newField('cmis:hasMoreItems', 'false', $feed); // $entry = null; // $feed->newField('cmis:hasMoreItems', 'false', $entry, true); //Expose the responseFeed $this->responseFeed = $feed; }
/** * Retrieves a list of child types for the supplied type * * NOTE this currently returns a hard coded empty list, since we do not currently support child types * TODO make dynamic if/when we support checking for child types (we don't actually need to support child types themselves) * * @param string $type * @return string CMIS AtomPub feed */ private function getTypeChildrenFeed() { //Create a new response feed // $baseURI=NULL,$title=NULL,$link=NULL,$updated=NULL,$author=NULL,$id=NULL $feed = new KT_cmis_atom_responseFeed_GET(CMIS_APP_BASE_URI); $feed->newField('title', 'Child Types of ' . ucwords($this->params[0]), $feed); $feed->newField('id', $this->params[0] . '-children', $feed); // TODO fetch child types - to be implemented when we support child types in the API // links $link = $feed->newElement('link'); $link->appendChild($feed->newAttr('rel', 'first')); $link->appendChild($feed->newAttr('href', CMIS_APP_BASE_URI . 'type/' . $this->params[0] . '/' . $this->params[1] . '?pageNo=1&pageSize=0')); $link->appendChild($feed->newAttr('type', 'application/atom+xml;type=feed')); $link = $feed->newElement('link'); $link->appendChild($feed->newAttr('rel', 'last')); // TODO set page number correctly - to be done when we support paging the the API $link->appendChild($feed->newAttr('href', CMIS_APP_BASE_URI . 'type/' . $this->params[0] . '/' . $this->params[1] . '?pageNo=1&pageSize=0')); $link->appendChild($feed->newAttr('type', 'application/atom+xml;type=feed')); $feed->newField('updated', KT_cmis_atom_service_helper::formatDatestamp(), $feed); $feed->newField('cmis:hasMoreItems', 'false', $feed); return $feed; }