server/src/app/Models/Document.php
changeset 163 59c68fc4848e
parent 145 49b75287c30b
child 168 17f10b56c079
equal deleted inserted replaced
162:a6cf5a06f02d 163:59c68fc4848e
   234 
   234 
   235     public function getOtherTypes() {
   235     public function getOtherTypes() {
   236         $res = array_values(array_filter($this->getTypes(), function($v) {
   236         $res = array_values(array_filter($this->getTypes(), function($v) {
   237             return $v instanceof Resource || $v->getDatatypeUri() !== Config::get('corpusparole.olac_discourse_type')['uri'];
   237             return $v instanceof Resource || $v->getDatatypeUri() !== Config::get('corpusparole.olac_discourse_type')['uri'];
   238         }));
   238         }));
       
   239         return $res;
       
   240     }
       
   241 
       
   242     public function getTranscript() {
       
   243         $res = null;
       
   244         foreach($this->graph->allOfType("<http://www.europeana.eu/schemas/edm/WebResource>") as $webResource) {
       
   245             $format = $webResource->getLiteral("dc11:format")->getValue();
       
   246 
       
   247             if((0 === strpos($format, 'application/xml')) ||
       
   248                (0 === strpos($format, 'application/pdf')) ) {
       
   249                 $conformsTo = $webResource->getResource("<http://purl.org/dc/terms/conformsTo>");
       
   250                 $res = [
       
   251                     'url' =>  $webResource->getUri(),
       
   252                     'format' => $format,
       
   253                     'conforms-to' => $conformsTo?$conformsTo->getUri():null,
       
   254                 ];
       
   255             }
       
   256         }
   239         return $res;
   257         return $res;
   240     }
   258     }
   241 
   259 
   242     public function getContributors() {
   260     public function getContributors() {
   243         if(is_null($this->contributors)) {
   261         if(is_null($this->contributors)) {
   416                 'language' => $this->getLanguageValue(),
   434                 'language' => $this->getLanguageValue(),
   417                 'modified' => $this->getModifiedValue(),
   435                 'modified' => $this->getModifiedValue(),
   418                 'publishers' => $publishers,
   436                 'publishers' => $publishers,
   419                 'contributors' => $contributors,
   437                 'contributors' => $contributors,
   420                 'subjects' => $subjects,
   438                 'subjects' => $subjects,
       
   439                 'transcript' => $this->getTranscript(),
   421                 'mediaArray'=> $mediaArray
   440                 'mediaArray'=> $mediaArray
   422             ];
   441             ];
   423 
   442 
   424             if($this->language_resolved) {
   443             if($this->language_resolved) {
   425                 $res['language_resolved'] = $this->getLanguageResolved();
   444                 $res['language_resolved'] = $this->getLanguageResolved();