本文整理汇总了PHP中CIBlockElement::WF_Lock方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::WF_Lock方法的具体用法?PHP CIBlockElement::WF_Lock怎么用?PHP CIBlockElement::WF_Lock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::WF_Lock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$lAdmin->AddGroupError(GetMessage("IBLIST_A_SAVE_ERROR", array("#ID#" => $ID, "#ERROR_MESSAGE#" => GetMessage("IBLIST_A_ACCESS_DENIED_STATUS")." [".$new_status."].<br>")), $TYPE.$ID);
}
}
}
break;
case "lock":
if ($TYPE=="E")
{
if ($bWorkflow && !CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_edit"))
{
$lAdmin->AddGroupError(GetMessage("IBLIST_A_UPDERR_ACCESS", array("#ID#" => $ID)), $TYPE.$ID);
continue;
}
else
{
CIBlockElement::WF_Lock($ID);
}
}
break;
case "unlock":
if ($TYPE=="E")
{
if ($bWorkflow && !CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_edit"))
{
$lAdmin->AddGroupError(GetMessage("IBLIST_A_UPDERR_ACCESS", array("#ID#" => $ID)), $TYPE.$ID);
continue;
}
if ($bBizproc)
call_user_func(array(ENTITY, "UnlockDocument"), $ID, "");
else
CIBlockElement::WF_UnLock($ID);
示例2: ShowError
ShowError(GetMessage("WD_ERROR_ELEMENT_NOT_FOUND"));
die;
}
}
}
if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
/** @var \Bitrix\Disk\File $diskFile */
$diskFile = \Bitrix\Disk\File::load(array('XML_ID' => $arResult['ELEMENT']['ID']), array('STORAGE'));
if ($diskFile) {
LocalRedirect(\Bitrix\Disk\Driver::getInstance()->getUrlManager()->getPathFileDetail($diskFile));
}
}
$ob->_get_file_info_arr($arResult["ELEMENT"]);
$arResult["WRITEABLE"] = $arResult['ELEMENT']['SHOW']['EDIT'];
if (in_array($arParams["ACTION"], array("EDIT", "PULL")) && $arParams["DOCUMENT_LOCK"] != "N") {
CIBlockElement::WF_Lock($arParams["ELEMENT_ID"], $ob->workflow == "workflow");
/**
* This part of code is necessary because info about element is got
* already but information about locking is absent. We can not lock
* element until check all rulles.
*/
$arResult["ELEMENT"]["LOCK_STATUS"] = CIBlockElement::WF_GetLockStatus($arParams["ELEMENT_ID"], $arResult['ELEMENT']['WF_LOCKED_BY'], $arResult['ELEMENT']['WF_DATE_LOCK']);
}
/********************************************************************
Default params
********************************************************************/
CJSCore::Init(array('viewer'));
__prepare_item_info($arResult["ELEMENT"], $arParams);
$arResult["ELEMENT"]['URL']['THIS'] = $ob->_uencode($arResult["ELEMENT"]['URL']['THIS'], array("utf8" => "Y", "convert" => $arParams["CONVERT"]));
$arError = array();
$bVarsFromForm = false;
示例3: _set_lock
function _set_lock(&$options, $op)
{
$lock = $op == 'LOCK';
$is_dir = false;
$ID = 0;
$bFirstElement = false;
$arProps = $this->_get_lock($options);
if (!$this->CheckWebRights("", array('action' => 'lock', 'arElement' => $this->arParams))) {
return $this->ThrowAccessDenied(__LINE__);
}
if (!is_array($arProps)) {
if ($lock && $this->arParams['not_found'] === true) {
if (!$this->CheckName($this->arParams["basename"])) {
return "400 bad request";
} elseif ($this->check_creator && $this->arParams["is_file"] === true && $this->arParams["element_array"]["CREATED_BY"] != $GLOBALS["USER"]->GetID()) {
return $this->ThrowAccessDenied(__LINE__);
} elseif ($this->arParams["parent_id"] !== false) {
$options1 = array('path' => $options["path"], 'content_length' => 0, 'content_type' => "", 'WF_COMMENTS' => GetMessage("WD_FILE_IS_CREATED_BY_LOCK"));
$stat = $this->PUT($options1);
if ($stat === false) {
return $this->ThrowAccessDenied(__LINE__);
} elseif (is_string($stat)) {
return $stat;
} else {
if (is_resource($stat) && get_resource_type($stat) == 'stream') {
fclose($stat);
}
if (!$this->CheckWebRights("", array("action" => "create", "arElement" => $this->arParams))) {
return $this->ThrowAccessDenied(__LINE__);
}
$this->put_commit($options1);
}
$ID = intVal($options1["ELEMENT_ID"]);
if ($ID <= 0) {
return "409 Conflict";
} else {
return "200 OK";
}
} else {
return $arProps;
// 404 not found
}
}
return $arProps;
// error in _get_lock
}
$ID = $this->arParams['item_id'];
$is_dir = $this->arParams["is_dir"];
if ($lock) {
if ($is_dir && !empty($options["depth"])) {
return "409 Conflict";
} elseif (!$is_dir && CIBlockElement::WF_IsLocked($ID, $locked_by, $date_lock)) {
return false;
}
$options["timeout"] = time() + 300;
// 5min. hardcoded
if (isset($options["update"])) {
$token = $options["update"];
$arProps["LOCK"] = is_array($arProps["LOCK"]) ? $arProps["LOCK"] : array();
if (array_key_exists($token, $arProps["LOCK"]) && strlen($arProps["LOCK"][$token]["exclusivelock"]) > 0) {
$arProps["LOCK"][$token]["expires"] = $options["timeout"];
$arProps["LOCK"][$token]["modified"] = time();
if (array_key_exists("owner", $arProps["LOCK"][$token])) {
$options["owner"] = $arProps["LOCK"][$token]["owner"];
}
$options["scope"] = $arProps["LOCK"][$token]["exclusivelock"] ? "exclusive" : "shared";
$options["type"] = $arProps["LOCK"][$token]["exclusivelock"] ? "write" : "read";
if ($bFirstElement) {
$arProps["FIRST"] = "Y";
}
CIBlockElement::SetPropertyValues($ID, $this->IBLOCK_ID, serialize($arProps), "WEBDAV_INFO");
CIBlockElement::WF_Lock($ID);
$this->_onEvent('Lock', $ID);
return true;
} else {
return false;
}
}
$arProps["LOCK"][$options["locktoken"]] = array("created" => time(), "modified" => time(), "owner" => $options["owner"], "expires" => $options["timeout"], "locktoken" => $options["locktoken"], "exclusivelock" => $options["scope"] === "exclusive" ? 1 : 0);
} else {
if (!empty($options["token"])) {
$token = $options["token"];
unset($arProps["LOCK"][$token]);
} else {
unset($arProps["LOCK"]);
}
if ($this->workflow == 'bizproc' && $GLOBALS['USER']->CanDoOperation('webdav_change_settings')) {
$arDocId = $this->wfParams["DOCUMENT_TYPE"];
$arDocId[2] = $ID;
$arStates = CBPDocument::GetDocumentStates($this->wfParams["DOCUMENT_TYPE"], $arDocId);
foreach ($arStates as $workflowId => $arState) {
CIBlockDocumentWebdav::UnlockDocument($ID, $workflowId);
}
}
}
if ($is_dir) {
$se = new CIBlockSection();
$x = $se->Update($ID, array("DESCRIPTION" => serialize($arProps)));
} else {
if ($lock && $bFirstElement) {
//.........这里部分代码省略.........