130 $srcRight = null; |
130 $srcRight = null; |
131 if(isset($srcArray[$prop]) && count($srcArray[$prop]) > 0) { |
131 if(isset($srcArray[$prop]) && count($srcArray[$prop]) > 0) { |
132 $srcRight = $srcArray[$prop][0]; |
132 $srcRight = $srcArray[$prop][0]; |
133 } |
133 } |
134 |
134 |
|
135 |
135 $license = [ 'type' => 'uri', 'value' => config('corpusparole.corpus_doc_default_cc_rights') ]; |
136 $license = [ 'type' => 'uri', 'value' => config('corpusparole.corpus_doc_default_cc_rights') ]; |
136 |
137 |
137 if($baseRight != null && $baseRight == $srcRight ) { |
138 if($baseRight == null && $srcRight != null) { |
|
139 $license = $srcRight; |
|
140 } elseif($baseRight != null && $srcRight == null) { |
138 $license = $baseRight; |
141 $license = $baseRight; |
|
142 } elseif($baseRight != null && $srcRight != null) { |
|
143 |
|
144 // The sound rights takes precedence. We test for Text which is easier. |
|
145 $soundRight = null; |
|
146 $baseCHO = $baseRes->get("<http://www.europeana.eu/schemas/edm/aggregatedCHO>"); |
|
147 if(!is_null($baseCHO)) { |
|
148 foreach ($baseCHO->all("dc11:type","resource") as $resType) { |
|
149 $type = $resType->getUri(); |
|
150 if($type === 'http://purl.org/dc/dcmitype/Text') { |
|
151 // the baseRes is a text, we take the source |
|
152 $soundRight = $srcRight; |
|
153 break; |
|
154 } |
|
155 } |
|
156 } |
|
157 // in all case we take the base right |
|
158 if(is_null($soundRight)) { |
|
159 $soundRight = $baseRight; |
|
160 } |
|
161 $license = $soundRight; |
139 } |
162 } |
140 |
163 |
141 $targetArray[$prop] = [$license,]; |
164 $targetArray[$prop] = [$license,]; |
142 } |
165 } |
143 |
166 |