• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/exchangetasks.php
  • Класс: CDavExchangeTasks
  • Вызов: CDavExchangeTasks::FormatFieldsArray
private function FormatFieldsArray($arFields)
{
	$arFieldsNew = array();

	$arMap = array(
		"XML_ID" => "Id",
		"SUBJECT" => "Subject",
		"BODY" => "Body",
		"BODY_TYPE" => "BodyType",
		"DATE_CREATE" => "DateTimeCreated",
		"IMPORTANCE" => "Importance",
		'GUID' => array(	// Extended field. Must be represented as array
			'PropertyName' => 'BX_TASKS_GUID',
			'PropertyType' => 'String',
			'Value'        => 'not inited yet'	// will be initialized later
		),
		'SERIALIZED_DATA' => array(	// Extended field. Must be represented as array
			'PropertyName' => 'BX_TASKS_SERIALIZED_DATA',
			'PropertyType' => 'String',
			'Value'        => 'not inited yet'	// will be initialized later
		),
		"ACTUAL_WORK" => "ActualWork",
		"BILLING_INFORMATION" => "BillingInformation",
		"MILEAGE" => "Mileage",
		"START_DATE" => "StartDate",
		"DUE_DATE" => "DueDate",
		"IS_COMPLETE" => "IsComplete",
		"PERCENT_COMPLETE" => "PercentComplete",
		"STATUS" => "Status",
		//"STATUS_DESCRIPTION" => "StatusDescription",
		"TOTAL_WORK" => "TotalWork",
		"OWNER" => "Owner",
		"REMINDER_MINUTES_BEFORE_START" => "ReminderMinutesBeforeStart",
		"RECURRING_TYPE" => "RecurringType",
		"RECURRING_INTERVAL" => "RecurringInterval",
		"RECURRING_DAYOFMONTH" => "RecurringDayOfMonth",
		"RECURRING_DAYSOFWEEK" => "RecurringDaysOfWeek",
		"RECURRING_DAYOFWEEKINDEX" => "RecurringDayOfWeekIndex",
		"RECURRING_MONTH" => "RecurringMonth",
		"RECURRING_STARTDATE" => "RecurringStartDate",
		"RECURRING_NUMBEROFOCCURRENCES" => "RecurringNumberOfOccurrences",
		"RECURRING_ENDDATE" => "RecurringEndDate",
	);

	foreach ($arFields as $key => $value)
	{
		if (!array_key_exists($key, $arMap))
		{
			continue;
		}

		$newKey = $arMap[$key];
		if (is_array($newKey))
		{
			$arFieldsNew[$key] = $newKey;
			$arFieldsNew[$key]['Value'] = base64_encode($this->Decode($value));
		}
		elseif (in_array($newKey, array("DateTimeCreated", "StartDate", "DueDate")))
		{
			$arFieldsNew[$newKey] = date("c", MakeTimeStamp($value));
		}
		elseif (in_array($newKey, array("RecurringStartDate", "RecurringEndDate")))
		{
			$arFieldsNew[$newKey] = date("Y-m-dZ", MakeTimeStamp($value));
		}
		elseif (
			$this->FormatStandartFieldsArray($newKey, $value, $arFieldsNew)
			|| $this->FormatRecurrenceFieldsArray($newKey, $value, $arFieldsNew)
		)
		{

		}
		else
		{
			$arFieldsNew[$newKey] = $this->Decode($value);
		}
	}

	if (isset($arFieldsNew["ReminderMinutesBeforeStart"]) && (int)$arFieldsNew["ReminderMinutesBeforeStart"])
	{
		$arFieldsNew["ReminderMinutesBeforeStart"] = (int)$arFieldsNew["ReminderMinutesBeforeStart"];
		$arFieldsNew["ReminderIsSet"] = true;
	}

	return $arFieldsNew;
}