Ejemplo n.º 1
0
 /**
  * @param $activity
  * @return array
  */
 public function getXmlData(Activity $activity)
 {
     $activityData = [];
     $documentLinks = $activity->documentLinks()->get();
     foreach ($documentLinks as $documentLink) {
         $documentLink = $documentLink->document_link;
         $activityData[] = ['@attributes' => ['url' => $documentLink['url'], 'format' => $documentLink['format']], 'title' => ['narrative' => $this->buildNarrative(getVal($documentLink, ['title', 0, 'narrative'], []))], 'category' => ['@attributes' => ['code' => getVal($documentLink, ['category', 0, 'code'])]], 'language' => ['@attributes' => ['code' => getVal($documentLink, ['language', 0, 'language'])]], 'document-date' => ['@attributes' => ['iso-date' => getVal($documentLink, ['document_date', 0, 'date'])]]];
     }
     return $activityData;
 }
Ejemplo n.º 2
0
 /**
  * @param $activity
  * @return array
  */
 public function getXmlData(Activity $activity)
 {
     $activityData = [];
     $documentLinks = $activity->documentLinks()->get();
     foreach ($documentLinks as $documentLink) {
         $documentLink = $documentLink->document_link;
         $activityData[] = ['@attributes' => ['url' => $documentLink['url'], 'format' => $documentLink['format']], 'title' => ['narrative' => $this->buildNarrative($documentLink['title'][0]['narrative'])], 'category' => ['@attributes' => ['code' => isset($documentLink['category'][0]['code']) ? $documentLink['category'][0]['code'] : '']], 'language' => ['@attributes' => ['code' => isset($documentLink['language'][0]['language']) ? $documentLink['language'][0]['language'] : '']]];
     }
     return $activityData;
 }