• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/integration/timeman/worktime.php
  • Класс: BitrixIntranetIntegrationTimemanWorktime
  • Вызов: Worktime::addTMDayInfoToOption
static function addTMDayInfoToOption($fields)
{
	$data = Option::get("intranet", "ustat_online_timeman", "");
	if (!empty($data))
	{
		$data = unserialize($data, ["allowed_classes" => false]);
	}

	$optionDate = isset($data["date"]) && is_numeric($data["date"]) ? $data["date"] : 0;
	$currentDate = new Date;
	$currentDate = $currentDate->getTimestamp();

	if (!$optionDate || $currentDate > $optionDate)
	{
		$newValue = [
			"date" => $currentDate
		];
		$newValue["tm_days"][$fields["userId"]] = $fields["workDayStatus"];
	}
	else
	{
		$newValue = $data;
		$newValue["tm_days"][$fields["userId"]] = $fields["workDayStatus"];
	}

	Option::set("intranet", "ustat_online_timeman", serialize($newValue));

	$currentTMDayData = self::getTMDayData();
	self::sendPush($currentTMDayData);
}