function execute($args, $request)
{
$sectionDao = DAORegistry::getDAO('SectionDAO');
$journal = $request->getJournal();
// Get or create the section object
if ($this->getSectionId()) {
$section = $sectionDao->getById($this->getSectionId(), $journal->getId());
} else {
import('classes.journal.Section');
$section = $sectionDao->newDataObject();
$section->setJournalId($journal->getId());
}
// Populate/update the section object from the form
$section->setTitle($this->getData('title'), null);
// Localized
$section->setAbbrev($this->getData('abbrev'), null);
// Localized
$reviewFormId = $this->getData('reviewFormId');
if ($reviewFormId === '') {
$reviewFormId = null;
}
$section->setReviewFormId($reviewFormId);
$section->setMetaIndexed($this->getData('metaIndexed') ? 0 : 1);
// #2066: Inverted
$section->setMetaReviewed($this->getData('metaReviewed') ? 0 : 1);
// #2066: Inverted
$section->setAbstractsNotRequired($this->getData('abstractsNotRequired') ? 1 : 0);
$section->setIdentifyType($this->getData('identifyType'), null);
// Localized
$section->setEditorRestricted($this->getData('editorRestriction') ? 1 : 0);
$section->setHideTitle($this->getData('hideTitle') ? 1 : 0);
$section->setHideAuthor($this->getData('hideAuthor') ? 1 : 0);
$section->setHideAbout($this->getData('hideAbout') ? 1 : 0);
$section->setPolicy($this->getData('policy'), null);
// Localized
$section->setAbstractWordCount($this->getData('wordCount'));
$section = parent::execute($section);
// Insert or update the section in the DB
if ($this->getSectionId()) {
$sectionDao->updateObject($section);
} else {
$section->setSequence(REALLY_BIG_NUMBER);
$this->setSectionId($sectionDao->insertObject($section));
$sectionDao->resequenceSections($journal->getId());
}
import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
// Save the section editor associations.
ListbuilderHandler::unpack($request, $this->getData('subEditors'), array($this, 'deleteSubEditorEntry'), array($this, 'insertSubEditorEntry'), array($this, 'updateSubEditorEntry'));
return true;
}