Esempio n. 1
0
 /**
  * @inheritDoc
  */
 public function related($link, $escape = true)
 {
     if ($link['type'] === 'ctrlnum') {
         return $this->buildCtrlNumRelatedLink($link, $escape);
     } else {
         return parent::related($link, $escape);
     }
 }
Esempio n. 2
0
 /**
  * Return an XML representation of the record using the specified format.
  * Return false if the format is unsupported.
  *
  * @param string     $format     Name of format to use (corresponds with OAI-PMH
  * metadataPrefix parameter).
  * @param string     $baseUrl    Base URL of host containing VuFind (optional;
  * may be used to inject record URLs into XML when appropriate).
  * @param RecordLink $recordLink Record link helper (optional; may be used to
  * inject record URLs into XML when appropriate).
  *
  * @return mixed         XML, or false if format unsupported.
  */
 public function getXML($format, $baseUrl = null, $recordLink = null)
 {
     // For OAI-PMH Dublin Core, produce the necessary XML:
     if ($format == 'oai_dc') {
         $dc = 'http://purl.org/dc/elements/1.1/';
         $xml = new \SimpleXMLElement('<oai_dc:dc ' . 'xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" ' . 'xmlns:dc="' . $dc . '" ' . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' . 'xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ ' . 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd" />');
         $xml->addChild('title', htmlspecialchars($this->getTitle()), $dc);
         $primary = $this->getPrimaryAuthor();
         if (!empty($primary)) {
             $xml->addChild('creator', htmlspecialchars($primary), $dc);
         }
         $corporate = $this->getCorporateAuthor();
         if (!empty($corporate)) {
             $xml->addChild('creator', htmlspecialchars($corporate), $dc);
         }
         foreach ($this->getSecondaryAuthors() as $current) {
             $xml->addChild('creator', htmlspecialchars($current), $dc);
         }
         foreach ($this->getLanguages() as $lang) {
             $xml->addChild('language', htmlspecialchars($lang), $dc);
         }
         foreach ($this->getPublishers() as $pub) {
             $xml->addChild('publisher', htmlspecialchars($pub), $dc);
         }
         foreach ($this->getPublicationDates() as $date) {
             $xml->addChild('date', htmlspecialchars($date), $dc);
         }
         foreach ($this->getAllSubjectHeadings() as $subj) {
             $xml->addChild('subject', htmlspecialchars(implode(' -- ', $subj)), $dc);
         }
         if (null !== $baseUrl && null !== $recordLink) {
             $url = $baseUrl . $recordLink->getUrl($this);
             $xml->addChild('identifier', $url, $dc);
         }
         return $xml->asXml();
     }
     // Unsupported format:
     return false;
 }