本文整理汇总了PHP中CIMNotify::SetLastSendId方法的典型用法代码示例。如果您正苦于以下问题:PHP CIMNotify::SetLastSendId方法的具体用法?PHP CIMNotify::SetLastSendId怎么用?PHP CIMNotify::SetLastSendId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMNotify
的用法示例。
在下文中一共展示了CIMNotify::SetLastSendId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetUnreadNotify
public function GetUnreadNotify($arParams = array())
{
global $DB;
$order = isset($arParams['ORDER']) && $arParams['ORDER'] == 'ASC' ? 'ASC' : 'DESC';
$bSpeedCheck = isset($arParams['SPEED_CHECK']) && $arParams['SPEED_CHECK'] == 'N' ? false : true;
$bTimeZone = isset($arParams['USE_TIME_ZONE']) && $arParams['USE_TIME_ZONE'] == 'N' ? false : true;
$bGetOnlyFlash = isset($arParams['GET_ONLY_FLASH']) && $arParams['GET_ONLY_FLASH'] == 'Y' ? true : false;
$arNotify['result'] = false;
$arNotify['notify'] = array();
$arNotify['unreadNotify'] = array();
$arNotify['loadNotify'] = false;
$arNotify['maxNotify'] = 0;
$bLoadNotify = $bSpeedCheck ? !CIMMessenger::SpeedFileExists($this->user_id, IM_SPEED_NOTIFY) : true;
if ($bLoadNotify) {
if (!$bTimeZone) {
CTimeZone::Disable();
}
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tM.ID,\n\t\t\t\t\tM.CHAT_ID,\n\t\t\t\t\tM.MESSAGE,\n\t\t\t\t\tM.MESSAGE_OUT,\n\t\t\t\t\t" . $DB->DateToCharFunction('M.DATE_CREATE') . " DATE_CREATE,\n\t\t\t\t\tM.NOTIFY_TYPE,\n\t\t\t\t\tM.NOTIFY_MODULE,\n\t\t\t\t\tM.NOTIFY_EVENT,\n\t\t\t\t\tM.NOTIFY_TITLE,\n\t\t\t\t\tM.NOTIFY_BUTTONS,\n\t\t\t\t\tM.NOTIFY_TAG,\n\t\t\t\t\tM.NOTIFY_SUB_TAG,\n\t\t\t\t\tR.LAST_ID,\n\t\t\t\t\tR.STATUS,\n\t\t\t\t\tR.USER_ID TO_USER_ID,\n\t\t\t\t\tM.AUTHOR_ID FROM_USER_ID\n\t\t\t\tFROM b_im_relation R\n\t\t\t\tINNER JOIN b_im_message M ON M.NOTIFY_READ = 'N' AND M.CHAT_ID = R.CHAT_ID\n\t\t\t\tWHERE R.USER_ID = " . $this->user_id . " AND R.MESSAGE_TYPE = '" . IM_MESSAGE_SYSTEM . "'\n\t\t\t\tORDER BY DATE_CREATE " . ($order == "DESC" ? "DESC" : "ASC") . ", ID " . ($order == "DESC" ? "DESC" : "ASC") . "\n\t\t\t";
if (!$bTimeZone) {
CTimeZone::Enable();
}
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$arMark = array();
while ($arRes = $dbRes->Fetch()) {
if ($this->bHideLink) {
$arRes['HIDE_LINK'] = 'Y';
}
$arNotify['original_notify'][$arRes['ID']] = $arRes;
$arNotify['notify'][$arRes['ID']] = $bGetOnlyFlash ? $arRes : self::GetFormatNotify($arRes);
$arNotify['unreadNotify'][$arRes['ID']] = $arRes['ID'];
if ($arRes['STATUS'] == IM_STATUS_UNREAD && (!isset($arMark[$arRes["CHAT_ID"]]) || $arMark[$arRes["CHAT_ID"]] < $arRes["ID"])) {
$arMark[$arRes["CHAT_ID"]] = $arRes["ID"];
}
if ($arNotify['maxNotify'] < $arRes['ID']) {
$arNotify['maxNotify'] = $arRes['ID'];
}
}
foreach ($arMark as $chatId => $lastSendId) {
CIMNotify::SetLastSendId($chatId, $lastSendId);
}
$arNotify['countNotify'] = $this->GetNotifyCounter($arNotify);
CIMMessenger::SpeedFileCreate($this->user_id, $arNotify['countNotify'], IM_SPEED_NOTIFY);
if ($bGetOnlyFlash) {
foreach ($arNotify['notify'] as $key => $value) {
if (isset($_SESSION['IM_FLASHED_NOTIFY']) && in_array($key, $_SESSION['IM_FLASHED_NOTIFY'])) {
unset($arNotify['notify'][$key]);
unset($arNotify['original_notify'][$key]);
$arNotify['loadNotify'] = true;
} else {
$arNotify['notify'][$key] = self::GetFormatNotify($value);
}
}
}
$arNotify['result'] = true;
} else {
$arNotify['countNotify'] = $this->GetNotifyCounter();
if ($arNotify['countNotify'] > 0) {
$arNotify['loadNotify'] = true;
}
}
return $arNotify;
}
示例2: GetUnreadNotify
public function GetUnreadNotify($arParams = Array())
{
global $DB;
$order = isset($arParams['ORDER']) && $arParams['ORDER'] == 'ASC'? 'ASC': 'DESC';
$bSpeedCheck = isset($arParams['SPEED_CHECK']) && $arParams['SPEED_CHECK'] == 'N'? false: true;
$bTimeZone = isset($arParams['USE_TIME_ZONE']) && $arParams['USE_TIME_ZONE'] == 'N'? false: true;
$bGetOnlyFlash = isset($arParams['GET_ONLY_FLASH']) && $arParams['GET_ONLY_FLASH'] == 'Y'? true: false;
$arNotify['result'] = false;
$arNotify['notify'] = Array();
$arNotify['unreadNotify'] = Array();
$arNotify['loadNotify'] = false;
$arNotify['countNotify'] = 0;
$arNotify['maxNotify'] = 0;
$bLoadNotify = $bSpeedCheck? !CIMMessenger::SpeedFileExists($this->user_id, IM_SPEED_NOTIFY): true;
if ($bLoadNotify)
{
$strSql = "SELECT CHAT_ID, STATUS FROM b_im_relation WHERE USER_ID = ".$this->user_id." AND MESSAGE_TYPE = '".IM_MESSAGE_SYSTEM."'";
$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if ($arRes = $dbRes->Fetch())
{
$chatId = intval($arRes['CHAT_ID']);
$chatStatus = $arRes['STATUS'];
}
else
return $arNotify;
if (!$bTimeZone)
CTimeZone::Disable();
$strSql ="
SELECT
M.ID,
M.CHAT_ID,
M.MESSAGE,
M.MESSAGE_OUT,
".$DB->DatetimeToTimestampFunction('M.DATE_CREATE')." DATE_CREATE,
M.NOTIFY_TYPE,
M.NOTIFY_MODULE,
M.NOTIFY_EVENT,
M.NOTIFY_TITLE,
M.NOTIFY_BUTTONS,
M.NOTIFY_TAG,
M.NOTIFY_SUB_TAG,
$this->user_id TO_USER_ID,
M.AUTHOR_ID FROM_USER_ID
FROM b_im_message M
WHERE M.CHAT_ID = ".$chatId." AND M.NOTIFY_READ = 'N'
";
if (!$bTimeZone)
CTimeZone::Enable();
$strSql = $DB->TopSql($strSql, 500);
$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
$arMark = Array();
$arGetUsers = Array();
while ($arRes = $dbRes->Fetch())
{
if ($this->bHideLink)
$arRes['HIDE_LINK'] = 'Y';
$arNotify['original_notify'][$arRes['ID']] = $arRes;
$arNotify['notify'][$arRes['ID']] = $arRes;
$arNotify['unreadNotify'][$arRes['ID']] = $arRes['ID'];
if ($chatStatus == IM_STATUS_UNREAD && (!isset($arMark[$arRes["CHAT_ID"]]) || $arMark[$arRes["CHAT_ID"]] < $arRes["ID"]))
$arMark[$arRes["CHAT_ID"]] = $arRes["ID"];
if ($arNotify['maxNotify'] < $arRes['ID'])
$arNotify['maxNotify'] = $arRes['ID'];
$arGetUsers[] = $arRes['FROM_USER_ID'];
}
foreach ($arMark as $chatId => $lastSendId)
CIMNotify::SetLastSendId($chatId, $lastSendId);
$arNotify['countNotify'] = $this->GetNotifyCounter($arNotify);
CIMMessenger::SpeedFileCreate($this->user_id, $arNotify['countNotify'], IM_SPEED_NOTIFY);
$arUsers = CIMContactList::GetUserData(Array('ID' => $arGetUsers, 'DEPARTMENT' => 'N', 'USE_CACHE' => 'Y', 'CACHE_TTL' => 86400));
$arGetUsers = $arUsers['users'];
if ($bGetOnlyFlash)
{
foreach ($arNotify['notify'] as $key => $value)
{
if (isset($_SESSION['IM_FLASHED_NOTIFY'][$key]))
{
unset($arNotify['notify'][$key]);
unset($arNotify['original_notify'][$key]);
$arNotify['loadNotify'] = true;
}
else
{
$value['FROM_USER_DATA'] = $arGetUsers;
$arNotify['notify'][$key] = self::GetFormatNotify($value);
}
}
}
//.........这里部分代码省略.........
示例3: MailNotifyAgent
public static function MailNotifyAgent()
{
global $DB;
$defSiteID = CSite::GetDefSite();
$arMark = array();
$arGroupNotify = array();
$arGroupNotifyUser = array();
$arUnsendNotify = CIMNotify::GetUnsendNotify();
foreach ($arUnsendNotify as $id => $arNotify) {
if (!isset($arMark[$arNotify["CHAT_ID"]]) || $arMark[$arNotify["CHAT_ID"]] < $arNotify["ID"]) {
$arMark[$arNotify["CHAT_ID"]] = $arNotify["ID"];
}
if ($arNotify['TO_USER_ACTIVE'] != 'Y') {
unset($arUnsendNotify[$id]);
continue;
}
if (isset($arNotify["NOTIFY_MODULE"]) && isset($arNotify["NOTIFY_EVENT"]) && !CIMNotifySchema::CheckEnableFeature($arNotify["NOTIFY_MODULE"], $arNotify["NOTIFY_EVENT"], IM_FEATURE_MAIL)) {
unset($arUnsendNotify[$id]);
continue;
}
$siteID = $arNotify["TO_USER_LID"];
if ($siteID == false || StrLen($siteID) <= 0) {
$siteID = $defSiteID;
if ($siteID == false || StrLen($siteID) <= 0) {
unset($arUnsendNotify[$id]);
continue;
}
}
if (strlen($arNotify["MESSAGE_OUT"]) <= 0) {
$arNotify["MESSAGE_OUT"] = $arNotify["MESSAGE"];
}
if (!(isset($arNotify["EMAIL_TEMPLATE"]) && strlen($arNotify["EMAIL_TEMPLATE"]) > 0)) {
$arNotify["EMAIL_TEMPLATE"] = "IM_NEW_NOTIFY";
}
$arNotify["USER"] = htmlspecialcharsback(CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arNotify["TO_USER_NAME"], "LAST_NAME" => $arNotify["TO_USER_LAST_NAME"], "SECOND_NAME" => $arNotify["TO_USER_SECOND_NAME"], "LOGIN" => $arNotify["TO_USER_LOGIN"]), true));
$arNotify["FROM_USER"] = htmlspecialcharsback(CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arNotify["FROM_USER_NAME"], "LAST_NAME" => $arNotify["FROM_USER_LAST_NAME"], "SECOND_NAME" => $arNotify["FROM_USER_SECOND_NAME"], "LOGIN" => $arNotify["FROM_USER_LOGIN"]), true));
$arNotify['NOTIFY_TAG_MD5'] = md5($arNotify['NOTIFY_TAG']);
if ($arNotify["EMAIL_TEMPLATE"] == "IM_NEW_NOTIFY" && $arNotify['NOTIFY_TAG'] != '') {
if (isset($arGroupNotify[$arNotify['NOTIFY_TAG_MD5']])) {
$arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']][$arNotify["FROM_USER_ID"]] = $arNotify["FROM_USER"];
unset($arUnsendNotify[$id]);
} else {
$arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']][$arNotify["FROM_USER_ID"]] = $arNotify["FROM_USER"];
$arGroupNotify[$arNotify['NOTIFY_TAG_MD5']] = true;
}
}
$arUnsendNotify[$id] = $arNotify;
}
foreach ($arMark as $chatId => $lastSendId) {
CIMNotify::SetLastSendId($chatId, $lastSendId);
}
$CTP = new CTextParser();
foreach ($arUnsendNotify as $id => $arNotify) {
$arFields = array("MESSAGE_ID" => $arNotify["ID"], "USER" => $arNotify["USER"], "USER_ID" => $arNotify["TO_USER_ID"], "USER_LOGIN" => $arNotify["TO_USER_LOGIN"], "USER_NAME" => $arNotify["TO_USER_NAME"], "USER_LAST_NAME" => $arNotify["TO_USER_LAST_NAME"], "USER_SECOND_NAME" => $arNotify["TO_USER_SECOND_NAME"], "DATE_CREATE" => $arNotify["DATE_CREATE"], "FROM_USER_ID" => $arNotify["FROM_USER_ID"], "FROM_USER_LOGIN" => $arNotify["FROM_USER_LOGIN"], "FROM_USER" => $arNotify["FROM_USER"], "SENDER_ID" => $arNotify["FROM_USER_ID"], "SENDER_LOGIN" => $arNotify["FROM_USER_LOGIN"], "SENDER_NAME" => $arNotify["FROM_USER_NAME"], "SENDER_LAST_NAME" => $arNotify["FROM_USER_LAST_NAME"], "SENDER_SECOND_NAME" => $arNotify["FROM_USER_SECOND_NAME"], "EMAIL_TO" => $arNotify["TO_USER_EMAIL"], "TITLE" => trim($arNotify["NOTIFY_TITLE"]), "MESSAGE" => CTextParser::convert4mail(str_replace("#BR#", "\n", strip_tags($arNotify["MESSAGE_OUT"]))), "MESSAGE_50" => $CTP->html_cut(str_replace(array("<br>", "<br/>", "<br />", "#BR#"), array(" ", " ", " ", " "), nl2br(CTextParser::convert4mail(strip_tags($arNotify["MESSAGE_OUT"])))), 50));
if (strlen($arFields['TITLE']) > 0) {
$arFields["MESSAGE_50"] = $arFields['TITLE'];
} else {
$arFields["TITLE"] = $arFields['MESSAGE_50'];
}
if (isset($arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']]) && count($arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']]) > 1) {
$arNotify["EMAIL_TEMPLATE"] = "IM_NEW_NOTIFY_GROUP";
$arFields['FROM_USERS'] = implode(', ', $arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']]);
unset($arFields['FROM_USER']);
}
$event = new CEvent();
$event->Send($arNotify["EMAIL_TEMPLATE"], $siteID, $arFields, "N");
}
return "CIMMail::MailNotifyAgent();";
}