- capitalize type attribute for datacite standard

- DatasetExtension filter persons
This commit is contained in:
Arno Kaimbacher 2019-09-16 13:47:30 +02:00
parent 84deb7c457
commit 69f6f250b9
9 changed files with 41 additions and 29 deletions

View file

@ -62,11 +62,11 @@ class IndexController extends Controller
$relationTypes = ["IsCitedBy", "Cites", "IsSupplementTo", "IsSupplementedBy", "IsContinuedBy", "Continues", "HasMetadata", "IsMetadataFor","IsNewVersionOf", "IsPreviousVersionOf", "IsPartOf", "HasPart", "IsReferencedBy", "References", "IsDocumentedBy", "Documents", "IsCompiledBy", "Compiles", "IsVariantFormOf", "IsOriginalFormOf", "IsIdenticalTo", "IsReviewedBy", "Reviews", "IsDerivedFrom", "IsSourceOf"];
$relationTypes = array_combine($relationTypes, $relationTypes);
$titleTypes = ['sub' => 'sub', 'alternative' => 'alternative', 'translated' => 'translated', 'other' => 'other'];
$titleTypes = ['sub' => 'Sub', 'alternative' => 'Alternative', 'translated' => 'Translated', 'other' => 'Other'];
$keywordTypes = ['uncontrolled' => 'uncontrolled'];
$descriptionTypes = ['methods' => 'methods', 'series_information' => 'series_information', 'technical_info' => 'technical_info', 'translated' => 'translated', 'other' => 'other'];
$descriptionTypes = ['methods' => 'Methods', 'series_information' => 'Series_information', 'technical_info' => 'Technical_info', 'translated' => 'Translated', 'other' => 'Other'];
$page = Page::query()->where('page_slug', 'terms-and-conditions')->firstOrFail();

View file

@ -268,11 +268,13 @@ trait DatasetExtension
//$licenses = $select->with('datasets')->get();
//$rows = $supplier->datasets;
$rows = $this->{$relation};
//if (isset($this->externalFields[$fieldname]['pivot']))
//{
// $pivArray = $this->externalFields[$fieldname]['pivot'];
// $rows = $rows->wherePivot('role', $pivArray['role']);
//}
if (isset($this->externalFields[$fieldname]['pivot'])) {
$pivArray = $this->externalFields[$fieldname]['pivot'];
$pivotValue = $pivArray['role'];
//$through = $this->externalFields[$fieldname]['through'];
$rows = $this->{$relation}()->wherePivot('role', $pivotValue)->get();
//$rows = $this->belongsToMany($modelclass, $through, 'document_id')->wherePivot('role', $pivotValue)->get();
}
} else {
$rows = $select->whereHas('dataset', function ($q) use ($datasetId) {
$q->where('id', $datasetId);
@ -287,10 +289,15 @@ trait DatasetExtension
$objArray = [];
foreach ($attributes as $property_name) {
$fieldName = self::convertColumnToFieldname($property_name);
// $field =new Field($fieldName);
$fieldval = $row->{$property_name};
// $field->setValue($fieldval);
// $this->_mapField($field, $dom, $rootNode);
$fieldval = "";
if ($fieldName == "Type") {
$fieldval = ucfirst($row->{$property_name});
} else {
// $field =new Field($fieldName);
$fieldval = $row->{$property_name};
// $field->setValue($fieldval);
// $this->_mapField($field, $dom, $rootNode);
}
$objArray[$fieldName] = $fieldval;
}
$result[] = $objArray;

View file

@ -24,7 +24,7 @@ class Person extends Model
public function documents()
{
return $this->belongsToMany(Dataset::class, 'link_documents_persons', 'person_id', 'document_id')
->withPivot('role');
->withPivot('role', 'sort_order', 'allow_email_contact');
}
// public function scopeNotLimit($query)