• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/controller/monitor.php
  • Класс: BitrixTimemanControllerMonitor
  • Вызов: Monitor::recordHistoryAction
public function recordHistoryAction($history)
{
	$enabled = Config::getEnabled();
	if ($enabled !== 'Y')
	{
		return [
			'enabled' => $enabled,
		];
	}

	$history = Encoding::convertEncoding($history, LANG_CHARSET, 'UTF-8');

	try
	{
		$history = Json::decode($history);
	}
	catch (ArgumentException $e)
	{
		$this->addError(new Error('Unable to decode history', 415));

		return null;
	}

	foreach ($history as $day)
	{
		History::deleteForCurrentUser($day['dateLog'], $day['desktopCode']);
	}

	$recorded = History::record($history);

	return [
		'enabled' => $enabled,
		'recorded' => $recorded,
	];
}