Date :: renderControl: Bitrix method

      
<?php 
//  Bitrix\Bizproc\BaseType\Date :: renderControl()
//  /dist/bitrix/modules/bizproc/lib/basetype/date.php:116

    
protected static function renderControl(FieldType $fieldType, array $field$value$allowSelection$renderMode)
    {
        
$name = static::generateControlName($field);
        
$value = static::internalizeValue($fieldType'Renderer'$value);
        
$offset = ($value instanceof Value\Date) ? $value->getOffset() : 0;

        
$className = static::generateControlClassName($fieldType$field);
        
$renderResult '';

        if (
$renderMode FieldType::RENDER_MODE_public && $allowSelection)
        {
            
$renderResult '<input name="'.htmlspecialcharsbx($name).'" type="text" '
                
.'class="'.htmlspecialcharsbx($className).'"
                    value="'
.htmlspecialcharsbx($value).'"
                    placeholder="'
.htmlspecialcharsbx($fieldType->getDescription()).'"
                    data-role="inline-selector-target"
                    data-selector-type="'
.htmlspecialcharsbx($fieldType->getType()).'"
                >'
;
        }
        elseif (
$renderMode FieldType::RENDER_MODE_MOBILE)
        {
            
$renderResult '<div><input type="hidden" value="'
                
.htmlspecialcharsbx($value).'" data-type="'
                
.htmlspecialcharsbx(static::getType()).'" name="'.htmlspecialcharsbx($name).'"/>'
                
.'<a href="#" onclick="return BX.BizProcMobile.showDatePicker(this, event);">'
                
.($valuehtmlspecialcharsbx($value) : Loc::getMessage('BPDT_DATE_MOBILE_SELECT')).'</a></div>';
        }
        else
        {
            \
CJSCore::Init(['popup''date']);
            
$renderResult '<input type="text" name="'.htmlspecialcharsbx($name)
                .
'" value="'.htmlspecialcharsbx($value).'" class="'.htmlspecialcharsbx($className).'"/>'
                
.'<img src="/bitrix/js/main/core/images/calendar-icon.gif" alt="calendar" class="calendar-icon" '
                
.'onclick="BX.calendar({node:this, field: this.previousSibling, bTime: '
                
.(static::getType() == FieldType::DATETIME 'true' 'false')
                .
', bHideTime: '.(static::getType() == FieldType::DATETIME 'false' 'true').'});" '
                
.'onmouseover="BX.addClass(this, \'calendar-icon-hover\');" '
                
.'onmouseout="BX.removeClass(this, \'calendar-icon-hover\');" border="0"/>';

            
$tzName 'tz_'.$name;
            
$zones self::getZones();

            if (!
$offset && $renderMode FieldType::RENDER_MODE_PUBLIC)
            {
                
$offset 'current';
            }

            
$tzClassName 'bizproc-type-control-date-lc';
            if (
$fieldType->isMultiple())
            {
                
$tzClassName .= ' bizproc-type-control-date-lc-multiple';
            }

            
$renderResult .= '<select name="'.htmlspecialcharsbx($tzName).'" class="'.$tzClassName.'">';
            foreach (
$zones as $zone)
            {
                
$selected = ($offset && $offset === $zone['offset']) ? 'selected' '';
                
$renderResult .= '<option value="'.htmlspecialcharsbx($zone['value']).'" '.$selected.'>'
                    
.htmlspecialcharsbx($zone['text']).'</option>';
            }
            
$renderResult .= '</select>';

            if (
$fieldType->isMultiple())
            {
                
$settings $fieldType->getSettings();
                
$settings['timezones'] = $zones;
                
$fieldType->setSettings($settings);
            }
        }

        return 
$renderResult;
    }