Vote::getEventBallots

  1. Bitrix24 API (v. 23.675.0)
  2. vote
  3. Vote
  4. getEventBallots
  • Модуль: vote
  • Путь к файлу: ~/bitrix/modules/vote/lib/copy/implement/vote.php
  • Класс: BitrixVoteCopyImplementVote
  • Вызов: Vote::getEventBallots
private function getEventBallots($voteId, $copiedIdsRelation)
{
	$ballots = [];

	$questionIds = [];
	$answerIds = [];
	foreach ($copiedIdsRelation as $key => $value)
	{
		if (is_int($key))
		{
			$questionIds[$key] = $value;
		}
		else
		{
			$answerIds = $answerIds + $value;
		}
	}

	$voteBase = new VoteBase($voteId);
	foreach ($voteBase->getStatistic() as $data)
	{
		$ballot = [];
		foreach ($data["BALLOT"] as $questionId => $answer)
		{
			foreach ($answer as $answerId => $answerMessage)
			{
				$ballot[$questionIds[$questionId]] = [
					$answerIds[$answerId] => $answerMessage
				];
			}
		}
		$ballots[$data["ID"]] = ["BALLOT" => $ballot];
	}

	return $ballots;
}

Добавить комментарий