16 import(
'lib.pkp.controllers.grid.settings.sections.form.PKPSectionForm');
29 'controllers/grid/settings/sections/form/sectionForm.tpl',
36 $this->
addCheck(
new FormValidator($this,
'path',
'required',
'manager.setup.form.section.pathRequired'));
37 $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 return parent::fetch($request, $template, $display);
123 parent::readInputData();
124 $this->
readUserVars(array(
'abbrev',
'path',
'description',
'policy',
'identifyType',
'isInactive',
'metaIndexed',
'abstractsNotRequired',
'editorRestriction',
'wordCount'));
133 return $sectionDao->getLocaleFieldNames();
143 $journal = $request->getJournal();
147 $section = $sectionDao->getById($this->
getSectionId(), $journal->getId());
149 import(
'classes.journal.Section');
150 $section = $sectionDao->newDataObject();
151 $section->setJournalId($journal->getId());
155 $section->setTitle($this->
getData(
'title'),
null);
156 $section->setAbbrev($this->
getData(
'abbrev'),
null);
157 $section->setPath($this->
getData(
'path'));
158 $section->setDescription($this->
getData(
'description'),
null);
159 $section->setIsInactive($this->
getData(
'isInactive') ? 1 : 0);
160 $section->setMetaIndexed($this->
getData(
'metaIndexed') ? 0 : 1);
161 $section->setAbstractsNotRequired($this->
getData(
'abstractsNotRequired') ? 1 : 0);
162 $section->setIdentifyType($this->
getData(
'identifyType'),
null);
163 $section->setEditorRestricted($this->
getData(
'editorRestriction') ? 1 : 0);
164 $section->setPolicy($this->
getData(
'policy'),
null);
165 $section->setAbstractWordCount($this->
getData(
'wordCount'));
169 $sectionDao->updateObject($section);
171 $section->setSequence(REALLY_BIG_NUMBER);
172 $this->
setSectionId($sectionDao->insertObject($section));
173 $sectionDao->resequenceSections($journal->getId());
176 return parent::execute(...$functionArgs);