本文整理匯總了PHP中CIntranetUtils::IsUserAbsent方法的典型用法代碼示例。如果您正苦於以下問題:PHP CIntranetUtils::IsUserAbsent方法的具體用法?PHP CIntranetUtils::IsUserAbsent怎麽用?PHP CIntranetUtils::IsUserAbsent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CIntranetUtils
的用法示例。
在下文中一共展示了CIntranetUtils::IsUserAbsent方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _FormatUser
function _FormatUser(&$arUser, $arPath)
{
global $USER, $CACHE_ABSENCE;
if ($arUser['PERSONAL_PHOTO']) {
$arImage = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30);
$arUser['PERSONAL_PHOTO'] = $arImage['IMG'];
}
if ($arPath['DETAIL_URL']) {
$arUser['DETAIL_URL'] = str_replace('#ID#', $arUser['ID'], $arPath['DETAIL_URL']);
}
$arUser["canViewProfile"] = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser['ID'], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$arUser["canMessage"] = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser['ID'], "message", CSocNetUser::IsCurrentUserModuleAdmin());
if ($arPath['MESSAGES_CHAT_URL']) {
$arUser['MESSAGES_CHAT_URL'] = str_replace('#ID#', $arUser['ID'], $arPath['MESSAGES_CHAT_URL']);
}
$arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
$arUser['IS_ONLINE'] = CSocNetUser::IsOnLine($arUser['ID']);
if ($arUser['IS_ABSENT']) {
$maxAbsence = 0;
foreach ($CACHE_ABSENCE[$arUser["ID"]] as $arAbsence) {
if (MakeTimeStamp($arAbsence["DATE_TO"]) > $maxAbsence) {
$arUser['ABSENT_TILL'] = $arAbsence["DATE_TO"];
}
}
}
$arFilter = array("TO_USER_ID" => $arUser['ID'], "MESSAGE_TYPE" => SONET_MESSAGE_PRIVATE, "FROM_USER_ID" => $USER->GetID());
$dbMessages = CSocNetMessages::GetList(array("DATE_CREATE" => "DESC"), $arFilter, false, array("nTopCount" => 1), array("ID", "DATE_CREATE"));
if ($arMessages = $dbMessages->GetNext()) {
$arUser['LAST_CHAT'] = $arMessages["DATE_CREATE"];
}
return true;
}
示例2: foreach
$arDepCacheValue[$arSect['ID']] = $arSect['NAME'];
}
}
foreach ($arUser['UF_DEPARTMENT'] as $key => $sect) {
$arDep[$sect] = $arDepCacheValue[$sect];
}
}
$arUser['UF_DEPARTMENT'] = $arDep;
$arUser["DETAIL_URL"] = $arItem["URL"];
$arUser['IS_ONLINE'] = $bSoNet && $arUser['IS_ONLINE'] == "Y";
if ($arUser['PERSONAL_BIRTHDAY']) {
$arBirthDate = ParseDateTime($arUser['PERSONAL_BIRTHDAY'], CSite::GetDateFormat('SHORT'));
$arUser['IS_BIRTHDAY'] = intval($arBirthDate['MM']) == date('n') && intval($arBirthDate['DD']) == date('j');
}
$arUser['IS_FEATURED'] = CIntranetUtils::IsUserHonoured($arUser['ID']);
$arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
$arResult["SEARCH"][$i]["USER"] = $arUser;
}
}
}
$arResult['USER_PROP'] = array();
$arRes = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", 0, LANGUAGE_ID);
if (!empty($arRes)) {
foreach ($arRes as $key => $val) {
$arResult['USER_PROP'][$val["FIELD_NAME"]] = strLen($val["EDIT_FORM_LABEL"]) > 0 ? $val["EDIT_FORM_LABEL"] : $val["FIELD_NAME"];
}
}
}
$arrDropdown = array();
$arResult["DROPDOWN_SONET"] = array();
$EntityType = array_key_exists("arrFILTER", $arParams) && in_array("socialnetwork_group", $arParams["arrFILTER"]) ? SONET_ENTITY_GROUP : SONET_ENTITY_USER;
示例3: array
}
if (StrLen($arResult["FatalError"]) <= 0) {
$arResult["Urls"]["User"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arResult["User"]["ID"]));
$arResult["Urls"]["UserMessages"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_USERS_MESSAGES"], array("user_id" => $arResult["User"]["ID"]));
$arResult["Urls"]["VideoCall"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_VIDEO_CALL"], array("user_id" => $arResult["User"]["ID"]));
if (!CModule::IncludeModule("video")) {
$arResult["CurrentUserPerms"]["Operations"]["videocall"] = false;
}
$arResult["IS_ONLINE"] = $arResult["User"]["IS_ONLINE"] == "Y";
if ($arResult["User"]['PERSONAL_BIRTHDAY'] != '') {
$arBirthDate = ParseDateTime($arResult["User"]['PERSONAL_BIRTHDAY'], CSite::GetDateFormat('SHORT'));
$arResult['IS_BIRTHDAY'] = intval($arBirthDate['MM']) == date('n') && intval($arBirthDate['DD']) == date('j');
}
if (CModule::IncludeModule('intranet')) {
$arResult['IS_FEATURED'] = CIntranetUtils::IsUserHonoured($arResult["User"]['ID']);
$arResult['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arResult["User"]['ID']);
}
if (intval($arResult["User"]["PERSONAL_PHOTO"]) <= 0) {
switch ($arResult["User"]["PERSONAL_GENDER"]) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arResult["User"]["PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
$arImage = CSocNetTools::InitImage($arResult["User"]["PERSONAL_PHOTO"], 50, "/bitrix/images/socialnetwork/nopic_user_50.gif", 50, $arResult["CurrentUserPerms"]["Operations"]["viewprofile"] ? $arResult["Urls"]["User"] : "", true, 'target="_blank"');
示例4: array
$arResult["Urls"]["LogGroups"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_LOG"], array());
$arResult["Urls"]["LogGroups"] .= (StrPos($arResult["Urls"]["LogGroups"], "?") !== false ? "&" : "?") . "flt_entity_type=" . SONET_ENTITY_GROUP;
$arResult["Urls"]["LogUsers"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_LOG"], array());
$arResult["Urls"]["LogUsers"] .= (StrPos($arResult["Urls"]["LogUsers"], "?") !== false ? "&" : "?") . "flt_entity_type=" . SONET_ENTITY_USER;
$arResult["Urls"]["Activity"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_ACTIVITY"], array());
$arResult["Urls"]["VideoCall"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_VIDEO_CALL"], array("user_id" => $arResult["User"]["ID"]));
$arResult["ALLOW_CREATE_GROUP"] = CSocNetUser::IsCurrentUserModuleAdmin() || $GLOBALS["APPLICATION"]->GetGroupRight("socialnetwork", false, "Y", "Y", array(SITE_ID, false)) >= "K";
if (!CModule::IncludeModule("video")) {
$arResult["CurrentUserPerms"]["Operations"]["videocall"] = false;
} elseif (!CVideo::CanUserMakeCall()) {
$arResult["CurrentUserPerms"]["Operations"]["videocall"] = false;
}
$arResult["IS_ONLINE"] = $arResult["User"]["IS_ONLINE"] == "Y";
if (CModule::IncludeModule('intranet')) {
$arResult['IS_HONOURED'] = CIntranetUtils::IsUserHonoured($arResult["User"]["ID"]);
$arResult['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arResult["User"]["ID"], $arParams['CALENDAR_USER_IBLOCK_ID']);
//departments and managers
$obCache = new CPHPCache();
$path = "/user_card_" . intval($arResult["User"]["ID"] / 100);
if ($arParams["CACHE_TIME"] == 0 || $obCache->StartDataCache($arParams["CACHE_TIME"], $arResult["User"]["ID"], $path)) {
if ($arParams["CACHE_TIME"] > 0 && defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_CARD_" . intval($arResult["User"]["ID"] / 100));
}
//departments
$arResult['DEPARTMENTS'] = array();
$dbRes = CIntranetUtils::GetSubordinateDepartmentsList($arResult["User"]["ID"]);
while ($arRes = $dbRes->GetNext()) {
$arRes['URL'] = str_replace('#ID#', $arRes['ID'], $arParams['PATH_TO_CONPANY_DEPARTMENT']);
$arResult['DEPARTMENTS'][$arRes['ID']] = $arRes;
$arResult['DEPARTMENTS'][$arRes['ID']]['EMPLOYEE_COUNT'] = 0;
示例5: Execute
public function Execute()
{
if (!CModule::IncludeModule("intranet")) {
$this->UserType = "random";
$this->SkipAbsent = "N";
}
$arUsers = array();
if ($this->UserType == "boss") {
if ($this->SkipAbsent != "Y" && $this->SkipAbsent != "N") {
$this->SkipAbsent = "N";
}
$arUsers = $this->GetUsersList($this->UserParameter, false);
if (count($arUsers) <= 0) {
$this->GetUser = null;
return CBPActivityExecutionStatus::Closed;
}
$userId = $arUsers[0];
$arUserDepartmentId = null;
$dbUser = CUser::GetByID($userId);
if ($arUser = $dbUser->Fetch()) {
if (isset($arUser["UF_DEPARTMENT"])) {
if (!is_array($arUser["UF_DEPARTMENT"])) {
$arUser["UF_DEPARTMENT"] = array($arUser["UF_DEPARTMENT"]);
}
foreach ($arUser["UF_DEPARTMENT"] as $v) {
$arUserDepartmentId[] = $v;
}
}
}
$arUserDepartments = array();
$departmentIBlockId = COption::GetOptionInt('intranet', 'iblock_structure');
foreach ($arUserDepartmentId as $departmentId) {
$ar = array();
$dbPath = CIBlockSection::GetNavChain($departmentIBlockId, $departmentId);
while ($arPath = $dbPath->GetNext()) {
$ar[] = $arPath["ID"];
}
$arUserDepartments[] = array_reverse($ar);
}
$arBoss = array();
foreach ($arUserDepartments as $arV) {
$maxLevel = $this->MaxLevel;
foreach ($arV as $level => $deptId) {
if ($maxLevel > 0 && $level + 1 > $maxLevel) {
break;
}
$dbRes = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $departmentIBlockId, 'ID' => $deptId), false, array('ID', 'UF_HEAD'));
while ($arRes = $dbRes->Fetch()) {
if ($arRes["UF_HEAD"] == $userId || intval($arRes["UF_HEAD"]) <= 0 || $this->SkipAbsent == "Y" && CIntranetUtils::IsUserAbsent($arRes["UF_HEAD"])) {
$maxLevel++;
continue;
}
if (!in_array($arRes["UF_HEAD"], $arBoss)) {
$arBoss[] = $arRes["UF_HEAD"];
}
}
}
}
$ar = array();
foreach ($arBoss as $v) {
$ar[] = "user_" . $v;
}
if (count($ar) == 0) {
$ar = null;
} elseif (count($ar) == 1) {
$ar = $ar[0];
}
if ($ar !== null) {
$this->GetUser = $ar;
return CBPActivityExecutionStatus::Closed;
}
} else {
if ($this->SkipAbsent != "Y" && $this->SkipAbsent != "N") {
$this->SkipAbsent = "Y";
}
$arUsers = $this->GetUsersList($this->UserParameter, $this->SkipAbsent == "Y");
if ($this->SkipAbsent == "Y") {
$arUsers = array_values($arUsers);
}
if (count($arUsers) > 0) {
$rnd = mt_rand(0, count($arUsers) - 1);
$this->GetUser = "user_" . $arUsers[$rnd];
return CBPActivityExecutionStatus::Closed;
}
}
$arReserveUsers = $this->GetUsersList($this->ReserveUserParameter, $this->SkipAbsent == "Y");
if (count($arReserveUsers) > 0) {
if ($this->UserType == 'random') {
$this->GetUser = 'user_' . $arReserveUsers[0];
} else {
foreach ($arReserveUsers as &$user) {
$user = 'user_' . $user;
}
unset($user);
$this->GetUser = $arReserveUsers;
}
}
return CBPActivityExecutionStatus::Closed;
}
示例6: foreach
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);
}
if ($bLoadDepartments && is_array($arUser['UF_DEPARTMENT']) && count($arUser['UF_DEPARTMENT']) > 0) {
if (array_key_exists('UF_DEPARTMENT', $arCacheData[$arUser['ID']])) {
$arUser['UF_DEPARTMENT'] = $arCacheData[$arUser['ID']]['UF_DEPARTMENT'];
} else {
示例7: array
}
if ($bLoadDepartments && is_array($arUser['UF_DEPARTMENT']) && count($arUser['UF_DEPARTMENT']) > 0) {
if (array_key_exists('UF_DEPARTMENT', $arCacheData[$arUser['ID']])) {
$arUser['UF_DEPARTMENT'] = $arCacheData[$arUser['ID']]['UF_DEPARTMENT'];
} else {
$arUser['UF_DEPARTMENT'] = $arCacheData[$arUser['ID']]['UF_DEPARTMENT'] = CIntranetUtils::GetDepartmentsData($arUser['UF_DEPARTMENT']);
}
}
$arResult['USERS'][$key] = $arUser;
}
}
if ($arParams['bCache']) {
$CACHE_MANAGER->EndTagCache();
$obCache->EndDataCache(array('TEMPLATE_DATA' => $arCacheData, 'USER_PROP' => $arResult['USER_PROP']));
}
if ($arResult['bUsersCached'] && strlen($strUserIDs) > 0) {
$dbRes = CUser::GetList($by = 'id', $order = 'asc', array('ID' => $strUserIDs, 'LAST_ACTIVITY' => 120));
while ($arRes = $dbRes->Fetch()) {
$arResult['USERS'][$arRes['ID']]['IS_ONLINE'] = true;
}
unset($dbRes);
}
foreach ($arResult['USERS'] as $USER_ID => $arUser) {
$arResult['USERS'][$USER_ID]['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($USER_ID);
}
if ($arParams['bAdmin']) {
global $INTRANET_TOOLBAR;
__IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
$INTRANET_TOOLBAR->AddButton(array('ONCLICK' => $APPLICATION->GetPopupLink(array('URL' => "/bitrix/admin/iblock_element_edit.php?type=" . CUtil::JSEscape($arParams['IBLOCK_TYPE']) . "&lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $arParams['IBLOCK_ID'] . "&bxpublic=Y&from_module=iblock", 'PARAMS' => array('height' => 500, 'width' => 700, 'resize' => false))), "TEXT" => GetMessage('INTR_ABSC_TPL_ADD_ENTRY'), "ICON" => 'add', "SORT" => 1000));
$INTRANET_TOOLBAR->AddButton(array('HREF' => "/bitrix/admin/iblock_element_admin.php?type=" . htmlspecialcharsbx($arParams['IBLOCK_TYPE']) . "&lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $arParams['IBLOCK_ID'], "TEXT" => GetMessage('INTR_ABSC_TPL_EDIT_ENTRIES'), 'ICON' => 'settings', "SORT" => 1100));
}
示例8: 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']));
}
}