• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/livefeed/timemanentry.php
  • Класс: BitrixSocialnetworkLivefeedTimemanEntry
  • Вызов: TimemanEntry::initSourceFields
public function initSourceFields()
{
	static $cache = [];

	$timemanEntryId = $this->entityId;

	if ($timemanEntryId <= 0)
	{
		return;
	}

	if (isset($cache[$timemanEntryId]))
	{
		$timemanEntry = $cache[$timemanEntryId];
	}
	elseif (Loader::includeModule('timeman'))
	{
		$res = WorktimeRecordTable::getList([
			'filter' => [
				'ID' => $timemanEntryId
			],
			'select' => [ 'ID', 'USER_ID', 'DATE_START', 'APPROVED_BY' ]
		]);
		$timemanEntry = $res->fetch();
		$cache[$timemanEntryId] = $timemanEntry;
	}

	if (!empty($timemanEntry))
	{
		$this->setSourceFields($timemanEntry);

		$userName = '';
		$res = CUser::getById($timemanEntry['USER_ID']);
		if ($userFields = $res->fetch())
		{
			$userName = CUser::formatName(
				CSite::getNameFormat(),
				$userFields,
				true,
				false
			);
		}

		$this->setSourceTitle(Loc::getMessage('SONET_LIVEFEED_TIMEMAN_ENTRY_TITLE', [
			'#USER_NAME#' => $userName,
			'#DATE#' => FormatDate('j F', makeTimeStamp($timemanEntry['DATE_START']))
		]));
	}
	else
	{
		$this->setSourceTitle($this->getUnavailableTitle());
	}
}