| Server IP : 10.10.92.66 / Your IP : 104.23.197.230 Web Server : Apache/2.4.52 (Ubuntu) System : Linux jurnalpolinema 5.15.0-177-generic #187-Ubuntu SMP Sat Apr 11 22:54:33 UTC 2026 x86_64 User : jurnal ( 1001) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/jurnal/public_html/lib/pkp/classes/metadata/ |
Upload File : |
<?php
/**
* @file classes/metadata/MetadataDescriptionDummyAdapter.inc.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class MetadataDescriptionDummyAdapter
* @ingroup metadata
* @see MetadataDescription
*
* @brief Class that simulates a metadata adapter for metadata
* description object for direct metadata description persistence.
*/
import('lib.pkp.classes.metadata.MetadataDataObjectAdapter');
class MetadataDescriptionDummyAdapter extends MetadataDataObjectAdapter {
/**
* Constructor
*
* @param $metadataDescription MetadataDescription
*/
function __construct(&$metadataDescription, $mode = null) {
$this->setDisplayName('Inject/Extract Metadata into/from a MetadataDescription');
// Configure the adapter
$inputType = $outputType = 'metadata::'.$metadataDescription->getMetadataSchemaName().'(*)';
parent::__construct(PersistableFilter::tempGroup($inputType, $outputType), $mode);
$this->_assocType = $metadataDescription->getAssocType();
}
//
// Implement template methods from PersistableFilter
//
/**
* @see PersistableFilter::getClassName()
*/
function getClassName() {
return 'lib.pkp.classes.metadata.MetadataDescriptionDummyAdapter';
}
//
// Implement template methods from MetadataDataObjectAdapter
//
/**
* @see MetadataDataObjectAdapter::injectMetadataIntoDataObject()
* @param $sourceMetadataDescription MetadataDescription
* @param $targetMetadataDescription MetadataDescription
* @return MetadataDescription
*/
function &injectMetadataIntoDataObject(&$sourceMetadataDescription, &$targetMetadataDescription) {
// Inject data from the source description into the target description.
assert($sourceMetadataDescription->getMetadataSchema() == $targetMetadataDescription->getMetadataSchema());
$targetMetadataDescription->setStatements($sourceMetadataDescription->getStatements());
return $targetMetadataDescription;
}
/**
* @see MetadataDataObjectAdapter::extractMetadataFromDataObject()
* @param $sourceMetadataDescription MetadataDescription
* @return MetadataDescription
*/
function extractMetadataFromDataObject(&$sourceMetadataDescription) {
// Create a copy of the meta-data description to decouple
// it from the original.
return clone($sourceMetadataDescription);
}
/**
* We override the standard implementation so that
* meta-data fields will be persisted without namespace
* prefix. This is ok as meta-data descriptions always
* only have meta-data from one namespace.
*
* @param $translated boolean if true, return localized field
* names, otherwise return additional field names.
* @return array an array of field names to be persisted.
*/
function getMetadataFieldNames($translated = true) {
// Do we need to build the field name cache first?
if (is_null($this->_metadataFieldNames)) {
// Initialize the cache array
$this->_metadataFieldNames = array();
// Retrieve all properties and add
// their names to the cache
$metadataSchema =& $this->getMetadataSchema();
$properties =& $metadataSchema->getProperties();
foreach($properties as $property) {
$propertyAssocTypes = $property->getAssocTypes();
if (in_array($this->_assocType, $propertyAssocTypes)) {
// Separate translated and non-translated property names
// and add the name space so that field names are unique
// across various meta-data schemas.
$this->_metadataFieldNames[$property->getTranslated()][] = $property->getName();
}
}
}
// Return the field names
return $this->_metadataFieldNames[$translated];
}
}