本文整理汇总了PHP中CBPDocument::CanUserOperateDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::CanUserOperateDocument方法的具体用法?PHP CBPDocument::CanUserOperateDocument怎么用?PHP CBPDocument::CanUserOperateDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPDocument
的用法示例。
在下文中一共展示了CBPDocument::CanUserOperateDocument方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/********************************************************************
/Main data
********************************************************************/
$arResult["VERSIONS"] = array();
$arResult["GRID_VERSIONS"] = array();
$arResult["ERROR_MESSAGE"] = "";
/********************************************************************
Action
********************************************************************/
if (!empty($arParams['ACTION']) && !empty($_REQUEST["ID"]) && check_bitrix_sessid()) {
$arError = array();
$ID = $_REQUEST["ID"];
switch ($arParams['ACTION']) {
case "delete":
if ($arParams["MODULE_ID"] == "webdav") {
if (CBPDocument::CanUserOperateDocument(CBPWebDavCanUserOperateOperation::DeleteDocument, $GLOBALS["USER"]->GetID(), $arParams["DOCUMENT_ID"], array("UserGroups" => $GLOBALS["USER"]->GetUserGroupArray()))) {
CBPHistoryService::Delete($ID, $arParams["DOCUMENT_ID"]);
} else {
$arError[] = array("id" => "access_denied", "text" => GetMessage("BPADH_NO_PERMS"));
}
} else {
CBPHistoryService::Delete($ID, $arParams["DOCUMENT_ID"]);
}
break;
case "recover":
if ($arParams["MODULE_ID"] == "webdav" && isset($arParams["OBJECT"])) {
$arParams['OBJECT']->IsDir(array('element_id' => $arParams["DOCUMENT_ID"][2]));
if (($arParams["OBJECT"]->workflow == 'bizproc' || $arParams["OBJECT"]->workflow == 'bizproc_limited') && $arParams['OBJECT']->arParams['not_found'] == false) {
CBPDocument::AddDocumentToHistory($arParams['DOCUMENT_ID'], $arParams['OBJECT']->arParams["element_name"], $GLOBALS["USER"]->GetID());
if (method_exists('CIBlockDocumentWebdav', 'TruncateHistory')) {
CIBlockDocumentWebdav::TruncateHistory($arParams['OBJECT']->wfParams['DOCUMENT_TYPE'], $arParams["DOCUMENT_ID"][2]);
示例2: processActionStopBizProc
public function processActionStopBizProc()
{
$this->checkRequiredPostParams(array('fileId', 'idBizProc'));
if (!Loader::includeModule("bizproc")) {
$this->errorCollection->addOne(new Error(Loc::getMessage('DISK_FILE_VIEW_BIZPROC_LOAD')));
}
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
$fileId = (int) $this->request->getPost('fileId');
/** @var File $file */
$file = File::loadById($fileId);
if (!$file) {
$this->errorCollection->addOne(new Error(Loc::getMessage('DISK_FILE_VIEW_ERROR_COULD_NOT_FIND_OBJECT'), self::ERROR_COULD_NOT_FIND_OBJECT));
$this->sendJsonErrorResponse();
}
$documentData = array('DISK' => array('DOCUMENT_ID' => \Bitrix\Disk\BizProcDocument::getDocumentComplexId($fileId)), 'WEBDAV' => array('DOCUMENT_ID' => \Bitrix\Disk\BizProcDocumentCompatible::getDocumentComplexId($fileId)));
$webdavFileId = $file->getXmlId();
if (!empty($webdavFileId)) {
$documentData['OLD_FILE_COMMON'] = array('DOCUMENT_ID' => array('webdav', 'CIBlockDocumentWebdav', $webdavFileId));
$documentData['OLD_FILE_GROUP'] = array('DOCUMENT_ID' => array('webdav', 'CIBlockDocumentWebdavSocnet', $webdavFileId));
}
$workflowId = $this->request->getPost('idBizProc');
$error = array();
foreach ($documentData as $nameModule => $data) {
$availabilityProcess = CBPDocument::GetDocumentState($data['DOCUMENT_ID'], $workflowId);
if (!empty($availabilityProcess)) {
if (CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $this->getUser()->getId(), $data['DOCUMENT_ID'])) {
CBPDocument::TerminateWorkflow($workflowId, $data['DOCUMENT_ID'], $error);
}
}
}
if ($error) {
$this->errorCollection->addOne(new Error(array_shift($error)));
$this->sendJsonErrorResponse();
}
$this->sendJsonSuccessResponse();
}
示例3: foreach
foreach ($arTasks as $arTask) {
$backUrl = CHTTP::urlAddParams($APPLICATION->GetCurPageParam("", array($arResult["FORM_ID"] . "_active_tab")), array($arResult["FORM_ID"] . "_active_tab" => "tab_bp"));
$url = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#task_id#", "#group_id#"), array($arResult["IBLOCK_ID"], intval($arResult["SECTION_ID"]), $arResult["ELEMENT_ID"], $arTask["ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~BIZPROC_TASK_URL"]), array("back_url" => $backUrl), array("skip_empty" => true, "encode" => true));
$html .= '<a href="' . htmlspecialcharsbx($url) . '" title="' . strip_tags($arTask["DESCRIPTION"]) . '">' . $arTask["NAME"] . '</a><br />';
}
$arTab2Fields[] = array("id" => "BIZPROC_TASKS" . $bizProcIndex, "name" => GetMessage("CT_BLEE_BIZPROC_TASKS"), "type" => "label", "value" => $html);
}
}
}
}
if (!$bizProcIndex) {
$arTab2Fields[] = array("id" => "BIZPROC_NO", "name" => GetMessage("CT_BLEE_BIZPROC_NA_LABEL"), "type" => "label", "value" => GetMessage("CT_BLEE_BIZPROC_NA"));
}
$custom_html .= '<input type="hidden" name="bizproc_index" value="' . $bizProcIndex . '">';
if ($arResult["ELEMENT_ID"]) {
$bStartWorkflowPermission = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $USER->GetID(), BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["TEMPLATE_ID"]));
if ($bStartWorkflowPermission) {
$arTab2Fields[] = array("id" => "BIZPROC_NEW", "name" => GetMessage("CT_BLEE_BIZPROC_NEW"), "type" => "section");
$backUrl = CHTTP::urlAddParams($APPLICATION->GetCurPageParam("", array($arResult["FORM_ID"] . "_active_tab")), array($arResult["FORM_ID"] . "_active_tab" => "tab_bp"));
$url = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#group_id#"), array($arResult["IBLOCK_ID"], intval($arResult["SECTION_ID"]), $arResult["ELEMENT_ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~BIZPROC_WORKFLOW_START_URL"]), array("back_url" => $backUrl, "sessid" => bitrix_sessid()), array("skip_empty" => true, "encode" => true));
$arTab2Fields[] = array("id" => "BIZPROC_NEW_START", "name" => GetMessage("CT_BLEE_BIZPROC_START"), "type" => "custom", "colspan" => true, "value" => '<a href="' . htmlspecialcharsbx($url) . '">' . GetMessage("CT_BLEE_BIZPROC_START") . '</a>');
}
}
$arTabs[] = array("id" => "tab_bp", "name" => GetMessage("CT_BLEE_BIZPROC_TAB"), "icon" => "", "fields" => $arTab2Fields);
}
if (isset($arResult["RIGHTS"])) {
ob_start();
IBlockShowRights('element', $arResult["IBLOCK_ID"], $arResult["ELEMENT_ID"], "", "RIGHTS", $arResult["TASKS"], $arResult["RIGHTS"], true, $arResult["ELEMENT_ID"] <= 0, $arResult["SELECTED"], $arResult["HIGHLIGHT"]);
$rights_html = ob_get_contents();
ob_end_clean();
$rights_fields = array(array("id" => "RIGHTS", "name" => GetMessage("CT_BLEE_ACCESS_RIGHTS"), "type" => "custom", "colspan" => true, "value" => $rights_html));
示例4: array
$aActions[] = array("TEXT" => GetMessage("CC_BLL_ELEMENT_ACTION_MENU_START_BP"), "MENU" => $arBPStart);
}
if (CModule::IncludeModule("bizproc")) {
if (!empty($documentStates)) {
$currentUserGroups = $GLOBALS["USER"]->GetUserGroupArray();
if ($data["CREATED_BY"] == $GLOBALS["USER"]->GetID()) {
$currentUserGroups[] = "author";
}
$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)) {
示例5: GetMessage
?>
"><?php
echo GetMessage("IBEL_BIZPROC_START");
?>
</a></span>
</td>
</tr>
</table>
</li>
<?php
}
foreach ($arDocumentStates as $arDocumentState) {
$bizProcIndex++;
if (intVal($arDocumentState["WORKFLOW_STATUS"]) < 0 || $arDocumentState["ID"] <= 0) {
continue;
} elseif (!CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), $arParams["DOCUMENT_ID"], array("DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"]))) {
continue;
}
$arTasks = array();
$arDumpWorkflow = array();
$arTasks = CBPDocument::GetUserTasksForWorkflow($USER->GetID(), $arDocumentState["ID"]);
if (strlen($arDocumentState["WORKFLOW_STATUS"]) > 0) {
$arDmpWorkflow = array_reverse(CBPTrackingService::DumpWorkflow($arDocumentState["ID"]));
$track = $tmp = reset($arDmpWorkflow);
do {
$strMessageTemplate = "";
switch ($track["TYPE"]) {
case 1:
$strMessageTemplate = GetMessage("BPABL_TYPE_1");
break;
case 2:
示例6: GetMessage
echo GetMessage("IBEL_BIZPROC_NA");
?>
</td>
</tr>
<?
}
?>
<input type="hidden" name="bizproc_index" value="<?php
echo $bizProcIndex;
?>
">
<?
if ($ID > 0):
$bStartWorkflowPermission = CBPDocument::CanUserOperateDocument(
CBPCanUserOperateOperation::StartWorkflow,
$USER->GetID(),
array(MODULE_ID, ENTITY, $ID),
array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["TEMPLATE_ID"])
);
if ($bStartWorkflowPermission):
?>
<tr class="heading">
<td colspan="2"><?echo GetMessage("IBEL_BIZPROC_NEW")?></td>
</tr>
<tr>
<td colspan="2" align="center">
<a href="/bitrix/admin/<?php
echo MODULE_ID;
?>
_start_bizproc.php?document_id=<?php
echo $ID;
?>
示例7: array
$arResult['USE_REVIEW'] = $arParams['USE_REVIEW'];
$arResult['ELEMENT'] = array();
$arParams['ELEMENT_NAME'] = urldecode($arParams['ELEMENT_NAME']);
$arFilter = array('IBLOCK_ID' => $arParams['IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N', 'ACTIVE' => 'Y');
if (empty($arParams['ELEMENT_NAME'])) {
$arParams['ELEMENT_NAME'] = CWiki::GetDefaultPage($arParams['IBLOCK_ID']);
}
if (!empty($arParams['ELEMENT_NAME']) && ($arResult['ELEMENT'] = CWiki::GetElementByName($arParams['ELEMENT_NAME'], $arFilter)) != false) {
$arParams['ELEMENT_ID'] = $arResult['ELEMENT']['ID'];
} else {
$this->AbortResultCache();
return;
}
//$arResult['TOPLINKS'] = CWikiUtils::getRightsLinks(array('article', 'history'), $arParams);
$documentId = array('iblock', 'CWikiDocument', $arParams['ELEMENT_ID']);
$bCanUserWrite = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $GLOBALS['USER']->GetID(), $documentId, array('UserGroups' => $GLOBALS['USER']->GetUserGroupArray()));
if (!$bCanUserWrite) {
$this->AbortResultCache();
ShowError(GetMessage('WIKI_ACCESS_DENIED'));
return;
}
if (!empty($historyId) && check_bitrix_sessid()) {
$this->AbortResultCache();
if (isset($_REQUEST['delete'])) {
if (CWikiUtils::IsDeleteable()) {
$historyService = new CBPHistoryService();
$historyService->DeleteHistory($historyId, array('iblock', 'CWikiDocument', $arParams['ELEMENT_ID']));
$CACHE_MANAGER->ClearByTag('wiki_' . $arParams['ELEMENT_ID']);
LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_HISTORY'], array('wiki_name' => $arParams['ELEMENT_NAME'], 'group_id' => CWikiSocnet::$iSocNetId)));
} else {
$this->AbortResultCache();
示例8: IncludeModuleLangFile
IncludeModuleLangFile(__FILE__);
/*
$bizprocModulePermissions = $APPLICATION->GetGroupRight("bizproc");
if ($bizprocModulePermissions < "R")
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
*/
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$errorMessage = "";
$ID = trim($_REQUEST["ID"]);
$adminMode = strtoupper($_REQUEST["admin_mode"]) == "Y";
$arWorkflowState = CBPStateService::GetWorkflowState($ID);
if (!is_array($arWorkflowState) || count($arWorkflowState) <= 0) {
$APPLICATION->SetTitle(GetMessage("BPABL_INVALID_WF"));
CAdminMessage::ShowMessage(GetMessage("BPABL_INVALID_WF") . ". ");
} else {
$bCanView = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), $arWorkflowState["DOCUMENT_ID"], array("WorkflowId" => $ID, "DocumentStates" => array($ID => $arWorkflowState), "UserGroups" => $GLOBALS["USER"]->GetUserGroupArray()));
if (!$bCanView) {
$APPLICATION->SetTitle(GetMessage("BPABL_ERROR"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
echo ShowError(GetMessage("BPABL_NO_PERMS"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
$backUrl = "/" . ltrim(trim($_REQUEST["back_url"]), "\\/");
if (strlen($backUrl) <= 0) {
$backUrl = CBPDocument::GetDocumentAdminPage($arWorkflowState["DOCUMENT_ID"]);
}
$aMenu = array(array("TEXT" => GetMessage("BPABL_BACK"), "LINK" => $backUrl, "ICON" => "btn_list"));
$context = new CAdminContextMenu($aMenu);
$context->Show();
$APPLICATION->SetTitle(str_replace("#ID#", $ID, GetMessage("BPABL_TITLE")));
示例9: current
if ($arResult["PROCESSES"] && $arResult["USE_COMMENTS"]) {
$documentState = CBPDocument::GetDocumentStates(BizprocDocument::generateDocumentComplexType($arIBlock["IBLOCK_TYPE_ID"], $arIBlock["ID"]), BizprocDocument::getDocumentComplexId($arIBlock["IBLOCK_TYPE_ID"], $data["ID"]));
if (!empty($documentState)) {
$documentState = current($documentState);
$data["WORKFLOW_ID"] = $documentState["ID"];
} else {
$data["WORKFLOW_ID"] = '';
}
}
$arUserGroupsForBPTmp = $arUserGroupsForBP;
if ($USER->GetID() == $data["CREATED_BY"]) {
$arUserGroupsForBPTmp[] = "Author";
}
$arBPStart = array();
foreach ($arDocumentTemplates as $arWorkflowTemplate) {
if (CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $USER->GetID(), BizprocDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], intval($data["~ID"])), array("IBlockId" => $arIBlock["ID"], "AllUserGroups" => $arUserGroupsForBPTmp, "DocumentStates" => $arDocumentStatesForBP, "WorkflowId" => $arWorkflowTemplate["ID"]))) {
$backUrl = $APPLICATION->GetCurPageParam();
$url = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#workflow_template_id#", "#group_id#"), array($arIBlock["ID"], intval($arResult["SECTION_ID"]), intval($data["~ID"]), $arWorkflowTemplate["ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["BIZPROC_WORKFLOW_START_URL"]), array("workflow_template_id" => $arWorkflowTemplate["ID"], "back_url" => $backUrl));
$url .= (strpos($url, "?") === false ? "?" : "&") . bitrix_sessid_get();
$arBPStart[] = array("TEXT" => $arWorkflowTemplate["NAME"], "ONCLICK" => "jsUtils.Redirect(arguments, '" . CUtil::JSEscape($url) . "')");
}
}
$url = str_replace(array("#list_id#", "#section_id#", "#element_id#", "#group_id#"), array($arIBlock["ID"], intval($arResult["SECTION_ID"]), intval($data["~ID"]), $arParams["SOCNET_GROUP_ID"]), $arParams["LIST_ELEMENT_URL"]);
if ($arResult["ANY_SECTION"]) {
$url = CHTTP::urlAddParams($url, array("list_section_id" => ""));
}
$aActions = array();
if (!$arResult["IS_SOCNET_GROUP_CLOSED"] && ($lists_perm >= CListPermissions::CAN_WRITE || CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $data["~ID"], "element_edit"))) {
$aActions[] = array("ICONCLASS" => "edit", "TEXT" => GetMessage("CC_BLL_ELEMENT_ACTION_MENU_EDIT"), "ONCLICK" => "jsUtils.Redirect(arguments, '" . CUtil::JSEscape($url) . "')", "DEFAULT" => true);
$arResult["ELEMENTS_CAN_MOVE"][] = $data["ID"];
} else {
示例10: elseif
}
} elseif ($arParams["USE_BIZPROC"] == "Y") {
CBPDocument::AddShowParameterInit("webdav", "only_users", $arParams["BIZPROC"]["DOCUMENT_TYPE"], $arParams["BIZPROC"]["ENTITY"]);
$bizProcIndex = 0;
$bizProcCounter = 0;
$arDocumentStates = isset($arResult['DOCUMENT_STATES']) ? $arResult['DOCUMENT_STATES'] : array();
if (!empty($arDocumentStates)) {
?>
<li class="wd-upload-form-propety">
<?php
/*?> <div class="wd-upload-form-propety-title"><?=GetMessage("WD_BP")?>:</div><?*/
?>
<?php
foreach ($arDocumentStates as $arDocumentState) {
$bizProcIndex++;
$canViewWorkflow = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), $arParams["DOCUMENT_ID"], array("DocumentType" => $arParams["BIZPROC"]["DOCUMENT_TYPE"], "IBlockPermission" => $arParams["PERMISSION"], "AllUserGroups" => $arResult["CurrentUserGroups"], "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"] > 0 ? $arDocumentState["ID"] : $arDocumentState["TEMPLATE_ID"]));
if (!$canViewWorkflow || $arDocumentState['WORKFLOW_STATUS'] !== -1) {
continue;
}
$bizProcCounter++;
?>
<p class="wd-docstate-title"><?php
echo htmlspecialcharsbx($arDocumentState["TEMPLATE_NAME"]);
?>
<?php
if ($arDocumentState["TEMPLATE_DESCRIPTION"] != '') {
?>
<img src="/bitrix/js/main/core/images/hint.gif" id="docState_<?php
echo $arDocumentState['ID'];
?>
" />
示例11: 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');
//.........这里部分代码省略.........
示例12: CIBlockSectionRights
$obRights = new CIBlockSectionRights($arResult["IBLOCK_ID"], $SECTION_ID);
}
$arDBRights = $obRights->GetRights();
$arElement["RIGHTS"] = CListPermissions::MergeRights($arParams["~IBLOCK_TYPE_ID"], $arDBRights, $arPOSTRights);
}
//if($arResult["CAN_EDIT_RIGHTS"])
//---BP---
if ($bBizproc) {
$DOCUMENT_TYPE = "iblock_" . $arResult["IBLOCK_ID"];
$arDocumentStates = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", $DOCUMENT_TYPE), $arResult["ELEMENT_ID"] > 0 ? array("iblock", "CIBlockDocument", $arResult["ELEMENT_ID"]) : null, "Y");
$arCurrentUserGroups = $GLOBALS["USER"]->GetUserGroupArray();
if (!$arResult["ELEMENT_FIELDS"] || $arResult["ELEMENT_FIELDS"]["CREATED_BY"] == $GLOBALS["USER"]->GetID()) {
$arCurrentUserGroups[] = "Author";
}
if ($arResult["ELEMENT_ID"]) {
$canWrite = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $GLOBALS["USER"]->GetID(), array("iblock", "CIBlockDocument", $arResult["ELEMENT_ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
} else {
$canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $GLOBALS["USER"]->GetID(), array("iblock", "CIBlockDocument", $DOCUMENT_TYPE), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
}
if (!$canWrite) {
$strError = GetMessage("CC_BLEE_ACCESS_DENIED_STATUS");
}
}
if (!$strError) {
if ($bBizproc) {
$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) {
示例13: CAdminException
$e = new CAdminException($arError);
ShowError($e->GetString());
return false;
}
if (method_exists($arParams["DOCUMENT_TYPE"][1], "GetUserGroups")) {
$arParams["USER_GROUPS"] = call_user_func_array(array($arParams["DOCUMENT_TYPE"][1], "GetUserGroups"), array($arParams["DOCUMENT_TYPE"], $arParams["DOCUMENT_ID"], $GLOBALS["USER"]->GetID()));
} else {
$arParams["USER_GROUPS"] = $GLOBALS["USER"]->GetUserGroupArray();
}
/********************************************************************
/Main data
********************************************************************/
$arResult["ERROR_MESSAGE"] = "";
$arParams["StartWorkflowPermission"] = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $USER->GetID(), $arParams["DOCUMENT_ID"], array("DocumentStates" => $arDocumentStates)) ? "Y" : "N";
$arParams["StopWorkflowPermission"] = $arParams["StartWorkflowPermission"];
$arParams["DropWorkflowPermission"] = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), $arParams["DOCUMENT_ID"], array("DocumentStates" => $arDocumentStates)) ? "Y" : "N";
/********************************************************************
Action
********************************************************************/
if (!((!empty($_REQUEST["action"]) || $_SERVER['REQUEST_METHOD'] == "POST") && check_bitrix_sessid())) {
} elseif (!empty($_POST["cancel"]) && !empty($arParams["back_url"])) {
LocalRedirect($arParams["back_url"]);
} else {
if ($_REQUEST["action"] == "stop_bizproc") {
if ($arParams["StopWorkflowPermission"] != "Y") {
$arError[] = array("id" => "access_denied", "text" => GetMessage("BPADH_NO_PERMS"));
} else {
CBPDocument::TerminateWorkflow($_REQUEST["id"], $arParams["DOCUMENT_ID"], $ar);
if (count($ar) > 0) {
$str = "";
foreach ($ar as $a) {
示例14: FormatDateFromDB
if (isset($data["ACTIVE_TO"])) {
$data['ACTIVE_TO'] = FormatDateFromDB($data['ACTIVE_TO']);
}
if (isset($data["DATE_CREATE"])) {
$data['DATE_CREATE'] = FormatDateFromDB($data['DATE_CREATE']);
}
if (isset($data["TIMESTAMP_X"])) {
$data['TIMESTAMP_X'] = FormatDateFromDB($data['TIMESTAMP_X']);
}
$arUserGroupsForBPTmp = $arUserGroupsForBP;
if ($GLOBALS["USER"]->GetID() == $data["CREATED_BY"]) {
$arUserGroupsForBPTmp[] = "Author";
}
$arBPStart = array();
foreach ($arDocumentTemplates as $arWorkflowTemplate) {
if (CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $GLOBALS["USER"]->GetID(), array("iblock", "CIBlockDocument", intval($data["~ID"])), array("IBlockId" => $arIBlock["ID"], "AllUserGroups" => $arUserGroupsForBPTmp, "DocumentStates" => $arDocumentStatesForBP, "WorkflowId" => $arWorkflowTemplate["ID"]))) {
$url = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#workflow_template_id#", "#group_id#"), array($arIBlock["ID"], intval($arResult["SECTION_ID"]), intval($data["~ID"]), $arWorkflowTemplate["ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["BIZPROC_WORKFLOW_START_URL"]), array("workflow_template_id" => $arWorkflowTemplate["ID"]));
$url .= (strpos($url, "?") === false ? "?" : "&") . bitrix_sessid_get();
$arBPStart[] = array("TEXT" => $arWorkflowTemplate["NAME"], "ONCLICK" => "jsUtils.Redirect(arguments, '" . CUtil::JSEscape($url) . "')");
}
}
$url = str_replace(array("#list_id#", "#section_id#", "#element_id#", "#group_id#"), array($arIBlock["ID"], intval($arResult["SECTION_ID"]), intval($data["~ID"]), $arParams["SOCNET_GROUP_ID"]), $arParams["LIST_ELEMENT_URL"]);
if ($arResult["ANY_SECTION"]) {
$url = CHTTP::urlAddParams($url, array("list_section_id" => ""));
}
$aActions = array();
if ($lists_perm >= CListPermissions::CAN_WRITE || CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $data["~ID"], "element_edit")) {
$aActions[] = array("ICONCLASS" => "edit", "TEXT" => GetMessage("CC_BLL_ELEMENT_ACTION_MENU_EDIT"), "ONCLICK" => "jsUtils.Redirect(arguments, '" . CUtil::JSEscape($url) . "')", "DEFAULT" => true);
$arResult["ELEMENTS_CAN_MOVE"][] = $data["ID"];
} else {
$aActions[] = array("ICONCLASS" => "view", "TEXT" => GetMessage("CC_BLL_ELEMENT_ACTION_MENU_VIEW"), "ONCLICK" => "jsUtils.Redirect(arguments, '" . CUtil::JSEscape($url) . "')", "DEFAULT" => true);
示例15: __build_item_info
//.........这里部分代码省略.........
}
if ($ob->Type == "iblock" && $res["SHOW"]["LOCK"] == "Y") {
$arActions["element_lock"] = array("ICONCLASS" => "element_unlock", "TITLE" => GetMessage("WD_LOCK_ELEMENT"), "TEXT" => GetMessage("WD_LOCK"), "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($res["URL"]["~LOCK"]) . "');");
}
if (($res["SHOW"]["LOCK"] == "Y" || $res["SHOW"]["UNLOCK"] == "Y") && in_array($res["FILE_EXTENTION"], $arOfficeExtensions)) {
$arActions["element_edit_office"] = array("ICONCLASS" => "element_edit", "TITLE" => GetMessage("WD_EDIT_MSOFFICE"), "TEXT" => GetMessage("WD_EDIT_MSOFFICE_MENU"), "OFFICECHECK" => true, "DISABLED" => !($bShowWebdav && $res["SHOW"]["EDIT"] == "Y"), "ONCLICK" => 'return EditDocWithProgID(\'' . CUtil::addslashes($res["URL"]["~THIS"]) . '\');');
}
}
$arActions["element_view"] = array("ICONCLASS" => "element_view", "TITLE" => GetMessage("WD_VIEW_ELEMENT"), "TEXT" => GetMessage($res["~TYPE"] == "FILE" ? "WD_PROPERTIES" : "WD_VIEW"), "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($res["URL"][$res["~TYPE"] == "FILE" ? "EDIT" : "~VIEW"]) . "');");
if ($arParams["USE_COMMENTS"] == "Y" && IsModuleInstalled("forum")) {
$arActions["element_comment"] = array("ICONCLASS" => "element_comment", "TITLE" => GetMessage("WD_ELEMENT_COMMENT_NAME"), "TEXT" => GetMessage("WD_ELEMENT_COMMENT_TITLE"), "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($res["URL"]["~VIEW"] . "?webdavForm" . $arParams["IBLOCK_ID"] . "_active_tab=tab_comments") . "');");
}
if ($arParams["PERMISSION"] >= "U") {
$arActions["copy_link"] = array("ICONCLASS" => "element_download", "TITLE" => GetMessage("WD_COPY_LINK_TITLE"), "TEXT" => GetMessage("WD_COPY_LINK"), "ONCLICK" => "WDCopyLinkDialog('" . CUtil::JSEscape(($GLOBALS['APPLICATION']->IsHTTPS() ? 'https' : 'http') . '://' . str_replace("//", "/", $_SERVER['HTTP_HOST'] . "/" . $res["URL"]["THIS"])) . "')");
/*
$urlT = CUtil::JSEscape(($GLOBALS['APPLICATION']->IsHTTPS() ? 'https' : 'http').'://'.str_replace("//", "/", $_SERVER['HTTP_HOST']."/".$res["URL"]["THIS"]));
$arActions["copy_ext_link"] = array(
"ICONCLASS" => "element_download",
"TITLE" => GetMessage("WD_COPY_EXT_LINK_TITLE"),
"TEXT" => GetMessage("WD_COPY_EXT_LINK"),
"ONCLICK" => CWebDavExtLinks::InsertDialogCallText($urlT)
);
*/
if ($res["SHOW"]["HISTORY"] == "Y") {
$arActions["element_history"] = array("ICONCLASS" => "element_history" . ($res["SHOW"]["BP"] == "Y" ? " bizproc_history" : ""), "TITLE" => GetMessage("WD_HIST_ELEMENT_ALT"), "TEXT" => GetMessage("WD_HIST_ELEMENT"), "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($res["URL"]["~VIEW"] . "?webdavForm" . $arParams["IBLOCK_ID"] . "_active_tab=tab_history") . "');");
}
if ($res["SHOW"]["LOCK"] == "Y" || $res["SHOW"]["UNLOCK"] == "Y") {
if ($res["SHOW"]["BP_VIEW"] == "Y") {
$arActionsBpTmp[] = array("ICONCLASS" => "bizproc_document", "TITLE" => GetMessage("IBLIST_A_BP_H"), "TEXT" => GetMessage("IBLIST_A_BP_H"), "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($res["URL"]["~BP"]) . "');");
}
if ($res["SHOW"]["BP_START"] == "Y" && is_array($arParams["TEMPLATES"])) {
$arr = array();
foreach ($arParams["TEMPLATES"] as $key => $arWorkflowTemplate) {
if (!CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $GLOBALS["USER"]->GetID(), $res["DOCUMENT_ID"], array("UserGroups" => $res["USER_GROUPS"], "DocumentStates" => $res["~arDocumentStates"], "WorkflowTemplateList" => $arTemplates, "WorkflowTemplateId" => $arWorkflowTemplate["ID"]))) {
continue;
}
$url = $res["URL"]["~BP_START"];
$url .= (strpos($url, "?") === false ? "?" : "&") . "workflow_template_id=" . $arWorkflowTemplate["ID"] . '&' . bitrix_sessid_get();
$arr[] = array("ICONCLASS" => "", "TITLE" => $arWorkflowTemplate["DESCRIPTION"], "TEXT" => $arWorkflowTemplate["NAME"], "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "');");
}
if (!empty($arr)) {
$arActionsBpTmp[] = array("ICONCLASS" => "bizproc_start", "TITLE" => GetMessage("WD_START_BP_TITLE"), "TEXT" => GetMessage("WD_START_BP"), "MENU" => $arr);
}
}
//if ($res["SHOW"]["BP_CLONE"] == "Y")
//{
//$arActionsBpTmp[] = array(
//"ICONCLASS" => "bizproc_document",
//"TITLE" => GetMessage("WD_CREATE_VERSION_ALT"),
//"TEXT" => GetMessage("WD_CREATE_VERSION"),
//"ONCLICK" => "jsUtils.Redirect([], '".CUtil::JSEscape($res["URL"]["~CLONE"])."');");
//$arActionsBpTmp[] = array(
//"ICONCLASS" => "bizproc_document",
//"TITLE" => GetMessage("WD_VERSIONS_ALT"),
//"TEXT" => GetMessage("WD_VERSIONS"),
//"ONCLICK" => "jsUtils.Redirect([], '".CUtil::JSEscape($res["URL"]["~VERSIONS"])."');");
//}
if (!empty($arActionsBpTmp)) {
$arActions += $arActionsBpTmp;
}
$arActions["separator_del"] = array("SEPARATOR" => true);
if ($ob->Type == "folder" || $ob->Type == "iblock" && $res["WF_PARENT_ELEMENT_ID"] === null) {
$arActions["element_rename"] = array("ICONCLASS" => "element_rename", "TITLE" => GetMessage("WD_RENAME_TITLE"), "TEXT" => GetMessage("WD_RENAME_NAME"), "ONCLICK" => "WDRename(BX('ID_" . $res["TYPE"] . $res["ID"] . "'), bxGrid_" . $arParams["GRID_ID"] . ", '" . $arParams["GRID_ID"] . "')");
}
}
if ($res["SHOW"]["COPY"] == 'Y') {