Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/iblock/lib/bizproctype/ |
Upload File : |
<?php namespace Bitrix\Iblock\BizprocType; use Bitrix\Bizproc\FieldType; use Bitrix\Main\Loader; if (Loader::requireModule("bizproc")) { class Sequence extends UserTypeProperty { public static function getType() { return FieldType::INT; } /** * @param FieldType $fieldType Document field type. * @param array $field Form field. * @param mixed $value Field value. * @param bool $allowSelection Allow selection flag. * @param int $renderMode Control render mode. * @return string */ public static function renderControlSingle(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode) { return self::renderControl($fieldType, $field, $value, $allowSelection, $renderMode); } /** * @param FieldType $fieldType Document field type. * @param array $field Form field. * @param mixed $value Field value. * @param bool $allowSelection Allow selection flag. * @param int $renderMode Control render mode. * @return string */ public static function renderControlMultiple(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode) { $typeValue = []; if (!is_array($value) || is_array($value) && \CBPHelper::isAssociativeArray($value)) { $value = [$value]; } foreach ($value as $v) { if (!\CBPActivity::isExpression($v)) { $typeValue[] = $v; } } $controls = []; foreach ($typeValue as $k => $v) { $singleField = $field; $singleField["Index"] = $k; $controls[] = self::renderControlSingle($fieldType, $singleField, $v, $allowSelection, $renderMode); } return static::wrapCloneableControls($controls, static::generateControlName($field)); } /** * Low-level control rendering method * @param FieldType $fieldType * @param array $field * @param mixed $value * @param bool $allowSelection * @param int $renderMode * @return string - HTML rendering */ protected static function renderControl(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode) { $name = static::generateControlName($field); $controlId = static::generateControlId($field); $className = static::generateControlClassName($fieldType, $field); $options = $fieldType->getOptions(); $iblockId = self::getIblockId($fieldType); $propertyId = 0; $queryObject = \CIBlockProperty::getByID(mb_substr($field["Field"], mb_strlen("PROPERTY_")), $iblockId); if ($property = $queryObject->fetch()) { $propertyId = $property["ID"]; } if ($value) { $value = (int) $value; } else { $sequence = new \CIBlockSequence($iblockId, $propertyId); $value = $sequence->getCurrent(); } $readonly = ((isset($options["write"]) && $options["write"] == "Y") ? "" : "readonly"); return '<input '.htmlspecialcharsbx($readonly).' type="text" class="'. htmlspecialcharsbx($className).'" size="40" id="'.htmlspecialcharsbx($controlId).'" name="' .htmlspecialcharsbx($name).'" value="'.htmlspecialcharsbx((string) $value).'"/>'; } private static function getIblockId(FieldType $fieldType) { $documentType = $fieldType->getDocumentType(); $type = explode('_', $documentType[2]); return intval($type[1]); } } }