本文整理汇总了PHP中CBPHelper::convertParameterValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::convertParameterValues方法的具体用法?PHP CBPHelper::convertParameterValues怎么用?PHP CBPHelper::convertParameterValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPHelper
的用法示例。
在下文中一共展示了CBPHelper::convertParameterValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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()) {
//.........这里部分代码省略.........