Генерирует HTML с выбором элемента во вcплывающем окне, шаблон select.

@return string
356721
protected function getEditHtmlSelect()
    {
        /** @var AdminBaseHelper $linkedHelper */
        $linkedHelper = $this->getSettings('HELPER');
        $inputSize = (int) $this->getSettings('INPUT_SIZE');
        $windowWidth = (int) $this->getSettings('WINDOW_WIDTH');
        $windowHeight = (int) $this->getSettings('WINDOW_HEIGHT');

        $name = 'FIELDS';
        $key = $this->getCode();

        $entityData = $this->getOrmElementData();

        if (!empty($entityData)) {
            $elementId = $entityData[$linkedHelper::pk()];
            $elementName = $entityData[$this->getSettings('TITLE_FIELD_NAME')] ?
                $entityData[$this->getSettings('TITLE_FIELD_NAME')] :
                Loc::getMessage('IBLOCK_ELEMENT_NOT_FOUND');
        } else {
            $elementId = '';
        }

        $popupUrl = $linkedHelper::getUrl(array_merge(
            array(
                'popup' => 'Y',
                'eltitle' => $this->getSettings('TITLE_FIELD_NAME'),
                'n' => $name,
                'k' => $key
            ),
            $this->getSettings('ADDITIONAL_URL_PARAMS')
        ));

        return '<input name="' . $this->getEditInputName() . '"
                     id="' . $name . '[' . $key . ']"
                     value="' . $elementId . '"
                     size="' . $inputSize . '"
                     type="text">' .
        '<input type="button"
                    value="..." onClick="jsUtils.OpenWindow(\''. $popupUrl . '\', ' . $windowWidth . ', '
        . $windowHeight . ');">' . '&nbsp;<span id="sp_' . md5($name) . '_' . $key . '" >' .
        static::prepareToOutput($elementName)
        . '</span>';
    }
856092
public function html()
    {
        if (!$this->hasContent() && !$this->isEditable()) {
            return '';
        }

        $content = $this->hasContent() ? $this->show() : $this->showDefault();

        // If the return data is a View then assign any parameters to it.
        if ($content instanceof View && !empty($this->viewParams)) {
            $content->with($this->viewParams);
        }

        return (string) $content;
    }
