-
Notifications
You must be signed in to change notification settings - Fork 138
/
SubmissionSubmitForm.inc.php
executable file
·99 lines (79 loc) · 2.62 KB
/
SubmissionSubmitForm.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* @defgroup author_form_submit
*/
/**
* @file classes/author/form/submit/SubmissionSubmitForm.inc.php
*
* Copyright (c) 2003-2010 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class SubmissionSubmitForm
* @ingroup author_form_submit
*
* @brief Base class for author submit forms.
*/
import('lib.pkp.classes.form.Form');
class SubmissionSubmitForm extends Form {
/** @var int the ID of the monograph */
var $monographId;
/** @var Monograph current monograph */
var $monograph;
/** @var int the current step */
var $step;
/**
* Constructor.
* @param $monograph object
* @param $step int
*/
function SubmissionSubmitForm($monograph, $step) {
parent::Form(sprintf('submission/form/submit/step%d.tpl', $step));
$this->addCheck(new FormValidatorPost($this));
$this->step = (int) $step;
$this->monograph = $monograph;
$this->monographId = $monograph ? $monograph->getId() : null;
}
/**
* Display the form.
*/
function display() {
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('validateId', 'submit');
$templateMgr->assign('monographId', $this->monographId);
$templateMgr->assign('submitStep', $this->step);
if (isset($this->monograph)) {
$templateMgr->assign('submissionProgress', $this->monograph->getSubmissionProgress());
}
switch($this->step) {
case 3:
$helpTopicId = 'submission.indexingAndMetadata';
break;
default:
$helpTopicId = 'submission.index';
}
$templateMgr->assign('helpTopicId', $helpTopicId);
$press =& Request::getPress();
$settingsDao =& DAORegistry::getDAO('PressSettingsDAO');
$templateMgr->assign_by_ref('pressSettings', $settingsDao->getPressSettings($press->getId()));
parent::display();
}
/**
* Automatically assign Series Editors to new submissions.
* @param $monograph object
* @return array of series editors
*/
function assignEditors(&$monograph) {
$seriesId = $monograph->getSeriesId();
$press =& Request::getPress();
$seriesEditorsDao =& DAORegistry::getDAO('SeriesEditorsDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
$seriesEditors =& $seriesEditorsDao->getEditorsBySeriesId($press->getId(), $seriesId);
$seriesEditorUserGroup = $userGroupDao->getDefaultByRoleId($press->getId(), ROLE_ID_SERIES_EDITOR);
foreach ($seriesEditors as $seriesEditorEntry) {
$signoffDao->build('SIGNOFF_STAGE', ASSOC_TYPE_MONOGRAPH, $monograph->getId(), WORKFLOW_STAGE_ID_SUBMISSION, $seriesEditorEntry['user']->getId(), $seriesEditorUserGroup->getId());
}
return $seriesEditors;
}
}
?>