| Server IP : 127.0.1.1 / Your IP : 216.73.216.60 Web Server : Apache/2.4.58 (Ubuntu) System : Linux nepub 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/public_html/plugins/generic/dataverse/classes/ |
Upload File : |
<?php
import('plugins.generic.dataverse.dataverseAPI.DataverseClient');
class DataverseMetadata
{
private $dataverseLicenses;
public function getDataverseSubjects(): array
{
return [
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.agriculturalSciences'),
'value' => 'Agricultural Sciences',
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.artsAndHumanities'),
'value' => 'Arts and Humanities'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.astronomyAndAstrophysics'),
'value' => 'Astronomy and Astrophysics'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.businessAndManagement'),
'value' => 'Business and Management'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.chemistry'),
'value' => 'Chemistry'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.computerAndInformationScience'),
'value' => 'Computer and Information Science'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.earthAndEnvironmentalSciences'),
'value' => 'Earth and Environmental Sciences'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.Engineering'),
'value' => 'Engineering'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.Law'),
'value' => 'Law'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.mathematicalSciences'),
'value' => 'Mathematical Sciences'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.medicineHealthAndLifeSciences'),
'value' => 'Medicine, Health and Life Sciences'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.Physics'),
'value' => 'Physics'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.socialSciences'),
'value' => 'Social Sciences'
],
[
'label' => __('plugins.generic.dataverse.metadataForm.subject.Other'),
'value' => 'Other'
],
];
}
public function getDataverseLicenses(): ?array
{
try {
$dataverseClient = new DataverseClient();
$this->dataverseLicenses = $dataverseClient->getDataverseCollectionActions()->getLicenses();
return $this->dataverseLicenses;
} catch (DataverseException $e) {
error_log('Dataverse API error (licenses): ' . $e->getMessage());
return [];
}
}
public function getDefaultLicense(): ?string
{
if (empty($this->dataverseLicenses)) {
$this->getDataverseLicenses();
}
foreach ($this->dataverseLicenses as $license) {
if ($license['isDefault']) {
return $license['name'];
}
}
return null;
}
private function getDataverseConfiguration(): DataverseConfiguration
{
$request = Application::get()->getRequest();
$context = $request->getContext();
$configurationDAO = DAORegistry::getDAO('DataverseConfigurationDAO');
$configuration = $configurationDAO->get($context->getId());
return $configuration;
}
}