Server : Apache/2.4.41 (Ubuntu) System : Linux journalup 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) 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, Directory : /var/www/html/classes/journal/ |
<?php /** * @file classes/journal/JournalDAO.inc.php * * Copyright (c) 2014-2020 Simon Fraser University * Copyright (c) 2003-2020 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class JournalDAO * @ingroup journal * @see Journal * * @brief Operations for retrieving and modifying Journal objects. */ import('lib.pkp.classes.context.ContextDAO'); import('classes.journal.Journal'); import('lib.pkp.classes.metadata.MetadataTypeDescription'); define('JOURNAL_FIELD_TITLE', 1); define('JOURNAL_FIELD_SEQUENCE', 2); class JournalDAO extends ContextDAO { /** @copydoc SchemaDAO::$schemaName */ var $schemaName = 'context'; /** @copydoc SchemaDAO::$tableName */ var $tableName = 'journals'; /** @copydoc SchemaDAO::$settingsTableName */ var $settingsTableName = 'journal_settings'; /** @copydoc SchemaDAO::$primaryKeyColumn */ var $primaryKeyColumn = 'journal_id'; /** @var array Maps schema properties for the primary table to their column names */ var $primaryTableColumns = [ 'id' => 'journal_id', 'urlPath' => 'path', 'enabled' => 'enabled', 'seq' => 'seq', 'primaryLocale' => 'primary_locale', ]; /** * Create a new DataObject of the appropriate class * * @return DataObject */ public function newDataObject() { return new Journal(); } /** * Retrieve the IDs and titles of all journals in an associative array. * @return array */ function getTitles($enabledOnly = false) { $journals = array(); $journalIterator = $this->getAll($enabledOnly); while ($journal = $journalIterator->next()) { $journals[$journal->getId()] = $journal->getLocalizedName(); } return $journals; } /** * Delete the public IDs of all publishing objects in a journal. * @param $journalId int * @param $pubIdType string One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see <http://dtd.nlm.nih.gov/publishing/tag-library/n-4zh0.html>). */ function deleteAllPubIds($journalId, $pubIdType) { $pubObjectDaos = array('IssueDAO', 'PublicationDAO', 'ArticleGalleyDAO'); foreach($pubObjectDaos as $daoName) { $dao = DAORegistry::getDAO($daoName); $dao->deleteAllPubIds($journalId, $pubIdType); } import('lib.pkp.classes.submission.SubmissionFileDAODelegate'); $submissionFileDaoDelegate = new SubmissionFileDAODelegate(); $submissionFileDaoDelegate->deleteAllPubIds($journalId, $pubIdType); } /** * Check whether the given public ID exists for any publishing * object in a journal. * @param $journalId int * @param $pubIdType string One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see <http://dtd.nlm.nih.gov/publishing/tag-library/n-4zh0.html>). * @param $pubId string * @param $assocType int The object type of an object to be excluded from * the search. Identified by one of the ASSOC_TYPE_* constants. * @param $assocId int The id of an object to be excluded from the search. * @param $forSameType boolean Whether only the same objects should be considered. * @return boolean */ function anyPubIdExists($journalId, $pubIdType, $pubId, $assocType = ASSOC_TYPE_ANY, $assocId = 0, $forSameType = false) { $pubObjectDaos = array( ASSOC_TYPE_ISSUE => DAORegistry::getDAO('IssueDAO'), ASSOC_TYPE_SUBMISSION => DAORegistry::getDAO('SubmissionDAO'), ASSOC_TYPE_GALLEY => Application::getRepresentationDAO(), ASSOC_TYPE_ISSUE_GALLEY => DAORegistry::getDAO('IssueGalleyDAO'), ASSOC_TYPE_SUBMISSION_FILE => DAORegistry::getDAO('SubmissionFileDAO') ); if ($forSameType) { $dao = $pubObjectDaos[$assocType]; $excludedId = $assocId; if ($dao->pubIdExists($pubIdType, $pubId, $excludedId, $journalId)) return true; return false; } foreach($pubObjectDaos as $daoAssocType => $dao) { if ($assocType == $daoAssocType) { $excludedId = $assocId; } else { $excludedId = 0; } if ($dao->pubIdExists($pubIdType, $pubId, $excludedId, $journalId)) return true; } return false; } }