• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/ivr/item.php
  • Класс: BitrixVoximplantIvrItem
  • Вызов: Item::setActions
public function setActions(array $newActions)
{
	$oldActions = array();
	foreach ($this->actions as $action)
	{
		if($action->getId() > 0)
		{
			$oldActions[$action->getId()] = $action;
		}
	}
	$this->actions = array();

	foreach ($newActions as $action)
	{
		if(is_array($action))
		{
			$action = Action::createFromArray($action);
		}

		if($action->getId() > 0 && !empty($oldActions))
		{
			if(isset($oldActions[$action->getId()]))
			{
				$tmpNewAction = $oldActions[$action->getId()];
				$tmpNewAction->setFromArray($action->toArray());
				$this->actions[] = $tmpNewAction;
				unset($oldActions[$action->getId()]);
			}
			else
			{
				$action->setId(0);
				$this->actions[] = $action;
			}
		}
		else
		{
			$this->actions[] = $action;
		}
	}

	foreach ($oldActions as $action)
	{
		$this->actionsToDelete[] = $action;
	}

	return $this;
}