コード例 #1
0
 /**
  * Responds to the ListMetadataFormats verb.
  *
  * Outputs records for all of the items in the database in the specified
  * metadata format.
  *
  * @todo extend for additional metadata formats
  */
 private function listMetadataFormats()
 {
     if (isset($this->query['identifier'])) {
         $identifier = $this->query['identifier'];
         $findItem = new Pas_OaiPmhRepository_OaiIdentifier();
         $itemId = $findItem->oaiIdToItem($identifier);
         if (!$itemId) {
             $this->throwError(self::OAI_ERR_ID_DOES_NOT_EXIST);
             return;
         }
         $itemTable = new OaiFinds();
         $item = $itemTable->getRecord($itemId);
         if (!$item) {
             $this->throwError(self::OAI_ERR_ID_DOES_NOT_EXIST);
             return;
         }
     }
     if (!$this->error) {
         $listMetadataFormats = $this->document->createElement('ListMetadataFormats');
         $this->document->documentElement->appendChild($listMetadataFormats);
         foreach ($this->metadataFormats as $format) {
             $method = $format;
             $formatObject = new $method(null, $listMetadataFormats);
             $formatObject->declareMetadataFormat();
         }
     }
 }