function __construct($itemId, $itemType, $stageId, $template = null)
{
$template = $template != null ? $template : 'controllers/grid/users/stageParticipant/form/notify.tpl';
parent::__construct($template);
$this->_itemId = $itemId;
$this->_itemType = $itemType;
$this->_stageId = $stageId;
if ($itemType == ASSOC_TYPE_SUBMISSION) {
$this->_submissionId = $itemId;
} else {
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
/* @var $submissionFileDao SubmissionFileDAO */
$submissionFile = $submissionFileDao->getLatestRevision($itemId);
$this->_submissionId = $submissionFile->getSubmissionId();
}
// Some other forms (e.g. the Add Participant form) subclass this form and do not have the list builder
// or may not enforce the sending of an email. Only include checks if the list builder is included.
if ($this->includeNotifyUsersListbuilder()) {
$this->addCheck(new FormValidatorListbuilder($this, 'users', 'stageParticipants.notify.warning'));
$this->addCheck(new FormValidator($this, 'message', 'required', 'stageParticipants.notify.warning'));
}
$this->addCheck(new FormValidatorPost($this));
$this->addCheck(new FormValidatorCSRF($this));
}