- ersistent Identifier: ID mit Url bei technischen Metadaten

- Embargo-Datum in den Tab "Inhalt"
- Filegröße in den Tab "Inhalt"
- Publisher und Herausgeber in den Tab "Technische Metadaten"
- usätzliche Titel,  Referenzen
- OAI Link unten bei Hilfe
- composer updates
This commit is contained in:
Arno Kaimbacher 2020-03-11 17:21:27 +01:00
parent 9ab92b5fa0
commit 27464d08f7
5 changed files with 85 additions and 35 deletions

View file

@ -187,6 +187,10 @@ class Dataset extends Model
{
return $this->hasMany(Title::class, 'document_id', 'id');
}
public function additionalTitles()
{
return $this->hasMany(Title::class, 'document_id', 'id')->where('type', '!=', 'Main');
}
public function mainTitle()
{

View file

@ -23,7 +23,7 @@ class File extends Model
return $this->hasMany(HashValue::class, 'file_id', 'id');
}
/**
/**
* Create hash value model objects from original file.
*
* TODO throws Exception in case hash computation is not possible
@ -34,7 +34,7 @@ class File extends Model
public function createHashValues()
{
$hashtypes = array('md5', 'sha512');
foreach ($hashtypes as $type) {
$hash = new HashValue();
$hash->type = $type;
@ -44,7 +44,7 @@ class File extends Model
}
}
/**
/**
* Get the hash value of the file
*
* @param string $type Type of the hash value, @see hash_file();
@ -65,11 +65,21 @@ class File extends Model
private function getPath()
{
//return storage_path('app/public/' . $this->path_name);
return public_path('storage/' . $this->path_name);
return public_path('storage/' . $this->path_name);
}
public function exists()
{
return \Illuminate\Support\Facades\File::exists(public_path('storage/' . $this->path_name));
}
public function formatSize($precision = 1)
{
$size = $this->file_size;
$unit = ['Byte', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
for ($i = 0; $size >= 1024 && $i < count($unit) - 1; $i++) {
$size /= 1024;
}
return round($size, $precision) . ' ' . $unit[$i];
}
}