本文整理汇总了PHP中CBPWorkflowTemplateLoader::ExportTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPWorkflowTemplateLoader::ExportTemplate方法的具体用法?PHP CBPWorkflowTemplateLoader::ExportTemplate怎么用?PHP CBPWorkflowTemplateLoader::ExportTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPWorkflowTemplateLoader
的用法示例。
在下文中一共展示了CBPWorkflowTemplateLoader::ExportTemplate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restore_exception_handler
}
restore_exception_handler();
?>
<script type="text/javascript">
window.location = '<?php
echo $_REQUEST["apply"] == "Y" ? Cutil::JSEscape("/bitrix/admin/" . MODULE_ID . "_bizproc_workflow_edit.php?lang=" . LANGUAGE_ID . "&entity=" . AddSlashes(ENTITY) . "&ID=" . $ID . "&back_url_list=" . urlencode($_REQUEST["back_url_list"])) : Cutil::JSEscape($back_url);
?>
';
</script>
<?php
die;
}
if ($_SERVER['REQUEST_METHOD'] == 'GET' && $_REQUEST['export_template'] == 'Y' && check_bitrix_sessid()) {
$APPLICATION->RestartBuffer();
if ($ID > 0) {
$datum = CBPWorkflowTemplateLoader::ExportTemplate($ID);
header("HTTP/1.1 200 OK");
header("Content-Type: application/force-download; name=\"bp-" . $ID . ".bpt\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . (function_exists('mb_strlen') ? mb_strlen($datum, 'ISO-8859-1') : strlen($datum)));
header("Content-Disposition: attachment; filename=\"bp-" . $ID . ".bpt\"");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
header("Pragma: public");
echo $datum;
}
die;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_REQUEST['import_template'] == 'Y' && check_bitrix_sessid()) {
$APPLICATION->RestartBuffer();
//CUtil::DecodeUriComponent($_POST);
示例2: export
/**
* @param int $iblockId This variable is the id iblock.
* @return string
* @throws Main\ArgumentNullException
* @throws Main\ArgumentOutOfRangeException
*/
public static function export($iblockId)
{
$iblockId = intval($iblockId);
if ($iblockId <= 0) {
throw new Main\ArgumentNullException("iblockId");
}
$db = \CIBlock::GetList(array(), array("ID" => $iblockId, "CHECK_PERMISSIONS" => "N"));
$iblock = $db->Fetch();
if (!$iblock) {
throw new Main\ArgumentOutOfRangeException("iblockId");
}
if (!$iblock["CODE"]) {
throw new Main\ArgumentException("Parameter 'CODE' is required.", "matches");
}
$list = new \CList($iblockId);
$fields = $list->getFields();
foreach ($fields as $fieldId => $field) {
if ($field["TYPE"] == "NAME") {
$iblock["~NAME_FIELD"] = array("NAME" => $field["NAME"], "SETTINGS" => $field["SETTINGS"], "DEFAULT_VALUE" => $field["DEFAULT_VALUE"], "SORT" => $field["SORT"]);
break;
}
}
$iblockUtf8 = Main\Text\Encoding::convertEncodingArray($iblock, LANG_CHARSET, "UTF-8");
$iblockUtf8 = serialize($iblockUtf8);
$iblockUtf8Length = Main\Text\String::getBinaryLength($iblockUtf8);
$datum = str_pad($iblockUtf8Length, 10, "0", STR_PAD_LEFT) . $iblockUtf8;
if (intval($iblock["PICTURE"]) > 0) {
$picture = \CFile::MakeFileArray($iblock["PICTURE"]);
if (isset($picture["tmp_name"]) && !empty($picture["tmp_name"])) {
$f = fopen($picture["tmp_name"], "rb");
$pictureData = fread($f, filesize($picture["tmp_name"]));
fclose($f);
$pictureTypeLength = Main\Text\String::getBinaryLength($picture["type"]);
$pictureLength = Main\Text\String::getBinaryLength($pictureData);
$datum .= "P" . str_pad($pictureTypeLength, 10, "0", STR_PAD_LEFT) . $picture["type"] . str_pad($pictureLength, 10, "0", STR_PAD_LEFT) . $pictureData;
}
}
$documentType = self::getDocumentType($iblock["IBLOCK_TYPE_ID"], $iblockId);
$templatesList = \CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => $documentType), false, false, array("ID", "AUTO_EXECUTE", "NAME", "DESCRIPTION", "SYSTEM_CODE"));
while ($templatesListItem = $templatesList->Fetch()) {
$bpDescrUtf8 = Main\Text\Encoding::convertEncodingArray($templatesListItem, LANG_CHARSET, "UTF-8");
$bpDescrUtf8 = serialize($bpDescrUtf8);
$bpDescrUtf8Length = Main\Text\String::getBinaryLength($bpDescrUtf8);
$datum .= "B" . str_pad($bpDescrUtf8Length, 10, "0", STR_PAD_LEFT) . $bpDescrUtf8;
$bp = \CBPWorkflowTemplateLoader::ExportTemplate($templatesListItem["ID"], false);
$bpLength = Main\Text\String::getBinaryLength($bp);
$datum .= str_pad($bpLength, 10, "0", STR_PAD_LEFT) . $bp;
}
if (function_exists("gzcompress")) {
$datum = "compressed" . gzcompress($datum, 9);
}
return $datum;
}