本文整理汇总了PHP中CBPWorkflowTemplateLoader::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPWorkflowTemplateLoader::getList方法的具体用法?PHP CBPWorkflowTemplateLoader::getList怎么用?PHP CBPWorkflowTemplateLoader::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPWorkflowTemplateLoader
的用法示例。
在下文中一共展示了CBPWorkflowTemplateLoader::getList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processActionDefault
protected function processActionDefault()
{
if ($this->storage->isEnabledBizProc()) {
$documentData = array('DISK' => \Bitrix\Disk\BizProcDocument::generateDocumentComplexType($this->storage->getId()), 'WEBDAV' => \Bitrix\Disk\BizProcDocumentCompatible::generateDocumentComplexType($this->storage->getId()));
if (!empty($this->arParams['FILE_ID'])) {
$autoExecute = CBPDocumentEventType::Edit;
} else {
$autoExecute = CBPDocumentEventType::Create;
}
$this->arParams['BIZPROC_PARAMETERS'] = false;
$this->arParams['BIZPROC_PARAMETERS_REQUIRED'] = array();
$workflowTemplateId = '';
foreach ($documentData as $nameModule => $data) {
$workflowTemplateObject = CBPWorkflowTemplateLoader::getList(array(), array("DOCUMENT_TYPE" => $data, "AUTO_EXECUTE" => $autoExecute, "ACTIVE" => "Y"), false, false, array("ID", "PARAMETERS"));
while ($workflowTemplate = $workflowTemplateObject->getNext()) {
if (!empty($workflowTemplate['PARAMETERS'])) {
foreach ($workflowTemplate['PARAMETERS'] as $parametersId => $parameters) {
if ($parameters['Required']) {
$this->arParams['BIZPROC_PARAMETERS_REQUIRED'][] = 'bizproc' . $workflowTemplate['ID'] . '_' . $parametersId;
}
}
$this->arParams['BIZPROC_PARAMETERS'] = true;
}
$workflowTemplateId = $workflowTemplate['ID'];
}
}
$this->arParams['STATUS_START_BIZPROC'] = !empty($workflowTemplateId);
}
$this->arParams['STORAGE_ID'] = $this->storage->getId();
$this->includeComponentTemplate();
}
示例2: deleteDataIblock
public static function deleteDataIblock($iblockId)
{
$iblockId = intval($iblockId);
$documentType = array('lists', get_called_class(), 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);
}
}
示例3: processBeforeAction
protected function processBeforeAction($actionName)
{
parent::processBeforeAction($actionName);
if (strlen($this->arParams['STORAGE_ID']) <= 0) {
ShowError(Loc::getMessage('ACCESS_DENIED') . ' ' . Loc::getMessage('BIZPROC_WFEDIT_ERROR_TYPE'));
return false;
}
if ($this->arResult['ID'] > 0) {
$templatesList = CBPWorkflowTemplateLoader::getList(array(), array('ID' => $this->arResult['ID']));
if ($template = $templatesList->fetch()) {
if (!CBPDocument::canUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $this->getUser()->getID(), $template['DOCUMENT_TYPE'])) {
$this->showAccessDenied();
return false;
}
$this->arResult['TEMPLATE_NAME'] = $template['NAME'];
$this->arResult['TEMPLATE_DESC'] = $template['DESCRIPTION'];
$this->arResult['TEMPLATE_AUTOSTART'] = $template['AUTO_EXECUTE'];
$this->arResult['TEMPLATE'] = $template['TEMPLATE'];
$this->arResult['PARAMETERS'] = $template['PARAMETERS'];
$this->arResult['VARIABLES'] = $template['VARIABLES'];
$this->arResult['CONSTANTS'] = $template['CONSTANTS'];
} else {
$this->arResult['ID'] = 0;
}
if ($template["ENTITY"] == Bitrix\Disk\BizProcDocument::className()) {
$this->arResult['DOCUMENT_COMPLEX_TYPE'] = \Bitrix\Disk\BizProcDocument::generateDocumentComplexType($this->arParams['STORAGE_ID']);
$this->arResult['ENTITY'] = $template['ENTITY'];
} else {
$this->arResult['DOCUMENT_COMPLEX_TYPE'] = \Bitrix\Disk\BizProcDocumentCompatible::generateDocumentComplexType($this->arParams['STORAGE_ID']);
$this->arResult['ENTITY'] = $template['ENTITY'];
}
} else {
$this->arResult['ENTITY'] = Bitrix\Disk\BizProcDocument::className();
$this->arResult['DOCUMENT_COMPLEX_TYPE'] = \Bitrix\Disk\BizProcDocument::generateDocumentComplexType($this->arParams['STORAGE_ID']);
if (!CBPDocument::canUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $this->getUser()->getID(), $this->arResult['DOCUMENT_COMPLEX_TYPE'])) {
$this->showAccessDenied();
return false;
}
$this->arResult['TEMPLATE_NAME'] = Loc::getMessage("BIZPROC_WFEDIT_DEFAULT_TITLE");
$this->arResult['TEMPLATE_DESC'] = '';
$this->arResult['TEMPLATE_AUTOSTART'] = 1;
$this->arResult['PARAMETERS'] = array();
$this->arResult['VARIABLES'] = array();
$this->arResult['CONSTANTS'] = array();
if ($this->request->getQuery('init') == 'statemachine') {
$this->arResult['TEMPLATE'] = array(array('Type' => 'StateMachineWorkflowActivity', 'Name' => 'Template', 'Properties' => array(), 'Children' => array()));
} else {
$this->arResult['TEMPLATE'] = array(array('Type' => 'SequentialWorkflowActivity', 'Name' => 'Template', 'Properties' => array(), 'Children' => array()));
}
}
return true;
}
示例4: getData
protected function getData()
{
$this->arResult['SHOW_MODE'] = 'SelectWorkflow';
$this->arResult['TEMPLATES'] = array();
$this->arResult['PARAMETERS_VALUES'] = array();
$this->arResult['ERROR_MESSAGE'] = '';
$runtime = CBPRuntime::getRuntime();
$runtime->startRuntime();
$this->arResult['DocumentService'] = $runtime->getService('DocumentService');
foreach ($this->arResult['DOCUMENT_DATA'] as $nameModule => $data) {
$workflowTemplateObject = CBPWorkflowTemplateLoader::getList(array(), array('DOCUMENT_TYPE' => $data['DOCUMENT_TYPE'], 'ACTIVE' => 'Y'), false, false, array('ID', 'NAME', 'DESCRIPTION', 'MODIFIED', 'USER_ID', 'PARAMETERS'));
while ($workflowTemplate = $workflowTemplateObject->getNext()) {
if (!CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $this->getUser()->getID(), $data['DOCUMENT_ID'], array())) {
continue;
}
if ($nameModule == 'DISK') {
$this->arResult['TEMPLATES'][$workflowTemplate['ID']] = $workflowTemplate;
$this->arResult['TEMPLATES'][$workflowTemplate['ID']]['URL'] = htmlspecialcharsex($this->getApplication()->getCurPageParam('workflow_template_id=' . $workflowTemplate['ID'] . '&' . bitrix_sessid_get(), array('workflow_template_id', 'sessid')));
} else {
$this->arResult['TEMPLATES_OLD'][$workflowTemplate['ID']] = $workflowTemplate;
$this->arResult['TEMPLATES_OLD'][$workflowTemplate['ID']]['URL'] = htmlspecialcharsex($this->getApplication()->getCurPageParam('workflow_template_id=' . $workflowTemplate['ID'] . '&old=1&' . bitrix_sessid_get(), array('workflow_template_id', 'sessid')));
}
}
}
if ($this->arParams['TEMPLATE_ID'] > 0 && strlen($this->request->getPost('CancelStartParamWorkflow')) <= 0 && (array_key_exists($this->arParams['TEMPLATE_ID'], $this->arResult['TEMPLATES']) || array_key_exists($this->arParams['TEMPLATE_ID'], $this->arResult['TEMPLATES_OLD']))) {
if (array_key_exists($this->arParams['TEMPLATE_ID'], $this->arResult['TEMPLATES'])) {
$templates = $this->arResult['TEMPLATES'];
$documentParameters = $this->arResult['DOCUMENT_DATA']['DISK'];
$this->arResult['CHECK_TEMPLATE'] = 'DISK';
} else {
$templates = $this->arResult['TEMPLATES_OLD'];
$documentParameters = $this->arResult['DOCUMENT_DATA']['WEBDAV'];
$this->arResult['CHECK_TEMPLATE'] = 'WEBDAV';
}
$workflowTemplate = $templates[$this->arParams['TEMPLATE_ID']];
$arWorkflowParameters = array();
$canStartWorkflow = false;
if (count($workflowTemplate['PARAMETERS']) <= 0) {
$canStartWorkflow = true;
} elseif ($this->request->isPost() && strlen($this->request->getPost('DoStartParamWorkflow')) > 0 && check_bitrix_sessid()) {
$errorsTemporary = array();
$request = $this->request->getPostList()->toArray();
foreach ($_FILES as $key => $value) {
if (array_key_exists('name', $value)) {
if (is_array($value['name'])) {
$keys = array_keys($value['name']);
for ($i = 0, $cnt = count($keys); $i < $cnt; $i++) {
$array = array();
foreach ($value as $k1 => $v1) {
$array[$k1] = $v1[$keys[$i]];
}
$request[$key][] = $array;
}
} else {
$request[$key] = $value;
}
}
}
$arWorkflowParameters = CBPWorkflowTemplateLoader::checkWorkflowParameters($workflowTemplate['PARAMETERS'], $request, $documentParameters['DOCUMENT_TYPE'], $errorsTemporary);
if (count($errorsTemporary) > 0) {
$canStartWorkflow = false;
foreach ($errorsTemporary as $e) {
$this->errorCollection->add(array(new Error($e['message'])));
}
} else {
$canStartWorkflow = true;
}
}
if ($canStartWorkflow) {
$errorsTemporary = array();
$workflowId = CBPDocument::startWorkflow($this->arParams['TEMPLATE_ID'], $documentParameters['DOCUMENT_ID'], array_merge($arWorkflowParameters, array('TargetUser' => 'user_' . intval($this->getUser()->getID()))), $errorsTemporary);
if (count($errorsTemporary) > 0) {
$this->arResult['SHOW_MODE'] = 'StartWorkflowError';
foreach ($errorsTemporary as $e) {
$this->errorCollection->add(array(new Error('[' . $e['code'] . '] ' . $e['message'])));
}
} else {
$this->arResult['SHOW_MODE'] = 'StartWorkflowSuccess';
if (strlen($this->arResult['back_url']) > 0) {
LocalRedirect(str_replace('#WF#', $workflowId, $this->request->getQuery('back_url')));
$this->end(true);
}
}
} else {
$doStartParam = $this->request->isPost() && strlen($this->request->getPost('DoStartParamWorkflow') && check_bitrix_sessid()) > 0;
$keys = array_keys($workflowTemplate['PARAMETERS']);
foreach ($keys as $key) {
$value = $doStartParam ? $this->request->getQuery($key) : $workflowTemplate['PARAMETERS'][$key]['Default'];
if (!is_array($value)) {
$this->arResult['PARAMETERS_VALUES'][$key] = CBPHelper::convertParameterValues($value);
} else {
$keys1 = array_keys($value);
foreach ($keys1 as $key1) {
$this->arResult['PARAMETERS_VALUES'][$key][$key1] = CBPHelper::convertParameterValues($value[$key1]);
}
}
}
$this->arResult['SHOW_MODE'] = 'WorkflowParameters';
}
if ($this->errorCollection->hasErrors()) {
//.........这里部分代码省略.........
示例5: getAutoloadTemplateBizProc
protected function getAutoloadTemplateBizProc($documentData)
{
$this->arResult['WORKFLOW_TEMPLATES'] = array();
$this->arResult['BIZPROC_PARAMETERS'] = false;
foreach ($documentData as $nameModule => $data) {
$workflowTemplateObject = CBPWorkflowTemplateLoader::getList(array(), array("DOCUMENT_TYPE" => $data["DOCUMENT_TYPE"], "AUTO_EXECUTE" => CBPDocumentEventType::Create, "ACTIVE" => "Y"), false, false, array("ID", "NAME", "DESCRIPTION", "PARAMETERS"));
while ($workflowTemplate = $workflowTemplateObject->getNext()) {
if (!empty($workflowTemplate['PARAMETERS'])) {
$this->arResult['BIZPROC_PARAMETERS'] = true;
$this->arResult['WORKFLOW_TEMPLATES'][$workflowTemplate['ID']]['PARAMETERS'] = $workflowTemplate['PARAMETERS'];
}
$this->arResult['WORKFLOW_TEMPLATES'][$workflowTemplate['ID']]['ID'] = $workflowTemplate['ID'];
$this->arResult['WORKFLOW_TEMPLATES'][$workflowTemplate['ID']]['NAME'] = $workflowTemplate['NAME'];
}
}
}
示例6: startAutoBizProc
public static function startAutoBizProc($storageId, $fileId, $autoExecute, $workflowParameters)
{
$documentData = array('DISK' => array('DOCUMENT_TYPE' => \Bitrix\Disk\BizProcDocument::generateDocumentComplexType($storageId), 'DOCUMENT_ID' => \Bitrix\Disk\BizProcDocument::getDocumentComplexId($fileId)), 'WEBDAV' => array('DOCUMENT_TYPE' => \Bitrix\Disk\BizProcDocumentCompatible::generateDocumentComplexType($storageId), 'DOCUMENT_ID' => \Bitrix\Disk\BizProcDocumentCompatible::getDocumentComplexId($fileId)));
$error = array();
foreach ($documentData as $nameModule => $data) {
$workflowTemplateObject = \CBPWorkflowTemplateLoader::getList(array(), array("DOCUMENT_TYPE" => $data["DOCUMENT_TYPE"], "AUTO_EXECUTE" => $autoExecute, "ACTIVE" => "Y"), false, false, array("ID", "PARAMETERS"));
while ($workflowTemplate = $workflowTemplateObject->getNext()) {
if (!empty($workflowTemplate)) {
$workflowParameter = array();
foreach ($workflowParameters as $idParameter => $valueParameter) {
$search = $workflowTemplate['ID'];
$res = strpos($idParameter, $search);
if ($res === 7) {
$parameterKey = end(explode('_', $idParameter));
$workflowParameter[$parameterKey] = $valueParameter;
}
}
$workflowParametersCheck = \CBPWorkflowTemplateLoader::checkWorkflowParameters($workflowTemplate["PARAMETERS"], $workflowParameter, $data["DOCUMENT_TYPE"], $error);
\CBPDocument::startWorkflow($workflowTemplate['ID'], $data["DOCUMENT_ID"], $workflowParametersCheck, $error);
}
}
}
}
示例7: getTemplateData
protected function getTemplateData()
{
$this->arResult['NAV_RESULT'] = "";
$this->arResult['TEMPLATES'] = array();
$this->arResult['GRID_TEMPLATES'] = array();
$this->arResult['CREATE_NEW_TEMPLATES'] = false;
$this->arResult['PROMPT_OLD_TEMPLATE'] = false;
$checkNewTemplate = false;
$checkOldTemplate = false;
foreach ($this->arParams['DOCUMENT_DATA'] as $nameModule => $data) {
$result = CBPWorkflowTemplateLoader::getList(array('name' => 'asc'), 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 ($result) {
$checklistTemplate = $result->fetch();
if (!empty($checklistTemplate) && $nameModule == 'DISK') {
$checkNewTemplate = true;
} elseif (!empty($checklistTemplate) && $nameModule == 'WEBDAV') {
$checkOldTemplate = true;
}
$result->NavStart(25, false);
$this->arResult['NAV_RESULT'] = $result;
$adminPage = $this->getApplication()->getCurPageParam('&action=delete&' . bitrix_sessid_get(), array('back_url', 'action', 'ID', 'sessid'));
while ($res = $result->getNext()) {
$res['URL'] = array('EDIT' => CComponentEngine::makePathFromTemplate($this->arParams['~EDIT_URL'], array('ID' => $res['ID'])), 'DELETE' => $adminPage . '&ID=' . $res['ID']);
foreach ($res['URL'] as $key => $val) {
$res['URL']['~' . $key] = $val;
$res['URL'][$key] = htmlspecialcharsbx($val);
}
$res['USER'] = CUser::formatName($this->arParams['NAME_TEMPLATE'], array('NAME' => $res['~USER_NAME'], 'LAST_NAME' => $res['~USER_LAST_NAME'], 'SECOND_NAME' => $res['~USER_SECOND_NAME'], 'LOGIN' => $res['~USER_LOGIN']), true);
$autoExecuteText = array();
if ($res['AUTO_EXECUTE'] == CBPDocumentEventType::None) {
$autoExecuteText[] = Loc::getMessage('BPATT_AE_NONE');
}
if (($res['AUTO_EXECUTE'] & CBPDocumentEventType::Create) != 0) {
$autoExecuteText[] = Loc::getMessage('BPATT_AE_CREATE');
}
if (($res['AUTO_EXECUTE'] & CBPDocumentEventType::Edit) != 0) {
$autoExecuteText[] = Loc::getMessage('BPATT_AE_EDIT');
}
if (($res['AUTO_EXECUTE'] & CBPDocumentEventType::Delete) != 0) {
$autoExecuteText[] = Loc::getMessage('BPATT_AE_DELETE');
}
$res['AUTO_EXECUTE'] = $autoExecuteText;
$this->arResult['TEMPLATES'][$res['ID']] = $res;
$presentCreate = ($res['~AUTO_EXECUTE'] & CBPDocumentEventType::Create) != 0;
$url = $this->getApplication()->getCurPageParam('ID=' . $res['ID'] . '&action=create' . ($presentCreate ? 'present' : '') . '&' . bitrix_sessid_get(), array('back_url', 'action', 'ID', 'sessid'));
$presentEdit = ($res["~AUTO_EXECUTE"] & CBPDocumentEventType::Edit) != 0;
$url1 = $this->getApplication()->getCurPageParam('ID=' . $res["ID"] . '&action=edit' . ($presentEdit ? 'present' : '') . '&' . bitrix_sessid_get(), array('back_url', 'action', 'ID', 'sessid'));
$actions = array(array('ICONCLASS' => '', 'TITLE' => $presentCreate ? Loc::getMessage('BPATT_DO_N_LOAD_CREATE_TITLE') : Loc::getMessage('BPATT_DO_LOAD_CREATE_TITLE'), 'TEXT' => $presentCreate ? Loc::getMessage('BPATT_DO_N_LOAD_CREATE') : Loc::getMessage('BPATT_DO_LOAD_CREATE'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "');"), array('ICONCLASS' => '', 'TITLE' => $presentEdit ? Loc::getMessage('BPATT_DO_N_LOAD_EDIT_TITLE') : Loc::getMessage('BPATT_DO_LOAD_EDIT_TITLE'), 'TEXT' => $presentEdit ? Loc::getMessage('BPATT_DO_N_LOAD_EDIT') : Loc::getMessage('BPATT_DO_LOAD_EDIT'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($url1) . "');"));
$actions[] = array('SEPARATOR' => true);
if (isset($res['URL']['VARS'])) {
$actions[] = array('ICONCLASS' => "edit", 'TITLE' => Loc::getMessage('BPATT_DO_EDIT_VARS'), 'TEXT' => Loc::getMessage('BPATT_DO_EDIT_VARS1'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($res['URL']['~VARS']) . "');", 'DEFAULT' => false);
}
if (Loader::includeModule('bizprocdesigner')) {
$actions[] = array('ICONCLASS' => 'edit', 'TITLE' => Loc::getMessage('BPATT_DO_EDIT1'), 'TEXT' => Loc::getMessage('BPATT_DO_EDIT1'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($res['URL']['~EDIT']) . "');", 'DEFAULT' => true);
}
$actions[] = array('ICONCLASS' => "delete", 'TITLE' => Loc::getMessage('BPATT_DO_DELETE1'), 'TEXT' => Loc::getMessage('BPATT_DO_DELETE1'), 'ONCLICK' => "if(confirm('" . CUtil::JSEscape(Loc::getMessage('BPATT_DO_DELETE1_CONFIRM')) . "')){jsUtils.Redirect([], '" . CUtil::JSEscape($res['URL']['~DELETE']) . "')};");
if ($nameModule == 'WEBDAV') {
$res['NAME'] .= ' ' . Loc::getMessage('BPATT_DO_OLD_TEMPLATE');
$res['~NAME'] .= ' ' . Loc::getMessage('BPATT_DO_OLD_TEMPLATE');
}
$this->arResult['GRID_TEMPLATES'][$res['ID']] = array('id' => $res['ID'], 'data' => $res, 'actions' => $actions, 'columns' => array('NAME' => Loader::includeModule('bizprocdesigner') ? '<a href="' . $res['URL']['EDIT'] . '">' . $res['NAME'] . '</a>' : $res['NAME'], 'AUTO_EXECUTE' => implode("<br />", $res['AUTO_EXECUTE'])), 'editable' => false);
}
}
}
if ($checkOldTemplate) {
$this->arResult['PROMPT_OLD_TEMPLATE'] = true;
if (!$checkNewTemplate) {
$this->arResult['CREATE_NEW_TEMPLATES'] = true;
}
}
}