233793
protected function getInput()
	{
		$html = array();
		$attr = '';

		$select = new HtmlSelect;

		// Try to inject the text object into the field
		try
		{
			$select->setText($this->getText());
		}
		catch (\RuntimeException $exception)
		{
			// A Text object was not set, ignore the error and try to continue processing
		}

		// Initialize some field attributes.
		$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
		$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
		$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
		$attr .= $this->multiple ? ' multiple="multiple"' : '';

		// Initialize JavaScript field attributes.
		$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

		// Get the field groups.
		$groups = (array) $this->getGroups();

		// Create a read-only list (no name) with a hidden input to store the value.
		if ((string) $this->element['readonly'] == 'true')
		{
			$html[] = $select->groupedlist(
				$groups,
				null,
				array(
					'list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'group.items' => null, 'option.key.toHtml' => false,
					'option.text.toHtml' => false
				)
			);
			$html[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '"/>';
		}
		else
		// Create a regular list.
		{
			$html[] = $select->groupedlist(
				$groups,
				$this->name,
				array(
					'list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'group.items' => null, 'option.key.toHtml' => false,
					'option.text.toHtml' => false
				)
			);
		}

		return implode($html);
	}
814176
public function getHTML()
    {
        $this->parse();
        $xml = clone $this->xml;

        /* Удаляем расширенные теги */
        $tags = $xml->getElementsByTagNameNS(self::NS, '*');
        while ($tags->length > 0)
        {
            $node = $tags->item(0);
            $node->parentNode->removeChild($node);
        }

        // Есть ли поля для выбора файлов?
        $hasFileInputs = false;

        /*
         * Удаляем расширенные атрибуты
         * Ищем input[type=file]
         */
        $tags = $xml->getElementsByTagName('*');
        for ($i = 0; $i < $tags->length; $i++)
        {
            $node = $tags->item($i);

            $isElement = $node->nodeType == XML_ELEMENT_NODE;
            /** @var DOMElement $node */
            $hasAttributes = $isElement && $node->hasAttributes();

            if ($isElement && $hasAttributes)
            {
                /** @var DOMNamedNodeMap $attrs */
                $attrs = $node->attributes;
                for ($j = 0; $j < $attrs->length; $j++)
                {
                    /** @var DOMAttr $attr */
                    $attr = $attrs->item($j);
                    if ($attr->namespaceURI == self::NS)
                    {
                        $attr->ownerElement->removeAttributeNode($attr);
                        $j--;
                    }
                }

                if ($node->tagName == 'input' && $node->getAttribute('type') == 'file')
                {
                    $hasFileInputs = true;
                }
            }
        }

        if ($hasFileInputs)
        {
            /** @var DOMElement $element */
            $element = $xml->firstChild->nextSibling;
            $element->setAttribute('enctype', 'multipart/form-data');
        }

        // Предотвращаем схлопывание пустых textarea
        $tags = $xml->getElementsByTagName('textarea');
        for ($i = 0; $i < $tags->length; $i++)
        {
            $node = $tags->item($i);
            $cdata = $xml->createCDATASection('');
            $node->appendChild($cdata);
        }

        $xml->formatOutput = true;
        $html = $xml->saveXML($xml->firstChild->nextSibling);
        // Удаляем атрибуты пространств имён
        $html = preg_replace('/\s*xmlns:\w+=("|\').*?("|\')/', '', $html);
        // Удаляем пустые <![CDATA[]]>
        $html = str_replace('<![CDATA[]]>', '', $html);

        return $html;
    }
212477
public function getHtml(): string
  {
    $this->attributes['type']    = 'checkbox';
    $this->attributes['name']    = $this->submitName;
    $this->attributes['checked'] = !empty($this->value);

    $html = $this->prefix;
    $html .= $this->getHtmlPrefixLabel();
    $html .= Html::generateVoidElement('input', $this->attributes);
    $html .= $this->getHtmlPostfixLabel();
    $html .= $this->postfix;

    return $html;
  }
294474
private function _optionsHTML()
    {
        $result = '';
        foreach ($this->options() as $key => $label) {
            $selected = ResourceTable::getSearchValue($this->index()) == $key ? ' selected="selected"' : '';
            $result .= '<option value="'.$key.'"'.$selected.'>'.$label.'</option>';
        }
        return $result;
    }
192913
public function getHtml(): string
  {
    $this->prepareOverviewTable();

    if (!empty($this->templateData))
    {
      $this->setAttrData('slat-name', $this->submitName);

      // If required add template row to this louver control. This row will be used by JS for adding dynamically
      // additional rows to the louver control.
      $this->templateData[$this->templateKey] = 0;
      $row                                    = $this->rowFactory->createRow($this, $this->templateData);
      $row->addClass('slat_template');
      $row->setAttrStyle('visibility: collapse');
      $row->prepare($this->submitName);
    }

    $ret = $this->prefix;

    $ret .= Html::generateTag('table', $this->attributes);

    // Generate HTML code for the column classes.
    $ret .= '<colgroup>';
    $ret .= $this->rowFactory->getHtmlColumnGroup();
    $ret .= '</colgroup>';

    $ret .= Html::generateTag('thead', ['class' => OverviewTable::$class]);
    $ret .= $this->getHtmlHeader();
    $ret .= '</thead>';

    if ($this->footerControl)
    {
      $ret .= Html::generateTag('tfoot', ['class' => OverviewTable::$class]);
      $ret .= '<tr>';
      $ret .= Html::generateTag('td', ['colspan' => $this->rowFactory->getNumberOfColumns()]);
      $ret .= $this->footerControl->getHtml();
      $ret .= '</td>';
      $ret .= '<td class="error"></td>';
      $ret .= '</tr>';
      $ret .= '</tfoot>';
    }

    $ret .= Html::generateTag('tbody', ['class' => OverviewTable::$class]);
    $ret .= $this->getHtmlBody();
    $ret .= '</tbody>';

    $ret .= '</table>';

    $ret .= $this->postfix;

    $this->rowFactory->generateResponsiveCss($this->getAttribute('id'));

    return $ret;
  }
1036360
function toHTML()
    {

        // get the options of the select control
        $attributes = $this->get_attributes(array('options', 'value', 'multiple', 'other'));

        // if select box is not "multi-select" and the "other" attribute is set
        if (!isset($attributes['multiple']) && isset($attributes['other']))

            // add an extra options to the already existing ones
            $attributes['options'] += array('other' => $this->form_properties['language']['other']);

        // if the default value, as added when instantiating the object is still there
        // or if no options were specified
        if (($key = array_search('#replace-with-language#', $attributes['options'])) !== false || empty($attributes['options']))

            // put the label from the language file
            $attributes['options'][$key] = $this->form_properties['language']['select'];

        // use a private, recursive method to generate the select's content
        $optContent = $this->_generate($attributes['options'], $attributes['value']);

        // return generated HTML
        return '<select '. $this->_render_attributes() . '>' . $optContent . '</select>';

    }
752590
public function GetSelect() {
      // Close off any open query elements.
      $this->_EndQuery();
      
      $Sql = (!$this->_Distinct) ? 'select ' : 'select distinct ';

      // Don't escape the field if it is numeric or an asterisk (all columns)
      $Selects = array();
      foreach($this->_Selects as $Key => $Expr) {
         $Field = $Expr['Field'];
         $Function = $Expr['Function'];
         $Alias = $Expr['Alias'];
         $CaseOptions = ArrayValue('CaseOptions', $Expr);
         if ($Field != '*' && !is_numeric($Field))
            $Field = $this->EscapeIdentifier($Field);

         if ($Alias == '' && $Function != '')
            $Alias = $Field;

         // if (in_array(strtolower($Function), array('max', 'min', 'avg', 'sum', 'count')))
         if ($Function != '') {
				if(strpos($Function, '%s') !== FALSE)
					$Field = sprintf($Function, $Field);
				else
					$Field = $Function.'('.$Field.')';
			}

         if ($CaseOptions !== FALSE)
            $Field = 'case ' . $Field . $CaseOptions . ' end';

         if ($Alias != '')
            $Field .= ' as '.$this->QuoteIdentifier($Alias);

         if ($Field != '')
            $Selects[] = $Field;
      }
      $Sql .= (count($Selects) == 0) ? '*' : implode(', ', $Selects);

      if (count($this->_Froms) > 0)
         $Sql .= "\nfrom ".$this->_FromTables($this->_Froms);

      if (count($this->_Joins) > 0) {
         $Sql .= "\n";
         $Sql .= implode("\n", $this->_Joins);
      }

      if (count($this->_Wheres) > 0)
         $Sql .= "\nwhere ";

      $Sql .= implode("\n", $this->_Wheres);

      // Close any where groups that were left open.
      for ($i = 0; $i < $this->_OpenWhereGroupCount; ++$i) {
         $Sql .= ')';
      }
      $this->_OpenWhereGroupCount = 0;

      if (count($this->_GroupBys) > 0) {
         $Sql .= "\ngroup by ";

         // special consideration for table aliases
         if (count($this->_AliasMap) > 0 && $this->Database->DatabasePrefix)
            $Sql .= implode(', ', $this->_FilterTableAliases($this->_GroupBys));
         else
            $Sql .= implode(', ', $this->_GroupBys);
      }

      if (count($this->_Havings) > 0)
         $Sql .= "\nhaving ".implode("\n", $this->_Havings);

      if (count($this->_OrderBys) > 0)
         $Sql .= "\norder by ".implode(', ', $this->_OrderBys);

      if (is_numeric($this->_Limit)) {
         $Sql .= "\n";
         $Sql = $this->GetLimit($Sql, $this->_Limit, $this->_Offset);
      }

      return $Sql;
   }
846530
protected function get_element_markup() {
		$select_markup = "<select {$this->get_id_and_class_markup()}>";
		$value         = $this->get_value();

		foreach ( $this->option_values as $option_value => $display ) {
			$select_markup .= '<option value="' . \esc_attr( $option_value ) . '" ' . \selected( $value, $option_value, false ) . '>' . \esc_html( $display ) . '</option>';
		}
		$select_markup .= '</select>';

		return $select_markup;
	}
846074
public function getInputHtml()
    {
        $this->rule->setElementName($this->element->getName());

        if ($this->element->getValue()) {
            /* Hack : reload in a new instance to have element name set.
             *        can not be done in afterLoad of the backend model
             *        since we do not know yet the form structure
             */
            $conditions = $this->element->getValue();
            if (!is_array($conditions)) {
                $conditions = $conditions->getConditions()->asArray();
            }
            $this->rule->getConditions()->loadArray($conditions);
            $this->element->setRule($this->rule);
        }

        $this->input = $this->elementFactory->create('text');
        $this->input->setRule($this->rule)->setRenderer($this->conditions);

        $this->setConditionFormName($this->rule->getConditions(), $this->getElement()->getContainer()->getHtmlId());

        if (is_array($this->getData('url_params'))) {
            $this->setConditionUrlParams($this->rule->getConditions(), $this->getData('url_params'));
        }

        return $this->input->toHtml();
    }
1349578
private function elementHtml() {return dfc($this, function() {
		/**
		 * 2015-12-11
		 * Класс .df-label-sibling означает: элемент рядом с label.
		 * Инлайновым элементам я тоже добавляю класс .df-label-sibling:
		 * @see \Df\Framework\Form\Element\Renderer\Inline::render()
		 */
		$this->e()->addClass('df-label-sibling');
		/**
		 * 2015-12-28
		 * К сожалению, мы не можем назначать классы для label:
		 * @uses \Magento\Framework\Data\Form\Element\AbstractElement::getLabelHtml()
		 * https://github.com/magento/magento2/blob/2.0.0/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php#L425
		 * Потому ситуацию, когда label расположена справа от элемента,
		 * помечаем классом для элемента.
		 * При этом сама label справа может быть выбрана селектором .df-label-sibling ~ label
		 */
		if ($this->shouldLabelBeAtRight()) {
			$this->e()->addClass('df-label-at-right');
		}
		return $this->e()->getElementHtml();
	});}
753623
public function html() {
        global $OUTPUT;

        $options = $this->options;
        $selected = $this->selected;

        $context = array(
            'name' => $this->name,
            'value' => $this->selected,
            'tabindex' => 1,
            'disabled' => !empty($this->isdisabled),
            'options' => array_map(function($option) use ($options, $selected) {
                return [
                    'name' => $options[$option],
                    'value' => $option,
                    'selected' => $selected == $option
                ];
            }, array_keys($options))
        );

        return $OUTPUT->render_from_template('gradereport_singleview/dropdown_attribute', $context);
    }
934019
protected function render_select(): string
    {
        if (!$this->choices) {
            return '';
        }

        $html = '<select '.$this->metaString().' id="'.
            $this->escape->attr($this->id).'" name="'.
            $this->escape->attr($this->name).'">';

        foreach ($this->choices as $value => $label) {
            if (isset($this->meta['multiple'])) {
                $selected = $this->selected(
                    $value,
                    (\in_array($value, (array)$this->value) ? $value : '')
                );
            } else {
                $selected = $this->selected($value, $this->value);
            }

            $html .= '<option '.$selected.' value="'.
                $this->escape->attr($value).'">'.$label.'</option>';
        }

        $html .= '</select>';

        return $html;
    }
810382
protected function _getSelectForm()
    {
        $form = new \Gems_Form(array('name' => 'autosubmit', 'class' => 'form-inline', 'role' => 'form'));

        $form->setHtml('div');
        $div = $form->getHtml();
        $div->class = 'search';

        $span = $div->div(array('class' => 'panel panel-default'))->div(array('class' => 'inputgroup panel-body'));

        $element = $form->createElement('select', 'gpa_level', array(
            'multiOptions' => $this->patchLevels,
            'onchange' => 'this.form.submit();',
            'onkeyup' => 'this.form.submit();',
            ));

        $element->setValue($this->getPatchLevel());
        $span->input($element);

        $form->addElement($element);

        $submit = $form->createElement('submit', 'search', array(
            'label' => $this->_('Search'),
            'class' => 'button small',
            ));

        $span->input($submit);
        $form->addElement($submit);

        return $form;
    }
304229
public function field()
    {
        $optionsCode = '';

        if (is_array($this->options['options'])) {
            foreach ($this->options['options'] as $key => $value) {
                $optionsCode .= '<option value="'.$key.'"'.($this->value == $key ?
                    ' selected="selected"' : null).'>'.
                    $value.'</option>';
            }
        } elseif ($optionClass = $this->options['options']) {
            $options = $optionClass::orderBy((isset($this->options['optionsSort']) ? $this->options['optionsSort'] : 'id'),
                                              (isset($this->options['optionsSortOrder']) ? $this->options['optionsSortOrder'] : 'asc'))->get();

            foreach ($options as $option) {
                $optionValue = isset($this->options['optionsValue']) ? $this->options['optionsValue'] : 'id';
                $optionShow = isset($this->options['optionsShow']) ? $this->options['optionsShow'] : 'name';

                $optionsCode .= '<option value="'.$option->$optionValue.'"'.($this->value == $option->$optionValue ?
                    ' selected="selected"' : null).'>'.
                    $option->$optionShow.'</option>';
            }
        }

        $input = new HTMLBrick('select', $optionsCode, [
            'id'   => $this->id,
            'name' => $this->name,
        ]);
        $input->addClass('form-control');

        return $input;
    }
29383
public function genEditHtmlInputs()
    {
        $return = '';

        $elementList = $this->getOrmElementList();

        if (!is_null($elementList)) {
            /** @var \DigitalWand\AdminHelper\Helper\AdminBaseHelper $linkedHelper */
            $linkedHelper = $this->getSettings('HELPER');
            foreach ($elementList as $key => $element) {
                $return .= InputType("radio", $this->getEditInputName(), $element[$linkedHelper::pk()], $this->getValue(), false, $element['TITLE']);
            }
        } else {
            $return = Loc::getMessage('DIGITALWAND_AH_ORM_MISSING_ELEMENTS');
        }

        return $return;
    }