本文整理汇总了PHP中CIBlockElementRights::UserHasRightTo方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElementRights::UserHasRightTo方法的具体用法?PHP CIBlockElementRights::UserHasRightTo怎么用?PHP CIBlockElementRights::UserHasRightTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElementRights
的用法示例。
在下文中一共展示了CIBlockElementRights::UserHasRightTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkUserReadAccess
public function checkUserReadAccess($parameters)
{
global $USER;
$parameters['listId'] = (int) $parameters['listId'];
$parameters['elementId'] = (int) $parameters['elementId'];
if ($parameters['listId'] == 0 || $parameters['elementId'] == 0) {
return false;
}
$userPermission = \CListPermissions::CheckAccess($USER, $parameters["IBLOCK_TYPE_ID"], $parameters['listId']);
if ($userPermission < 0) {
return false;
} else {
if ($userPermission < \CListPermissions::CAN_READ && !\CIBlockElementRights::UserHasRightTo($parameters['listId'], $parameters['elementId'], "element_read")) {
return false;
}
}
return true;
}
示例2: CheckElementOperation
public static function CheckElementOperation($intIBlockID, $intElementID, $strOperation, $strAccess)
{
$intIBlockID = intval($intIBlockID);
if ($intIBlockID <= 0) {
return false;
}
$intElementID = intval($intElementID);
if ($intElementID <= 0) {
return false;
}
if (!self::$boolCheck) {
self::CheckExtRights();
}
if (self::$boolExtRights) {
return CIBlockElementRights::UserHasRightTo($intIBlockID, $intElementID, $strOperation);
} else {
return CIBlock::GetPermission($intIBlockID) >= $strAccess;
}
}
示例3: GetPanelButtons
/**
*
*
*
*
*
* @return mixed <p></p>
*
*
* <h4>Example</h4>
* <pre>
* <br><br>
* </pre>
*
*
*
* <h4>See Also</h4>
* <p></p><a name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/getpanelbuttons.php
* @author Bitrix
*/
public static function GetPanelButtons($IBLOCK_ID = 0, $ELEMENT_ID = 0, $SECTION_ID = 0, $arOptions = array())
{
/** @global CMain $APPLICATION */
global $APPLICATION;
$arButtons = array("view" => array(), "edit" => array(), "configure" => array(), "submenu" => array());
if (array_key_exists("SECTION_BUTTONS", $arOptions) && $arOptions["SECTION_BUTTONS"] === false) {
$bSectionButtons = false;
} else {
$bSectionButtons = true;
}
if (array_key_exists("SESSID", $arOptions) && $arOptions["SESSID"] === false) {
$bSessID = false;
} else {
$bSessID = true;
}
$IBLOCK_ID = intval($IBLOCK_ID);
$ELEMENT_ID = intval($ELEMENT_ID);
$SECTION_ID = intval($SECTION_ID);
if ($ELEMENT_ID > 0 && ($IBLOCK_ID <= 0 || $bSectionButtons && $SECTION_ID == 0)) {
$rsIBlockElement = CIBlockElement::GetList(array(), array("ID" => $ELEMENT_ID, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y"), false, false, array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID"));
if ($arIBlockElement = $rsIBlockElement->Fetch()) {
$IBLOCK_ID = $arIBlockElement["IBLOCK_ID"];
$SECTION_ID = $arIBlockElement["IBLOCK_SECTION_ID"];
}
}
if ($IBLOCK_ID <= 0) {
return $arButtons;
}
$bCatalog = false;
if (isset($arOptions["CATALOG"]) && $arOptions["CATALOG"] == true) {
if (CModule::IncludeModule('catalog')) {
$bCatalog = true;
}
}
$return_url = array("add_element" => "", "edit_element" => "", "edit_iblock" => "", "history_element" => "", "edit_section" => "", "add_section" => "", "delete_section" => "", "delete_element" => "", "element_list" => "", "section_list" => "");
if (array_key_exists("RETURN_URL", $arOptions)) {
if (is_array($arOptions["RETURN_URL"])) {
foreach ($arOptions["RETURN_URL"] as $key => $url) {
if (!empty($url) && array_key_exists($key, $return_url)) {
$return_url[$key] = $url;
}
}
} elseif (!empty($arOptions["RETURN_URL"])) {
foreach ($return_url as $key => $url) {
$return_url[$key] = $arOptions["RETURN_URL"];
}
}
}
$str = "";
foreach ($return_url as $key => $url) {
if (empty($url)) {
if (empty($str)) {
if (defined("BX_AJAX_PARAM_ID")) {
$str = $APPLICATION->GetCurPageParam("", array(BX_AJAX_PARAM_ID));
} else {
$str = $APPLICATION->GetCurPageParam();
}
}
$return_url[$key] = $str;
}
}
$arIBlock = CIBlock::GetArrayByID($IBLOCK_ID);
$bWorkflow = CModule::IncludeModule("workflow") && $arIBlock["WORKFLOW"] !== "N";
$s = $bWorkflow ? "&WF=Y" : "";
$arLabels = $arOptions["LABELS"];
if ($ELEMENT_ID > 0 && CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ELEMENT_ID, "element_edit")) {
$url = "/bitrix/admin/" . CIBlock::GetAdminElementEditLink($IBLOCK_ID, $ELEMENT_ID, array("force_catalog" => $bCatalog, "filter_section" => $SECTION_ID, "bxpublic" => "Y", "from_module" => "iblock", "return_url" => $return_url["edit_element"])) . $s;
$action = $APPLICATION->GetPopupLink(array("URL" => $url, "PARAMS" => array("width" => 700, 'height' => 400, 'resize' => false)));
$arButton = array("TEXT" => strlen($arLabels["ELEMENT_EDIT_TEXT"]) ? $arLabels["ELEMENT_EDIT_TEXT"] : $arIBlock["ELEMENT_EDIT"], "TITLE" => strlen($arLabels["ELEMENT_EDIT_TITLE"]) ? $arLabels["ELEMENT_EDIT_TITLE"] : $arIBlock["ELEMENT_EDIT"], "ACTION" => 'javascript:' . $action, "ACTION_URL" => $url, "ONCLICK" => $action, "DEFAULT" => $APPLICATION->GetPublicShowMode() != 'configure' ? true : false, "ICON" => "bx-context-toolbar-edit-icon", "ID" => "bx-context-toolbar-edit-element");
$arButtons["edit"]["edit_element"] = $arButton;
$arButtons["configure"]["edit_element"] = $arButton;
$url = str_replace("&bxpublic=Y&from_module=iblock", "", $url);
$arButton["ACTION"] = "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')";
unset($arButton["ONCLICK"]);
$arButtons["submenu"]["edit_element"] = $arButton;
if ($bWorkflow) {
//.........这里部分代码省略.........
示例4: foreach
foreach ($arErrorsTmp as $e) {
$strWarning .= $e["message"] . "<br />";
}
}
}
}
$arDocumentStates = null;
CBPDocument::AddDocumentToHistory(BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]), $arElement["NAME"], $GLOBALS["USER"]->GetID());
}
}
if (!$strError) {
//Successfull update
//And go to proper page
if (isset($_POST["save"])) {
LocalRedirect($arResult["~LIST_SECTION_URL"]);
} elseif ($lists_perm < CListPermissions::CAN_READ && !CIBlockElementRights::UserHasRightTo($arResult["IBLOCK_ID"], $arResult["ELEMENT_ID"], "element_read")) {
LocalRedirect($arResult["~LIST_SECTION_URL"]);
} else {
$url = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#group_id#"), array($arResult["IBLOCK_ID"], intval($_POST["IBLOCK_SECTION_ID"]), $arResult["ELEMENT_ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_ELEMENT_URL"]), array($tab_name => $_POST[$tab_name]), array("skip_empty" => true, "encode" => true));
if (isset($_GET["list_section_id"]) && strlen($_GET["list_section_id"]) == 0) {
$url = CHTTP::urlAddParams($url, array("list_section_id" => ""));
}
LocalRedirect($url);
}
} else {
ShowError($strError);
$bVarsFromForm = true;
}
} else {
//Go to list section page
LocalRedirect($arResult["~LIST_SECTION_URL"]);
示例5: GetMessage
$obRights->GetRights(array("count_overwrited" => true, "parents" => $str_IBLOCK_ELEMENT_SECTION)),
false, /*$bForceInherited=*/($ID <= 0) || $bCopy
);
$tabControl->EndCustomField("RIGHTS", $htmlHidden);
endif;
$bDisabled =
($view=="Y")
|| ($bWorkflow && $prn_LOCK_STATUS=="red")
|| (
(($ID <= 0) || $bCopy)
&& !CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $MENU_SECTION_ID, "section_element_bind")
)
|| (
(($ID > 0) && !$bCopy)
&& !CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_edit")
)
|| (
$bBizproc
&& !$canWrite
)
;
if (!defined('BX_PUBLIC_MODE') || BX_PUBLIC_MODE != 1):
ob_start();
?>
<input <?if ($bDisabled) echo "disabled";?> type="submit" class="adm-btn-save" name="save" id="save" value="<?echo GetMessage("IBLOCK_EL_SAVE")?>">
<? if (!$bAutocomplete)
{
?><input <?if ($bDisabled) echo "disabled";?> type="submit" class="button" name="apply" id="apply" value="<?echo GetMessage('IBLOCK_APPLY')?>"><?
}
示例6: array
$dbIB = CIBlockElement::GetList(array(), array('ID' => $arParams['ENTITY_ID'], 'IBLOCK_ID' => $arParams['IBLOCK_ID']), false, false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'NAME'));
if ($dbIB && ($arIB = $dbIB->Fetch())) {
$arResult['ENTITY_NAME'] = $arIB['NAME'];
$arResult['ENTITY_PARENTS'][] = $arIB['IBLOCK_SECTION_ID'];
}
}
if (sizeof($arResult['ENTITY_PARENTS']) > 0 && intval($arResult['ENTITY_PARENTS'][0]) > 0) {
$dbChain = CIBlockSection::GetNavChain($arParams['IBLOCK_ID'], $arResult['ENTITY_PARENTS'][0]);
if ($dbChain) {
while ($arChain = $dbChain->Fetch()) {
$arResult['ENTITY_PARENTS'][] = $arChain['IBLOCK_SECTION_ID'];
}
}
}
}
if ($USER->CanDoOperation('webdav_change_settings') || $obIBlockRights && $obIBlockRights->UserHasRightTo($arParams['IBLOCK_ID'], $arParams['ENTITY_ID'], $checkOP)) {
$arTasks = CIBlockRights::GetRightsList();
$arTaskLetters = CWebDavIblock::GetTasks();
//bad hack. It's not public rights.
if (isset($arTaskLetters['S'])) {
unset($arTasks[$arTaskLetters['S']]);
}
if (isset($arTaskLetters['T'])) {
unset($arTasks[$arTaskLetters['T']]);
}
$arResult['PERMISSIONS'] = $arTasks;
if (!$bCreate) {
$arRightParams = array("count_overwrited" => true);
if (!empty($arResult['ENTITY_PARENTS'])) {
$arRightParams['parents'] = $arResult['ENTITY_PARENTS'];
}
示例7: array
$IBLOCK_ID = (int) $IBLOCK_ID;
if ($IBLOCK_ID <= 0) {
return;
}
$MENU_SECTION_ID = (int) $MENU_SECTION_ID;
$PRODUCT_ID = $ID > 0 ? CIBlockElement::GetRealElement($ID) : 0;
$arBaseProduct = false;
$periodTimeTypes = array();
if ($arMainCatalog['SUBSCRIPTION'] == 'Y') {
$arDefProduct = array('QUANTITY' => '', 'QUANTITY_RESERVED' => '', 'VAT_ID' => 0, 'VAT_INCLUDED' => 'N', 'QUANTITY_TRACE_ORIG' => 'D', 'CAN_BUY_ZERO_ORIG' => 'D', 'PRICE_TYPE' => '', 'RECUR_SCHEME_TYPE' => '', 'RECUR_SCHEME_LENGTH' => '', 'TRIAL_PRICE_ID' => '', 'WITHOUT_ORDER' => '', 'PURCHASING_PRICE' => '', 'PURCHASING_CURRENCY' => '', 'BARCODE_MULTI' => '', 'SUBSCRIBE_ORIG' => 'D');
$periodTimeTypes = CCatalogProduct::GetTimePeriodTypes(true);
} else {
$arDefProduct = array('QUANTITY' => '', 'QUANTITY_RESERVED' => '', 'WEIGHT' => '', 'WIDTH' => '', 'LENGTH' => '', 'HEIGHT' => '', 'MEASURE' => '', 'VAT_ID' => 0, 'VAT_INCLUDED' => 'N', 'QUANTITY_TRACE_ORIG' => 'D', 'CAN_BUY_ZERO_ORIG' => 'D', 'PURCHASING_PRICE' => '', 'PURCHASING_CURRENCY' => '', 'BARCODE_MULTI' => '', 'SUBSCRIBE_ORIG' => 'D');
}
if ($PRODUCT_ID > 0) {
$bReadOnly = !($USER->CanDoOperation('catalog_price') && CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $PRODUCT_ID, "element_edit_price"));
if ($arMainCatalog['SUBSCRIPTION'] == 'Y') {
$arProductSelect = array('ID', 'QUANTITY', 'QUANTITY_RESERVED', 'QUANTITY_TRACE_ORIG', 'VAT_ID', 'VAT_INCLUDED', 'CAN_BUY_ZERO_ORIG', 'PRICE_TYPE', 'RECUR_SCHEME_TYPE', 'RECUR_SCHEME_LENGTH', 'TRIAL_PRICE_ID', 'WITHOUT_ORDER', 'PURCHASING_PRICE', 'PURCHASING_CURRENCY', 'BARCODE_MULTI', 'SUBSCRIBE_ORIG', 'TYPE');
} else {
$arProductSelect = array('ID', 'QUANTITY', 'QUANTITY_RESERVED', 'QUANTITY_TRACE_ORIG', 'WEIGHT', 'WIDTH', 'LENGTH', 'HEIGHT', 'MEASURE', 'VAT_ID', 'VAT_INCLUDED', 'CAN_BUY_ZERO_ORIG', 'PURCHASING_PRICE', 'PURCHASING_CURRENCY', 'BARCODE_MULTI', 'SUBSCRIBE_ORIG', 'TYPE');
}
$rsProducts = CCatalogProduct::GetList(array(), array('ID' => $PRODUCT_ID), false, false, $arProductSelect);
$arBaseProduct = $rsProducts->Fetch();
if ($bCopy) {
$arBaseProduct['QUANTITY'] = '';
$arBaseProduct['QUANTITY_RESERVED'] = '';
}
} else {
$bReadOnly = !($USER->CanDoOperation('catalog_price') && CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $MENU_SECTION_ID, "element_edit_price"));
}
if (empty($arBaseProduct)) {
示例8: CanUserOperateDocument
function CanUserOperateDocument($operation, $userId, $documentId, $arParameters = array())
{
$documentId = trim($documentId);
if (strlen($documentId) <= 0) {
return false;
}
if (!array_key_exists("IBlockId", $arParameters) && (!array_key_exists("IBlockPermission", $arParameters) || !array_key_exists("DocumentStates", $arParameters) || !array_key_exists("IBlockRightsMode", $arParameters) || array_key_exists("IBlockRightsMode", $arParameters) && $arParameters["IBlockRightsMode"] === "E") || !array_key_exists("CreatedBy", $arParameters) && !array_key_exists("AllUserGroups", $arParameters)) {
$dbElementList = CIBlockElement::GetList(array(), array("ID" => $documentId, "SHOW_NEW" => "Y", "SHOW_HISTORY" => "Y"), false, false, array("ID", "IBLOCK_ID", "CREATED_BY"));
$arElement = $dbElementList->Fetch();
if (!$arElement) {
return false;
}
$arParameters["IBlockId"] = $arElement["IBLOCK_ID"];
$arParameters["CreatedBy"] = $arElement["CREATED_BY"];
}
if (!array_key_exists("IBlockRightsMode", $arParameters)) {
$arParameters["IBlockRightsMode"] = CIBlock::GetArrayByID($arParameters["IBlockId"], "RIGHTS_MODE");
}
if ($arParameters["IBlockRightsMode"] === "E") {
if ($operation === CBPCanUserOperateOperation::ReadDocument) {
return CIBlockElementRights::UserHasRightTo($arParameters["IBlockId"], $documentId, "element_read");
} elseif ($operation === CBPCanUserOperateOperation::WriteDocument) {
return CIBlockElementRights::UserHasRightTo($arParameters["IBlockId"], $documentId, "element_edit");
} elseif ($operation === CBPCanUserOperateOperation::StartWorkflow || $operation === CBPCanUserOperateOperation::ViewWorkflow) {
if (CIBlockElementRights::UserHasRightTo($arParameters["IBlockId"], $documentId, "element_edit")) {
return true;
}
if (!array_key_exists("WorkflowId", $arParameters)) {
return false;
}
if (!CIBlockElementRights::UserHasRightTo($arParameters["IBlockId"], $documentId, "element_read")) {
return false;
}
$userId = intval($userId);
if (!array_key_exists("AllUserGroups", $arParameters)) {
if (!array_key_exists("UserGroups", $arParameters)) {
$arParameters["UserGroups"] = CUser::GetUserGroup($userId);
}
$arParameters["AllUserGroups"] = $arParameters["UserGroups"];
if ($userId == $arParameters["CreatedBy"]) {
$arParameters["AllUserGroups"][] = "Author";
}
}
if (!array_key_exists("DocumentStates", $arParameters)) {
if ($operation === CBPCanUserOperateOperation::StartWorkflow) {
$arParameters["DocumentStates"] = CBPWorkflowTemplateLoader::GetDocumentTypeStates(array("iblock", "CIBlockDocument", "iblock_" . $arParameters["IBlockId"]));
} else {
$arParameters["DocumentStates"] = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", "iblock_" . $arParameters["IBlockId"]), array("iblock", "CIBlockDocument", $documentId));
}
}
if (array_key_exists($arParameters["WorkflowId"], $arParameters["DocumentStates"])) {
$arParameters["DocumentStates"] = array($arParameters["WorkflowId"] => $arParameters["DocumentStates"][$arParameters["WorkflowId"]]);
} else {
return false;
}
$arAllowableOperations = CBPDocument::GetAllowableOperations($userId, $arParameters["AllUserGroups"], $arParameters["DocumentStates"]);
if (!is_array($arAllowableOperations)) {
return false;
}
if ($operation === CBPCanUserOperateOperation::ViewWorkflow && in_array("read", $arAllowableOperations) || $operation === CBPCanUserOperateOperation::StartWorkflow && in_array("write", $arAllowableOperations)) {
return true;
}
$chop = $operation === CBPCanUserOperateOperation::ViewWorkflow ? "element_read" : "element_edit";
foreach ($arAllowableOperations as $op) {
$ar = CTask::GetOperations($op, true);
if (in_array($chop, $ar)) {
return true;
}
}
}
return false;
}
if (!array_key_exists("IBlockPermission", $arParameters)) {
if (CModule::IncludeModule('lists')) {
$arParameters["IBlockPermission"] = CLists::GetIBlockPermission($arParameters["IBlockId"], $userId);
} else {
$arParameters["IBlockPermission"] = CIBlock::GetPermission($arParameters["IBlockId"], $userId);
}
}
if ($arParameters["IBlockPermission"] <= "R") {
return false;
} elseif ($arParameters["IBlockPermission"] >= "W") {
return true;
}
$userId = intval($userId);
if (!array_key_exists("AllUserGroups", $arParameters)) {
if (!array_key_exists("UserGroups", $arParameters)) {
$arParameters["UserGroups"] = CUser::GetUserGroup($userId);
}
$arParameters["AllUserGroups"] = $arParameters["UserGroups"];
if ($userId == $arParameters["CreatedBy"]) {
$arParameters["AllUserGroups"][] = "Author";
}
}
if (!array_key_exists("DocumentStates", $arParameters)) {
$arParameters["DocumentStates"] = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", "iblock_" . $arParameters["IBlockId"]), array("iblock", "CIBlockDocument", $documentId));
}
if (array_key_exists("WorkflowId", $arParameters)) {
if (array_key_exists($arParameters["WorkflowId"], $arParameters["DocumentStates"])) {
$arParameters["DocumentStates"] = array($arParameters["WorkflowId"] => $arParameters["DocumentStates"][$arParameters["WorkflowId"]]);
//.........这里部分代码省略.........
示例9: foreach
$bizProcIndex = 0;
$arDocumentStates = CBPDocument::GetDocumentStates(BizProcDocument::generateDocumentComplexType($arParams["IBLOCK_TYPE_ID"], $arResult["IBLOCK_ID"]), $arResult["ELEMENT_ID"] > 0 ? BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $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(), BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"]));
} else {
$canViewWorkflow = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::StartWorkflow, $GLOBALS["USER"]->GetID(), BizProcDocument::generateDocumentComplexType($arParams["IBLOCK_TYPE_ID"], $arResult["IBLOCK_ID"]), array("sectionId" => intval($arResult["SECTION_ID"]), "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"]));
}
if ($canViewWorkflow) {
$arTab2Fields[] = array("id" => "BIZPROC_TITLE" . $bizProcIndex, "name" => $arDocumentState["TEMPLATE_NAME"], "type" => "section");
if ($arParams["IBLOCK_TYPE_ID"] != COption::GetOptionString("lists", "livefeed_iblock_type_id") && strlen($arDocumentState["ID"]) && CIBlockElementRights::UserHasRightTo($arResult["IBLOCK_ID"], $arResult["ELEMENT_ID"], "element_rights_edit") && strlen($arDocumentState["WORKFLOW_STATUS"])) {
$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"])) {
$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#", "#document_state_id#", "#group_id#"), array($arResult["IBLOCK_ID"], $arDocumentState["ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~BIZPROC_LOG_URL"]), array("back_url" => $backUrl), array("skip_empty" => true, "encode" => true));
if (strlen($arDocumentState["ID"])) {
$arTab2Fields[] = array("id" => "BIZPROC_STATE" . $bizProcIndex, "name" => GetMessage("CT_BLEE_BIZPROC_STATE"), "type" => "label", "value" => '<a href="' . htmlspecialcharsbx($url) . '">' . (strlen($arDocumentState["STATE_TITLE"]) ? $arDocumentState["STATE_TITLE"] : $arDocumentState["STATE_NAME"]) . '</a>');
$canDeleteWorkflow = false;
示例10: array
$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"]);
if (strlen($arDocumentState["ID"])) {
$arTab2Fields[] = array("id" => "BIZPROC_STATE" . $bizProcIndex, "name" => GetMessage("CT_BLEE_BIZPROC_STATE"), "type" => "label", "value" => '<a href="' . htmlspecialcharsbx($url) . '">' . (strlen($arDocumentState["STATE_TITLE"]) ? $arDocumentState["STATE_TITLE"] : $arDocumentState["STATE_NAME"]) . '</a>');
$canDeleteWorkflow = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), array("iblock", "CIBlockDocument", $arResult["ELEMENT_ID"]), array("UserGroups" => $arCurrentUserGroups));
if ($canDeleteWorkflow) {
示例11: intval
<?php
/** @global CUser $USER */
/** @global int $ID */
use Bitrix\Main, Bitrix\Main\Localization\Loc;
if ($USER->CanDoOperation('catalog_price')) {
$IBLOCK_ID = intval($IBLOCK_ID);
if (0 >= $IBLOCK_ID) {
return;
}
$MENU_SECTION_ID = intval($MENU_SECTION_ID);
$ID = (int) $ID;
$PRODUCT_ID = 0 < $ID ? CIBlockElement::GetRealElement($ID) : 0;
$boolPriceRights = $PRODUCT_ID > 0 ? CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $PRODUCT_ID, "element_edit_price") : CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $MENU_SECTION_ID, "element_edit_price");
if ($boolPriceRights) {
Loc::loadMessages($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/catalog/templates/product_edit_action.php');
$arCatalogBasePrices = array();
$arCatalogPrices = array();
$CAT_ROW_COUNTER = intval($CAT_ROW_COUNTER);
if ($CAT_ROW_COUNTER < 0) {
$strWarning .= Loc::getMessage("C2IT_INTERNAL_ERROR") . "<br>";
}
$arCatalogBaseGroup = CCatalogGroup::GetBaseGroup();
if (!$arCatalogBaseGroup) {
$strWarning .= Loc::getMessage("C2IT_NO_BASE_TYPE") . "<br>";
}
$CAT_VAT_ID = intval($CAT_VAT_ID);
$CAT_VAT_INCLUDED = !isset($CAT_VAT_INCLUDED) || $CAT_VAT_INCLUDED == 'N' ? 'N' : 'Y';
$bUseExtForm = isset($_POST['price_useextform']) && $_POST['price_useextform'] == 'Y';
if (!$bUseExtForm) {
$CAT_ROW_COUNTER = 0;
示例12: foreach
$arID[] = $arRes['ID'];
}
}
foreach ($arID as $ID) {
if (strlen($ID) <= 0) {
continue;
}
$ID = intval($ID);
$arRes = CIBlockElement::GetByID($ID);
$arRes = $arRes->Fetch();
if (!$arRes) {
continue;
}
$bPermissions = false;
//delete and modify can:
if (CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_edit_any_wf_status ")) {
$bPermissions = true;
} else {
//For delete action we have to check all statuses in element history
$STATUS_PERMISSION = CIBlockElement::WF_GetStatusPermission($arRes["WF_STATUS_ID"], $_REQUEST['action'] == "delete" ? $ID : false);
if ($STATUS_PERMISSION >= 2) {
$bPermissions = true;
}
}
if (!$bPermissions) {
$lAdmin->AddGroupError(GetMessage("IBLOCK_ADM_HISTORY_UPDERR3") . " (ID:" . $ID . ")", $ID);
continue;
}
switch ($_REQUEST['action']) {
case "delete":
$d = CIBlockElement::GetByID($ID);
示例13: intval
<?php
/** @global CUser $USER */
/** @global int $ID */
use Bitrix\Main, Bitrix\Main\Localization\Loc;
if ($USER->CanDoOperation('catalog_price')) {
$IBLOCK_ID = intval($IBLOCK_ID);
if ($IBLOCK_ID <= 0) {
return;
}
$PRODUCT_ID = 0 < $ID ? CIBlockElement::GetRealElement($ID) : 0;
$boolPriceRights = $PRODUCT_ID > 0 ? CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $PRODUCT_ID, "element_edit_price") : CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, "element_edit_price");
if ($boolPriceRights) {
Loc::loadMessages($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/catalog/templates/product_edit_action.php');
$arCatalogBasePrices = array();
$arCatalogPrices = array();
$SUBCAT_ROW_COUNTER = intval($SUBCAT_ROW_COUNTER);
if ($SUBCAT_ROW_COUNTER < 0) {
$strWarning .= Loc::getMessage("C2IT_INTERNAL_ERROR") . "<br>";
}
$arCatalogBaseGroup = CCatalogGroup::GetBaseGroup();
if (!$arCatalogBaseGroup) {
$strWarning .= Loc::getMessage("C2IT_NO_BASE_TYPE") . "<br>";
}
$SUBCAT_VAT_ID = intval($SUBCAT_VAT_ID);
$SUBCAT_VAT_INCLUDED = !isset($SUBCAT_VAT_INCLUDED) || $SUBCAT_VAT_INCLUDED == 'N' ? 'N' : 'Y';
$bUseExtForm = isset($_POST['subprice_useextform']) && $_POST['subprice_useextform'] == 'Y';
if (!$bUseExtForm) {
$SUBCAT_ROW_COUNTER = 0;
}
for ($i = 0; $i <= $SUBCAT_ROW_COUNTER; $i++) {
示例14: array
}
$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);
}
if ($lists_perm > CListPermissions::CAN_READ || CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, intval($arResult["SECTION_ID"]), "section_element_bind")) {
$urlCopy = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#group_id#"), array($arIBlock["ID"], intval($arResult["SECTION_ID"]), 0, $arParams["SOCNET_GROUP_ID"]), $arParams["LIST_ELEMENT_URL"]), array("copy_id" => $data["~ID"]), array("skip_empty" => true, "encode" => true));
$aActions[] = array("TEXT" => GetMessage("CC_BLL_ELEMENT_ACTION_MENU_COPY"), "ONCLICK" => "jsUtils.Redirect(arguments, '" . CUtil::JSEscape($urlCopy) . "')");
}
if (count($arBPStart) && ($lists_perm >= CListPermissions::CAN_BIZPROC || CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $data["~ID"], "element_bizproc_start"))) {
$aActions[] = array("TEXT" => GetMessage("CC_BLL_ELEMENT_ACTION_MENU_START_BP"), "MENU" => $arBPStart);
}
if ($lists_perm >= CListPermissions::CAN_WRITE || CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $data["~ID"], "element_delete")) {
$aActions[] = array("SEPARATOR" => true);
$aActions[] = array("ICONCLASS" => "delete", "TEXT" => GetMessage("CC_BLL_ELEMENT_ACTION_MENU_DELETE"), "ONCLICK" => "bxGrid_" . $arResult["GRID_ID"] . ".DeleteItem('" . $data["ID"] . "', '" . GetMessage("CC_BLL_ELEMENT_ACTION_MENU_DELETE_CONF") . "')");
$arResult["ELEMENTS_CAN_DELETE"][] = $data["ID"];
}
$arResult["ELEMENTS_ROWS"][] = array("id" => $data["ID"], "data" => $data, "actions" => $aActions, "columns" => $aCols);
}
$rsElements->bShowAll = false;
$arResult["NAV_OBJECT"] = $rsElements;
$arResult["SORT"] = $grid_sort["sort"];
$arResult["LIST_NEW_ELEMENT_URL"] = str_replace(array("#list_id#", "#section_id#", "#element_id#", "#group_id#"), array($arIBlock["ID"], intval($arResult["SECTION_ID"]), 0, $arParams["SOCNET_GROUP_ID"]), $arParams["LIST_ELEMENT_URL"]);
if ($arResult["ANY_SECTION"]) {
$arResult["LIST_NEW_ELEMENT_URL"] = CHTTP::urlAddParams($arResult["LIST_NEW_ELEMENT_URL"], array("list_section_id" => ""));
}
$APPLICATION->SetTitle(GetMessage("CC_BLL_TITLE", array("#NAME#" => $arResult["IBLOCK"]["NAME"])));
$APPLICATION->AddChainItem($arResult["IBLOCK"]["NAME"], CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#group_id#"), array($arResult["IBLOCK_ID"], 0, $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_URL"]), array("list_section_id" => "")));
示例15: IncludeModuleLangFile
<?php
/** @global CUser $USER */
/** @var string $strWarning */
/** @var int $IBLOCK_ID */
/** @var int $ID */
if ($USER->CanDoOperation('catalog_price')) {
$IBLOCK_ID = (int) $IBLOCK_ID;
$ID = (int) $ID;
$userId = (int) $USER->GetID();
if (0 < $IBLOCK_ID && 0 < $ID) {
$PRODUCT_ID = CIBlockElement::GetRealElement($ID);
$bUseStoreControl = COption::GetOptionString('catalog', 'default_use_store_control', 'N') == "Y";
$bEnableReservation = 'N' != COption::GetOptionString('catalog', 'enable_reservation');
if (CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $PRODUCT_ID, "element_edit_price")) {
IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/catalog/templates/product_edit_action.php');
if ('' == $strWarning) {
$bUseExtForm = isset($_POST['price_useextform']) && 'Y' == $_POST['price_useextform'];
$arCatalog = CCatalog::GetByID($IBLOCK_ID);
$arCatalogPrice_tmp = array();
$intBasePriceCount = count($arCatalogBasePrices);
$dbCatGroups = CCatalogGroup::GetList(array(), array("!BASE" => "Y"));
while ($arCatGroups = $dbCatGroups->Fetch()) {
unset($arCatalogPrice_tmp);
$arCatalogPrice_tmp = array();
for ($i = 0; $i < $intBasePriceCount; $i++) {
${"CAT_PRICE_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]} = str_replace(",", ".", ${"CAT_PRICE_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]});
$arCatalogPrice_tmp[$i] = array("ID" => IntVal(${"CAT_ID_" . $arCatGroups["ID"]}[$arCatalogBasePrices[$i]["IND"]]), "EXTRA_ID" => ${"CAT_EXTRA_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]} ? IntVal(${"CAT_EXTRA_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]}) : 0, "PRICE" => ${"CAT_PRICE_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]}, "CURRENCY" => Trim(${"CAT_CURRENCY_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]}), "QUANTITY_FROM" => $arCatalogBasePrices[$i]["QUANTITY_FROM"], "QUANTITY_TO" => $arCatalogBasePrices[$i]["QUANTITY_TO"]);
if (strlen($arCatalogPrice_tmp[$i]["CURRENCY"]) <= 0) {
$arCatalogPrice_tmp[$i]["CURRENCY"] = $arCatalogBasePrices[$i]["CURRENCY"];
}