/** * @param StageRecord $stageRecord * @return array */ public function getPreselectedRecipients(StageRecord $stageRecord) { if ($stageRecord->areEditorsPreselected()) { return array_merge($stageRecord->getPreselectedRecipients(), $this->getRecordService()->getCreateUserIds()); } else { return $stageRecord->getPreselectedRecipients(); } }
/** * @param int $stageId * @return StageRecord * @throws \RuntimeException */ protected function createInternalStage($stageId) { $stageId = (int) $stageId; if (!isset($this->internalStages[$stageId])) { throw new \RuntimeException('Invalid internal stage "' . $stageId . '"', 1476048246); } $record = ['uid' => $stageId, 'title' => static::getLanguageService()->sL($this->internalStages[$stageId]['label'])]; $fieldNamePrefix = $this->internalStages[$stageId]['name'] . '_'; foreach ($this->internalStageFieldNames as $fieldName) { $record[$fieldName] = $this->record[$fieldNamePrefix . $fieldName]; } $stage = StageRecord::build($this, $stageId, $record); $stage->setInternal(true); return $stage; }
/** * @param StageRecord $stageRecord * @return int */ public function determineOrder(StageRecord $stageRecord) { if ($this->getUid() === $stageRecord->getUid()) { return 0; } elseif ($this->isEditStage() || $stageRecord->isExecuteStage() || $this->isPreviousTo($stageRecord)) { return -1; } elseif ($this->isExecuteStage() || $stageRecord->isEditStage() || $this->isNextTo($stageRecord)) { return 1; } return 0; }