当前位置: 首页>>代码示例>>PHP>>正文


PHP CBPWorkflowTemplateLoader::GetList方法代码示例

本文整理汇总了PHP中CBPWorkflowTemplateLoader::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPWorkflowTemplateLoader::GetList方法的具体用法?PHP CBPWorkflowTemplateLoader::GetList怎么用?PHP CBPWorkflowTemplateLoader::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBPWorkflowTemplateLoader的用法示例。


在下文中一共展示了CBPWorkflowTemplateLoader::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteDataIblock

 public static function deleteDataIblock($iblockId)
 {
     $iblockId = intval($iblockId);
     $documentType = array('lists', 'BizprocDocument', self::generateDocumentType($iblockId));
     $errors = array();
     $templateObject = CBPWorkflowTemplateLoader::GetList(array('ID' => 'DESC'), array('DOCUMENT_TYPE' => $documentType), false, false, array('ID'));
     while ($template = $templateObject->fetch()) {
         CBPDocument::deleteWorkflowTemplate($template['ID'], $documentType, $errors);
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:10,代码来源:bizprocdocument.php

示例2: UpdateWorkflowTemplate

	/**
	* Метод изменяет параметры шаблона рабочего потока.
	*
	* @param int $id - код шаблона рабочего потока.
	* @param array $documentType - код типа документа в виде массива array(модуль, сущность, код_типа_документа_в_модуле).
	* @param array $arFields - массив новых значений параметров шаблона рабочего потока.
	* @param array $arErrors - массив ошибок, которые произошли при выполнении в виде array(array("code" => код_ошибки, "message" => сообщение, "file" => путь_к_файлу), ...).
	*/
	public static function UpdateWorkflowTemplate($id, $documentType, $arFields, &$arErrors)
	{
		$arErrors = array();

		$dbTemplates = CBPWorkflowTemplateLoader::GetList(
			array(),
			array("ID" => $id, "DOCUMENT_TYPE" => $documentType),
			false,
			false,
			array("ID")
		);
		$arTemplate = $dbTemplates->Fetch();
		if (!$arTemplate)
		{
			$arErrors[] = array(
				"code" => 0,
				"message" => str_replace("#ID#", $id, GetMessage("BPCGDOC_INVALID_WF_ID")),
				"file" => ""
			);
			return;
		}

		try
		{
			CBPWorkflowTemplateLoader::Update($id, $arFields);
		}
		catch (Exception $e)
		{
			$arErrors[] = array(
				"code" => $e->getCode(),
				"message" => $e->getMessage(),
				"file" => $e->getFile()." [".$e->getLine()."]"
			);
		}
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:43,代码来源:document.php

示例3: array

if (strlen($fatalErrorMessage) <= 0) {
    $documentType = array($moduleId, $entity, $documentType);
    $documentId = array($moduleId, $entity, $documentId);
    $runtime = CBPRuntime::GetRuntime();
    $runtime->StartRuntime();
    $documentService = $runtime->GetService("DocumentService");
    $bCanUserStartDocumentWorkflow = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $GLOBALS["USER"]->GetID(), $documentId, array("UserGroups" => $GLOBALS["USER"]->GetUserGroupArray()));
    if (!$bCanUserStartDocumentWorkflow) {
        $fatalErrorMessage .= GetMessage("BPABS_NO_PERMS") . ". ";
    }
}
if (strlen($fatalErrorMessage) <= 0) {
    $showMode = "SelectWorkflow";
    $workflowTemplateId = intval($_REQUEST["workflow_template_id"]);
    $arWorkflowTemplates = array();
    $dbWorkflowTemplate = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => $documentType, "ACTIVE" => "Y"), false, false, array("ID", "NAME", "DESCRIPTION", "MODIFIED", "USER_ID", "PARAMETERS"));
    while ($arWorkflowTemplate = $dbWorkflowTemplate->GetNext()) {
        $arWorkflowTemplates[$arWorkflowTemplate["ID"]] = $arWorkflowTemplate;
        $arWorkflowTemplates[$arWorkflowTemplate["ID"]]["URL"] = htmlspecialcharsex($APPLICATION->GetCurPageParam("workflow_template_id=" . $arWorkflowTemplate["ID"] . '&' . bitrix_sessid_get(), array("workflow_template_id", "sessid")));
    }
    if ($workflowTemplateId > 0 && check_bitrix_sessid() && strlen($_POST["CancelStartParamWorkflow"]) <= 0 && array_key_exists($workflowTemplateId, $arWorkflowTemplates)) {
        $arWorkflowTemplate = $arWorkflowTemplates[$workflowTemplateId];
        $arWorkflowParameters = array();
        $bCanStartWorkflow = false;
        if (count($arWorkflowTemplate["PARAMETERS"]) <= 0) {
            $bCanStartWorkflow = true;
        } elseif ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["DoStartParamWorkflow"]) > 0) {
            $arErrorsTmp = array();
            $arRequest = $_REQUEST;
            foreach ($_FILES as $k => $v) {
                if (array_key_exists("name", $v)) {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:bizproc_start.php

示例4: array

	else
		return "'".str_replace("'", "\'", $var)."'";

}

$db = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => $documentType));
if ($ar = $db->Fetch())
{
	$hFileTmp = fopen($_SERVER["DOCUMENT_ROOT"]."/+++++++2.+++", "a");  // DUMPING
	fwrite($hFileTmp, print_rrr($ar));
	fclose($hFileTmp);
}
*/
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
    $workflowTemplateId = 0;
    $db = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => $documentType), false, false, array("ID"));
    if ($ar = $db->Fetch()) {
        $workflowTemplateId = intval($ar["ID"]);
    }
    if ($workflowTemplateId <= 0) {
        $redirectPath = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BP"], array("block_id" => $arParams["BLOCK_ID"]));
        if ($_REQUEST["template_type"] == "statemachine") {
            $redirectPath .= (strpos($redirectPath, "?") !== false ? "&" : "?") . "init=statemachine";
        }
        LocalRedirect($redirectPath);
    }
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
    $arWorkflowTemplate = CBPWorkflowTemplateLoader::GetTemplateState($workflowTemplateId);
    if (!is_array($arWorkflowTemplate["STATE_PERMISSIONS"]) || count($arWorkflowTemplate["STATE_PERMISSIONS"]) <= 0) {
        $arWorkflowTemplate["STATE_PERMISSIONS"]["create"] = array("author");
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例5: IncludeModuleLangFile

# mailto:sources@bitrixsoft.com              #
##############################################
*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/bizproc/prolog.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/bizproc/include.php";
CUtil::InitJSCore(array("window", "ajax"));
IncludeModuleLangFile(__FILE__);
$APPLICATION->SetTitle(GetMessage("BIZPROC_WFEDIT_TITLE_EDIT"));
$document_type = preg_replace("/[^0-9A-Za-z_-]/", "", $_REQUEST['document_type']);
$strFatalError = false;
$canWrite = false;
$arTemplate = false;
$ID = IntVal($_REQUEST['ID']);
if ($ID > 0) {
    $dbTemplatesList = CBPWorkflowTemplateLoader::GetList(array(), array("ID" => $ID));
    if ($arTemplate = $dbTemplatesList->Fetch()) {
        $canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), $arTemplate["DOCUMENT_TYPE"]);
        $document_type = $arTemplate["DOCUMENT_TYPE"][2];
        $workflowTemplateName = $arTemplate["NAME"];
        $workflowTemplateDescription = $arTemplate["DESCRIPTION"];
        $workflowTemplateAutostart = $arTemplate["AUTO_EXECUTE"];
        $arWorkflowTemplate = $arTemplate["TEMPLATE"];
        $arWorkflowParameters = $arTemplate["PARAMETERS"];
        $arWorkflowVariables = $arTemplate["VARIABLES"];
        $arWorkflowConstants = $arTemplate["CONSTANTS"];
    } else {
        $ID = 0;
    }
}
if ($ID <= 0) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:bizproc_workflow_edit.php

