• Модуль: xmpp
  • Путь к файлу: ~/bitrix/modules/xmpp/classes/client.php
  • Класс: CXMPPClient
  • Вызов: CXMPPClient::ChangeWorkPresence
public function ChangeWorkPresence($type, $note, $clientDomain = "")
{
	global $DB;

	$iblockId = self::GetPresenceIBlockId($clientDomain);
	if ($iblockId <= 0)
		return;

	if ($type == "Authenticate")
	{
		$this->presenceDate = date($DB->DateFormatToPHP(FORMAT_DATETIME));
		$this->presenceType = $note;
		return;
	}

	if ($this->presenceDate == '' || $this->presenceDate == date($DB->DateFormatToPHP(FORMAT_DATETIME)))
		return;
	if (intval($this->id) <= 0)
		return;

	$arFields = array(
		"DATE_ACTIVE_FROM" => $this->presenceDate,
		"DATE_ACTIVE_TO" => date($DB->DateFormatToPHP(FORMAT_DATETIME)),
		"NAME" => ($this->presenceType == '') ? "Online" : $this->presenceType,
		"ACTIVE" => "Y",
		"IBLOCK_ID" => $iblockId,
		"IBLOCK_SECTION_ID" => 0,
		"PROPERTY_VALUES" => array(
			"USER" => array($this->id),
			"USER_ACTIVE" => array("Y"),
		),
	);

	$iblockElementObject = new CIBlockElement;
	$idTmp = $iblockElementObject->Add($arFields);

	$this->presenceDate = date($DB->DateFormatToPHP(FORMAT_DATETIME));
	$this->presenceType = $note;
}