@param array $options
@param mixed $selection

@return string
547886
protected function renderOptions(array $options, $selection)
	{
		$html = '';

		foreach($options as $key => $val) {
			if(is_array($val) === false) {
				$selected = ($key == $selection) ? ' selected' : null;
				$html .= '<option value="' . $key . '"' . $selected . '>' . $val . '</option>';
			} else {
				$html .= '<optgroup label="' . $key . '">' . $this->renderOptions($val, $selection) . '</optgroup>';
			}
		}

		return $html;
	}
442372
public static function selectOptions($optionsArray, $selected = NULL) {
    $ret = array();
    foreach ($optionsArray as $value => $label) {
      if ($label instanceof HTMLTag) {
        $tag = $label;
        
        if ($tag->getAttribute('value') === $selected)
          $tag->setAttribute('selected','selected');

      } else {
        /* Interface Form Item */
        if($label instanceof \Psc\Form\Item) {
          $item = $label;
          $label = $item->getFormLabel();
          $value = $item->getFormValue();
        }
        
        $tag = static::tag('option',self::esc((string) $label),array('value'=>$value));
        if ($value === $selected)
          $tag->setAttribute('selected','selected');
      }
      
      $ret[] = $tag;
    }
    return $ret;
  }
612112
private function getOption($option, array $options)
    {
        return isset($options[$option]) ? $options[$option] : $this->$option;
    }
986326
public function select($name, array $options, $selected = null, array $attributes = [])
    {
        $tag = new Tag('select', $attributes);
        $tag->name = $name;
        
        if ($selected === null)
            $selected = $this->getDefaultValue($name);

        foreach ($options as $value => $label)
        {
            $option = new Tag('option');
            $option->value = $value;
            $option->setText($label);

            if ($selected !== null && $value == $selected)
                $option->selected = true;

            $tag->addChild($option);
        }

        return $tag;
    }
1061930
protected function getControllerOptions( array $selected )
	{
		$html = '';
		$aimeos = Base::getAimeos();
		$context = Scheduler\Base::getContext();
		$cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' );

		$langid = 'en';
		if( isset( $GLOBALS['BE_USER']->uc['lang'] ) && $GLOBALS['BE_USER']->uc['lang'] != '' ) {
			$langid = $GLOBALS['BE_USER']->uc['lang'];
		}

		$localeItem = \Aimeos\MShop::create( $context, 'locale' )->createItem();
		$localeItem->setLanguageId( $langid );
		$context->setLocale( $localeItem );

		$controllers = \Aimeos\Controller\Jobs::get( $context, $aimeos, $cntlPaths );

		foreach( $controllers as $name => $controller )
		{
			$active = ( in_array( $name, $selected ) ? 'selected="selected"' : '' );
			$title = htmlspecialchars( $controller->getDescription(), ENT_QUOTES, 'UTF-8' );
			$cntl = htmlspecialchars( $controller->getName(), ENT_QUOTES, 'UTF-8' );
			$name = htmlspecialchars( $name, ENT_QUOTES, 'UTF-8' );

			$html .= sprintf( '<option value="%1$s" title="%2$s" %3$s>%4$s</option>', $name, $title, $active, $cntl );
		}

		return $html;
	}
1248891
public function getPk($options = '')
    {
        if (!empty($this->pk)) {
            $pk = $this->pk;
        } else {
            $pk = $this->getTableInfo(is_array($options) ? $options['table'] : $options, 'pk');
        }
        return $pk;
    }
1014750
public function select(array $configs, $options)
    {
        $label = (!empty($options['name']) ? ucwords($options['name']) : '');

        return '
        <div class="input-field">
        '.parent::plainSelect(array_merge([
            'id' => $this->genId($label),
        ], $configs), $options).(empty($label) | (substr($label, 0,
                1) == '_') ? '' : '<label for="'.$label.'">'.$this->inputToRead($label).'</label>').'
        </div>
         ';
    }
1222586
public function select($options = [])
    {
        $sql = str_replace(
            ['%TABLE%', '%DISTINCT%', '%FIELD%', '%JOIN%', '%WHERE%', '%GROUP%', '%HAVING%', '%ORDER%', '%LIMIT%', '%UNION%', '%LOCK%', '%COMMENT%', '%FORCE%'],
            [
                $this->parseTable($options['table'], $options),
                $this->parseDistinct($options['distinct']),
                $this->parseField($options['field'], $options),
                $this->parseJoin($options['join'], $options),
                $this->parseWhere($options['where'], $options),
                $this->parseGroup($options['group']),
                $this->parseHaving($options['having']),
                $this->parseOrder($options['order'], $options),
                $this->parseLimit($options['limit']),
                $this->parseUnion($options['union']),
                $this->parseLock($options['lock']),
                $this->parseComment($options['comment']),
                $this->parseForce($options['force']),
            ], $this->selectSql);
        return $sql;
    }
