Current Path : /home/bitrix/ext_www/school1535.yacl.site/local/ajax/ |
Current File : /home/bitrix/ext_www/school1535.yacl.site/local/ajax/getHead.php |
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); $userId = intval($_POST['userId']); $userDepartment = getUserInfoById($userId, ['UF_DEPARTMENT'])['UF_DEPARTMENT']; $deps = CIntranetUtils::GetDepartmentManager($userDepartment, $userId, true); $headInfo = current($deps); $head = $headInfo['ID']; $fullHeadName = $headInfo['LAST_NAME'] . ' ' . $headInfo['NAME']; // $head = getDepartmentHead($userDepartment); // if ($head) { // $headInfo = getUserInfoById($head); // $fullHeadName = $headInfo['LAST_NAME'] . ' ' . $headInfo['NAME']; // } $answer = [ 'success' => true, 'id' => $head ? $head : '', 'fullName' => $head ? $fullHeadName : 'не найден' ]; echo json_encode($answer);