示例6: array

				Default falues
********************************************************************/
$arResult["NAV_STRING"] = "";
$arResult["NAV_RESULT"] = "";
$arResult["TEMPLATES"] = array();
$arResult["GRID_TEMPLATES"] = array();
/********************************************************************
				/Default falues
********************************************************************/
/********************************************************************
				Data
********************************************************************/
$arResult["GRID_ID"] = "bizproc_wflist_" . $arParams["MODULE_ID"];
$gridOptions = new CGridOptions($arResult["GRID_ID"]);
$gridSort = $gridOptions->GetSorting(array("sort" => array("NAME" => "ASC")));
$db_res = CBPWorkflowTemplateLoader::GetList($gridSort["sort"], array("DOCUMENT_TYPE" => $documentType), false, false, array("ID", "NAME", "DESCRIPTION", "MODIFIED", "USER_ID", "AUTO_EXECUTE", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN", "ACTIVE", "USER_SECOND_NAME"));
if ($db_res) {
    $db_res->NavStart(25, false);
    $arResult["NAV_RESULT"] = $db_res;
    $arResult["NAV_STRING"] = $db_res->GetPageNavStringEx($navComponentObject, GetMessage("BPATT_NAV"), "");
    $adminPage = $APPLICATION->GetCurPageParam('back_url=' . urlencode($back_url) . '&action=delete&' . bitrix_sessid_get(), array('back_url', 'action', 'ID', 'sessid'));
    while ($res = $db_res->GetNext()) {
        $res["URL"] = array("EDIT" => CComponentEngine::MakePathFromTemplate($arParams["~EDIT_URL"], array("ID" => $res["ID"], "MODULE_ID" => $arParams["MODULE_ID"], "ENTITY" => $arParams["ENTITY"], "DOCUMENT_ID" => $arParams["DOCUMENT_ID"])), "DELETE" => $adminPage . "&ID=" . $res["ID"]);
        if (isset($arParams["~EDIT_VARS_URL"]) && strlen($arParams["~EDIT_VARS_URL"]) > 0) {
            $res["URL"]["VARS"] = CComponentEngine::MakePathFromTemplate($arParams["~EDIT_VARS_URL"], array("ID" => $res["ID"], "MODULE_ID" => $arParams["MODULE_ID"], "ENTITY" => $arParams["ENTITY"], "DOCUMENT_ID" => $arParams["DOCUMENT_ID"]));
        }
        if (isset($arParams["~EDIT_CONSTANTS_URL"]) && strlen($arParams["~EDIT_CONSTANTS_URL"]) > 0) {
            $res["URL"]["CONSTANTS"] = CComponentEngine::MakePathFromTemplate($arParams["~EDIT_CONSTANTS_URL"], array("ID" => $res["ID"], "MODULE_ID" => $arParams["MODULE_ID"], "ENTITY" => $arParams["ENTITY"], "DOCUMENT_ID" => $arParams["DOCUMENT_ID"]));
        }
        foreach ($res["URL"] as $key => $val) {
            $res["URL"]["~" . $key] = $val;
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例7: array

                 $arFields["EVENT1"] = "forum";
                 $arFields["EVENT2"] = "message";
                 $arFields["EVENT3"] = "";
             }
             $arForum = array("ID" => CForumNew::Add($arFields));
         }
     }
 } else {
     $arForum = array("ID" => "");
 }
 if (CModule::IncludeModule('bizproc')) {
     if (CBPDocument::GetNumberOfWorkflowTemplatesForDocumentType(array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID)) <= 0) {
         CBPDocument::AddDefaultWorkflowTemplates(array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID));
     }
     $TEMPLATE_ID = 0;
     $dbWorkflowTemplate = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID), "SYSTEM_CODE" => "status.php", "ACTIVE" => "Y"), false, false, array("ID"));
     if ($arWorkflowTemplate = $dbWorkflowTemplate->Fetch()) {
         $TEMPLATE_ID = $arWorkflowTemplate["ID"];
     }
     $arElement = array("IBLOCK_ID" => $IBLOCK_ID, "NAME" => GetMessage("DEMO_IBLOCK_CONTENT_ARTICLES_NAME"), "PREVIEW_TEXT" => GetMessage("DEMO_IBLOCK_CONTENT_ARTICLES_PREVIEW_TEXT"), "WF_STATUS_ID" => 2, "WF_NEW" => "Y", "PROPERTY_VALUES" => array("KEYWORDS" => GetMessage("DEMO_IBLOCK_CONTENT_ARTICLES_KEYWORDS"), "THEMES" => 4));
     $obElement = new CIBlockElement();
     $element_id = $obElement->Add($arElement);
     if ($element_id && $TEMPLATE_ID > 0) {
         $arErrorsTmp = array();
         $bpId = CBPDocument::StartWorkflow($TEMPLATE_ID, array("iblock", "CIBlockDocument", $element_id), array("Creators" => array("author"), "Approvers" => array(1)), $arErrorsTmp);
         if (count($arErrorsTmp) <= 0) {
             $arDocumentStates = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID), array("iblock", "CIBlockDocument", $element_id));
             $arCurrentUserGroups = $GLOBALS["USER"]->GetUserGroupArray();
             $arCurrentUserGroups[] = "Author";
             $arEvents = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, array_pop($arDocumentStates));
             CBPDocument::SendExternalEvent($bpId, $arEvents[0]["NAME"], array("Groups" => $arCurrentUserGroups, "User" => $GLOBALS["USER"]->GetID()), $arErrorTmp);
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:content-articles.php

