16 import(
'lib.pkp.controllers.grid.settings.sections.form.PKPSectionForm');
29 'controllers/grid/settings/sections/form/sectionForm.tpl',
36 $journal = $request->getJournal();
45 $journal = $request->getJournal();
50 $section = $sectionDao->getById($sectionId, $journal->getId());
53 if (isset($section)) {
55 'title' => $section->getTitle(
null),
56 'abbrev' => $section->getAbbrev(
null),
57 'reviewFormId' => $section->getReviewFormId(),
58 'isInactive' => $section->getIsInactive(),
59 'metaIndexed' => !$section->getMetaIndexed(),
60 'metaReviewed' => !$section->getMetaReviewed(),
61 'abstractsNotRequired' => $section->getAbstractsNotRequired(),
62 'identifyType' => $section->getIdentifyType(
null),
63 'editorRestriction' => $section->getEditorRestricted(),
64 'hideTitle' => $section->getHideTitle(),
65 'hideAuthor' => $section->getHideAuthor(),
66 'policy' => $section->getPolicy(
null),
67 'wordCount' => $section->getAbstractWordCount(),
70 'roleIds' => ROLE_ID_SUB_EDITOR,
71 'assignedToSection' => (
int) $this->getSectionId(),
76 'assignedSubeditors' => [],
88 if ($this->
getData(
'isInactive')) {
90 $context = $request->getContext();
94 $sectionsIterator = $sectionDao->getByContextId($context->getId());
95 $activeSectionsCount = 0;
96 while ($section = $sectionsIterator->next()) {
97 if (!$section->getIsInactive() && ($sectionId != $section->getId())) {
98 $activeSectionsCount++;
101 if ($activeSectionsCount < 1 && $this->
getData(
'isInactive')) {
102 $this->
addError(
'isInactive', __(
'manager.sections.confirmDeactivateSection.error'));
106 return parent::validate($callHooks);
112 function fetch($request, $template =
null, $display =
false) {
114 $templateMgr->assign(
'sectionId', $this->
getSectionId());
116 $journal = $request->getJournal();
119 $reviewForms = $reviewFormDao->getActiveByAssocId(ASSOC_TYPE_JOURNAL, $journal->getId());
120 $reviewFormOptions = array();
121 while ($reviewForm = $reviewForms->next()) {
122 $reviewFormOptions[$reviewForm->getId()] = $reviewForm->getLocalizedTitle();
124 $templateMgr->assign(
'reviewFormOptions', $reviewFormOptions);
126 return parent::fetch($request, $template, $display);
133 parent::readInputData();
134 $this->
readUserVars(array(
'abbrev',
'policy',
'reviewFormId',
'identifyType',
'isInactive',
'metaIndexed',
'metaReviewed',
'abstractsNotRequired',
'editorRestriction',
'hideTitle',
'hideAuthor',
'wordCount'));
143 return $sectionDao->getLocaleFieldNames();
153 $journal = $request->getJournal();
157 $section = $sectionDao->getById($this->
getSectionId(), $journal->getId());
159 import(
'classes.journal.Section');
160 $section = $sectionDao->newDataObject();
161 $section->setJournalId($journal->getId());
165 $section->setTitle($this->
getData(
'title'),
null);
166 $section->setAbbrev($this->
getData(
'abbrev'),
null);
167 $reviewFormId = $this->
getData(
'reviewFormId');
168 if ($reviewFormId ===
'') $reviewFormId =
null;
169 $section->setReviewFormId($reviewFormId);
170 $section->setIsInactive($this->
getData(
'isInactive') ? 1 : 0);
171 $section->setMetaIndexed($this->
getData(
'metaIndexed') ? 0 : 1);
172 $section->setMetaReviewed($this->
getData(
'metaReviewed') ? 0 : 1);
173 $section->setAbstractsNotRequired($this->
getData(
'abstractsNotRequired') ? 1 : 0);
174 $section->setIdentifyType($this->
getData(
'identifyType'),
null);
175 $section->setEditorRestricted($this->
getData(
'editorRestriction') ? 1 : 0);
176 $section->setHideTitle($this->
getData(
'hideTitle') ? 1 : 0);
177 $section->setHideAuthor($this->
getData(
'hideAuthor') ? 1 : 0);
178 $section->setPolicy($this->
getData(
'policy'),
null);
179 $section->setAbstractWordCount($this->
getData(
'wordCount'));
183 $sectionDao->updateObject($section);
185 $section->setSequence(REALLY_BIG_NUMBER);
186 $this->
setSectionId($sectionDao->insertObject($section));
187 $sectionDao->resequenceSections($journal->getId());
190 return parent::execute(...$functionArgs);