本文整理汇总了PHP中CIntranetUtils::IsToday方法的典型用法代码示例。如果您正苦于以下问题:PHP CIntranetUtils::IsToday方法的具体用法?PHP CIntranetUtils::IsToday怎么用?PHP CIntranetUtils::IsToday使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIntranetUtils
的用法示例。
在下文中一共展示了CIntranetUtils::IsToday方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetRecentList
//.........这里部分代码省略.........
'birthday' => $arRes['PERSONAL_BIRTHDAY'],
'profile' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('im', 'path_to_user_profile', "", $nameOfSite), array("user_id" => $arRes["ITEM_ID"]))
);
}
else
{
$itemId = 'chat'.$itemId;
$item['CHAT'] = Array(
'id' => $arRes['ITEM_ID'],
'name' => $arRes["C_TITLE"],
'owner' => $arRes["C_OWNER_ID"],
);
}
$arRecent[$itemId] = $item;
}
// remove old entity
if (!empty($toDelete))
{
if (isset($toDelete[IM_MESSAGE_PRIVATE]))
self::DeleteRecent($toDelete[IM_MESSAGE_PRIVATE]);
if (isset($toDelete[IM_MESSAGE_GROUP]))
self::DeleteRecent($toDelete[IM_MESSAGE_GROUP], true);
}
if($obCache->StartDataCache())
$obCache->EndDataCache(Array('recent' => $arRecent, 'users' => $arUsers));
}
$arOnline = self::GetStatus(Array('ID' => array_values($arUsers)));
foreach ($arRecent as $key => $value)
{
if ($value['TYPE'] != IM_MESSAGE_PRIVATE)
continue;
$arRecent[$key]['USER']['birthday'] = $bIntranetEnable? CIntranetUtils::IsToday($value['USER']['birthday']): false;
$arRecent[$key]['USER']['status'] = isset($arOnline['users'][$value['USER']['id']])? 'online': 'offline';
}
if ($bLoadUnreadMessage)
{
$CIMMessage = new CIMMessage(false, Array(
'hide_link' => true
));
$ar = $CIMMessage->GetUnreadMessage(Array(
'LOAD_DEPARTMENT' => 'N',
'ORDER' => 'ASC',
'GROUP_BY_CHAT' => 'Y',
'USE_TIME_ZONE' => $bTimeZone? 'Y': 'N',
'USE_SMILES' => $bSmiles? 'Y': 'N'
));
foreach ($ar['message'] as $data)
{
if (!isset($arRecent[$data['senderId']]))
{
$arRecent[$data['senderId']] = Array(
'TYPE' => IM_MESSAGE_PRIVATE,
'USER' => $ar['users'][$data['senderId']]
);
}
$arRecent[$data['senderId']]['MESSAGE'] = Array(
'id' => $data['id'],
'senderId' => $data['senderId'],
'date' => $data['date'],
'text' => preg_replace("/------------------------------------------------------(.*)------------------------------------------------------/mi", " [".GetMessage('IM_QUOTE')."] ", strip_tags(str_replace(array("<br>","<br/>","<br />", "#BR#"), Array(" ", " ", " ", " "), $data['text']), "<img>"))
);
示例2: foreach
$strUserIDs = '';
}
if ($arParams['bCache']) {
$obCache->StartDataCache();
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache($cache_dir);
}
foreach ($arResult['USERS'] as $key => $arUser) {
if ($arResult['bUsersCached']) {
$strUserIDs .= ($strUserIDs ? '|' : '') . $arUser['ID'];
}
if (!is_array($arCacheData[$arUser['ID']])) {
$arCacheData[$arUser['ID']] = array();
}
$arUser['IS_ONLINE'] = $arResult['bUsersCached'] ? false : CIntranetUtils::IsOnline($arUser['LAST_ACTIVITY_DATE']);
$arUser['IS_BIRTHDAY'] = CIntranetUtils::IsToday($arUser['PERSONAL_BIRTHDAY']);
if (array_key_exists('IS_ABSENT', $arCacheData[$arUser['ID']])) {
$arUser['IS_ABSENT'] = $arCacheData[$arUser['ID']]['IS_ABSENT'];
} else {
$arUser['IS_ABSENT'] = $arCacheData[$arUser['ID']]['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
}
if (array_key_exists('IS_FEATURED', $arCacheData[$arUser['ID']])) {
$arUser['IS_FEATURED'] = $arCacheData[$arUser['ID']]['IS_FEATURED'];
} else {
$arUser['IS_FEATURED'] = $arCacheData[$arUser['ID']]['IS_FEATURED'] = CIntranetUtils::IsUserHonoured($arUser['ID']);
}
if ($arUser['PERSONAL_PHOTO']) {
$arImage = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 100);
$arUser['PERSONAL_PHOTO'] = $arImage['IMG'];
//$arUser['PERSONAL_PHOTO'] = CFile::ShowImage($arUser['PERSONAL_PHOTO'], 100, 100);
}
示例3: GetRecentList
//.........这里部分代码省略.........
if ($arRes['ITEM_TYPE'] == IM_MESSAGE_PRIVATE) {
$arUsers[] = $arRes['ITEM_ID'];
$arFileTmp = CFile::ResizeImageGet($arRes["PERSONAL_PHOTO"], array('width' => 58, 'height' => 58), BX_RESIZE_IMAGE_EXACT, false, false, true);
$item['USER'] = array('id' => $arRes['ITEM_ID'], 'name' => CUser::FormatName($nameTemplateSite, $arRes, true, false), 'nameList' => CUser::FormatName($nameTemplate, $arRes, true, false), 'workPosition' => $arRes['WORK_POSITION'], 'color' => self::GetUserColor($arRes["ID"], $arRes['PERSONAL_GENDER'] == 'M' ? 'M' : 'F'), 'avatar' => empty($arFileTmp['src']) ? '/bitrix/js/im/images/blank.gif' : $arFileTmp['src'], 'status' => 'offline', 'birthday' => $arRes['PERSONAL_BIRTHDAY'], 'gender' => $arRes['PERSONAL_GENDER'] == 'F' ? 'F' : 'M', 'extranet' => false, 'network' => $arRes['EXTERNAL_AUTH_ID'] == self::NETWORK_AUTH_ID, 'phoneDevice' => false, 'profile' => CIMContactList::GetUserPath($arRes["ITEM_ID"]));
} else {
$chatType = $arRes["ITEM_TYPE"] == IM_MESSAGE_OPEN ? 'open' : 'chat';
if ($arRes["C_ENTITY_TYPE"] == 'CALL') {
$chatType = 'call';
}
$itemId = 'chat' . $itemId;
$item['CHAT'] = array('id' => $arRes['ITEM_ID'], 'name' => $arRes["C_TITLE"], 'color' => $arRes["CHAT_COLOR"] == "" ? IM\Color::getColorByNumber($arRes['ITEM_ID']) : IM\Color::getColor($arRes['CHAT_COLOR']), 'avatar' => CIMChat::GetAvatarImage($arRes["C_AVATAR"]), 'extranet' => $arRes["CHAT_EXTRANET"] == "" ? "" : ($arRes["CHAT_EXTRANET"] == "Y" ? true : false), 'owner' => $arRes["C_OWNER_ID"], 'type' => $chatType, 'messageType' => $arRes['CHAT_TYPE'], 'call_number' => $arRes["C_CALL_NUMBER"]);
}
$arRecent[$itemId] = $item;
}
$params = CIMMessageParam::Get($arMessageId);
foreach ($arRecent as $key => $value) {
if (isset($params[$value['MESSAGE']['id']])) {
if (count($params[$value['MESSAGE']['id']]['FILE_ID']) > 0 && strlen(trim($arRecent[$key]['MESSAGE']['text'])) <= 0) {
$arRecent[$key]['MESSAGE']['text'] = "[" . GetMessage('IM_FILE') . "]";
}
$arRecent[$key]['MESSAGE']['params'] = $params[$value['MESSAGE']['id']];
}
}
if (!empty($toDelete)) {
if (isset($toDelete[IM_MESSAGE_PRIVATE])) {
self::DeleteRecent($toDelete[IM_MESSAGE_PRIVATE]);
}
if (isset($toDelete[IM_MESSAGE_CHAT])) {
self::DeleteRecent($toDelete[IM_MESSAGE_CHAT], true);
}
if (isset($toDelete[IM_MESSAGE_OPEN])) {
self::DeleteRecent($toDelete[IM_MESSAGE_OPEN], true);
}
}
$bExtranetEnable = IsModuleInstalled('extranet');
$bVoximplantEnable = IsModuleInstalled('voximplant');
if ($bExtranetEnable || $bVoximplantEnable) {
$arUserPhone = array();
$arUserDepartment = array();
$arSelectParams = array();
if ($bExtranetEnable) {
$arSelectParams[] = 'UF_DEPARTMENT';
}
if ($bVoximplantEnable) {
$arSelectParams[] = 'UF_VI_PHONE';
}
$dbUsers = CUser::GetList($sort_by = array('last_name' => 'asc'), $dummy = '', array('ID' => $userId . "|" . implode('|', $arUsers)), array('FIELDS' => array("ID"), 'SELECT' => $arSelectParams));
while ($arUser = $dbUsers->GetNext(true, false)) {
$arUserPhone[$arUser['ID']] = $arUser['UF_VI_PHONE'] == 'Y';
$arUserDepartment[$arUser['ID']] = self::IsExtranet($arUser);
}
foreach ($arRecent as $key => $value) {
if (isset($value['USER'])) {
$arRecent[$key]['USER']['extranet'] = $arUserDepartment[$value['USER']['id']];
$arRecent[$key]['USER']['phoneDevice'] = $arUserPhone[$value['USER']['id']];
}
}
}
if ($obCache->StartDataCache()) {
$obCache->EndDataCache(array('recent' => $arRecent, 'users' => $arUsers));
}
}
$arOnline = CIMStatus::GetList(array('ID' => array_values($arUsers), 'GET_OFFLINE' => 'Y'));
foreach ($arRecent as $key => $value) {
if ($value['TYPE'] != IM_MESSAGE_PRIVATE) {
continue;
}
$arRecent[$key]['USER']['birthday'] = $bIntranetEnable ? CIntranetUtils::IsToday($value['USER']['birthday']) : false;
$arRecent[$key]['USER']['status'] = isset($arOnline['users'][$value['USER']['id']]) ? $arOnline['users'][$value['USER']['id']]['status'] : 'offline';
$arRecent[$key]['USER']['idle'] = isset($arOnline['users'][$value['USER']['id']]) ? $arOnline['users'][$value['USER']['id']]['idle'] : 0;
$arRecent[$key]['USER']['mobileLastDate'] = isset($arOnline['users'][$value['USER']['id']]) ? $arOnline['users'][$value['USER']['id']]['mobileLastDate'] : 0;
if ($arOnline['users'][$value['USER']['id']]['color']) {
$arRecent[$key]['USER']['color'] = $arOnline['users'][$value['USER']['id']]['color'];
}
}
if ($bLoadUnreadMessage) {
$CIMMessage = new CIMMessage(false, array('HIDE_LINK' => 'Y'));
$ar = $CIMMessage->GetUnreadMessage(array('LOAD_DEPARTMENT' => 'N', 'ORDER' => 'ASC', 'GROUP_BY_CHAT' => 'Y', 'USE_TIME_ZONE' => $bTimeZone ? 'Y' : 'N', 'USE_SMILES' => $bSmiles ? 'Y' : 'N'));
foreach ($ar['message'] as $data) {
if (!isset($arRecent[$data['senderId']])) {
$arRecent[$data['senderId']] = array('TYPE' => IM_MESSAGE_PRIVATE, 'USER' => $ar['users'][$data['senderId']]);
}
$arRecent[$data['senderId']]['MESSAGE'] = array('id' => $data['id'], 'senderId' => $data['senderId'], 'date' => $data['date'], 'text' => preg_replace('#\\-{54}.+?\\-{54}#s', " [" . GetMessage('IM_QUOTE') . "] ", strip_tags(str_replace(array("<br>", "<br/>", "<br />", "#BR#"), array(" ", " ", " ", " "), $data['text']), "<img>")));
$arRecent[$data['senderId']]['COUNTER'] = $data['counter'];
}
$CIMChat = new CIMChat(false, array('HIDE_LINK' => 'Y'));
$ar = $CIMChat->GetUnreadMessage(array('ORDER' => 'ASC', 'GROUP_BY_CHAT' => 'Y', 'USER_LOAD' => 'N', 'FILE_LOAD' => 'N', 'USE_SMILES' => $bSmiles ? 'Y' : 'N', 'USE_TIME_ZONE' => $bTimeZone ? 'Y' : 'N'));
foreach ($ar['message'] as $data) {
if (!isset($arRecent['chat' . $data['recipientId']])) {
$arRecent['chat' . $data['recipientId']] = array('TYPE' => $ar['messageType'] ? $ar['messageType'] : IM_MESSAGE_CHAT, 'CHAT' => $ar['chat']);
}
$arRecent['chat' . $data['recipientId']]['MESSAGE'] = array('id' => $data['id'], 'senderId' => $data['senderId'], 'date' => $data['date'], 'text' => $data['text']);
$arRecent['chat' . $data['recipientId']]['COUNTER'] = $data['counter'];
}
}
if (!empty($arRecent)) {
sortByColumn($arRecent, array('COUNTER' => array(SORT_NUMERIC, SORT_DESC), 'MESSAGE' => array(SORT_NUMERIC, SORT_DESC)), array('COUNTER' => array(__CLASS__, 'GetRecentListSortCounter'), 'MESSAGE' => array(__CLASS__, 'GetRecentListSortMessage')), null, true);
}
return $arRecent;
}
示例4: workWithNonCacheAttr
/**
* Set mutable attributes
* @param bool $bFromCache
* @param string $strUserIds
*/
protected function workWithNonCacheAttr($bFromCache = false, $strUserIds = '')
{
//if list of users in cache - get last activity
if ($bFromCache && $strUserIds) {
$dbRes = CUser::getList($by = 'id', $order = 'asc', array('ID' => $strUserIds, 'LAST_ACTIVITY' => static::LAST_ACTIVITY), array('FIELDS' => array('ID')));
while ($arRes = $dbRes->fetch()) {
if ($this->arResult['USERS'][$arRes['ID']]) {
$this->arResult['USERS'][$arRes['ID']]['IS_ONLINE'] = true;
}
}
unset($dbRes, $arRes);
}
$buildResizedPhoto = false;
$displayPhoto = $this->displayPersonalPhoto();
foreach ($this->arResult['USERS'] as &$arUser) {
if ($this->bExcel && $displayPhoto) {
//if export in excel, then method $this->resizePersonalPhoto() not run. And not modify PERSONAL_PHOTO
if (!$arUser['PERSONAL_PHOTO']) {
$arUser['PERSONAL_PHOTO'] = $this->getDefaultPictureSonet($arUser['PERSONAL_GENDER']);
}
$arUser['PERSONAL_PHOTO_SOURCE'] = $arUser['PERSONAL_PHOTO'];
$arUser['PERSONAL_PHOTO'] = CFile::GetPath($arUser['PERSONAL_PHOTO']);
} elseif ($bFromCache && $displayPhoto) {
$buildResizedPhoto = $this->resizePersonalPhoto($arUser) || $buildResizedPhoto;
}
$arUser['IS_BIRTHDAY'] = CIntranetUtils::IsToday($arUser['PERSONAL_BIRTHDAY']);
$arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
}
//rewrite cache if we build new resized photo
if ($buildResizedPhoto) {
$this->obCache->clean($this->cacheId, $this->cacheDir);
$this->obCache->startDataCache();
$this->obCache->endDataCache(array('USERS' => $this->arResult['USERS'], 'STR_USER_ID' => $strUserIds, 'DEPARTMENTS' => $this->arResult['DEPARTMENTS'], 'DEPARTMENT_HEAD' => $this->arResult['DEPARTMENT_HEAD'], 'USERS_NAV' => $this->arResult['USERS_NAV']));
}
}