1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
sequence.php
См. документацию.
1<?php
2
3namespace Bitrix\Iblock\BizprocType;
4
5use Bitrix\Bizproc\FieldType;
6use Bitrix\Main\Loader;
7
8if (Loader::requireModule("bizproc"))
9{
10 class Sequence extends UserTypeProperty
11 {
12 public static function getType()
13 {
14 return FieldType::INT;
15 }
16
25 public static function renderControlSingle(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode)
26 {
27 return self::renderControl($fieldType, $field, $value, $allowSelection, $renderMode);
28 }
29
38 public static function renderControlMultiple(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode)
39 {
40 $typeValue = [];
41 if (!is_array($value) || is_array($value) && \CBPHelper::isAssociativeArray($value))
42 {
43 $value = [$value];
44 }
45
46 foreach ($value as $v)
47 {
49 {
50 $typeValue[] = $v;
51 }
52 }
53
54 $controls = [];
55 foreach ($typeValue as $k => $v)
56 {
57 $singleField = $field;
58 $singleField["Index"] = $k;
59 $controls[] = self::renderControlSingle($fieldType, $singleField, $v, $allowSelection, $renderMode);
60 }
61
62 return static::wrapCloneableControls($controls, static::generateControlName($field));
63 }
64
74 protected static function renderControl(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode)
75 {
76 $name = static::generateControlName($field);
77 $controlId = static::generateControlId($field);
78 $className = static::generateControlClassName($fieldType, $field);
79
80 $options = $fieldType->getOptions();
81
82 $iblockId = self::getIblockId($fieldType);
83 $propertyId = 0;
84 $queryObject = \CIBlockProperty::getByID(mb_substr($field["Field"], mb_strlen("PROPERTY_")), $iblockId);
85 if ($property = $queryObject->fetch())
86 {
87 $propertyId = $property["ID"];
88 }
89
90 if ($value)
91 {
92 $value = (int) $value;
93 }
94 else
95 {
96 $sequence = new \CIBlockSequence($iblockId, $propertyId);
97 $value = $sequence->getCurrent();
98 }
99
100 $readonly = ((isset($options["write"]) && $options["write"] == "Y") ? "" : "readonly");
101
102 return '<input '.htmlspecialcharsbx($readonly).' type="text" class="'.
103 htmlspecialcharsbx($className).'" size="40" id="'.htmlspecialcharsbx($controlId).'" name="'
104 .htmlspecialcharsbx($name).'" value="'.htmlspecialcharsbx((string) $value).'"/>';
105 }
106
107 private static function getIblockId(FieldType $fieldType)
108 {
109 $documentType = $fieldType->getDocumentType();
110 $type = explode('_', $documentType[2]);
111 return intval($type[1]);
112 }
113 }
114}
$type
Определения options.php:106
static requireModule($moduleName)
Определения loader.php:174
static isExpression($text)
Определения activity.php:1718
$options
Определения commerceml2.php:49
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$iblockId
Определения iblock_catalog_edit.php:30
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
$name
Определения menu_edit.php:35
$value
Определения Param.php:39
getType()
Определения Param.php:116
$k
Определения template_pdf.php:567