• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/service/worktime/action/worktimeactionlist.php
  • Класс: BitrixTimemanServiceWorktimeActionWorktimeActionList
  • Вызов: WorktimeActionList::buildActions
private function buildActions(WorktimeRecord $record = null)
{
	/** @var WorktimeAction[] $actions */
	$actions = [];
	if ($this->isEligibleToStart($record))
	{
		$action = WorktimeAction::createStartAction($this->userId);
		$shiftWithDate = $this->getRelevantShiftWithDate($this->userDateTime, $record);
		if ($shiftWithDate)
		{
			$action->setShift($shiftWithDate->getShift());
			$action->setSchedule($shiftWithDate->getSchedule());
		}
		else
		{
			$action->setSchedule($this->shiftsManager->getScheduleToStart($this->userDateTime));
		}
		$actions[] = $action;
	}
	if ($record)
	{
		if ($this->recordManager->isEligibleToStop())
		{
			$actions[] = WorktimeAction::createStopAction($this->userId);
		}

		if ($this->recordManager->isEligibleToPause())
		{
			$actions[] = WorktimeAction::createPauseAction($this->userId);
		}

		if ($this->recordManager->isEligibleToReopen())
		{
			$actions[] = WorktimeAction::createReopenAction($this->userId);
		}
		if ($this->recordManager->isEligibleToContinue())
		{
			$actions[] = WorktimeAction::createContinueAction($this->userId);
		}

		if ($this->recordManager->isEligibleToEdit())
		{
			$actions[] = WorktimeAction::createEditAction($this->userId);
		}
	}

	return $this->fillActions($actions);
}