本文整理汇总了PHP中CBPHelper::checkUserSubordination方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::checkUserSubordination方法的具体用法?PHP CBPHelper::checkUserSubordination怎么用?PHP CBPHelper::checkUserSubordination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPHelper
的用法示例。
在下文中一共展示了CBPHelper::checkUserSubordination方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
$arParams["TASK_ID"] = intval($arParams["TASK_ID"]);
if ($arParams["TASK_ID"] <= 0) {
$arParams["TASK_ID"] = intval($_REQUEST["TASK_ID"]);
}
if ($arParams["TASK_ID"] <= 0) {
$arParams["TASK_ID"] = intval($_REQUEST["task_id"]);
}
if (empty($arParams["USER_ID"]) && !empty($_REQUEST['USER_ID'])) {
$arParams["USER_ID"] = (int) $_REQUEST['USER_ID'];
}
$arParams["USER_ID"] = intval(empty($arParams["USER_ID"]) ? $currentUserId : $arParams["USER_ID"]);
$arResult["ShowMode"] = "Form";
$arResult['ReadOnly'] = false;
$arResult['IsComplete'] = false;
if ($arParams["USER_ID"] != $currentUserId) {
if (!$isAdmin && !CBPHelper::checkUserSubordination($currentUserId, $arParams["USER_ID"])) {
ShowError(GetMessage("BPAT_NO_ACCESS"));
return false;
}
$arResult["ShowMode"] = "Success";
$arResult['ReadOnly'] = true;
}
$arParams["WORKFLOW_ID"] = empty($arParams["WORKFLOW_ID"]) ? $_REQUEST["WORKFLOW_ID"] : $arParams["WORKFLOW_ID"];
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$arResult["backUrl"] = $_REQUEST["back_url"];
$arParams["TASK_EDIT_URL"] = trim($arParams["TASK_EDIT_URL"]);
if (empty($arParams["TASK_EDIT_URL"])) {
$arParams["TASK_EDIT_URL"] = $APPLICATION->GetCurPage() . "?PAGE_NAME=task_edit&ID=#ID#&back_url=" . urlencode($arResult["backUrl"]);
} else {
$arParams["TASK_EDIT_URL"] .= (strpos($arParams["TASK_EDIT_URL"], "?") === false ? "?" : "&") . "back_url=" . urlencode($arResult["backUrl"]);
}
示例2: array
}
$arResult["SORT"] = $gridSort["sort"];
$arResult["RECORDS"] = array();
if (!empty($_REQUEST['action_button_' . $arResult["GRID_ID"]]) && check_bitrix_sessid()) {
$action = $_REQUEST['action_button_' . $arResult["GRID_ID"]];
$ids = isset($_REQUEST['ID']) && is_array($_REQUEST['ID']) ? $_REQUEST['ID'] : null;
if (isset($_REQUEST['action_all_rows_' . $arResult["GRID_ID"]]) && $_REQUEST['action_all_rows_' . $arResult["GRID_ID"]] == 'Y') {
$ids = array();
}
if (is_array($ids)) {
if (strpos($action, 'set_status_') === 0) {
$status = substr($action, strlen('set_status_'));
CBPDocument::setTasksUserStatus($targetUserId, $status, $ids, $arResult['ERRORS']);
}
if ($action == 'delegate_to' && !empty($_REQUEST['ACTION_DELEGATE_TO_ID'])) {
if ($isAdmin || CBPHelper::checkUserSubordination($currentUserId, $_REQUEST['ACTION_DELEGATE_TO_ID'])) {
CBPDocument::delegateTasks($targetUserId, $_REQUEST['ACTION_DELEGATE_TO_ID'], $ids, $arResult['ERRORS']);
} else {
$arResult['ERRORS'][] = GetMessage('BPATL_ERROR_DELEGATE');
}
}
}
}
$dbRecordsList = CBPTaskService::GetList($gridSort["sort"], $arFilter, false, $gridOptions->GetNavParams(), $arSelectFields);
$arResult['IS_MY_TASKS'] = $currentUserId == $targetUserId;
$arResult['TARGET_USER_ID'] = (int) $targetUserId;
$useComments = (bool) CModule::IncludeModule("forum");
$workflows = array();
while ($arRecord = $dbRecordsList->getNext()) {
if ($useComments) {
$workflows[] = 'WF_' . $arRecord['WORKFLOW_ID'];
示例3: intval
}
$arParams["TASK_ID"] = intval($arParams["TASK_ID"]);
if ($arParams["TASK_ID"] <= 0) {
$arParams["TASK_ID"] = intval($_REQUEST["TASK_ID"]);
}
if ($arParams["TASK_ID"] <= 0) {
$arParams["TASK_ID"] = intval($_REQUEST["task_id"]);
}
if (empty($arParams["USER_ID"]) && !empty($_REQUEST['USER_ID'])) {
$arParams["USER_ID"] = (int) $_REQUEST['USER_ID'];
}
$arParams["USER_ID"] = intval(empty($arParams["USER_ID"]) ? $GLOBALS["USER"]->GetID() : $arParams["USER_ID"]);
$arResult["ShowMode"] = "Form";
$arResult['ReadOnly'] = false;
if ($arParams["USER_ID"] != $GLOBALS["USER"]->GetID()) {
if (!CBPHelper::checkUserSubordination($GLOBALS["USER"]->GetID(), $arParams["USER_ID"])) {
ShowError(GetMessage("BPAT_NO_ACCESS"));
return false;
}
$arResult["ShowMode"] = "Success";
$arResult['ReadOnly'] = true;
}
$arParams["WORKFLOW_ID"] = empty($arParams["WORKFLOW_ID"]) ? $_REQUEST["WORKFLOW_ID"] : $arParams["WORKFLOW_ID"];
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$arResult["backUrl"] = $_REQUEST["back_url"];
$arParams["TASK_EDIT_URL"] = trim($arParams["TASK_EDIT_URL"]);
if (empty($arParams["TASK_EDIT_URL"])) {
$arParams["TASK_EDIT_URL"] = $APPLICATION->GetCurPage() . "?PAGE_NAME=task_edit&ID=#ID#&back_url=" . urlencode($arResult["backUrl"]);
} else {
$arParams["TASK_EDIT_URL"] .= (strpos($arParams["TASK_EDIT_URL"], "?") === false ? "?" : "&") . "back_url=" . urlencode($arResult["backUrl"]);
}
示例4: substr
global $APPLICATION, $USER;
$SITE_ID = '';
if (isset($_REQUEST["SITE_ID"]) && is_string($_REQUEST["SITE_ID"])) {
$SITE_ID = substr(preg_replace("/[^a-z0-9_]/i", "", $_REQUEST["SITE_ID"]), 0, 2);
}
if ($SITE_ID != '') {
define("SITE_ID", $SITE_ID);
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
\Bitrix\Main\Localization\Loc::loadLanguageFile(__FILE__);
if (!check_bitrix_sessid() || !$USER->IsAuthorized()) {
die;
}
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'delegate') {
CModule::IncludeModule('bizproc');
$isAdmin = $USER->IsAdmin() || CModule::IncludeModule('bitrix24') && CBitrix24::IsPortalAdmin($USER->GetID());
$errors = array();
if (!empty($_REQUEST['task_id']) && !empty($_REQUEST['from_user_id']) && !empty($_REQUEST['to_user_id']) && ($isAdmin || CBPHelper::checkUserSubordination($USER->GetID(), $_REQUEST['to_user_id']))) {
if (!CBPDocument::delegateTasks($_REQUEST['from_user_id'], $_REQUEST['to_user_id'], $_REQUEST['task_id'], $errors)) {
$errors[] = GetMessage('BPAT_DELEGATE_NOTASKS');
}
} else {
$errors[] = GetMessage('BPAT_DELEGATE_ERROR');
}
$message = $errors ? $errors[0] : GetMessage('BPAT_DELEGATE_SUCCESS');
echo CUtil::PhpToJSObject(array('message' => $message, 'success' => empty($errors)));
} else {
$APPLICATION->ShowAjaxHead();
$APPLICATION->IncludeComponent('bitrix:intranet.user.selector.new', '.default', array('MULTIPLE' => 'N', 'NAME' => 'bp_task_delegate', 'SHOW_EXTRANET_USERS' => 'NONE', 'NAME_TEMPLATE' => COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), 'ON_SELECT' => 'BX.Bizproc.delegationOnSelect', 'SITE_ID' => SITE_ID), null, array('HIDE_ICONS' => 'Y'));
}
require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
示例5: define
/**
* Comments sandbox (iframe), for compatibility with Live Feed and BP task popup
*/
define("STOP_STATISTICS", true);
global $APPLICATION;
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if (!$GLOBALS["USER"]->IsAuthorized() || !check_bitrix_sessid() || !CModule::IncludeModule("bizproc")) {
die;
}
$taskId = isset($_REQUEST['TASK_ID']) ? (int) $_REQUEST['TASK_ID'] : 0;
$userId = isset($_REQUEST['USER_ID']) ? (int) $_REQUEST['USER_ID'] : 0;
if (!$userId) {
$userId = $GLOBALS['USER']->getId();
}
if ($userId != $GLOBALS["USER"]->getId()) {
if (!CBPHelper::checkUserSubordination($GLOBALS["USER"]->GetID(), $userId)) {
die;
}
}
$task = null;
if ($taskId > 0) {
$dbTask = CBPTaskService::GetList(array(), array("ID" => $taskId, "USER_ID" => $userId), false, false, array("ID", "WORKFLOW_ID"));
$task = $dbTask->fetch();
}
if (!$task) {
die;
}
$APPLICATION->RestartBuffer();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php
示例6: array
}
$arResult["SORT"] = $gridSort["sort"];
$arResult["RECORDS"] = array();
if (!empty($_REQUEST['action_button_' . $arResult["GRID_ID"]]) && check_bitrix_sessid()) {
$action = $_REQUEST['action_button_' . $arResult["GRID_ID"]];
$ids = isset($_REQUEST['ID']) && is_array($_REQUEST['ID']) ? $_REQUEST['ID'] : null;
if (isset($_REQUEST['action_all_rows_' . $arResult["GRID_ID"]]) && $_REQUEST['action_all_rows_' . $arResult["GRID_ID"]] == 'Y') {
$ids = array();
}
if (is_array($ids)) {
if (strpos($action, 'set_status_') === 0) {
$status = substr($action, strlen('set_status_'));
CBPDocument::setTasksUserStatus($arParams['USER_ID'], $status, $ids, $arResult['ERRORS']);
}
if ($action == 'delegate_to' && !empty($_REQUEST['ACTION_DELEGATE_TO_ID'])) {
if (CBPHelper::checkUserSubordination($arParams['USER_ID'], $_REQUEST['ACTION_DELEGATE_TO_ID'])) {
CBPDocument::delegateTasks($targetUserId, $_REQUEST['ACTION_DELEGATE_TO_ID'], $ids, $arResult['ERRORS']);
} else {
$arResult['ERRORS'][] = GetMessage('BPATL_ERROR_DELEGATE');
}
}
}
}
$dbRecordsList = CBPTaskService::GetList($gridSort["sort"], $arFilter, false, $gridOptions->GetNavParams(), $arSelectFields);
$arResult['IS_MY_TASKS'] = $arParams['USER_ID'] == $targetUserId;
$arResult['TARGET_USER_ID'] = (int) $targetUserId;
$useComments = (bool) CModule::IncludeModule("forum");
$workflows = array();
while ($arRecord = $dbRecordsList->getNext()) {
if ($useComments) {
$workflows[] = 'WF_' . $arRecord['WORKFLOW_ID'];
示例7: getTaskList
/**
* @param array $params Input params.
* @param int $n Offset.
* @param \CRestServer $server Rest server instance.
* @return array
* @throws AccessException
*/
public static function getTaskList($params, $n, $server)
{
global $USER;
self::checkAdminPermissions();
$params = array_change_key_case($params, CASE_UPPER);
$fields = array('ID' => 'ID', 'WORKFLOW_ID' => 'WORKFLOW_ID', 'DOCUMENT_NAME' => 'DOCUMENT_NAME', 'DESCRIPTION' => 'DESCRIPTION', 'NAME' => 'NAME', 'MODIFIED' => 'MODIFIED', 'WORKFLOW_STARTED' => 'WORKFLOW_STARTED', 'WORKFLOW_STARTED_BY' => 'WORKFLOW_STARTED_BY', 'OVERDUE_DATE' => 'OVERDUE_DATE', 'WORKFLOW_TEMPLATE_ID' => 'WORKFLOW_TEMPLATE_ID', 'WORKFLOW_TEMPLATE_NAME' => 'WORKFLOW_TEMPLATE_NAME', 'WORKFLOW_STATE' => 'WORKFLOW_STATE', 'STATUS' => 'STATUS', 'USER_ID' => 'USER_ID', 'USER_STATUS' => 'USER_STATUS', 'MODULE_ID' => 'MODULE_ID', 'ENTITY' => 'ENTITY', 'DOCUMENT_ID' => 'DOCUMENT_ID');
$select = static::getSelect($params['SELECT'], $fields, array('ID', 'WORKFLOW_ID', 'DOCUMENT_NAME', 'NAME'));
$select = array_merge(array('MODULE', 'ENTITY', 'DOCUMENT_ID'), $select);
$filter = static::getFilter($params['FILTER'], $fields);
$order = static::getOrder($params['ORDER'], $fields);
$currentUserId = (int) $USER->getId();
$targetUserId = isset($filter['USER_ID']) ? (int) $filter['USER_ID'] : 0;
if ($targetUserId !== $currentUserId && !\CBPHelper::checkUserSubordination($currentUserId, $targetUserId)) {
self::checkAdminPermissions();
}
$iterator = \CBPTaskService::getList($order, $filter, false, static::getNavData($n), $select);
$result = array();
while ($row = $iterator->fetch()) {
if (isset($row['MODIFIED'])) {
$row['MODIFIED'] = \CRestUtil::convertDateTime($row['MODIFIED']);
}
if (isset($row['WORKFLOW_STARTED'])) {
$row['WORKFLOW_STARTED'] = \CRestUtil::convertDateTime($row['WORKFLOW_STARTED']);
}
if (isset($row['OVERDUE_DATE'])) {
$row['OVERDUE_DATE'] = \CRestUtil::convertDateTime($row['OVERDUE_DATE']);
}
$row['DOCUMENT_URL'] = \CBPDocument::getDocumentAdminPage(array($row['MODULE_ID'], $row['ENTITY'], $row['DOCUMENT_ID']));
$result[] = $row;
}
return $result;
}
示例8: define
* Comments sandbox (iframe), for compatibility with Live Feed and BP task popup
*/
define("STOP_STATISTICS", true);
global $USER, $APPLICATION;
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if (!$USER->IsAuthorized() || !check_bitrix_sessid() || !CModule::IncludeModule("bizproc")) {
die;
}
$taskId = isset($_REQUEST['TASK_ID']) ? (int) $_REQUEST['TASK_ID'] : 0;
$userId = isset($_REQUEST['USER_ID']) ? (int) $_REQUEST['USER_ID'] : 0;
if (!$userId) {
$userId = $USER->getId();
}
if ($userId != $USER->getId()) {
$isAdmin = $USER->IsAdmin() || CModule::IncludeModule('bitrix24') && CBitrix24::IsPortalAdmin($USER->GetID());
if (!$isAdmin && !CBPHelper::checkUserSubordination($USER->GetID(), $userId)) {
die;
}
}
$task = null;
if ($taskId > 0) {
$dbTask = CBPTaskService::GetList(array(), array("ID" => $taskId, "USER_ID" => $userId), false, false, array("ID", "WORKFLOW_ID"));
$task = $dbTask->fetch();
}
if (!$task) {
die;
}
$APPLICATION->RestartBuffer();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php