diff --git a/classes/article/ArticleDAO.inc.php b/classes/article/ArticleDAO.inc.php
index 51d76ad1e7c..58109a5b805 100644
--- a/classes/article/ArticleDAO.inc.php
+++ b/classes/article/ArticleDAO.inc.php
@@ -219,7 +219,7 @@ function deleteById($submissionId) {
$publishedArticleDao->deletePublishedArticleByArticleId($submissionId);
$articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
- $articleGalleyDao->deleteGalleysByArticle($submissionId);
+ $articleGalleyDao->deleteByArticleId($submissionId);
$articleSearchDao = DAORegistry::getDAO('ArticleSearchDAO');
$articleSearchDao->deleteSubmissionKeywords($submissionId);
diff --git a/classes/article/ArticleGalley.inc.php b/classes/article/ArticleGalley.inc.php
index 520aacc2bdf..421b5903636 100644
--- a/classes/article/ArticleGalley.inc.php
+++ b/classes/article/ArticleGalley.inc.php
@@ -30,10 +30,7 @@ function ArticleGalley() {
* @return boolean
*/
function isHTMLGalley() {
- if ($this->getGalleyType() == 'htmlarticlegalleyplugin')
- return true;
- else
- return false;
+ return $this->getGalleyType() == 'htmlarticlegalleyplugin';
}
/**
@@ -41,10 +38,7 @@ function isHTMLGalley() {
* @return boolean
*/
function isPdfGalley() {
- if ($this->getGalleyType() == 'pdfarticlegalleyplugin')
- return true;
- else
- return false;
+ return $this->getGalleyType() == 'pdfarticlegalleyplugin';
}
/**
@@ -163,7 +157,7 @@ function getRemoteURL() {
* @return boolean
*/
function getIsAvailable() {
- return $this->getData('isAvailable') ? true : false;
+ return (boolean) $this->getData('isAvailable');
}
/**
diff --git a/classes/article/ArticleGalleyDAO.inc.php b/classes/article/ArticleGalleyDAO.inc.php
index 3ab26031301..4a330d161bd 100644
--- a/classes/article/ArticleGalleyDAO.inc.php
+++ b/classes/article/ArticleGalleyDAO.inc.php
@@ -97,16 +97,12 @@ function pubIdExists($pubIdType, $pubId, $galleyId, $journalId) {
* @param $articleId int
* @return ArticleGalley
*/
- function &getGalleyByPubId($pubIdType, $pubId, $articleId = null) {
- $galleyFactory =& $this->getGalleysBySetting('pub-id::'.$pubIdType, $pubId, $articleId);
- if ($galleyFactory->wasEmpty()) {
- $galley = null;
- } else {
- assert($galleyFactory->getCount() == 1);
- $galley =& $galleyFactory->next();
- }
+ function getGalleyByPubId($pubIdType, $pubId, $articleId = null) {
+ $galleyFactory = $this->getGalleysBySetting('pub-id::'.$pubIdType, $pubId, $articleId);
+ if ($galleyFactory->wasEmpty()) return null;
- return $galley;
+ assert($galleyFactory->getCount() == 1);
+ return $galleyFactory->next();
}
/**
@@ -186,7 +182,7 @@ function getByJournalId($journalId) {
* @param $articleId int
* @return ArticleGalley object
*/
- function getGalleyByBestGalleyId($galleyId, $articleId) {
+ function getByBestGalleyId($galleyId, $articleId) {
$galley = null;
if ($galleyId != '') $galley = $this->getGalleyByPubId('publisher-id', $galleyId, $articleId);
if (!isset($galley) && ctype_digit("$galleyId")) $galley = $this->getById((int) $galleyId, $articleId);
@@ -217,7 +213,7 @@ function getAdditionalFieldNames() {
* Update the localized fields for this galley.
* @param $galley
*/
- function updateLocaleFields(&$galley) {
+ function updateLocaleFields($galley) {
$this->updateDataObjectSettings('submission_galley_settings', $galley, array(
'galley_id' => $galley->getId()
));
@@ -254,12 +250,11 @@ function _fromRow($row) {
function insertObject($galley) {
$this->update(
'INSERT INTO submission_galleys
- (submission_id, file_id, label, locale, seq, remote_url, is_available, galley_type)
+ (submission_id, label, locale, seq, remote_url, is_available, galley_type)
VALUES
- (?, ?, ?, ?, ?, ?, ?, ?)',
+ (?, ?, ?, ?, ?, ?, ?)',
array(
(int) $galley->getSubmissionId(),
- 0,
$galley->getLabel(),
$galley->getLocale(),
$galley->getSeq() == null ? $this->getNextGalleySequence($galley->getSubmissionId()) : $galley->getSeq(),
@@ -284,7 +279,6 @@ function updateObject($galley) {
$this->update(
'UPDATE submission_galleys
SET
- file_id = ?,
label = ?,
locale = ?,
seq = ?,
@@ -293,7 +287,6 @@ function updateObject($galley) {
galley_type = ?
WHERE galley_id = ?',
array(
- 0,
$galley->getLabel(),
$galley->getLocale(),
$galley->getSeq(),
@@ -310,34 +303,31 @@ function updateObject($galley) {
* Delete an ArticleGalley.
* @param $galley ArticleGalley
*/
- function deleteGalley(&$galley) {
- return $this->deleteGalleyById($galley->getId());
+ function deleteObject($galley) {
+ return $this->deleteById($galley->getId());
}
/**
* Delete a galley by ID.
- * @param $galleyId int
- * @param $articleId int optional
+ * @param $galleyId int Galley ID.
+ * @param $articleId int Optional article ID.
*/
- function deleteGalleyById($galleyId, $articleId = null) {
+ function deleteById($galleyId, $articleId = null) {
- HookRegistry::call('ArticleGalleyDAO::deleteGalleyById', array(&$galleyId, &$articleId));
+ HookRegistry::call('ArticleGalleyDAO::deleteById', array(&$galleyId, &$articleId));
- if (isset($articleId)) {
- $this->update(
- 'DELETE FROM submission_galleys WHERE galley_id = ? AND submission_id = ?',
- array((int) $galleyId, (int) $articleId)
- );
- } else {
- $this->update(
- 'DELETE FROM submission_galleys WHERE galley_id = ?', (int) $galleyId
- );
- }
+ $params = array((int) $galleyId);
+ if ($articleId) $params[] = (int) $articleId;
+ $this->update(
+ 'DELETE FROM submission_galleys
+ WHERE galley_id = ?'
+ . ($articleId?' AND submission_id = ?':''),
+ $params
+ );
if ($this->getAffectedRows()) {
$this->update('DELETE FROM submission_galley_settings WHERE galley_id = ?', array((int) $galleyId));
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
- // Import constants
- import('lib.pkp.classes.submission.SubmissionFile');
+ import('lib.pkp.classes.submission.SubmissionFile'); // Import constants
$galleyFiles = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_GALLEY, $galleyId, $articleId, SUBMISSION_FILE_PROOF);
foreach ($galleyFiles as $file) {
@@ -354,32 +344,13 @@ function deleteGalleyById($galleyId, $articleId = null) {
* NOTE that this will not delete article_file entities or the respective files.
* @param $articleId int
*/
- function deleteGalleysByArticle($articleId) {
+ function deleteByArticleId($articleId) {
$galleys = $this->getBySubmissionId($articleId);
while ($galley = $galleys->next()) {
- $this->deleteGalleyById($galley->getId(), $articleId);
+ $this->deleteById($galley->getId(), $articleId);
}
}
- /**
- * Check if a galley exists with the associated file ID.
- * @param $articleId int
- * @param $fileId int
- * @return boolean
- */
- function galleyExistsByFileId($articleId, $fileId) {
- $result = $this->retrieve(
- 'SELECT COUNT(*) FROM submission_galleys
- WHERE submission_id = ? AND file_id = ?',
- array((int) $articleId, (int) $fileId)
- );
-
- $returner = isset($result->fields[0]) && $result->fields[0] == 1 ? true : false;
-
- $result->Close();
- return $returner;
- }
-
/**
* Sequentially renumber galleys for an article in their sequence order.
* @param $articleId int
diff --git a/classes/article/PublishedArticleDAO.inc.php b/classes/article/PublishedArticleDAO.inc.php
index dc5222046c2..d8c4fd30fc3 100644
--- a/classes/article/PublishedArticleDAO.inc.php
+++ b/classes/article/PublishedArticleDAO.inc.php
@@ -710,17 +710,6 @@ function resequencePublishedArticles($sectionId, $issueId) {
$this->flushCache();
}
- /**
- * Increment the views count for a galley.
- * @param $articleId int
- */
- function incrementViewsByArticleId($articleId) {
- return $this->update(
- 'UPDATE published_submissions SET views = views + 1 WHERE submission_id = ?',
- (int) $articleId
- );
- }
-
/**
* Return years of oldest/youngest published article on site or within a journal
* @param $journalId int Optional
diff --git a/classes/issue/IssueGalleyDAO.inc.php b/classes/issue/IssueGalleyDAO.inc.php
index 31153b7e0ce..b25703810b3 100644
--- a/classes/issue/IssueGalleyDAO.inc.php
+++ b/classes/issue/IssueGalleyDAO.inc.php
@@ -315,7 +315,7 @@ function deleteObject($galley) {
* @param $issueId int optional
*/
function deleteById($galleyId, $issueId = null) {
- HookRegistry::call('IssueGalleyDAO::deleteGalleyById', array(&$galleyId, &$issueId));
+ HookRegistry::call('IssueGalleyDAO::deleteById', array(&$galleyId, &$issueId));
if (isset($issueId)) {
$this->update(
@@ -344,37 +344,6 @@ function deleteByIssueId($issueId) {
}
}
- /**
- * Check if a galley exists with the associated file ID.
- * @param $issueId int
- * @param $fileId int
- * @return boolean
- */
- function galleyExistsByFileId($issueId, $fileId) {
- $result = $this->retrieve(
- 'SELECT COUNT(*) FROM issue_galleys
- WHERE issue_id = ? AND file_id = ?',
- array((int) $issueId, (int) $fileId)
- );
-
- $returner = isset($result->fields[0]) && $result->fields[0] == 1 ? true : false;
- $result->Close();
- return $returner;
- }
-
- /**
- * Increment the views count for a galley.
- * @param $galleyId int
- */
- function incrementViews($galleyId) {
- if ( !HookRegistry::call('IssueGalleyDAO::incrementViews', array(&$galleyId)) ) {
- return $this->update(
- 'UPDATE issue_galleys SET views = views + 1 WHERE galley_id = ?',
- (int) $galleyId
- );
- } else return false;
- }
-
/**
* Sequentially renumber galleys for an issue in their sequence order.
* @param $issueId int
diff --git a/controllers/grid/articleGalleys/ArticleGalleyGridHandler.inc.php b/controllers/grid/articleGalleys/ArticleGalleyGridHandler.inc.php
index 3ca1a625c8e..e4f6cb373f9 100644
--- a/controllers/grid/articleGalleys/ArticleGalleyGridHandler.inc.php
+++ b/controllers/grid/articleGalleys/ArticleGalleyGridHandler.inc.php
@@ -243,7 +243,7 @@ function update($args, $request) {
function delete($args, $request) {
$articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
$articleGalley = $this->getAuthorizedContextObject(ASSOC_TYPE_GALLEY);
- $articleGalleyDao->deleteGalley($articleGalley);
+ $articleGalleyDao->deleteObject($articleGalley);
return DAO::getDataChangedEvent();
}
@@ -256,7 +256,7 @@ function delete($args, $request) {
function setAvailable($args, $request) {
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
$articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
- $articleGalley = $articleGalleyDao->getGalleyByBestGalleyId(
+ $articleGalley = $articleGalleyDao->getByBestGalleyId(
$request->getUserVar('articleGalleyId'),
$submission->getId() // Make sure to validate the context.
);
diff --git a/controllers/modals/editorDecision/EditorDecisionHandler.inc.php b/controllers/modals/editorDecision/EditorDecisionHandler.inc.php
index 14ac62463c2..2880eb067c6 100644
--- a/controllers/modals/editorDecision/EditorDecisionHandler.inc.php
+++ b/controllers/modals/editorDecision/EditorDecisionHandler.inc.php
@@ -101,7 +101,7 @@ function saveApproveProof($args, $request) {
$user = $request->getUser();
$articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
- $galley = $articleGalleyDao->getGalleyByBestGalleyId($submissionFile->getAssocId(), $submission->getId());
+ $galley = $articleGalleyDao->getByBestGalleyId($submissionFile->getAssocId(), $submission->getId());
SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_PROOFS_APPROVED, 'submission.event.proofsApproved', array('formatName' => $galley->getLabel(),'name' => $user->getFullName(), 'username' => $user->getUsername()));
}
diff --git a/dbscripts/xml/ojs_schema.xml b/dbscripts/xml/ojs_schema.xml
index 277ffb99db7..93733e56bee 100644
--- a/dbscripts/xml/ojs_schema.xml
+++ b/dbscripts/xml/ojs_schema.xml
@@ -586,9 +586,6 @@
-
-
-
diff --git a/pages/article/ArticleHandler.inc.php b/pages/article/ArticleHandler.inc.php
index 25f17de4e7d..56250bf137c 100644
--- a/pages/article/ArticleHandler.inc.php
+++ b/pages/article/ArticleHandler.inc.php
@@ -82,7 +82,7 @@ function initialize($request, $args) {
$galleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
if ($this->journal->getSetting('enablePublicGalleyId')) {
- $this->galley = $galleyDao->getGalleyByBestGalleyId($galleyId, $this->article->getId());
+ $this->galley = $galleyDao->getByBestGalleyId($galleyId, $this->article->getId());
}
if (!$this->galley) {
@@ -126,7 +126,7 @@ function view($args, $request) {
$galleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
if ($journal->getSetting('enablePublicGalleyId')) {
- $galley = $galleyDao->getGalleyByBestGalleyId($galleyId, $article->getId());
+ $galley = $galleyDao->getByBestGalleyId($galleyId, $article->getId());
}
if (!isset($galley)) {
diff --git a/pages/rt/RTHandler.inc.php b/pages/rt/RTHandler.inc.php
index 23fdff66168..79cdd27808c 100644
--- a/pages/rt/RTHandler.inc.php
+++ b/pages/rt/RTHandler.inc.php
@@ -228,7 +228,7 @@ function printerFriendly($args, $request) {
$articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
if ($journal->getSetting('enablePublicGalleyId')) {
- $galley = $articleGalleyDao->getGalleyByBestGalleyId($galleyId, $article->getId());
+ $galley = $articleGalleyDao->getByBestGalleyId($galleyId, $article->getId());
} else {
$galley = $articleGalleyDao->getById($galleyId, $article->getId());
}
diff --git a/plugins/importexport/datacite/classes/DOIExportPlugin.inc.php b/plugins/importexport/datacite/classes/DOIExportPlugin.inc.php
index 27ff3f110c7..7aaf8330612 100644
--- a/plugins/importexport/datacite/classes/DOIExportPlugin.inc.php
+++ b/plugins/importexport/datacite/classes/DOIExportPlugin.inc.php
@@ -1087,7 +1087,7 @@ function _displayGalleyList(&$templateMgr, &$journal) {
* @param $journal Journal
* @return array
*/
- function &_getUnregisteredIssues(&$journal) {
+ function _getUnregisteredIssues($journal) {
// Retrieve all issues that have not yet been registered.
$issueDao = DAORegistry::getDAO('IssueDAO'); /* @var $issueDao IssueDAO */
$issues = $issueDao->getBySetting($this->getPluginId(). '::' . DOI_EXPORT_REGDOI, null, $journal->getId());
@@ -1112,7 +1112,7 @@ function &_getUnregisteredIssues(&$journal) {
* @param $journal Journal
* @return array
*/
- function &_getUnregisteredArticles(&$journal) {
+ function _getUnregisteredArticles($journal) {
// Retrieve all published articles that have not yet been registered.
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); /* @var $publishedArticleDao PublishedArticleDAO */
$articles = $publishedArticleDao->getBySetting($this->getPluginId(). '::' . DOI_EXPORT_REGDOI, null, $journal->getId());
@@ -1134,7 +1134,7 @@ function &_getUnregisteredArticles(&$journal) {
* @param $journal Journal
* @return array
*/
- function &_getUnregisteredGalleys(&$journal) {
+ function _getUnregisteredGalleys($journal) {
// Retrieve all galleys that have not yet been registered.
$galleyDao = DAORegistry::getDAO('ArticleGalleyDAO'); /* @var $galleyDao ArticleGalleyDAO */
$galleyFactory = $galleyDao->getGalleysBySetting($this->getPluginId(). '::' . DOI_EXPORT_REGDOI, null, null, $journal->getId());
@@ -1142,9 +1142,9 @@ function &_getUnregisteredGalleys(&$journal) {
// Retrieve issues, articles and language for galleys.
$galleyData = array();
while ($galley = $galleyFactory->next()) {
- $preparedGalley =& $this->_prepareGalleyData($galley, $journal);
+ $preparedGalley = $this->_prepareGalleyData($galley, $journal);
if (is_array($preparedGalley)) {
- $galleyData[] =& $preparedGalley;
+ $galleyData[] = $preparedGalley;
}
unset($galley, $preparedGalley);
}