• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/taskwebservice.php
  • Класс: CTasksWebService
  • Вызов: CTasksWebService::__getRow
function __getRow($arRes, $listName, &$last_change)
{
	static $tzOffset = null;

	if ($tzOffset === null)
		$tzOffset = CTasksTools::getTimeZoneOffset();

	// Make correct unix timestamp
	$change = MakeTimeStamp($arRes['CHANGED_DATE']) - $tzOffset;

	if ($last_change < $change)
		$last_change = $change;

	$obRow = new CXMLCreator('z:row');
	$obRow->setAttribute('ows_ID', $arRes['ID']);

	$version = $arRes['OUTLOOK_VERSION'] ? $arRes['OUTLOOK_VERSION'] : 1;

	if (is_array($arRes['FILES']) && count($arRes['FILES']) > 0)
		$obRow->setAttribute('ows_Attachments', 1);
	else
		$obRow->setAttribute('ows_Attachments', 0);

	$obRow->setAttribute('ows_owshiddenversion', $version);
	$obRow->setAttribute('ows_MetaInfo_vti_versionhistory', md5($arRes['ID']).':'.$version);

	$obRow->setAttribute('ows_Created', $this->__makeDateTime(MakeTimeStamp($arRes['CREATED_DATE']) - $tzOffset));
	$obRow->setAttribute('ows_Modified', $this->__makeDateTime($change));

	$obRow->setAttribute('ows_Title', $arRes['TITLE']);

	if ($arRes['DESCRIPTION_IN_BBCODE'] === 'Y')
	{
		$parser = new CTextParser();

		$obRow->setAttribute(
			'ows_Body',
			str_replace(
				"t",
				'    ',
				$parser->convertText($arRes['DESCRIPTION'])
			)
		);
	}
	else
		$obRow->setAttribute('ows_Body', $arRes['DESCRIPTION']);

	if ($arRes['START_DATE_PLAN'])
		$obRow->setAttribute('ows_StartDate', $this->__makeDateTime(MakeTimeStamp($arRes['START_DATE_PLAN']), true));

	if ($arRes['DEADLINE'])
		$obRow->setAttribute('ows_DueDate', $this->__makeDateTime(MakeTimeStamp($arRes['DEADLINE']), true));

	if ($arRes['RESPONSIBLE_ID'] > 0)
		$obRow->setAttribute('ows_AssignedTo', $this->__makeUser($arRes['RESPONSIBLE_ID']));

	$obRow->setAttribute('ows_Editor', $this->__makeUser($arRes['CHANGED_BY'] ? $arRes['CHANGED_BY'] : $arRes['CREATED_BY']));

	$obRow->setAttribute('ows_Priority', $arRes["PRIORITY"]);

	$obRow->setAttribute('ows_Status', in_array($arRes["REAL_STATUS"], $this->arNotChoiceStatuses) ? GetMessage("TASKS_STATUS_".$arRes["REAL_STATUS"]) : $arRes["REAL_STATUS"]);

	$obRow->setAttribute('ows_MetaInfo_DateComplete', $this->__makeDateTime(MakeTimeStamp($arRes['CLOSED_DATE'])));

	$obRow->setAttribute('ows_MetaInfo_TotalWork', $arRes['DURATION_PLAN'] * 60);
	$obRow->setAttribute('ows_MetaInfo_ActualWork', $arRes['DURATION_FACT'] * 60);

	$obRow->setAttribute('ows_UniqueId', $arRes['ID'].';#'.$listName);
	$obRow->setAttribute('ows_FSObjType', $arRes['ID'].';#0');

	$obRow->setAttribute('ows_PermMask', '0x7fffffffffffffff');
	$obRow->setAttribute('ows_ContentTypeId', '0x0108001E749911F9D25F4D90C446E16EEB2C0E');

	return $obRow;
}