989701
public static function generateSelectOptionsFromArray( $data, $selected = null ) {

		$options	= "";

		if( isset( $data ) ) {

			if( isset($selected) ) {

				foreach ( $data as $key => $value ) {

					if( $selected === $key ) {

						$options .= "<option value='$key' selected>$value</option>";
					}
					else {
						$options .= "<option value='$key'>$value</option>";
					}
				}
			}
			else {

				foreach ( $data as $key => $value ) {

					$options .= "<option value='$key'>$value</option>";
				}
			}
		}

		return $options;
	}
522200
public function renderOptionsDropArray(array $options, string $selected = null): string
    {
        $droplist = '';
        foreach ($options as $key => $value) {
            $value = 'edit' === strtolower($key) ? 'Edit...' : $value;
            $droplist .= ($key === '-')
                ? sprintf('<option value="%s" disabled="disabled">%s</option>%s', $key, htmlentities($value, ENT_HTML5, 'UTF-8'), "\n")
                : $this->renderAPMOptionsSelected($key, $value, $selected);
        }

        return $droplist;
    }
271092
public function button($name, $options = array())
    {
        $options += array(
            "type" => "button",
            "label" => "Button",
            "id"    => $this->id($name),
            "name"  => $this->name($name),
        );

        $label = $options["label"];
        unset($options["label"]);

        return sprintf('<button %s>%s</button>', $this->arrayToHtmlAttributes($options), $label);
    }
616108
public function selectOption($select, $option)
    {
        $select = $this->fixStepArgument($select);
        $option = $this->fixStepArgument($option);
        $this->getSession()->getPage()->selectFieldOption($select, $option);
    }
358058
public function serialize(SelectionQuestion $selectionQuestion, array $options = [])
    {
        $serialized = [
            'text' => $selectionQuestion->getText(),
            'mode' => $selectionQuestion->getMode(),
        ];

        if ($selectionQuestion->getPenalty()) {
            $serialized['penalty'] = $selectionQuestion->getPenalty();
        }

        if ($selectionQuestion->getTries()) {
            $serialized['tries'] = $selectionQuestion->getTries();
        }

        switch ($selectionQuestion->getMode()) {
           case SelectionQuestion::MODE_FIND:
               $serialized['tries'] = $selectionQuestion->getTries();
              break;
           case SelectionQuestion::MODE_SELECT:
               $serialized['selections'] = $this->serializeSelections($selectionQuestion);
              break;
           case SelectionQuestion::MODE_HIGHLIGHT:
               $serialized['selections'] = $this->serializeSelections($selectionQuestion);
               $serialized['colors'] = $this->serializeColors($selectionQuestion);
              break;
        }

        if (in_array(Transfer::INCLUDE_SOLUTIONS, $options)) {
            $serialized['solutions'] = $this->serializeSolutions($selectionQuestion);
        }

        return $serialized;
    }
221090
private function OptionsString()
    {
        if (!$this->select->Exists())
        {
            return '';
        }
        $list = new SelectListProvider($this->select);
        $options = $list->ToArray();
        $lines = array();
        foreach ($options as $key=>$value)
        {
            $lines[] = $key . ':' . $value;
        }
        return join("\r\n", $lines);
    }
1261108
public function selectMultiple($name, $options = array(), $selected = null, array $attributes = array(), array $extra = array())
    {
        $attributes[] = 'multiple';
        return $this->doBuild('select', $name, $selected, $attributes, $extra, $options);
    }
385857
private function _optionsToString(array $options)
    {
        $str = '';
        foreach ($options as $key => $val) {
            if ($key === 'password')
                $val = '*****';
            if ($str)
                $str .= ',';
            $str .= $key . '=' . $val;
        }
        return $str;
    }
239722
public function open($options = [])
    {
        $options['method'] = self::getMethod($options);

        $options['action'] = self::getAction($options);

        $options['accept-charset'] = 'UTF-8';

        if (isset($options['files']) && $options['files']) {
            $options['enctype'] = 'multipart/form-data';
        }

        $options = $this->attributes($options);

        return '<form'.$options.'>';
    }