• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/ustat/taskseventhandler.php
  • Класс: BitrixIntranetUStatTasksEventHandler
  • Вызов: TasksEventHandler::onTaskUpdateEvent
static function onTaskUpdateEvent($id, $arFields)
{
	$arTask = $arFields['META:PREV_FIELDS'];

	foreach ($arFields as $fieldName => $fieldValue)
	{
		// skip unexpected fields
		if (!isset($arTask[$fieldName]))
		{
			continue;
		}

		// skip not changed fields
		if ($fieldValue == $arTask[$fieldName])
		{
			continue;
		}

		switch($fieldName)
		{
			case 'STATUS':
				if ((int)$fieldValue === CTasks::STATE_IN_PROGRESS)
				{
					UStat::incrementCounter(static::SECTION);
				}
				elseif ((int)$fieldValue === CTasks::STATE_COMPLETED)
				{
					UStat::incrementCounter(static::SECTION);
				}
				break;

			case 'PRIORITY':
				UStat::incrementCounter(static::SECTION);
				break;

			case 'RESPONSIBLE_ID':
				UStat::incrementCounter(static::SECTION);
				break;

			case 'DEADLINE':
				UStat::incrementCounter(static::SECTION);
				break;

			case 'MARK':
				UStat::incrementCounter(static::SECTION);
				break;
		}
	}
}