From 26695e20f403997d7949b33bb78b41289b4d976c Mon Sep 17 00:00:00 2001 From: asmecher Date: Wed, 27 Jan 2010 01:11:42 +0000 Subject: [PATCH] #4427# Fixed section setters/getters --- classes/journal/Section.inc.php | 8 +++--- classes/journal/SectionDAO.inc.php | 26 +++++++++---------- classes/manager/form/SectionForm.inc.php | 4 +-- classes/oai/ojs/OAIDAO.inc.php | 2 +- pages/about/AboutHandler.inc.php | 2 +- pages/editor/IssueManagementHandler.inc.php | 2 +- .../metsGateway/MetsExportDom.inc.php | 8 +++--- .../crossref/CrossRefExportPlugin.inc.php | 2 +- .../importexport/mets/MetsExportDom.inc.php | 8 +++--- .../native/NativeExportDom.inc.php | 2 +- .../native/NativeImportDom.inc.php | 8 +++--- .../pubmed/PubMedExportPlugin.inc.php | 2 +- .../nlm/OAIMetadataFormat_NLM.inc.php | 2 +- templates/about/editorialPolicies.tpl | 2 +- templates/manager/sections/sections.tpl | 4 +-- templates/manager/statistics/statistics.tpl | 2 +- 16 files changed, 43 insertions(+), 41 deletions(-) diff --git a/classes/journal/Section.inc.php b/classes/journal/Section.inc.php index 25951b4582e..19c1793cd59 100644 --- a/classes/journal/Section.inc.php +++ b/classes/journal/Section.inc.php @@ -60,7 +60,8 @@ function getTrackAbbrev() { * @return int */ function getSectionId() { - return $this->getData('sectionId'); + if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.'); + return $this->getId(); } /** @@ -68,7 +69,8 @@ function getSectionId() { * @param $sectionId int */ function setSectionId($sectionId) { - return $this->setData('sectionId', $sectionId); + if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.'); + return $this->setId($sectionId); } /** @@ -138,7 +140,7 @@ function getAbbrev($locale) { function setAbbrev($abbrev, $locale) { return $this->setData('abbrev', $abbrev, $locale); } - + /** * Get abstract word count limit. * @return int diff --git a/classes/journal/SectionDAO.inc.php b/classes/journal/SectionDAO.inc.php index 7cad931ff90..18dcaea5cd8 100644 --- a/classes/journal/SectionDAO.inc.php +++ b/classes/journal/SectionDAO.inc.php @@ -133,7 +133,7 @@ function &getSectionByTitleAndAbbrev($sectionTitle, $sectionAbbrev, $journalId, */ function &_returnSectionFromRow(&$row) { $section = new Section(); - $section->setSectionId($row['section_id']); + $section->setId($row['section_id']); $section->setJournalId($row['journal_id']); $section->setReviewFormId($row['review_form_id']); $section->setSequence($row['seq']); @@ -168,7 +168,7 @@ function getLocaleFieldNames() { */ function updateLocaleFields(&$section) { $this->updateDataObjectSettings('section_settings', $section, array( - 'section_id' => $section->getSectionId() + 'section_id' => $section->getId() )); } @@ -198,9 +198,9 @@ function insertSection(&$section) { ) ); - $section->setSectionId($this->getInsertSectionId()); + $section->setId($this->getInsertSectionId()); $this->updateLocaleFields($section); - return $section->getSectionId(); + return $section->getId(); } /** @@ -235,7 +235,7 @@ function updateSection(&$section) { $section->getHideAbout(), $section->getDisableComments(), $section->getAbstractWordCount(), - $section->getSectionId() + $section->getId() ) ); $this->updateLocaleFields($section); @@ -247,7 +247,7 @@ function updateSection(&$section) { * @param $section Section */ function deleteSection(&$section) { - return $this->deleteSectionById($section->getSectionId(), $section->getJournalId()); + return $this->deleteSectionById($section->getId(), $section->getJournalId()); } /** @@ -367,10 +367,10 @@ function &getSectionTitles($journalId, $submittableOnly = false) { while (($section =& $sectionsIterator->next())) { if ($submittableOnly) { if (!$section->getEditorRestricted()) { - $sections[$section->getSectionId()] = $section->getLocalizedTitle(); + $sections[$section->getId()] = $section->getLocalizedTitle(); } } else { - $sections[$section->getSectionId()] = $section->getLocalizedTitle(); + $sections[$section->getId()] = $section->getLocalizedTitle(); } unset($section); } @@ -441,20 +441,20 @@ function deleteCustomSectionOrdering($issueId) { 'DELETE FROM custom_section_orders WHERE issue_id = ?', $issueId ); } - + /** * Delete a section from the custom section order table. * @param $issueId int - * @param $sectionId int + * @param $sectionId int */ function deleteCustomSection($issueId, $sectionId) { $sequence = $this->getCustomSectionOrder($issueId, $sectionId); - + $this->update( 'DELETE FROM custom_section_orders WHERE issue_id = ? AND section_id = ?', array($issueId, $sectionId) ); - - // Reduce the section order of every successive section by one + + // Reduce the section order of every successive section by one $this->update( 'UPDATE custom_section_orders SET seq = seq - 1 WHERE issue_id = ? AND seq > ?', array($issueId, $sequence) ); diff --git a/classes/manager/form/SectionForm.inc.php b/classes/manager/form/SectionForm.inc.php index 681fa17d076..3ad3634359d 100644 --- a/classes/manager/form/SectionForm.inc.php +++ b/classes/manager/form/SectionForm.inc.php @@ -226,9 +226,9 @@ function execute() { $section->setPolicy($this->getData('policy'), null); // Localized $section->setAbstractWordCount($this->getData('wordCount')); - if ($section->getSectionId() != null) { + if ($section->getId() != null) { $sectionDao->updateSection($section); - $sectionId = $section->getSectionId(); + $sectionId = $section->getId(); } else { $sectionId = $sectionDao->insertSection($section); diff --git a/classes/oai/ojs/OAIDAO.inc.php b/classes/oai/ojs/OAIDAO.inc.php index 087997cdcd7..d87ddc00142 100644 --- a/classes/oai/ojs/OAIDAO.inc.php +++ b/classes/oai/ojs/OAIDAO.inc.php @@ -486,7 +486,7 @@ function getSetJournalSectionId($journalSpec, $sectionSpec, $restrictJournalId = if (isset($sectionSpec)) { $section =& $this->sectionDao->getSectionByAbbrev($sectionSpec, $journal->getId()); if (isset($section)) { - $sectionId = $section->getSectionId(); + $sectionId = $section->getId(); } else { $sectionId = 0; } diff --git a/pages/about/AboutHandler.inc.php b/pages/about/AboutHandler.inc.php index e6d74ecb02d..262ddad7788 100644 --- a/pages/about/AboutHandler.inc.php +++ b/pages/about/AboutHandler.inc.php @@ -336,7 +336,7 @@ function editorialPolicies() { $sectionEditorEntriesBySection = array(); foreach ($sections as $section) { - $sectionEditorEntriesBySection[$section->getSectionId()] =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $section->getSectionId()); + $sectionEditorEntriesBySection[$section->getId()] =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $section->getId()); } $templateMgr->assign_by_ref('sectionEditorEntriesBySection', $sectionEditorEntriesBySection); diff --git a/pages/editor/IssueManagementHandler.inc.php b/pages/editor/IssueManagementHandler.inc.php index e1d583f0735..ea83ca829c5 100644 --- a/pages/editor/IssueManagementHandler.inc.php +++ b/pages/editor/IssueManagementHandler.inc.php @@ -512,7 +512,7 @@ function moveSectionToc($args) { $sectionDao->setDefaultCustomSectionOrders($issueId); } - $sectionDao->moveCustomSectionOrder($issueId, $section->getSectionId(), Request::getUserVar('newPos'), Request::getUserVar('d') == 'u'); + $sectionDao->moveCustomSectionOrder($issueId, $section->getId(), Request::getUserVar('newPos'), Request::getUserVar('d') == 'u'); } Request::redirect(null, null, 'issueToc', $issueId); diff --git a/plugins/gateways/metsGateway/MetsExportDom.inc.php b/plugins/gateways/metsGateway/MetsExportDom.inc.php index 04784797e90..f2f1eea1cb9 100644 --- a/plugins/gateways/metsGateway/MetsExportDom.inc.php +++ b/plugins/gateways/metsGateway/MetsExportDom.inc.php @@ -56,9 +56,9 @@ function generateIssueDiv(&$doc, &$root, &$issue) { function generateSectionDiv(&$doc, &$root, &$section, &$issue) { $pDiv =& XMLCustomWriter::createElement($doc, 'METS:div'); XMLCustomWriter::setAttribute($pDiv, 'TYPE', 'section'); - XMLCustomWriter::setAttribute($pDiv, 'DMDID', 'S-'.$section->getSectionId()); + XMLCustomWriter::setAttribute($pDiv, 'DMDID', 'S-'.$section->getId()); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); - $publishedArticleArray =& $publishedArticleDao->getPublishedArticlesBySectionId($section->getSectionId(),$issue->getIssueId()); + $publishedArticleArray =& $publishedArticleDao->getPublishedArticlesBySectionId($section->getId(),$issue->getIssueId()); $i = 0; while ($i < sizeof($publishedArticleArray)) { MetsExportDom::generateArticleDiv($doc, $pDiv, $publishedArticleArray[$i], $issue); @@ -216,7 +216,7 @@ function generateIssueDmdSecDom(&$doc, &$root, &$issue, &$journal) { */ function generateSectionDmdSecDom(&$doc, &$root, &$section, &$issue) { $dmdSec =& XMLCustomWriter::createElement($doc, 'METS:dmdSec'); - XMLCustomWriter::setAttribute($dmdSec, 'ID', 'S-'.$section->getSectionId()); + XMLCustomWriter::setAttribute($dmdSec, 'ID', 'S-'.$section->getId()); $mdWrap =& XMLCustomWriter::createElement($doc, 'METS:mdWrap'); $xmlData =& XMLCustomWriter::createElement($doc, 'METS:xmlData'); XMLCustomWriter::setAttribute($mdWrap, 'MDTYPE', 'MODS'); @@ -238,7 +238,7 @@ function generateSectionDmdSecDom(&$doc, &$root, &$section, &$issue) { XMLCustomWriter::appendChild($mdWrap,$xmlData); XMLCustomWriter::appendChild($root, $dmdSec); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); - $publishedArticleArray =& $publishedArticleDao->getPublishedArticlesBySectionId($section->getSectionId(),$issue->getIssueId()); + $publishedArticleArray =& $publishedArticleDao->getPublishedArticlesBySectionId($section->getId(),$issue->getIssueId()); $i = 0; $i = 0; while ($i < sizeof($publishedArticleArray)) { diff --git a/plugins/importexport/crossref/CrossRefExportPlugin.inc.php b/plugins/importexport/crossref/CrossRefExportPlugin.inc.php index d3c4ceae99a..ce5f3d4ac75 100644 --- a/plugins/importexport/crossref/CrossRefExportPlugin.inc.php +++ b/plugins/importexport/crossref/CrossRefExportPlugin.inc.php @@ -196,7 +196,7 @@ function exportIssues(&$journal, &$issues, $outputFile = null) { foreach ($issues as $issue) { foreach ($sectionDao->getSectionsForIssue($issue->getIssueId()) as $section) { - foreach ($publishedArticleDao->getPublishedArticlesBySectionId($section->getSectionId(), $issue->getIssueId()) as $article) { + foreach ($publishedArticleDao->getPublishedArticlesBySectionId($section->getId(), $issue->getIssueId()) as $article) { // Create the metadata node // this does not need to be repeated for every article // but its allowed to be and its simpler to do so diff --git a/plugins/importexport/mets/MetsExportDom.inc.php b/plugins/importexport/mets/MetsExportDom.inc.php index 9bbc27fdeae..1021eb27490 100644 --- a/plugins/importexport/mets/MetsExportDom.inc.php +++ b/plugins/importexport/mets/MetsExportDom.inc.php @@ -52,9 +52,9 @@ function generateIssueDiv(&$doc, &$root, &$issue) { function generateSectionDiv(&$doc, &$root, &$section, &$issue) { $pDiv =& XMLCustomWriter::createElement($doc, 'METS:div'); XMLCustomWriter::setAttribute($pDiv, 'TYPE', 'section'); - XMLCustomWriter::setAttribute($pDiv, 'DMDID', 'S-'.$section->getSectionId()); + XMLCustomWriter::setAttribute($pDiv, 'DMDID', 'S-'.$section->getId()); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); - $publishedArticleArray =& $publishedArticleDao->getPublishedArticlesBySectionId($section->getSectionId(),$issue->getIssueId()); + $publishedArticleArray =& $publishedArticleDao->getPublishedArticlesBySectionId($section->getId(),$issue->getIssueId()); $i = 0; while ($i < sizeof($publishedArticleArray)) { MetsExportDom::generateArticleDiv($doc, $pDiv, $publishedArticleArray[$i], $issue); @@ -212,7 +212,7 @@ function generateIssueDmdSecDom(&$doc, &$root, &$issue, &$journal) { */ function generateSectionDmdSecDom(&$doc, &$root, &$section, &$issue, &$journal) { $dmdSec =& XMLCustomWriter::createElement($doc, 'METS:dmdSec'); - XMLCustomWriter::setAttribute($dmdSec, 'ID', 'S-'.$section->getSectionId()); + XMLCustomWriter::setAttribute($dmdSec, 'ID', 'S-'.$section->getId()); $mdWrap =& XMLCustomWriter::createElement($doc, 'METS:mdWrap'); $xmlData =& XMLCustomWriter::createElement($doc, 'METS:xmlData'); XMLCustomWriter::setAttribute($mdWrap, 'MDTYPE', 'MODS'); @@ -234,7 +234,7 @@ function generateSectionDmdSecDom(&$doc, &$root, &$section, &$issue, &$journal) XMLCustomWriter::appendChild($mdWrap,$xmlData); XMLCustomWriter::appendChild($root, $dmdSec); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); - $publishedArticleArray =& $publishedArticleDao->getPublishedArticlesBySectionId($section->getSectionId(),$issue->getIssueId()); + $publishedArticleArray =& $publishedArticleDao->getPublishedArticlesBySectionId($section->getId(),$issue->getIssueId()); $i = 0; $i = 0; while ($i < sizeof($publishedArticleArray)) { diff --git a/plugins/importexport/native/NativeExportDom.inc.php b/plugins/importexport/native/NativeExportDom.inc.php index d6dd4efbf93..90605eb31e0 100644 --- a/plugins/importexport/native/NativeExportDom.inc.php +++ b/plugins/importexport/native/NativeExportDom.inc.php @@ -120,7 +120,7 @@ function &generateSectionDom(&$doc, &$journal, &$issue, &$section) { } $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); - foreach ($publishedArticleDao->getPublishedArticlesBySectionId($section->getSectionId(), $issue->getIssueId()) as $article) { + foreach ($publishedArticleDao->getPublishedArticlesBySectionId($section->getId(), $issue->getIssueId()) as $article) { $articleNode =& NativeExportDom::generateArticleDom($doc, $journal, $issue, $section, $article); XMLCustomWriter::appendChild($root, $articleNode); unset($articleNode); diff --git a/plugins/importexport/native/NativeImportDom.inc.php b/plugins/importexport/native/NativeImportDom.inc.php index 7ad7076d38c..4500d12e046 100644 --- a/plugins/importexport/native/NativeImportDom.inc.php +++ b/plugins/importexport/native/NativeImportDom.inc.php @@ -526,7 +526,7 @@ function handleSectionNode(&$journal, &$sectionNode, &$issue, &$errors, &$user, foreach($titles as $locale => $title) { $section = $sectionDao->getSectionByTitle($title, $journal->getId()); if ($section) { - $sectionId = $section->getSectionId(); + $sectionId = $section->getId(); if ($foundSectionId) { if ($foundSectionId != $sectionId) { // Mismatching sections found. Throw an error. @@ -611,7 +611,7 @@ function handleSectionNode(&$journal, &$sectionNode, &$issue, &$errors, &$user, // Handle custom ordering, if necessary. if ($sectionIndex !== null) { - $sectionDao->insertCustomSectionOrder($issue->getIssueId(), $section->getSectionId(), $sectionIndex); + $sectionDao->insertCustomSectionOrder($issue->getIssueId(), $section->getId(), $sectionIndex); } $hasErrors = false; @@ -638,7 +638,7 @@ function handleArticleNode(&$journal, &$articleNode, &$issue, &$section, &$artic $article = new Article(); $article->setJournalId($journal->getId()); $article->setUserId($user->getId()); - $article->setSectionId($section->getSectionId()); + $article->setSectionId($section->getId()); $article->setStatus(STATUS_PUBLISHED); $article->setSubmissionProgress(0); $article->setDateSubmitted(Core::getCurrentDate()); @@ -848,7 +848,7 @@ function handleArticleNode(&$journal, &$articleNode, &$issue, &$section, &$artic $publishedArticle->setPubId($publishedArticleDao->insertPublishedArticle($publishedArticle)); - $publishedArticleDao->resequencePublishedArticles($section->getSectionId(), $issue->getIssueId()); + $publishedArticleDao->resequencePublishedArticles($section->getId(), $issue->getIssueId()); /* --- Galleys (html or otherwise handled simultaneously) --- */ import('file.ArticleFileManager'); diff --git a/plugins/importexport/pubmed/PubMedExportPlugin.inc.php b/plugins/importexport/pubmed/PubMedExportPlugin.inc.php index 13110c90e3a..c2699902f7f 100644 --- a/plugins/importexport/pubmed/PubMedExportPlugin.inc.php +++ b/plugins/importexport/pubmed/PubMedExportPlugin.inc.php @@ -152,7 +152,7 @@ function exportIssues(&$journal, &$issues, $outputFile = null) { foreach ($issues as $issue) { foreach ($sectionDao->getSectionsForIssue($issue->getIssueId()) as $section) { - foreach ($publishedArticleDao->getPublishedArticlesBySectionId($section->getSectionId(), $issue->getIssueId()) as $article) { + foreach ($publishedArticleDao->getPublishedArticlesBySectionId($section->getId(), $issue->getIssueId()) as $article) { $articleNode =& PubMedExportDom::generateArticleDom($doc, $journal, $issue, $section, $article); XMLCustomWriter::appendChild($articleSetNode, $articleNode); } diff --git a/plugins/oaiMetadataFormats/nlm/OAIMetadataFormat_NLM.inc.php b/plugins/oaiMetadataFormats/nlm/OAIMetadataFormat_NLM.inc.php index ff56a88a048..43eb0b1e1bb 100644 --- a/plugins/oaiMetadataFormats/nlm/OAIMetadataFormat_NLM.inc.php +++ b/plugins/oaiMetadataFormats/nlm/OAIMetadataFormat_NLM.inc.php @@ -127,7 +127,7 @@ function toXml(&$record, $format = null) { "\t\t\t\n" . ($issue->getShowYear()?"\t\t\t" . htmlspecialchars(Core::cleanVar($issue->getYear())) . "\n":'') . ($issue->getShowVolume()?"\t\t\t" . htmlspecialchars(Core::cleanVar($issue->getVolume())) . "\n":'') . - ($issue->getShowNumber()?"\t\t\tgetSectionId()]*100) + $article->getSeq())) . "\">" . htmlspecialchars(Core::cleanVar($issue->getNumber())) . "\n":'') . + ($issue->getShowNumber()?"\t\t\tgetId()]*100) + $article->getSeq())) . "\">" . htmlspecialchars(Core::cleanVar($issue->getNumber())) . "\n":'') . "\t\t\t" . htmlspecialchars(Core::cleanVar($issue->getBestIssueId())) . "\n" . ($issue->getShowTitle()?"\t\t\t" . htmlspecialchars(Core::cleanVar($issue->getIssueTitle())) . "\n":''); diff --git a/templates/about/editorialPolicies.tpl b/templates/about/editorialPolicies.tpl index 2d1e0f1c477..15c3700dc34 100644 --- a/templates/about/editorialPolicies.tpl +++ b/templates/about/editorialPolicies.tpl @@ -46,7 +46,7 @@ {assign var="hasEditors" value=0} {foreach from=$sectionEditorEntriesBySection item=sectionEditorEntries key=key} - {if $key == $section->getSectionId()} + {if $key == $section->getId()} {foreach from=$sectionEditorEntries item=sectionEditorEntry} {assign var=sectionEditor value=$sectionEditorEntry.user} {if 0 == $hasEditors++} diff --git a/templates/manager/sections/sections.tpl b/templates/manager/sections/sections.tpl index 3f7037799cf..195344a9237 100644 --- a/templates/manager/sections/sections.tpl +++ b/templates/manager/sections/sections.tpl @@ -35,11 +35,11 @@ $(document).ready(function() { setupTableDND("#dragTable", "moveSection"); });   {iterate from=sections item=section name=sections} - + {$section->getLocalizedTitle()|escape} {$section->getLocalizedAbbrev()|escape} - getSectionId()}" class="action">{translate key="common.edit"} | getSectionId()}" onclick="return confirm('{translate|escape:"jsparam" key="manager.sections.confirmDelete"}')" class="action">{translate key="common.delete"} | getSectionId()}">↑ getSectionId()}">↓ + getId()}" class="action">{translate key="common.edit"} | getId()}" onclick="return confirm('{translate|escape:"jsparam" key="manager.sections.confirmDelete"}')" class="action">{translate key="common.delete"} | getId()}">↑ getId()}">↓ {/iterate} diff --git a/templates/manager/statistics/statistics.tpl b/templates/manager/statistics/statistics.tpl index 85b2f322a98..4f9bd682725 100644 --- a/templates/manager/statistics/statistics.tpl +++ b/templates/manager/statistics/statistics.tpl @@ -18,7 +18,7 @@