本文整理匯總了PHP中CBPWorkflowTemplateLoader::importTemplate方法的典型用法代碼示例。如果您正苦於以下問題:PHP CBPWorkflowTemplateLoader::importTemplate方法的具體用法?PHP CBPWorkflowTemplateLoader::importTemplate怎麽用?PHP CBPWorkflowTemplateLoader::importTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CBPWorkflowTemplateLoader
的用法示例。
在下文中一共展示了CBPWorkflowTemplateLoader::importTemplate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processActionImportTemplate
protected function processActionImportTemplate()
{
if ($this->request->getPost('import_template') == 'Y') {
$res = 0;
$error = '';
if (is_uploaded_file($_FILES['import_template_file']['tmp_name'])) {
$f = fopen($_FILES['import_template_file']['tmp_name'], "rb");
$datum = fread($f, filesize($_FILES['import_template_file']['tmp_name']));
if ($this->request->getPost('old_template')) {
$this->arResult['DOCUMENT_COMPLEX_TYPE'] = \Bitrix\Disk\BizProcDocumentCompatible::generateDocumentComplexType($this->arParams['STORAGE_ID']);
}
fclose($f);
try {
$res = CBPWorkflowTemplateLoader::importTemplate($this->arResult['ID'], $this->arResult['DOCUMENT_COMPLEX_TYPE'], $this->request->getPost('import_template_autostart'), $this->request->getPost('import_template_name'), $this->request->getPost('import_template_description'), $datum);
} catch (Exception $e) {
$error = preg_replace("#[\r\n]+#", " ", $e->getMessage());
}
}
if (intval($res) <= 0) {
$response = "\n\t\t\t\t\t<script>\n\t\t\t\t\t\talert('" . Loc::getMessage('BIZPROC_WFEDIT_IMPORT_ERROR') . (strlen($error) > 0 ? ': ' . $error : '') . "');\n\t\t\t\t\t\twindow.location = '" . str_replace('#ID#', $this->arResult['ID'], $this->arResult['EDIT_PAGE_TEMPLATE']) . "';\n\t\t\t\t\t</script>\n\t\t\t\t";
} else {
$response = "\n\t\t\t\t\t<script>\n\t\t\t\t\t\twindow.location = '" . str_replace('#ID#', $res, $this->arResult['EDIT_PAGE_TEMPLATE']) . "';\n\t\t\t\t\t</script>\n\t\t\t\t";
}
$this->sendResponse($response);
}
}