示例8: array

            case "delete":
                $arErrorsTmp = array();
                CBPDocument::DeleteWorkflowTemplate($ID, $documentType, $arErrorsTmp);
                if (count($arErrorsTmp) > 0) {
                    foreach ($arErrorsTmp as $e) {
                        $lAdmin->AddGroupError($e["message"], $ID);
                    }
                }
                break;
        }
    }
    if (empty($lAdmin->arGroupErrors) && !empty($_REQUEST["back_url"])) {
        LocalRedirect($_REQUEST["back_url"]);
    }
}
$dbResultList = CBPWorkflowTemplateLoader::GetList(array($by => $order), $arFilter, false, false, array("ID", "NAME", "DESCRIPTION", "MODIFIED", "USER_ID", "AUTO_EXECUTE", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN", "ACTIVE"));
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("BPATT_NAV")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "NAME", "content" => GetMessage("BPATT_NAME"), "sort" => "NAME", "default" => true), array("id" => "MODIFIED", "content" => GetMessage("BPATT_MODIFIED"), "sort" => "MODIFIED", "default" => true), array("id" => "USER", "content" => GetMessage("BPATT_USER"), "sort" => "USER_ID", "default" => true), array("id" => "ACTIVE", "content" => GetMessage("BPWFADM_ACT"), "sort" => "ACTIVE", "default" => true), array("id" => "AUTO_EXECUTE", "content" => GetMessage("BPATT_AUTO_EXECUTE"), "default" => true)));
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
while ($arResultItem = $dbResultList->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arResultItem);
    $row->AddField("ID", '<a href="' . $editPage . '?ID=' . $f_ID . '&document_type=' . urlencode($documentType[2]) . '&lang=' . LANGUAGE_ID . '&back_url_list=' . urlencode($backUrl) . '" title="' . GetMessage("BPATT_DO_EDIT") . '">' . $f_ID . '</a>');
    $row->AddInputField("NAME", array("SIZE" => "35"));
    $row->AddField("MODIFIED", $f_MODIFIED);
    $row->AddCheckField("ACTIVE");
    $row->AddField("USER", '[<a href="/bitrix/admin/user_edit.php?ID=' . $f_USER_ID . '&document_type=' . urlencode($documentType[2]) . '&lang=' . LANGUAGE_ID . '" title="' . GetMessage("BPATT_USER_PROFILE") . '">' . $f_USER_ID . '</a>] (' . $f_USER_LOGIN . ') ' . $f_USER_NAME . " " . $f_USER_LAST_NAME);
    $autoExecuteText = "";
    if ($f_AUTO_EXECUTE == CBPDocumentEventType::None) {
        $autoExecuteText .= GetMessage("BPATT_AE_NONE");
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:bizproc_workflow_admin.php

示例9: importTemplate

 private static function importTemplate($documentType, $bpDescr, $bp)
 {
     $id = 0;
     $db = \CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => $documentType, "SYSTEM_CODE" => $bpDescr["SYSTEM_CODE"]), false, false, array("ID", "IS_MODIFIED"));
     if ($res = $db->Fetch()) {
         if ($res["IS_MODIFIED"] == "Y") {
             return;
         }
         $id = $res["ID"];
     }
     try {
         \CBPWorkflowTemplateLoader::ImportTemplate($id, $documentType, $bpDescr["AUTO_EXECUTE"], $bpDescr["NAME"], $bpDescr["DESCRIPTION"], $bp, $bpDescr["SYSTEM_CODE"], true);
     } catch (\Exception $e) {
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:15,代码来源:importer.php

示例10: array

/********************************************************************
				Default falues
********************************************************************/
$arResult["NAV_STRING"] = "";
$arResult["NAV_RESULT"] = "";
$arResult["TEMPLATES"] = array();
$arResult["GRID_TEMPLATES"] = array();
/********************************************************************
				Data
********************************************************************/
$arResult['CREATE_NEW_TEMPLATES'] = false;
$arResult['PROMPT_OLD_TEMPLATE'] = false;
$checkNewTemplate = false;
$checkOldTemplate = false;
foreach ($documentData as $nameModule => $data) {
    $dbRes = CBPWorkflowTemplateLoader::GetList(array($by => $order), array("DOCUMENT_TYPE" => $data["DOCUMENT_TYPE"]), false, false, array("ID", "NAME", "DESCRIPTION", "MODIFIED", "USER_ID", "AUTO_EXECUTE", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN", "ACTIVE", "USER_SECOND_NAME"));
    if ($dbRes) {
        $checklistTemplate = $dbRes->Fetch();
        if (!empty($checklistTemplate) && $nameModule == 'DISK') {
            $checkNewTemplate = true;
        } elseif (!empty($checklistTemplate) && $nameModule == 'WEBDAV') {
            $checkOldTemplate = true;
        }
        $dbRes->NavStart(25, false);
        $arResult["NAV_RESULT"] = $dbRes;
        $arResult["NAV_STRING"] = $dbRes->GetPageNavStringEx($navComponentObject, GetMessage("BPATT_NAV"), "");
        $adminPage = $APPLICATION->GetCurPageParam('back_url=' . urlencode($back_url) . '&action=delete&' . bitrix_sessid_get(), array('back_url', 'action', 'ID', 'sessid'));
        while ($res = $dbRes->GetNext()) {
            $res["URL"] = array("EDIT" => CComponentEngine::MakePathFromTemplate($arParams["~EDIT_URL"], array("ID" => $res["ID"], "MODULE_ID" => $arParams["MODULE_ID"], "ENTITY" => $arParams["ENTITY"], "STORAGE_ID" => $arResult["STORAGE_ID"])), "DELETE" => $adminPage . "&ID=" . $res["ID"]);
            foreach ($res["URL"] as $key => $val) {
                $res["URL"]["~" . $key] = $val;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例11: CCrmPerms

$CrmPerms = new CCrmPerms($USER->GetID());
if (!$CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE')) {
    ShowError(GetMessage('CRM_PERMISSION_DENIED'));
    return;
}
$arTypes = array('CRM_LEAD' => array('ID' => 'CRM_LEAD', 'NAME' => GetMessage('CRM_BP_LEAD'), 'DOCUMENT' => 'CCrmDocumentLead', 'TYPE' => 'LEAD'), 'CRM_CONTACT' => array('ID' => 'CRM_CONTACT', 'NAME' => GetMessage('CRM_BP_CONTACT'), 'DOCUMENT' => 'CCrmDocumentContact', 'TYPE' => 'CONTACT'), 'CRM_COMPANY' => array('ID' => 'CRM_COMPANY', 'NAME' => GetMessage('CRM_BP_COMPANY'), 'DOCUMENT' => 'CCrmDocumentCompany', 'TYPE' => 'COMPANY'), 'CRM_DEAL' => array('ID' => 'CRM_DEAL', 'NAME' => GetMessage('CRM_BP_DEAL'), 'DOCUMENT' => 'CCrmDocumentDeal', 'TYPE' => 'DEAL'));
$arResult['ENTITY_ID'] = isset($_REQUEST['entity_id']) ? $_REQUEST['entity_id'] : $arParams['BP_ENTITY_ID'];
$arResult['BP_ID'] = isset($_REQUEST['bp_id']) ? $_REQUEST['bp_id'] : $arParams['BP_BP_ID'];
$arResult['ENTITY_NAME'] = $arTypes[$arResult['ENTITY_ID']]['NAME'];
$arResult['DOCUMENT_TYPE'] = $arTypes[$arResult['ENTITY_ID']]['TYPE'];
$arResult['ENTITY_TYPE'] = $arTypes[$arResult['ENTITY_ID']]['DOCUMENT'];
define('CRM_ENTITY', $arResult['ENTITY_TYPE']);
$arResult['~ENTITY_LIST_URL'] = $arParams['~ENTITY_LIST_URL'];
$arResult['ENTITY_LIST_URL'] = htmlspecialcharsbx($arResult['~ENTITY_LIST_URL']);
$arResult['~BP_LIST_URL'] = str_replace('#entity_id#', $arResult['ENTITY_ID'], $arParams['~BP_LIST_URL']);
$arResult['BP_LIST_URL'] = htmlspecialcharsbx($arResult['~BP_LIST_URL']);
$arResult['~BP_EDIT_URL'] = str_replace(array('#entity_id#'), array($arResult['ENTITY_ID']), $arParams['~BP_EDIT_URL']);
$arResult['BP_EDIT_URL'] = htmlspecialcharsbx($arResult['~BP_EDIT_URL']);
if (strlen($arResult['BP_ID']) > 0) {
    $db_res = CBPWorkflowTemplateLoader::GetList(array($by => $order), array('DOCUMENT_TYPE' => array('crm', $arResult['ENTITY_TYPE'], $arResult['DOCUMENT_TYPE']), 'ID' => $arResult['BP_ID']), false, false, array('ID', 'NAME'));
    if ($db_res) {
        $arTemplate = $db_res->Fetch();
    }
}
$this->IncludeComponentTemplate();
$APPLICATION->SetTitle(GetMessage('CRM_BP_LIST_TITLE_EDIT', array('#NAME#' => $arResult['ENTITY_NAME'])));
$APPLICATION->AddChainItem(GetMessage('CRM_BP_ENTITY_LIST'), $arResult['~ENTITY_LIST_URL']);
$APPLICATION->AddChainItem($arResult['ENTITY_NAME'], $arResult['~BP_LIST_URL']);
if (strlen($arTemplate['NAME']) > 0) {
    $APPLICATION->AddChainItem($arTemplate['NAME'], CComponentEngine::MakePathFromTemplate($arResult['~BP_EDIT_URL'], array('bp_id' => $arResult['BP_ID'])));
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例12: CanUserOperateDocumentType

 /**
  * Метод проверяет права на выполнение операций над документами заданного 
  * типа. Проверяются операции 4 - право изменять шаблоны рабочий потоков для 
  * данного типа документа.
  *
  * @param int $operation - операция.
  * @param int $userId - код пользователя, для которого проверяется право на выполнение операции.
  * @param string $documentId - код типа документа, к которому применяется операция.
  * @param array $arParameters - ассициативный массив вспомогательных 
  * параметров. Используется для того, чтобы не рассчитывать заново те 
  * вычисляемые значения, которые уже известны на момент вызова метода. 
  * Стандартными являются ключи массива DocumentStates - массив состояний 
  * рабочих потоков данного документа, WorkflowId - код рабочего потока (если 
  * требуется проверить операцию на одном рабочем потоке). Массив может быть 
  * дополнен другими произвольными ключами.
  * @return bool
  */
 function CanUserOperateDocumentType($operation, $userId, $documentType, $arParameters = array())
 {
     $documentType = trim($documentType);
     if (strlen($documentType) <= 0) {
         return false;
     }
     if ($storage = self::needProxyToDiskByDocType($documentType)) {
         return self::proxyToDisk(__FUNCTION__, array($operation, $userId, \Bitrix\Disk\BizProcDocumentCompatible::generateDocumentType($storage->getId()), $arParameters));
     }
     $iblockId = intval(substr($documentType, strlen("iblock_")));
     if ($iblockId <= 0) {
         throw new CBPArgumentOutOfRangeException("documentType", $documentType);
     }
     $arParameters["IBlockId"] = intval(substr($documentType, strlen("iblock_")));
     // Если нам явно не сказали, то узнаем инфоблочные права
     if (!array_key_exists("IBlockPermission", $arParameters)) {
         if (isset($arParameters['SectionId'])) {
             $arParameters['SectionId'] = intval($arParameters['SectionId']);
             $arParameters["IBlockPermission"] = CIBlockDocumentWebdav::GetIBRights('SECTION', $arParameters["IBlockId"], $arParameters['SectionId']);
         } else {
             $arParameters["IBlockPermission"] = CIBlockDocumentWebdav::GetIBRights('IBLOCK', $arParameters["IBlockId"]);
         }
     }
     if (CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_read") < "R") {
         return false;
     } elseif (CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_edit") >= "W") {
         return true;
     }
     // Если мы тут, то инфоблочные права равны U
     // Если нам явно не сказали, то узнаем группы пользователя
     $userId = intval($userId);
     if (!array_key_exists("AllUserGroups", $arParameters)) {
         if (!array_key_exists("UserGroups", $arParameters)) {
             $arParameters["UserGroups"] = CUser::GetUserGroup($userId);
         }
         $arParameters["AllUserGroups"] = $arParameters["UserGroups"];
         $arParameters["AllUserGroups"][] = "Author";
     }
     // Если нам явно не сказали, то узнаем текущие статусы документа
     if (!array_key_exists("DocumentStates", $arParameters)) {
         $arParameters["DocumentStates"] = CBPDocument::GetDocumentStates(array("webdav", "CIBlockDocumentWebdav", "iblock_" . $arParameters["IBlockId"]), null);
     }
     // Если нужно проверить только для одного рабочего потока
     if (array_key_exists("WorkflowId", $arParameters) && !empty($arParameters["WorkflowId"])) {
         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"]);
     // $arAllowableOperations == null - поток не является автоматом
     // $arAllowableOperations == array() - в автомате нет допустимых операций
     // $arAllowableOperations == array("read", ...) - допустимые операции
     if (!is_array($arAllowableOperations)) {
         return false;
     }
     $r = false;
     switch ($operation) {
         case CBPCanUserOperateOperation::ViewWorkflow:
             $r = CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_read") > "U" || in_array("read", $arAllowableOperations);
             break;
         case CBPCanUserOperateOperation::StartWorkflow:
             // право на запуск бизнес-процесса есть у имеющих право "W",
             $r = CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_bizproc_start") > "U" || in_array("write", $arAllowableOperations);
             // если задан конкретный шаблон потока, то проверяем его
             if ($r && CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_bizproc_start") <= "U" && $arParameters["WorkflowTemplateId"] > 0) {
                 // Выбираем все шаблоны для того, чтобы определить тип шаблона
                 // так как для последовательных процессов мы даем право на запуск
                 // бизнес-процесса без проверки прав на запись.
                 if (!array_key_exists("WorkflowTemplateList" . $arParameters["IBlockId"], $GLOBALS["WEBDAV"]["CACHE"])) {
                     if (array_key_exists("WorkflowTemplateList", $arParameters)) {
                         $GLOBALS["WEBDAV"]["CACHE"]["WorkflowTemplateList" . $arParameters["IBlockId"]] = array();
                         foreach ($arParameters["WorkflowTemplateList"] as $res) {
                             $GLOBALS["WEBDAV"]["CACHE"]["WorkflowTemplateList" . $arParameters["IBlockId"]][$res["ID"]] = $res;
                         }
                     } else {
                         $res = array();
                         $db_res = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("webdav", "CIBlockDocumentWebdav", "iblock_" . $arParameters["IBlockId"]), "ACTIVE" => "Y"), false, false, array("ID", "NAME", "DESCRIPTION", "TEMPLATE", "PARAMETERS"));
                         while ($arWorkflowTemplate = $db_res->GetNext()) {
                             $res[$arWorkflowTemplate["ID"]] = $arWorkflowTemplate;
                         }
                         $GLOBALS["WEBDAV"]["CACHE"]["WorkflowTemplateList" . $arParameters["IBlockId"]] = $res;
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:iblockbizproc.php

示例13: intval

    die;
}
$arParams["ID"] = intval($arParams["ID"]);
$arParams['POPUP'] = isset($arParams["POPUP"]) && $arParams["POPUP"] == 'Y';
$arParams['AJAX_RESPONSE'] = isset($arParams["AJAX_RESPONSE"]) && $arParams["AJAX_RESPONSE"] == 'Y';
if (!empty($_SERVER['HTTP_BX_AJAX']) && SITE_CHARSET != "utf-8") {
    CUtil::decodeURIComponent($_REQUEST);
    CUtil::decodeURIComponent($_FILES);
}
if ($arParams['POPUP']) {
    $APPLICATION->ShowAjaxHead();
}
$arTemplate = null;
$canWrite = false;
if ($arParams["ID"] > 0) {
    $dbTemplatesList = CBPWorkflowTemplateLoader::GetList(array(), array('ID' => $arParams['ID']), false, false, array('ID', 'DOCUMENT_TYPE', 'NAME', 'DESCRIPTION', 'CONSTANTS'));
    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['DESCRIPTION'] = $arTemplate['DESCRIPTION'];
        $arResult["CONSTANTS"] = $arTemplate["CONSTANTS"];
        $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";
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例14: InitializeIBlock

 function InitializeIBlock($taskType, $ownerId, $forumId)
 {
     $iblockId = COption::GetOptionInt("intranet", "iblock_tasks", 0);
     if ($iblockId <= 0) {
         return 0;
     }
     $forumId = intval($forumId);
     $arTasksConverted2BP = array();
     $keyTasksConverted2BP = $iblockId . "_" . $taskType . ($taskType == "group" ? "_" . $ownerId : "");
     global $CACHE_MANAGER;
     if ($CACHE_MANAGER->Read(2592000, "IntranetTasksConverted2BP")) {
         $arTasksConverted2BP = $CACHE_MANAGER->Get("IntranetTasksConverted2BP");
         if (array_key_exists($keyTasksConverted2BP, $arTasksConverted2BP)) {
             return $arTasksConverted2BP[$keyTasksConverted2BP];
         }
     }
     $globalParentSectionId = 0;
     $dbIBlock = CIBlock::GetList(array(), array("ID" => $iblockId, "ACTIVE" => "Y"));
     if ($arIBlock = $dbIBlock->Fetch()) {
         $arIBlockProperties = array();
         $dbIBlockProps = CIBlock::GetProperties($iblockId);
         while ($arIBlockProps = $dbIBlockProps->Fetch()) {
             $ind = StrLen($arIBlockProps["CODE"]) > 0 ? $arIBlockProps["CODE"] : $arIBlockProps["ID"];
             $arIBlockProperties[StrToUpper($ind)] = $arIBlockProps;
         }
         $arTasksProps = array("TASKPRIORITY" => array("NAME" => GetMessage("INTI_TASKPRIORITY"), "ACTIVE" => "Y", "SORT" => 100, "CODE" => "TaskPriority", "PROPERTY_TYPE" => "L", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId, "VALUES" => array(array("VALUE" => "   " . GetMessage("INTI_TASKPRIORITY_1"), "DEF" => "N", "SORT" => 100, "XML_ID" => "1"), array("VALUE" => "  " . GetMessage("INTI_TASKPRIORITY_2"), "DEF" => "Y", "SORT" => 200, "XML_ID" => "2"), array("VALUE" => " " . GetMessage("INTI_TASKPRIORITY_3"), "DEF" => "N", "SORT" => 300, "XML_ID" => "3"))), "TASKCOMPLETE" => array("NAME" => GetMessage("INTI_TASKCOMPLETE"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "TaskComplete", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKASSIGNEDTO" => array("NAME" => GetMessage("INTI_TASKASSIGNEDTO"), "ACTIVE" => "Y", "SORT" => 400, "CODE" => "TaskAssignedTo", "PROPERTY_TYPE" => "S", "USER_TYPE" => "UserID", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKTRACKERS" => array("NAME" => GetMessage("INTI_TASKTRACKERS"), "ACTIVE" => "Y", "SORT" => 400, "CODE" => "TaskTrackers", "PROPERTY_TYPE" => "S", "USER_TYPE" => "UserID", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "Y", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKALERT" => array("NAME" => GetMessage("INTI_TASKALERT"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "TaskAlert", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "Y", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKSIZE" => array("NAME" => GetMessage("INTI_TASKSIZE"), "ACTIVE" => "Y", "SORT" => 600, "CODE" => "TaskSize", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKSIZEREAL" => array("NAME" => GetMessage("INTI_TASKSIZEREAL"), "ACTIVE" => "Y", "SORT" => 700, "CODE" => "TaskSizeReal", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKFINISH" => array("NAME" => GetMessage("INTI_TASKFINISH"), "ACTIVE" => "Y", "SORT" => 800, "CODE" => "TaskFinish", "PROPERTY_TYPE" => "S", "USER_TYPE" => "DateTime", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKFILES" => array("NAME" => GetMessage("INTI_TASKFILES"), "ACTIVE" => "Y", "SORT" => 900, "CODE" => "TaskFiles", "PROPERTY_TYPE" => "F", "USER_TYPE" => false, "ROW_COUNT" => 10, "COL_COUNT" => 60, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "Y", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKREPORT" => array("NAME" => GetMessage("INTI_TASKREPORT"), "ACTIVE" => "Y", "SORT" => 1000, "CODE" => "TaskReport", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "ROW_COUNT" => 10, "COL_COUNT" => 60, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKREMIND" => array("NAME" => GetMessage("INTI_TASKREMIND"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "TaskRemind", "PROPERTY_TYPE" => "S", "USER_TYPE" => "DateTime", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "VERSION" => array("NAME" => GetMessage("INTI_VERSION"), "ACTIVE" => "Y", "SORT" => 1100, "CODE" => "VERSION", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 10, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKVERSION" => array("NAME" => GetMessage("INTI_TASKVERSION"), "ACTIVE" => "Y", "SORT" => 1100, "CODE" => "TASKVERSION", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 10, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId));
         foreach ($arTasksProps as $propKey => $arProp) {
             if (!array_key_exists($propKey, $arIBlockProperties)) {
                 $ibp = new CIBlockProperty();
                 $ibp->Add($arProp);
             }
         }
         $dbSectionsList = CIBlockSection::GetList(array(), array("GLOBAL_ACTIVE" => "Y", "XML_ID" => $taskType == "group" ? $ownerId : "users_tasks", "IBLOCK_ID" => $iblockId, "SECTION_ID" => 0), false);
         if ($arSection = $dbSectionsList->GetNext()) {
             $globalParentSectionId = $arSection["ID"];
         }
         if ($globalParentSectionId <= 0) {
             if ($taskType == "group") {
                 $folderName = "-";
                 $folderXmlId = $ownerId;
                 if ($arGroup = CSocNetGroup::GetByID($ownerId)) {
                     $folderName = $arGroup["NAME"] . " [" . $ownerId . "]";
                     $folderXmlId = $ownerId;
                 }
             } else {
                 $folderName = "User Tasks";
                 $folderXmlId = "users_tasks";
             }
             $arFields = array("IBLOCK_ID" => $iblockId, "IBLOCK_SECTION_ID" => 0, "ACTIVE" => "Y", "NAME" => $folderName, "XML_ID" => $folderXmlId);
             $iblockSection = new CIBlockSection();
             $globalParentSectionId = $iblockSection->Add($arFields, true);
             CIntranetTasks::InstallDefaultViews($taskType, $ownerId);
         }
         $db = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("intranet", "CIntranetTasksDocument", "x" . $iblockId)), false, false, array("ID"));
         //			while ($ar = $db->Fetch())
         //			{
         //				try
         //				{
         //					CBPWorkflowTemplateLoader::Delete($ar["ID"]);
         //				}
         //				catch(Exception $e)
         //				{
         //					CBPWorkflowTemplateLoader::Update($ar["ID"], array("AUTO_EXECUTE" => 0));
         //				}
         //			}
         $workflowTemplateId = 0;
         if ($ar = $db->Fetch()) {
             $workflowTemplateId = $ar["ID"];
         } else {
             require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/classes/general/tasks_wf_template.php";
             $workflowTemplateId = CBPWorkflowTemplateLoader::Add($arFields);
         }
         $arTaskStatusTmp = array();
         $arTaskStatusTmpAlt = array();
         $dbRes = CIBlockProperty::GetPropertyEnum("TaskStatus", array("SORT" => "ASC"), array("IBLOCK_ID" => $iblockId));
         while ($arRes = $dbRes->Fetch()) {
             $arTaskStatusTmp[StrToUpper($arRes["XML_ID"])] = $arRes["ID"];
             $arTaskStatusTmpAlt[$arRes["ID"]] = $arRes["XML_ID"];
         }
         $dbResult = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $iblockId, "INCLUDE_SUBSECTIONS" => "Y", "!PROPERTY_TASKVERSION" => 2), false, false, array("ID", "PROPERTY_TASKSTATUS", "PROPERTY_TASKASSIGNEDTO", "IBLOCK_SECTION_ID"));
         if ($arResult = $dbResult->Fetch()) {
             $arOldTasksWFs = array();
             $arOldTasksSTs = array();
             require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/classes/general/tasks_wf_template1.php";
             $arOldTasksWFsTmp = array();
             foreach ($arOldTasksWFs as $t1 => $t2) {
                 if (array_key_exists($t1, $arTaskStatusTmp)) {
                     $arOldTasksWFsTmp[$arTaskStatusTmp[$t1]] = $t2;
                 }
             }
             $arOldTasksSTsTmp = array();
             foreach ($arOldTasksSTs as $t1 => $t2) {
                 if (array_key_exists($t1, $arTaskStatusTmp)) {
                     $arOldTasksSTsTmp[$arTaskStatusTmp[$t1]] = $t2;
                 }
             }
             do {
                 $taskTypeTmp = "";
                 $ownerIdTmp = "";
                 $v = CIntranetTasks::PrepareSectionForPrint($arResult["IBLOCK_SECTION_ID"]);
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:tasks.php

示例15: executeComponent

 public function executeComponent()
 {
     if ($this->arParams['SET_TITLE']) {
         $this->setPageTitle(Loc::getMessage('BPWI_PAGE_TITLE'));
     }
     if (!empty($_POST['ID']) && check_bitrix_sessid() && $this->isAdmin()) {
         foreach ((array) $_POST['ID'] as $id) {
             CBPDocument::killWorkflow($id);
         }
     }
     $selectFields = array('ID', 'MODIFIED', 'OWNER_ID', 'OWNED_UNTIL', 'WS_MODULE_ID' => $this->getFieldName('WS_MODULE_ID'), 'WS_ENTITY' => $this->getFieldName('WS_ENTITY'), 'WS_DOCUMENT_ID' => $this->getFieldName('WS_DOCUMENT_ID'));
     $gridColumns = $this->getGridOptions()->getVisibleColumns();
     $this->arResult['HEADERS'] = $this->getGridHeaders();
     $showDocumentName = false;
     foreach ($this->arResult['HEADERS'] as $h) {
         if ((count($gridColumns) <= 0 || in_array($h['id'], $gridColumns)) && !in_array($h['id'], $selectFields)) {
             if ($this->getFieldName($h['id'])) {
                 $selectFields[$h['id']] = $this->getFieldName($h['id']);
             } elseif ($h['id'] == 'IS_LOCKED' && !in_array('OWNED_UNTIL', $selectFields)) {
                 $selectFields['OWNED_UNTIL'] = $this->getFieldName('OWNED_UNTIL');
             } elseif ($h['id'] == 'WS_DOCUMENT_NAME') {
                 $showDocumentName = true;
             }
         }
     }
     if (isset($selectFields['WS_STARTED_BY'])) {
         $selectFields['WS_STARTED_USER_NAME'] = $this->getFieldName('WS_STARTED_USER_NAME');
         $selectFields['WS_STARTED_USER_LAST_NAME'] = $this->getFieldName('WS_STARTED_USER_LAST_NAME');
         $selectFields['WS_STARTED_USER_LOGIN'] = $this->getFieldName('WS_STARTED_USER_LOGIN');
     }
     $filter = array();
     $templatesFilter = array();
     $this->arResult['DOCUMENT_TYPES'] = $this->getDocumentTypes();
     if (!empty($_REQUEST['type']) && isset($this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']])) {
         $this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['ACTIVE'] = true;
         if (!empty($this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['MODULE_ID'])) {
             $filter = array('=' . $this->getFieldName('WS_MODULE_ID') => $this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['MODULE_ID']);
             $templatesFilter = array('MODULE_ID' => $filter[$this->getFieldName('WS_MODULE_ID')]);
             if (!empty($this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['ENTITY'])) {
                 $filter['=' . $this->getFieldName('WS_ENTITY')] = $this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['ENTITY'];
                 $templatesFilter['ENTITY'] = $this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['ENTITY'];
             }
         } elseif ($_REQUEST['type'] == 'is_locked') {
             global $DB;
             $filter['<OWNED_UNTIL'] = date($DB->DateFormatToPHP(FORMAT_DATETIME), $this->getLockedTime());
         }
     } else {
         $this->arResult['DOCUMENT_TYPES']['*']['ACTIVE'] = true;
     }
     $templatesList = array('' => Loc::getMessage('BPWI_WORKFLOW_ID_ANY'));
     $dbResTmp = \CBPWorkflowTemplateLoader::GetList(array('NAME' => 'ASC'), $templatesFilter, false, false, array('ID', 'NAME'));
     while ($arResTmp = $dbResTmp->GetNext()) {
         $templatesList[$arResTmp['ID']] = $arResTmp['NAME'];
     }
     $this->arResult['FILTER'] = $this->getFilter();
     $this->arResult['FILTER'][] = array('id' => 'WS_WORKFLOW_TEMPLATE_ID', 'name' => Loc::getMessage('BPWI_WS_WORKFLOW_TEMPLATE_ID'), 'type' => 'list', 'items' => $templatesList);
     $gridFilter = $this->getGridOptions()->getFilter($this->arResult['FILTER']);
     $filter = $this->mergeFilters($filter, $gridFilter);
     if (!$this->isAdmin()) {
         global $USER;
         $filter['=' . $this->getFieldName('WS_STARTED_BY')] = $USER->getId();
     }
     list($currentPage, $pageSize, $offset) = $this->getPaginationInfo();
     $this->arResult['SORT'] = $this->getSorting();
     $this->arResult['CURRENT_PAGE'] = $currentPage;
     $this->arResult['SHOW_NEXT_PAGE'] = false;
     $this->arResult['RECORDS'] = array();
     $iterator = WorkflowInstanceTable::getList(array('order' => $this->arResult['SORT'], 'select' => $selectFields, 'filter' => $filter, 'limit' => $pageSize + 1, 'offset' => $offset));
     $rowsCount = 0;
     while ($row = $iterator->fetch()) {
         $rowsCount++;
         if ($rowsCount > $pageSize) {
             $this->arResult['SHOW_NEXT_PAGE'] = true;
             break;
         }
         $row['WS_WORKFLOW_TEMPLATE_ID'] = $row['WS_WORKFLOW_TEMPLATE_ID'] ? $templatesList[$row['WS_WORKFLOW_TEMPLATE_ID']] : null;
         $row['IS_LOCKED'] = $row['OWNED_UNTIL'] && $row['OWNED_UNTIL']->getTimestamp() < $this->getLockedTime();
         if (!empty($row['WS_STARTED_BY'])) {
             $row['WS_STARTED_BY'] = CUser::FormatName($this->arParams["NAME_TEMPLATE"], array('LOGIN' => $row['WS_STARTED_USER_LOGIN'], 'NAME' => $row['WS_STARTED_USER_NAME'], 'LAST_NAME' => $row['WS_STARTED_USER_LAST_NAME']), true) . " [" . $row['WS_STARTED_BY'] . "]";
         }
         $row['DOCUMENT_URL'] = $row['WS_DOCUMENT_NAME'] = '';
         if (!empty($row['WS_MODULE_ID'])) {
             $row['DOCUMENT_URL'] = CBPDocument::GetDocumentAdminPage(array($row['WS_MODULE_ID'], $row['WS_ENTITY'], $row['WS_DOCUMENT_ID']));
             if ($showDocumentName) {
                 $row['WS_DOCUMENT_NAME'] = CBPDocument::getDocumentName(array($row['WS_MODULE_ID'], $row['WS_ENTITY'], $row['WS_DOCUMENT_ID']));
             }
         }
         $rowActions = array(array("ICONCLASS" => "edit", "DEFAULT" => true, "TEXT" => Loc::getMessage("BPWI_OPEN_DOCUMENT"), "ONCLICK" => $row['DOCUMENT_URL'] ? "window.open('" . $row["DOCUMENT_URL"] . "');" : 'alert(\'' . Loc::getMessage('BPWI_NO_DOCUMENT') . '\')'));
         if ($this->isAdmin()) {
             $rowActions[] = array("ICONCLASS" => "delete", "TEXT" => Loc::getMessage("BPWI_DELETE_LABEL"), "ONCLICK" => "bxGrid_" . static::GRID_ID . ".DeleteItem('" . $row['ID'] . "', '" . Loc::getMessage("BPWI_DELETE_CONFIRM") . "')");
         }
         $this->arResult['RECORDS'][] = array('data' => $row, 'editable' => $this->isAdmin(), 'actions' => $rowActions);
     }
     $this->arResult['ROWS_COUNT'] = sizeof($this->arResult['RECORDS']);
     $this->arResult['GRID_ID'] = static::GRID_ID;
     $this->arResult['FILTER_PRESETS'] = $this->getFilterPresets();
     $this->arResult['EDITABLE'] = $this->isAdmin();
     $this->includeComponentTemplate();
 }
开发者ID:Satariall,项目名称:izurit,代码行数:99,代码来源:class.php


注:本文中的CBPWorkflowTemplateLoader::GetList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。