66 $db = \CIBlock::GetList(Array(), Array(
"ID" =>
$iblockId,
"CHECK_PERMISSIONS" =>
"N"));
79 foreach(
$fields as $fieldId => $field)
81 if ($field[
"TYPE"] ==
"NAME")
84 "NAME" => $field[
"NAME"],
85 "SETTINGS" => $field[
"SETTlINGS"],
86 "DEFAULT_VALUE" => $field[
"DEFAULT_VALUE"],
87 "SORT" => $field[
"SORT"],
94 $iblockLength = strlen(
$iblock);
95 $datum = str_pad($iblockLength, 10,
"0", STR_PAD_LEFT).$iblock;
97 if (intval(
$iblock[
"PICTURE"]) > 0)
99 $picture = \CFile::MakeFileArray(
$iblock[
"PICTURE"]);
100 if (isset($picture[
"tmp_name"]) && !empty($picture[
"tmp_name"]))
102 $f = fopen($picture[
"tmp_name"],
"rb");
103 $pictureData = fread(
$f, filesize($picture[
"tmp_name"]));
106 $pictureTypeLength = strlen($picture[
"type"]);
107 $pictureLength = strlen($pictureData);
108 $datum .=
"P".str_pad($pictureTypeLength, 10,
"0", STR_PAD_LEFT).$picture[
"type"].str_pad($pictureLength, 10,
"0", STR_PAD_LEFT).$pictureData;
114 $templatesList = \CBPWorkflowTemplateLoader::GetList(
116 array(
"DOCUMENT_TYPE" => $documentType),
119 array(
"ID",
"AUTO_EXECUTE",
"NAME",
"DESCRIPTION",
"SYSTEM_CODE")
121 while ($templatesListItem = $templatesList->Fetch())
123 $templatesListItem = serialize($templatesListItem);
124 $bpDescrLength = strlen($templatesListItem);
125 $datum .=
"B".str_pad($bpDescrLength, 10,
"0", STR_PAD_LEFT).$templatesListItem;
127 $bp = \CBPWorkflowTemplateLoader::ExportTemplate($templatesListItem[
"ID"],
false);
128 $bpLength = strlen($bp);
129 $datum .= str_pad($bpLength, 10,
"0", STR_PAD_LEFT).$bp;
132 if (function_exists(
"gzcompress"))
133 $datum =
"compressed".gzcompress($datum, 9);
144 $f = fopen($filePath,
"rb");
145 $datum = fread(
$f, filesize($filePath));
148 if (mb_substr($datum, 0, 10) ===
"compressed")
149 $datum = gzuncompress(substr($datum, 10));
151 $len = intval(substr($datum, 0, 10));
152 $dataSerialized = substr($datum, 10, $len);
165 public static function import($iblockType, $datum,
$siteId =
null)
170 if (mb_substr($datum, 0, 10) ===
"compressed")
171 $datum = gzuncompress(substr($datum, 10));
173 $len = intval(substr($datum, 0, 10));
174 $iblockSerialized = substr($datum, 10, $len);
175 $datum = substr($datum, $len + 10);
177 $marker = substr($datum, 0, 1);
182 $len = intval(substr($datum, 1, 10));
183 $pictureType = substr($datum, 11, $len);
184 $datum = substr($datum, $len + 11);
186 $len = intval(substr($datum, 0, 10));
187 $picture = substr($datum, 10, $len);
188 $datum = substr($datum, $len + 10);
190 $marker = substr($datum, 0, 1);
200 while (!empty($datum))
204 $len = intval(substr($datum, 1, 10));
205 $bpDescr = substr($datum, 11, $len);
206 $datum = substr($datum, $len + 11);
208 $bpDescr =
CheckSerializedData($bpDescr) ? unserialize($bpDescr, [
"allowed_classes" =>
false]) : [];
210 $len = intval(substr($datum, 0, 10));
211 $bp = substr($datum, 10, $len);
212 $datum = substr($datum, $len + 10);
214 static::importTemplate($documentType, $bpDescr, $bp);
224 $marker = substr($datum, 0, 1);
266 private static function createIBlock($iblockType,
$iblock, $pictureType, $picture,
$siteId =
null)