diff --git a/src/ClientInterface.php b/src/ClientInterface.php index 3a8049a..fa79cab 100644 --- a/src/ClientInterface.php +++ b/src/ClientInterface.php @@ -102,6 +102,17 @@ public function removeAllUsage($dcx_id); */ public function getCollections(); + /** + * Retrieve all docs of a collection. + * + * @param string $utag_id + * Id of a collection. + * + * @return array + * Documents of the given collection. + */ + public function getDocsOfCollection($utag_id); + /** * Return filename and url of a thumbnail for the given (image) document. * diff --git a/src/JsonClient.php b/src/JsonClient.php index 0a27322..4cdc1e6 100644 --- a/src/JsonClient.php +++ b/src/JsonClient.php @@ -841,27 +841,30 @@ public function getCollections() { } /** - * Retrieve all docs of a collection. - * - * @param string $utag_id - * Id of a collection. - * - * @return array - * Documents of the given collection. + * {@inheritdoc} */ public function getDocsOfCollection($utag_id) { $doctoutag_params = [ 'q[utag_id]' => $utag_id, 's[properties]' => '*', + 's[_referenced][dcx:document][s][_rights_effective]' => '*', 's[_referenced][dcx:document][s][files]' => '*', + 's[_referenced][dcx:document][s][_referenced][dcx:rights][s][properties]' => '*', ]; $this->dcxApiClient->get('doctoutag', $doctoutag_params, $docs); $documents = []; - foreach ($docs['entries'] as $doc) { - $documents[] = $doc['properties']['doc_id']['_id']; + + $document = reset($this->extractData($doc, ['_referenced', 'dcx:document'])); + $rights = $this->extractData($doc, ['_referenced', 'dcx:rights']); + + $document['_referenced']['dcx:rights'] = $rights; + + if ($this->computeStatus($document)) { + $documents[] = $doc['properties']['doc_id']['_id']; + } } return $documents;