本文整理汇总了PHP中CIntranetUtils::GetSubordinateEmployees方法的典型用法代码示例。如果您正苦于以下问题:PHP CIntranetUtils::GetSubordinateEmployees方法的具体用法?PHP CIntranetUtils::GetSubordinateEmployees怎么用?PHP CIntranetUtils::GetSubordinateEmployees使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIntranetUtils
的用法示例。
在下文中一共展示了CIntranetUtils::GetSubordinateEmployees方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSubUsers
private static function getSubUsers($userId)
{
static $arSubUsersIdsCache = array();
if (!isset($arSubUsersIdsCache[$userId])) {
$arSubUsersIds = array();
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$rsSubUsers = CIntranetUtils::GetSubordinateEmployees($userId, $bRecursive = true, $bSkipSelf = false, $onlyActive = 'Y');
while ($ar = $rsSubUsers->fetch()) {
$arSubUsersIds[] = (int) $ar['ID'];
}
$arSubUsersIdsCache[$userId] = $arSubUsersIds;
}
return $arSubUsersIdsCache[$userId];
}
示例2: intval
$arFields['DEADLINE'] = $_REQUEST['AGENDA_DEADLINE'][$key];
if (isset($_REQUEST['AGENDA_TYPE'][$key])) {
$arFields['INSTANCE_TYPE'] = $_REQUEST['AGENDA_TYPE'][$key] == CMeetingInstance::TYPE_TASK ? CMeetingInstance::TYPE_TASK : CMeetingInstance::TYPE_AGENDA;
}
if ($bNew) {
$arFields['ORIGINAL_TYPE'] = $_REQUEST['AGENDA_ORIGINAL'][$key] == CMeetingInstance::TYPE_TASK ? CMeetingInstance::TYPE_TASK : CMeetingInstance::TYPE_AGENDA;
}
if (isset($_REQUEST['AGENDA_PARENT'][$key])) {
$arFields['INSTANCE_PARENT_ID'] = intval($_REQUEST['AGENDA_PARENT'][$key]);
}
if ($_REQUEST['AGENDA_TASK'][$key] && !$arResult['MEETING']['AGENDA'][$key]['TASK_ID']) {
$TASK_ID = intval($_REQUEST['AGENDA_TASK'][$key]);
if ($TASK_ID <= 0) {
if ($arEmplIDs === null) {
$arEmplIDs = array();
$dbEmpl = CIntranetUtils::GetSubordinateEmployees($arResult['MEETING']['OWNER_ID'], true);
while ($arEmpl = $dbEmpl->Fetch()) {
$arEmplIDs[$arEmpl['ID']] = true;
}
}
$taskDeadline = '';
// Skip invalid deadline
if (isset($arFields['DEADLINE']) && MakeTimeStamp($arFields['DEADLINE']) > 0) {
$taskDeadline = $arFields['DEADLINE'];
}
$responsibleId = $arFields['RESPONSIBLE'][0];
$arTaskFields = array('RESPONSIBLE_ID' => $responsibleId > 0 ? $responsibleId : $USER->GetID(), 'TITLE' => strlen($arFields['TITLE']) > 0 ? $arFields['TITLE'] : $arResult['MEETING']['AGENDA'][$key]['TITLE'], 'DEADLINE' => $taskDeadline, 'TAGS' => array(), 'STATUS' => array_key_exists($arFields['RESPONSIBLE'][0], $arEmplIDs) ? 2 : 1, 'SITE_ID' => SITE_ID);
if ($arResult['MEETING']['OWNER_ID'] && $arResult['MEETING']['OWNER_ID'] != $USER->GetID()) {
$arTaskFields['CREATED_BY'] = $arResult['MEETING']['OWNER_ID'];
$arTaskFields['AUDITORS'] = array($USER->GetID());
}
示例3: trim
}
if (strlen($arParams["NAME_TEMPLATE"]) <= 0) {
$arParams["NAME_TEMPLATE"] = CSite::GetNameFormat();
}
$arParams['PAGER_TITLE'] = trim($arParams['PAGER_TITLE']);
if (strlen($arParams['PAGER_TITLE']) <= 0) {
$arParams['PAGER_TITLE'] = GetMessage('ML_PAGER_TITLE');
}
$arResult['MEETINGS'] = array();
$arResult['USERS'] = array();
$arUserIDs = array($arParams['USER_ID']);
CPageOption::SetOptionString("main", "nav_page_in_session", "N");
$arNavParams = array("nPageSize" => $arParams["MEETINGS_COUNT"], "bDescPageNumbering" => false, "bShowAll" => false);
$arSubIDs = array($USER->GetID());
$arResult['SUB_EMPLOYEES'] = array();
$dbUsers = CIntranetUtils::GetSubordinateEmployees($arParams['USER_ID'], true);
while ($arUser = $dbUsers->Fetch()) {
$arSubIDs[] = $arUser['ID'];
$arResult['SUB_EMPLOYEES'][$arUser['ID']] = $arUser;
}
$arResult['IS_HEAD'] = count($arSubIDs) > 0;
$arFilter = array("USER_ID" => $arParams['USER_ID']);
$arResult['FILTER'] = array('MY' => true);
if ($_REQUEST['FILTER']) {
$arFilterValues = $_REQUEST['FILTER'];
if ($arResult['IS_HEAD'] && !isset($arFilterValues['MY'])) {
$arResult['FILTER'] = array();
$arFilter['USER_ID'] = $arSubIDs;
}
if (isset($arFilterValues['TITLE']) && strlen(trim($arFilterValues['TITLE'])) > 0) {
$arResult['FILTER']['TITLE'] = $arFilterValues['TITLE'];
示例4: GetAccess
public static function GetAccess()
{
global $USER;
// simplest caching. is it enough? maybe...
static $access = null;
if (!is_array($access)) {
$access = array('READ' => array(), 'WRITE' => array());
$arAccessSettings = null;
if ($USER->CanDoOperation('tm_read')) {
$access['READ'][] = '*';
} elseif ($USER->CanDoOperation('tm_read_subordinate')) {
$arAccessSettings = self::GetAccessSettings();
if ($arAccessSettings['READ']['EMPLOYEE'] >= 2) {
$access['READ'][] = '*';
} else {
// everybody can read his own entries
$access['READ'][] = $USER->GetID();
if ($arAccessSettings['READ']['EMPLOYEE'] >= 1) {
$dbUsers = CIntranetUtils::GetDepartmentColleagues();
while ($arRes = $dbUsers->Fetch()) {
$access['READ'][] = $arRes['ID'];
}
}
$dbUsers = CIntranetUtils::GetSubordinateEmployees($USER->GetID(), $arAccessSettings['READ']['HEAD'] == 1);
while ($arRes = $dbUsers->Fetch()) {
if ($arAccessSettings['READ']['HEAD'] == 2) {
$access['READ'] = array('*');
break;
}
$access['READ'][] = $arRes['ID'];
}
$access['READ'] = array_values(array_unique($access['READ']));
}
}
if ($USER->CanDoOperation('tm_write')) {
$access['WRITE'][] = '*';
} elseif ($USER->CanDoOperation('tm_write_subordinate')) {
if ($arAccessSettings['WRITE']['EMPLOYEE'] >= 2) {
$access['WRITE'][] = '*';
} else {
// check if current user is The Boss.
$arManagers = self::GetUserManagers($USER->GetID());
if (count($arManagers) == 1 && $arManagers[0] == $USER->GetID()) {
$access['WRITE'][] = $USER->GetID();
}
if (!is_array($arAccessSettings)) {
$arAccessSettings = self::GetAccessSettings();
}
$dbUsers = CIntranetUtils::GetSubordinateEmployees($USER->GetID(), $arAccessSettings['WRITE']['HEAD'] == 1);
while ($arRes = $dbUsers->Fetch()) {
$access['WRITE'][] = $arRes['ID'];
}
$access['WRITE'] = array_values(array_unique($access['WRITE']));
}
}
}
return $access;
}
示例5: GetUserRole
public static function GetUserRole($ID, $USER_ID = false, $bCheckHead = true)
{
global $DB, $USER;
$role = false;
$ID = intval($ID);
$USER_ID = intval($USER_ID);
if ($ID > 0) {
if ($USER_ID <= 0) {
$USER_ID = $USER->GetID();
}
$sqlFilter = "AND USER_ID='" . $USER_ID . "'";
if ($bCheckHead) {
$arSubIDs = array($USER_ID);
$dbUsers = CIntranetUtils::GetSubordinateEmployees($USER_ID, true);
while ($arUser = $dbUsers->Fetch()) {
$arSubIDs[] = $arUser['ID'];
}
$sqlFilter = "AND USER_ID IN ('" . implode("', '", $arSubIDs) . "')";
}
$dbRes = $DB->Query("SELECT USER_ID, USER_ROLE FROM b_meeting_users WHERE MEETING_ID='" . $ID . "' " . $sqlFilter);
if ($bCheckHead) {
while ($arRes = $dbRes->Fetch()) {
$role = CMeeting::ROLE_HEAD;
if ($arRes['USER_ID'] == $USER_ID) {
$role = $arRes['USER_ROLE'];
break;
}
}
} else {
if ($arRes = $dbRes->Fetch()) {
$role = $arRes['USER_ROLE'];
}
}
}
return $role;
}