function AddReminder($arParams) { $fullUrl = $arParams['fullUrl']; $ownerType = $arParams['ownerType']; $ownerId = $arParams['ownerId']; $userId = $arParams['userId']; $url = $fullUrl . (strpos($fullUrl, '?') === FALSE ? '?' : '&') . 'EVENT_ID=' . $arParams["id"]; $remAgentParams = array('iblockId' => $arParams['iblockId'], 'eventId' => $arParams["id"], 'userId' => $userId, 'pathToPage' => $url, 'ownerType' => $ownerType, 'ownerId' => $ownerId ? $ownerId : 'false'); if ($arParams["remind"] !== false) { $rem_ts = MakeTimeStamp($arParams['dateFrom'], getTSFormat()); $delta = intVal($arParams["remind"]['count']) * 60; //Minute if ($arParams["remind"]['type'] == 'hour') { $delta = $delta * 60; } elseif ($arParams["remind"]['type'] == 'day') { $delta = $delta * 60 * 24; } //Day $rem_ts -= $delta; $remindTime = date(getDateFormat(), $rem_ts); if ($rem_ts >= time() - 60 * 5) { // Inaccuracy - 5 min CEventCalendar::AddAgent($remindTime, $remAgentParams); } else { CEventCalendar::RemoveAgent($remAgentParams); } } else { if (!$arParams['bNew']) { CEventCalendar::RemoveAgent($remAgentParams); } } }