本文整理汇总了PHP中CBPDocument::CanUserOperateDocumentType方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::CanUserOperateDocumentType方法的具体用法?PHP CBPDocument::CanUserOperateDocumentType怎么用?PHP CBPDocument::CanUserOperateDocumentType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPDocument
的用法示例。
在下文中一共展示了CBPDocument::CanUserOperateDocumentType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
if (strlen($sLastFolder) > 0) {
$aContext[] = array(
"TEXT" => GetMessage("IBEL_A_UP"),
"LINK" => CIBlock::GetAdminElementListLink($IBLOCK_ID, array(
'find_section_section' => $lastSectionId[count($lastSectionId) - 2],
)),
"LINK_PARAM" => "",
"TITLE" => GetMessage("IBEL_A_UP_TITLE"),
);
}
if ($bBizproc && IsModuleInstalled("bizprocdesigner")) {
$bCanDoIt = CBPDocument::CanUserOperateDocumentType(
CBPCanUserOperateOperation::CreateWorkflow, $USER->GetID(), array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID)
);
if ($bCanDoIt) {
$aContext[] = array(
"TEXT" => GetMessage("IBEL_BTN_BP"),
"LINK" => 'iblock_bizproc_workflow_admin.php?document_type=iblock_' . $IBLOCK_ID . '&lang=' . LANGUAGE_ID . '&back_url_list=' . urlencode($REQUEST_URI),
"LINK_PARAM" => "",
);
}
}
$lAdmin->AddAdminContextMenu($aContext);
$lAdmin->CheckListMode();
示例2: array
********************************************************************/
$arError = array();
if (strlen($arParams["MODULE_ID"]) <= 0) {
$arError[] = array("id" => "empty_module_id", "text" => GetMessage("BPATT_NO_MODULE_ID"));
}
if (strlen($arParams["STORAGE_ID"]) <= 0) {
$arError[] = array("id" => "empty_document_id", "text" => GetMessage("BPATT_NO_DOCUMENT_TYPE"));
}
$documentData = array('DISK' => array('DOCUMENT_TYPE' => \Bitrix\Disk\BizProcDocument::generateDocumentComplexType($arParams["STORAGE_ID"])), 'WEBDAV' => array('DOCUMENT_TYPE' => \Bitrix\Disk\BizProcDocumentCompatible::generateDocumentComplexType($arParams["STORAGE_ID"])));
$arResult["STORAGE_ID"] = \Bitrix\Disk\BizProcDocument::generateDocumentType($arParams["STORAGE_ID"]);
$arParams["USER_GROUPS"] = $GLOBALS["USER"]->GetUserGroupArray();
if (method_exists($arParams["DOCUMENT_TYPE"][1], "GetUserGroups")) {
$arParams["USER_GROUPS"] = call_user_func_array(array($arParams["ENTITY"], "GetUserGroups"), array($documentData['DISK']['DOCUMENT_TYPE'], $arResult["STORAGE_ID"], $GLOBALS["USER"]->GetID()));
}
if (empty($arError)) {
if (!CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), $documentData['DISK']['DOCUMENT_TYPE'], array("UserGroups" => $arParams["USER_GROUPS"]))) {
$arError[] = array("id" => "access_denied", "text" => GetMessage("BPATT_NO_PERMS"));
}
}
if (!empty($arError)) {
$e = new CAdminException($arError);
ShowError($e->GetString());
return false;
} elseif ($_REQUEST['action'] == 'create_default') {
CBPDocument::AddDefaultWorkflowTemplates($documentData['DISK']['DOCUMENT_TYPE']);
LocalRedirect($APPLICATION->GetCurPageParam("", array("action", "sessid")));
} elseif ($_REQUEST['action'] == 'delete') {
$arErrorsTmp = array();
foreach ($documentData as $nameModule => $data) {
$dbRes = CBPWorkflowTemplateLoader::GetList(array($by => $order), array("DOCUMENT_TYPE" => $data["DOCUMENT_TYPE"], "ID" => $_REQUEST["ID"]), false, false, array("ID"));
$availabilityTemplate = $dbRes->Fetch();
示例3: trim
$editPage = EDIT_PAGE;
}
$documentType = trim($_REQUEST["document_type"]);
$backUrl = "/" . ltrim(trim($_REQUEST["back_url_list"]), "\\/");
if (strlen($entity) <= 0) {
$fatalErrorMessage .= GetMessage("BPATT_NO_ENTITY") . ". ";
}
if (strlen($documentType) <= 0) {
$fatalErrorMessage .= GetMessage("BPATT_NO_DOC_TYPE") . ". ";
}
if (strlen($editPage) <= 0) {
$fatalErrorMessage .= GetMessage("BPATT_NO_EDIT_PAGE") . ". ";
}
if (strlen($fatalErrorMessage) <= 0) {
$documentType = array($moduleId, $entity, $documentType);
$bCanUserWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), $documentType, array("UserGroups" => $GLOBALS["USER"]->GetUserGroupArray()));
if (!$bCanUserWrite) {
$fatalErrorMessage .= GetMessage("BPATT_NO_PERMS") . ". ";
}
}
if (strlen($fatalErrorMessage) > 0) {
$APPLICATION->SetTitle(GetMessage("BPATT_ERROR"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
echo ShowError($fatalErrorMessage);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
$sTableID = "tbl_bizproc_workflow_templates";
$oSort = new CAdminSorting($sTableID, "ID", "DESC");
$lAdmin = new CAdminList($sTableID, $oSort);
$arFilterFields = array("filter_name", "filter_autoexecute");
示例4: array
$listProcesses = array();
$backUrl = $APPLICATION->GetCurPageParam();
foreach ($documentStates as $documentState) {
if (!$documentState["ID"]) {
continue;
}
$actionsProcess = array();
$canViewWorkflow = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), BizProcDocument::getDocumentComplexId($arIBlock["IBLOCK_TYPE_ID"], $data["ID"]), array("AllUserGroups" => $currentUserGroups, "DocumentStates" => $documentStates, "WorkflowId" => $documentState["ID"]));
if ($canViewWorkflow) {
/* Stop workflow */
if (strlen($documentState["ID"]) && CIBlockElementRights::UserHasRightTo($arIBlock["ID"], $data["ID"], "element_rights_edit") && strlen($documentState["WORKFLOW_STATUS"])) {
$actionsProcess[] = array("TEXT" => GetMessage("CT_BLL_BIZPROC_STOP"), "ONCLICK" => "javascript:BX['ListClass_" . $arResult["RAND_STRING"] . "']\n\t\t\t\t\t\t\t\t.performActionBp('" . $documentState['ID'] . "', " . $data["ID"] . ", 'stop');");
}
/* Removal workflow */
if (strlen($documentState["STATE_NAME"]) && strlen($documentState["ID"])) {
if (CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), BizProcDocument::getDocumentComplexId($arIBlock["IBLOCK_TYPE_ID"], $data["ID"]), array("UserGroups" => $currentUserGroups))) {
$actionsProcess[] = array("TEXT" => GetMessage("CT_BLL_BIZPROC_DELETE"), "ONCLICK" => "javascript:BX['ListClass_" . $arResult["RAND_STRING"] . "']\n\t\t\t\t\t\t\t\t.performActionBp('" . $documentState['ID'] . "', " . $data["ID"] . ", 'delete');");
}
}
/* Tasks workflow */
if (strlen($documentState["ID"])) {
$tasks = CBPDocument::getUserTasksForWorkflow($GLOBALS["USER"]->GetID(), $documentState["ID"]);
if (!empty($tasks)) {
foreach ($tasks as $task) {
$url = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#task_id#", "#group_id#"), array($arIBlock["ID"], intval($arResult["SECTION_ID"]), $data["ID"], $task["ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~BIZPROC_TASK_URL"]), array("back_url" => $backUrl), array("skip_empty" => true, "encode" => true));
$actionsProcess[] = array("TEXT" => $task["NAME"], "ONCLICK" => "jsUtils.Redirect(arguments, '" . CUtil::JSEscape($url) . "')");
}
}
}
if (!empty($actionsProcess)) {
$listProcesses[] = array("TEXT" => $documentState["TEMPLATE_NAME"] . " (" . $documentState["STARTED"] . ")", "MENU" => $actionsProcess);
示例5: array
// Dont display activities in INTERNAL mode.
if (!$bInternal) {
$arResult['HEADERS'][] = array('id' => 'ACTIVITY_ID', 'name' => GetMessage('CRM_COLUMN_ACTIVITY'), 'sort' => 'nearest_activity', 'default' => true);
}
$arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'CONTACT_COMPANY', 'name' => GetMessage('CRM_COLUMN_CONTACT_COMPANY_INFO'), 'sort' => 'company_title', 'default' => true, 'editable' => false), array('id' => 'PHOTO', 'name' => GetMessage('CRM_COLUMN_PHOTO'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'NAME', 'name' => GetMessage('CRM_COLUMN_NAME'), 'sort' => 'name', 'default' => false, 'editable' => true, 'class' => 'username'), array('id' => 'LAST_NAME', 'name' => GetMessage('CRM_COLUMN_LAST_NAME'), 'sort' => 'last_name', 'default' => false, 'editable' => true, 'class' => 'username'), array('id' => 'SECOND_NAME', 'name' => GetMessage('CRM_COLUMN_SECOND_NAME'), 'sort' => 'second_name', 'default' => false, 'editable' => true, 'class' => 'username'), array('id' => 'BIRTHDATE', 'name' => GetMessage('CRM_COLUMN_BIRTHDATE'), 'sort' => 'BIRTHDATE', 'default' => false, 'editable' => true, 'type' => 'date'), array('id' => 'POST', 'name' => GetMessage('CRM_COLUMN_POST'), 'sort' => 'post', 'default' => false, 'editable' => true), array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_COLUMN_COMPANY_ID'), 'sort' => 'company_title', 'default' => false, 'editable' => false), array('id' => 'TYPE_ID', 'name' => GetMessage('CRM_COLUMN_TYPE'), 'sort' => 'type_id', 'default' => false, 'editable' => array('items' => CCrmStatus::GetStatusList('CONTACT_TYPE')), 'type' => 'list')));
$CCrmFieldMulti->PrepareListHeaders($arResult['HEADERS']);
if ($isInExportMode) {
$CCrmFieldMulti->ListAddHeaders($arResult['HEADERS']);
}
$arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'ASSIGNED_BY', 'name' => GetMessage('CRM_COLUMN_ASSIGNED_BY'), 'sort' => 'assigned_by', 'default' => true, 'editable' => false, 'class' => 'username'), array('id' => 'FULL_ADDRESS', 'name' => EntityAddress::getFullAddressLabel(), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'ADDRESS', 'name' => $addressLabels['ADDRESS'], 'sort' => 'address', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_2', 'name' => $addressLabels['ADDRESS_2'], 'sort' => 'address_2', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_CITY', 'name' => $addressLabels['CITY'], 'sort' => 'address_city', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_REGION', 'name' => $addressLabels['REGION'], 'sort' => 'address_region', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_PROVINCE', 'name' => $addressLabels['PROVINCE'], 'sort' => 'address_province', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_POSTAL_CODE', 'name' => $addressLabels['POSTAL_CODE'], 'sort' => 'address_postal_code', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_COUNTRY', 'name' => $addressLabels['COUNTRY'], 'sort' => 'address_country', 'default' => false, 'editable' => false), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_COLUMN_COMMENTS'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'SOURCE_ID', 'name' => GetMessage('CRM_COLUMN_SOURCE'), 'sort' => 'source_id', 'default' => false, 'editable' => array('items' => CCrmStatus::GetStatusList('SOURCE')), 'type' => 'list'), array('id' => 'SOURCE_DESCRIPTION', 'name' => GetMessage('CRM_COLUMN_SOURCE_DESCRIPTION'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'EXPORT', 'name' => GetMessage('CRM_COLUMN_EXPORT'), 'type' => 'checkbox', 'default' => false, 'editable' => true), array('id' => 'CREATED_BY', 'name' => GetMessage('CRM_COLUMN_CREATED_BY'), 'sort' => 'created_by', 'default' => false, 'editable' => false, 'class' => 'username'), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'sort' => 'date_create', 'default' => false, 'class' => 'date'), array('id' => 'MODIFY_BY', 'name' => GetMessage('CRM_COLUMN_MODIFY_BY'), 'sort' => 'modify_by', 'default' => false, 'editable' => false, 'class' => 'username'), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'sort' => 'date_modify', 'default' => false, 'class' => 'date')));
$CCrmUserType->ListAddHeaders($arResult['HEADERS']);
if (IsModuleInstalled('bizproc')) {
$arBPData = CBPDocument::GetWorkflowTemplatesForDocumentType(array('crm', 'CCrmDocumentContact', 'CONTACT'));
$arDocumentStates = CBPDocument::GetDocumentStates(array('crm', 'CCrmDocumentContact', 'CONTACT'), null);
foreach ($arBPData as $arBP) {
if (!CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::StartWorkflow, $userID, array('crm', 'CCrmDocumentContact', 'CONTACT'), array('UserGroups' => $CCrmBizProc->arCurrentUserGroups, 'DocumentStates' => $arDocumentStates, 'WorkflowTemplateId' => $arBP['ID'], 'UserIsAdmin' => $isAdmin, 'CRMPermission' => $arResult['PERMS']['READ']))) {
continue;
}
$arResult['HEADERS'][] = array('id' => 'BIZPROC_' . $arBP['ID'], 'name' => $arBP['NAME'], 'sort' => false, 'default' => false, 'editable' => false);
}
}
unset($arHeader);
// <-- Headers initialization
// Try to extract user action data -->
// We have to extract them before call of CGridOptions::GetFilter() overvise the custom filter will be corrupted.
$actionData = array('METHOD' => $_SERVER['REQUEST_METHOD'], 'ACTIVE' => false);
if (check_bitrix_sessid()) {
$postAction = 'action_button_' . $arResult['GRID_ID'];
$getAction = 'action_' . $arResult['GRID_ID'];
if ($actionData['METHOD'] == 'POST' && isset($_POST[$postAction])) {
$actionData['ACTIVE'] = true;
示例6: die
<?php
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
CModule::IncludeModule('bizproc');
global $APPLICATION;
if (!check_bitrix_sessid()) {
die;
}
if (!CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), $_REQUEST['document_type'])) {
die;
}
CUtil::DecodeUriComponent($_REQUEST);
$activityType = $_REQUEST['activity'];
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$arActivityDescription = $runtime->GetActivityDescription($activityType);
if ($arActivityDescription == null) {
die("Bad activity type!" . htmlspecialcharsbx($activityType));
}
$runtime->IncludeActivityFile($activityType);
$isHtml = !empty($_REQUEST['content_type']) && $_REQUEST['content_type'] == 'html';
if ($isHtml) {
$APPLICATION->ShowAjaxHead();
}
$res = CBPActivity::CallStaticMethod($activityType, "getAjaxResponse", array($_REQUEST));
echo $isHtml ? $res : CUtil::PhpToJSObject($res);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
示例7: htmlspecialcharsex
$arResult["CAN_ADD_ELEMENT"] = !$arResult["IS_SOCNET_GROUP_CLOSED"] && ($lists_perm > CListPermissions::CAN_READ || CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $section_id, "section_element_bind"));
$arResult["CAN_EDIT_SECTIONS"] = !$arResult["IS_SOCNET_GROUP_CLOSED"] && ($lists_perm >= CListPermissions::CAN_WRITE || CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $section_id, "section_edit") || CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $section_id, "section_section_bind"));
$arResult["IBLOCK_PERM"] = $lists_perm;
$arResult["USER_GROUPS"] = $USER->GetUserGroupArray();
$arIBlock = CIBlock::GetArrayByID(intval($arParams["~IBLOCK_ID"]));
$arResult["~IBLOCK"] = $arIBlock;
$arResult["IBLOCK"] = htmlspecialcharsex($arIBlock);
$arResult["IBLOCK_ID"] = $arIBlock["ID"];
$arResult["PROCESSES"] = false;
$arResult["USE_COMMENTS"] = false;
if ($arParams["IBLOCK_TYPE_ID"] == COption::GetOptionString("lists", "livefeed_iblock_type_id")) {
$arResult["USE_COMMENTS"] = (bool) CModule::includeModule("forum");
$arResult["PROCESSES"] = true;
}
if ($arResult["IBLOCK"]["BIZPROC"] == "Y" && CModule::IncludeModule('bizproc')) {
$arParams["CAN_EDIT_BIZPROC"] = !$arResult["IS_SOCNET_GROUP_CLOSED"] && CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $USER->GetID(), BizprocDocument::generateDocumentComplexType($arParams["IBLOCK_TYPE_ID"], $IBLOCK_ID), array("UserGroups" => $USER->GetUserGroupArray()));
}
if (isset($arParams["SOCNET_GROUP_ID"]) && $arParams["SOCNET_GROUP_ID"] > 0) {
$arParams["SOCNET_GROUP_ID"] = intval($arParams["SOCNET_GROUP_ID"]);
} else {
$arParams["SOCNET_GROUP_ID"] = "";
}
$arResult["GRID_ID"] = "lists_list_elements_" . $arResult["IBLOCK_ID"];
$arResult["ANY_SECTION"] = isset($_GET["list_section_id"]) && strlen($_GET["list_section_id"]) == 0;
$arResult["SECTION"] = false;
$arResult["SECTION_ID"] = false;
$arResult["PARENT_SECTION_ID"] = false;
$arResult["SECTIONS"] = array();
$arResult["LIST_SECTIONS"] = array("0" => GetMessage("CC_BLL_UPPER_LEVEL"));
$arResult["~LIST_SECTIONS"] = array("0" => GetMessage("CC_BLL_UPPER_LEVEL"));
$arResult["SECTION_PATH"] = array();
示例8: intval
die;
}
if (!CModule::IncludeModule("bizproc")) {
return false;
}
if (!$GLOBALS["USER"]->IsAuthorized()) {
$GLOBALS["APPLICATION"]->AuthForm(GetMessage("ACCESS_DENIED"));
die;
}
$arParams["ID"] = intval($arParams["ID"]);
$arTemplate = null;
$canWrite = false;
if ($arParams["ID"] > 0) {
$dbTemplatesList = CBPWorkflowTemplateLoader::GetList(array(), array("ID" => $arParams["ID"]), false, false, array("ID", "DOCUMENT_TYPE", "NAME", "VARIABLES"));
if ($arTemplate = $dbTemplatesList->Fetch()) {
$canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), $arTemplate["DOCUMENT_TYPE"]);
$arResult["DOCUMENT_TYPE"] = $arTemplate["DOCUMENT_TYPE"];
$arResult["NAME"] = $arTemplate["NAME"];
$arResult["VARIABLES"] = $arTemplate["VARIABLES"];
$arResult["ID"] = $arTemplate["ID"];
}
}
if (!is_array($arTemplate) || !$canWrite) {
$GLOBALS["APPLICATION"]->AuthForm(GetMessage("ACCESS_DENIED"));
die;
}
$arParams["SET_TITLE"] = $arParams["SET_TITLE"] == "N" ? "N" : "Y";
$arParams["SET_NAV_CHAIN"] = $arParams["SET_NAV_CHAIN"] == "N" ? "N" : "Y";
$arResult['LIST_PAGE_URL'] = $arParams['LIST_PAGE_URL'];
$arResult["EDIT_PAGE_TEMPLATE"] = $arParams["EDIT_PAGE_TEMPLATE"];
$arResult["BackUrl"] = $_REQUEST["back_url"];
示例9: CheckWebRights
function CheckWebRights($method = "", $arParams = array(), $simple = true)
{
if ($this->withoutAuthorization) {
return true;
}
$strong = $method !== "";
$path = '';
if (is_array($arParams['arElement'])) {
$path = isset($arParams['arElement']['item_id']) ? $arParams['arElement']['item_id'] : '';
} elseif (is_string($arParams['arElement'])) {
$path = $arParams['arElement'];
}
$result = $this->CheckRights($method, $strong, $path);
if (!$result || $simple) {
return $result;
}
$arError = array();
$action = strtolower(is_set($arParams, "action") ? $arParams["action"] : $arParams["ACTION"]);
$arElement = is_set($arParams, "arElement") ? $arParams["arElement"] : array();
static $arErrors = array();
$static_id = md5(serialize(array($action, $arElement["ID"], $GLOBALS["USER"]->GetID())));
if (array_key_exists($static_id, $arErrors)) {
$arError = $arErrors[$static_id];
} else {
if ($this->e_rights) {
foreach (array('arElement', 'from', 'to') as $elm) {
if (is_set($arParams, $elm)) {
if ((!isset($arParams[$elm]['not_found']) || $arParams[$elm]['not_found'] === true) && !in_array($action, array('create', 'copy', 'move', 'mkcol'))) {
$arError[] = array("id" => "bad_element", "text" => GetMessage("WD_FILE_ERROR105"));
}
}
}
if (empty($arError)) {
if ($action == 'copy') {
//from[]
//to[]
$arTo = isset($arParams['to']) ? $arParams['to'] : array();
$arFrom = isset($arParams['from']) ? $arParams['from'] : array();
$nCount = min(sizeof($arTo), sizeof($arFrom));
for ($i = 0; $i < $nCount; $i++) {
$To = $arTo[$i];
$From = $arFrom[$i];
$type = $To['is_file'] ? 'ELEMENT' : 'SECTION';
$id = $To['not_found'] ? $To['parent_id'] : $To['item_id'];
$op = $From['is_file'] ? 'section_element_bind' : 'section_section_bind';
if (!$this->GetPermission($type, $id, $op)) {
$arError[] = array("id" => "", "text" => GetMessage("WD_ACCESS_DENIED"));
}
}
} elseif ($action == 'create' || $action == 'mkcol') {
//arElement
//null
if (empty($arElement)) {
$arParent = $this->GetObject();
$bAllowEdit = false;
if ($arParent['not_found'] === false) {
$bAllowEdit = $this->GetPermission($arParent['is_file'] ? 'ELEMENT' : 'SECTION', $arParent['item_id'], 'element_edit');
}
return $bAllowEdit;
} else {
$type = 'SECTION';
if (isset($arElement['parent_id']) && $arElement['parent_id'] > 0) {
$id = $arElement['parent_id'];
} else {
$id = $this->IBLOCK_ID;
$type = 'IBLOCK';
}
if ($action == 'mkcol') {
return $this->GetPermission($type, $id, 'section_section_bind');
}
if ($arElement['is_dir']) {
if (!$this->GetPermission($type, $id, 'section_section_bind')) {
$arError[] = array("id" => "", "text" => GetMessage("WD_ACCESS_DENIED"));
}
} else {
if (!empty($arParams['create_element_in_section']) || $this->workflow != "workflow" && $this->workflow != "bizproc") {
if (!$this->GetPermission($type, $id, 'section_element_bind')) {
$arError[] = array("id" => "cannot_create", "text" => GetMessage("WD_ACCESS_DENIED"));
}
} elseif ($this->workflow == "workflow") {
$db_res = CWorkflowStatus::GetDropDownList("N", "desc");
if (!($db_res && ($res = $db_res->Fetch()))) {
$arError[] = array("id" => "bad_wf_statuses", "text" => GetMessage("WD_ACCESS_DENIED"));
}
} elseif ($this->workflow == 'bizproc') {
$arDocumentStates = CBPDocument::GetDocumentStates($this->wfParams['DOCUMENT_TYPE'], null);
$arUserGroups = $this->USER["GROUPS"];
$arUserGroups[] = "Author";
$canWrite = false;
if (!CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $GLOBALS["USER"]->GetID(), $this->wfParams['DOCUMENT_TYPE'], array("IBlockPermission" => $this->permission, "AllUserGroups" => $arUserGroups, "DocumentStates" => $arDocumentStates))) {
$arError[] = array("id" => "bad_bizproc_permision", "text" => GetMessage("WD_ACCESS_DENIED"));
}
}
}
}
} elseif ($action == 'delete' || $action == 'undelete') {
//arElement
$type = $arElement['is_dir'] ? 'SECTION' : 'ELEMENT';
if ($type == 'ELEMENT') {
$res = $this->GetPermission($type, $arElement['item_id'], 'element_delete');
//.........这里部分代码省略.........
示例10: IncludeModuleLangFile
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_js.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/bizproc/include.php";
IncludeModuleLangFile(__FILE__);
if (!$USER->IsAuthorized()) {
die('<script>alert("' . GetMessage("ACCESS_DENIED") . '");</script>');
}
CUtil::DecodeUriComponent($_POST);
$activityName = $_REQUEST['id'];
$activityType = $_REQUEST['activity'];
//$runtime = CBPRuntime::GetRuntime();
//$arActivityDescription = $runtime->GetActivityDescription($activityType);
//if ($arActivityDescription == null)
// die ("Bad activity type!".$activityType);
$documentType = array(MODULE_ID, ENTITY, $_POST['document_type']);
try {
$canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $GLOBALS["USER"]->GetID(), $documentType);
} catch (Exception $e) {
$canWrite = false;
}
if (!$canWrite) {
echo '<script>alert("' . GetMessage("ACCESS_DENIED") . '");</script>';
die;
}
$arWorkflowTemplate = isset($_POST['arWorkflowTemplate']) && is_array($_POST['arWorkflowTemplate']) ? $_POST['arWorkflowTemplate'] : array();
$arWorkflowParameters = isset($_POST['arWorkflowParameters']) && is_array($_POST['arWorkflowParameters']) ? $_POST['arWorkflowParameters'] : array();
$arWorkflowVariables = isset($_POST['arWorkflowVariables']) && is_array($_POST['arWorkflowVariables']) ? $_POST['arWorkflowVariables'] : array();
$arWorkflowConstants = isset($_POST['arWorkflowConstants']) && is_array($_POST['arWorkflowConstants']) ? $_POST['arWorkflowConstants'] : array();
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$documentService = $runtime->GetService("DocumentService");
$documentFields = $documentService->GetDocumentFields($documentType);
示例11: elseif
} elseif (empty($_REQUEST["WF_STATUS_ID"]) && $iEditStatus > 0) {
if (array_key_exists(1, $arResult["WF_STATUSES"])) {
$_REQUEST["WF_STATUS_ID"] = 1;
} else {
$_REQUEST["WF_STATUS_ID"] = $iEditStatus;
}
}
} elseif ($ob->workflow == "bizproc") {
$docID = null;
if (!empty($arParams['ELEMENT_ID'])) {
$docID = $arParams['DOCUMENT_TYPE'];
$docID[2] = intval($arParams['ELEMENT_ID']);
}
$arDocumentStates = CBPDocument::GetDocumentStates($arParams["DOCUMENT_TYPE"], $docID);
$arResult['DOCUMENT_STATES'] = $arDocumentStates;
$canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $GLOBALS["USER"]->GetID(), $arParams["DOCUMENT_TYPE"], array("SectionId" => $arParams["SECTION_ID"], "AllUserGroups" => $arResult["CurrentUserGroups"], "DocumentStates" => $arDocumentStates));
if (!$canWrite) {
$arFilter = array("DOCUMENT_TYPE" => $ob->wfParams['DOCUMENT_TYPE'], "ACTIVE" => "Y");
$dbWFTemplates = CBPWorkflowTemplateLoader::GetList(array(), $arFilter, false, false, array("ID"));
if ($dbWFTemplates && ($arWFTemplates = $dbWFTemplates->Fetch())) {
if (empty($arDocumentStates) && $arParams['PERMISSION'] === 'U') {
$sErrMsg = GetMessage("WD_NO_BP_AUTORUN");
} elseif (!empty($arDocumentStates) && $arParams['PERMISSION'] === 'U') {
$sErrMsg = GetMessage("WD_BP_ACTIVE_STATES");
} else {
$sErrMsg = GetMessage("WD_ACCESS_DENIED");
}
} else {
$sErrMsg = GetMessage("WD_NO_BP_TEMPLATES");
}
if (!$ob->e_rights && $arParams["PERMISSION"] >= "X") {
示例12: ShowError
ShowError(GetMessage("CC_BLL_UNKNOWN_ERROR"));
return;
}
} elseif ($lists_perm < CListPermissions::CAN_READ && !(CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, "element_read") || CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $section_id, "section_element_bind"))) {
ShowError(GetMessage("CC_BLL_ACCESS_DENIED"));
return;
}
$arParams["CAN_EDIT"] = $lists_perm >= CListPermissions::IS_ADMIN || CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, "iblock_edit");
$arResult["IBLOCK_PERM"] = $lists_perm;
$arResult["USER_GROUPS"] = $USER->GetUserGroupArray();
$arIBlock = CIBlock::GetArrayByID(intval($arParams["~IBLOCK_ID"]));
$arResult["~IBLOCK"] = $arIBlock;
$arResult["IBLOCK"] = htmlspecialcharsex($arIBlock);
$arResult["IBLOCK_ID"] = $arIBlock["ID"];
if ($arResult["IBLOCK"]["BIZPROC"] == "Y" && CModule::IncludeModule('bizproc')) {
$arParams["CAN_EDIT_BIZPROC"] = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID), array("UserGroups" => $GLOBALS["USER"]->GetUserGroupArray()));
}
if (isset($arParams["SOCNET_GROUP_ID"]) && $arParams["SOCNET_GROUP_ID"] > 0) {
$arParams["SOCNET_GROUP_ID"] = intval($arParams["SOCNET_GROUP_ID"]);
} else {
$arParams["SOCNET_GROUP_ID"] = "";
}
$arResult["GRID_ID"] = "lists_list_elements_" . $arResult["IBLOCK_ID"];
$arResult["ANY_SECTION"] = isset($_GET["list_section_id"]) && strlen($_GET["list_section_id"]) == 0;
$arResult["SECTION"] = false;
$arResult["SECTION_ID"] = false;
$arResult["PARENT_SECTION_ID"] = false;
$arResult["SECTIONS"] = array();
$arResult["LIST_SECTIONS"] = array("0" => GetMessage("CC_BLL_UPPER_LEVEL"));
$arResult["~LIST_SECTIONS"] = array("0" => GetMessage("CC_BLL_UPPER_LEVEL"));
$arResult["SECTION_PATH"] = array();
示例13: array
$DOCUMENT_TYPE = "iblock_" . $arResult["IBLOCK_ID"];
CBPDocument::AddShowParameterInit("iblock", "only_users", $DOCUMENT_TYPE);
$arTab2Fields = array();
$arTab2Fields[] = array("id" => "BIZPROC_WF_STATUS", "name" => GetMessage("CT_BLEE_BIZPROC_PUBLISHED"), "type" => "label", "value" => $arResult["ELEMENT_FIELDS"]["BP_PUBLISHED"] == "Y" ? GetMessage("MAIN_YES") : GetMessage("MAIN_NO"));
$bizProcIndex = 0;
$arDocumentStates = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", $DOCUMENT_TYPE), $arResult["ELEMENT_ID"] > 0 ? array("iblock", "CIBlockDocument", $arResult["ELEMENT_ID"]) : null, "Y");
$custom_html .= '<input type="hidden" name="stop_bizproc" id="stop_bizproc" value="">';
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$documentService = $runtime->GetService("DocumentService");
foreach ($arDocumentStates as $arDocumentState) {
$bizProcIndex++;
if ($arResult["ELEMENT_ID"] > 0) {
$canViewWorkflow = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), array("iblock", "CIBlockDocument", $arResult["ELEMENT_ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"] > 0 ? $arDocumentState["ID"] : $arDocumentState["TEMPLATE_ID"]));
} else {
$canViewWorkflow = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), array("iblock", "CIBlockDocument", "iblock_" . $arResult["IBLOCK_ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"] > 0 ? $arDocumentState["ID"] : $arDocumentState["TEMPLATE_ID"]));
}
if ($canViewWorkflow) {
$arTab2Fields[] = array("id" => "BIZPROC_TITLE" . $bizProcIndex, "name" => $arDocumentState["TEMPLATE_NAME"], "type" => "section");
if (strlen($arDocumentState["ID"]) && strlen($arDocumentState["WORKFLOW_STATUS"]) && CIBlockElementRights::UserHasRightTo($arResult["IBLOCK_ID"], $arResult["ELEMENT_ID"], "element_rights_edit")) {
$arTab2Fields[] = array("id" => "BIZPROC_STOP" . $bizProcIndex, "name" => GetMessage("CT_BLEE_BIZPROC_STOP_LABEL"), "type" => "label", "value" => '<a href="javascript:jsStopBP(\'' . CUtil::JSEscape('form_' . $arResult["FORM_ID"]) . '\', \'' . CUtil::JSEscape($arDocumentState["ID"]) . '\');">' . GetMessage("CT_BLEE_BIZPROC_STOP") . '</a>');
}
$arTab2Fields[] = array("id" => "BIZPROC_NAME" . $bizProcIndex, "name" => GetMessage("CT_BLEE_BIZPROC_NAME"), "type" => "label", "value" => $arDocumentState["TEMPLATE_NAME"]);
if ($arDocumentState["TEMPLATE_DESCRIPTION"] != '') {
$arTab2Fields[] = array("id" => "BIZPROC_DESC" . $bizProcIndex, "name" => GetMessage("CT_BLEE_BIZPROC_DESC"), "type" => "label", "value" => $arDocumentState["TEMPLATE_DESCRIPTION"]);
}
if (strlen($arDocumentState["STATE_MODIFIED"])) {
$arTab2Fields[] = array("id" => "BIZPROC_DATE" . $bizProcIndex, "name" => GetMessage("CT_BLEE_BIZPROC_DATE"), "type" => "label", "value" => $arDocumentState["STATE_MODIFIED"]);
}
if (strlen($arDocumentState["STATE_NAME"])) {
$url = str_replace(array("#list_id#", "#document_state_id#", "#group_id#"), array($arResult["IBLOCK_ID"], $arDocumentState["ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~BIZPROC_LOG_URL"]);
示例14: GetMessage
if (!$APPLICATION->CaptchaCheckCode($_REQUEST["captcha_word"], $_REQUEST["captcha_sid"])) {
$arResult["ERRORS"][] = GetMessage("IBLOCK_FORM_WRONG_CAPTCHA");
}
}
//---BP---
if ($bBizproc) {
$DOCUMENT_TYPE = "iblock_" . $arIBlock["ID"];
$arDocumentStates = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", $DOCUMENT_TYPE), $arParams["ID"] > 0 ? array("iblock", "CIBlockDocument", $arParams["ID"]) : null, "Y");
$arCurrentUserGroups = $USER->GetUserGroupArray();
if (!$arElement || $arElement["CREATED_BY"] == $USER->GetID()) {
$arCurrentUserGroups[] = "Author";
}
if ($arParams["ID"]) {
$canWrite = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array("iblock", "CIBlockDocument", $arParams["ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
} else {
$canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array("iblock", "CIBlockDocument", $DOCUMENT_TYPE), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
}
if (!$canWrite) {
$arResult["ERRORS"][] = GetMessage("CC_BIEAF_ACCESS_DENIED_STATUS");
}
if (count($arResult["ERRORS"]) == 0) {
$arBizProcParametersValues = array();
foreach ($arDocumentStates as $arDocumentState) {
if (strlen($arDocumentState["ID"]) <= 0) {
$arErrorsTmp = array();
$arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflowParametersValidate($arDocumentState["TEMPLATE_ID"], $arDocumentState["TEMPLATE_PARAMETERS"], array("iblock", "CIBlockDocument", $DOCUMENT_TYPE), $arErrorsTmp);
foreach ($arErrorsTmp as $e) {
$arResult["ERRORS"][] = $e["message"];
}
}
}
示例15: GetMessage
}
if($arParams["ID"])
{
$canWrite = CBPDocument::CanUserOperateDocument(
CBPCanUserOperateOperation::WriteDocument,
$USER->GetID(),
array("iblock", "CIBlockDocument", $arParams["ID"]),
array(/*"IBlockPermission" => $arResult["IBLOCK_PERM"],*/ "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates)
);
}
else
{
$canWrite = CBPDocument::CanUserOperateDocumentType(
CBPCanUserOperateOperation::WriteDocument,
$USER->GetID(),
array("iblock", "CIBlockDocument", $DOCUMENT_TYPE),
array(/*"IBlockPermission" => $arResult["IBLOCK_PERM"],*/ "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates)
);
}
if(!$canWrite)
$arResult["ERRORS"][] = GetMessage("CC_BIEAF_ACCESS_DENIED_STATUS");
if(empty($arResult["ERRORS"]))
{
$arBizProcParametersValues = array();
foreach ($arDocumentStates as $arDocumentState)
{
if(strlen($arDocumentState["ID"]) <= 0)
{
$arErrorsTmp = array();