Generate AP&M Offices options for <select>.

@param array  $options  The set of options for <select>
@param string $selected The selection option in the array

@return string

@api
503227
public function renderAPMOptionsDrop(array $options, string $selected = null): string
    {
        $droplist = null;
        $labels = array_keys($this->offices);
        foreach ($options as $key => $value) {
            $droplist .= in_array($key, $labels) ? $value : null;
            $droplist .= $this->renderAPMOptionsSelected($key, $value, $selected);
            $droplist .= ($key === 'AP&M 7456') ? '</optgroup>' : null;
        }

        return $droplist;
    }
740185
public static function options2html(array $options = [], $selectedValue = null){
        // buffer prepared html codes
        $buffer = [];
        // loop options
        foreach ($options as $key => $value) {
            // make optgroup
            if(is_array($value)){
                // turn optgroup options to html
                $optgroupOptions = static::options2html($value, $selectedValue);
                // append prepared group to buffer
                $buffer[] = "<optgroup label='$key'>$optgroupOptions</options>";
            } else {
            // make option
                // print selected='' if option value and selected value are equivalent
                $selected = static::selected($selectedValue, $value);
                // append prepared option to buffer
                $buffer[] = "<option value='$value' $selected>$key</option>";
            }
        }
        // make html
        $html = implode('', $buffer);
        // return result
        return $html;
    }
1286456
function getOptions(array $options = array())
    {
        if (empty($options)) {
            $params = array(1, $this->username, $this->password);
        } else {
            $params = array(1, $this->username, $this->password, $options);
        }

        return $this->sendRequest('wp.getOptions', $params);
    }
635507
public static function selecty($options, $selected = null, $attribs = array())
    {
        $htmls = array();
        $htmls[] = self::select(null, $attribs, false);
        if (Arr::iterable($options)) {
            foreach ($options as $value => $title) {
                $option_attribs = array('value'=>$value);
                if ((string) $selected === (string) $value) {
                    $option_attribs['selected'] = 'selected';
                }
                
                $htmls[] = self::option($title, $option_attribs);
            }
        }
        $htmls[] = '</select>';
        return join("\n", $htmls);
    }
1311597
protected function placeholder_option( $display, $selected ) {
		$selected = $this->get_selected_value( null, $selected );

		$options = [
			'selected' => $selected,
			'value'    => '',
		];

		return $this->to_html_string( '<option' . $this->attributes( $options ) . '>' . esc_html( $display ) . '</option>' );
	}
1282516
public function selectPdo($select, $param = null)
    {
        if ($this->usePaginator === true) {
            return $this->initPaginator(array($select, $param));
        }
        $this->result = $this->tableGateway->selectPdo($select, $param);

        return $this->result;
    }
1356180
public function addOptions(array $options) : Select
    {
        foreach ($options as $value => $content) {
            $this->addOption($content, $value);
        }

        return $this;
    }
1012129
public static function select(array $options = []) : string {
		if (!empty($options['searchable'])) {
			$options['searchable'] = 'searchable';
		}
		if (!empty($options['preset'])) {
			$options['preset'] = 'preset';
		}
		if (!empty($options['tree'])) {
			$options['tree'] = 'tree';
		}
		if (!empty($options['color_picker'])) {
			$options['color_picker'] = 'color_picker';
		}
		return Factory::delegate('flag.numbers.framework.html', 'select', [$options]);
	}
141228
public function select(
        $name,
        $list = [],
        $selected = null,
        array $selectAttributes = [],
        array $optionsAttributes = [],
        array $optgroupsAttributes = []
    ) {
        $this->type = 'select';

        // When building a select box the "value" attribute is really the selected one
        // so we will use that when checking the model or session for a value which
        // should provide a convenient method of re-populating the forms on post.
        $selected = $this->getValueAttribute($name, $selected);

        $selectAttributes['id'] = $this->getIdAttribute($name, $selectAttributes);

        if (! isset($selectAttributes['name'])) {
            $selectAttributes['name'] = $name;
        }

        // We will simply loop through the options and build an HTML value for each of
        // them until we have an array of HTML declarations. Then we will join them
        // all together into one single HTML element that can be put on the form.
        $html = [];

        if (isset($selectAttributes['placeholder'])) {
            $html[] = $this->placeholderOption($selectAttributes['placeholder'], $selected);
            unset($selectAttributes['placeholder']);
        }

        foreach ($list as $value => $display) {
            $optionAttributes = $optionsAttributes[$value] ?? [];
            $optgroupAttributes = $optgroupsAttributes[$value] ?? [];
            $html[] = $this->getSelectOption($display, $value, $selected, $optionAttributes, $optgroupAttributes);
        }

        // Once we have all of this HTML, we can join this into a single element after
        // formatting the attributes into an HTML "attributes" string, then we will
        // build out a final select statement, which will contain all the values.
        $selectAttributes = $this->html->attributes($selectAttributes);

        $list = implode('', $html);

        return $this->toHtmlString("<select{$selectAttributes}>{$list}</select>");
    }
803685
public function render(array $options, $name, $selected = array(), array $attrs = array(), $tpl = false)
    {
        $selected = (array) $selected;

        $attrs = array_merge(array('multiple' => false), $attrs);

        if ($attrs['multiple'] === true) {
            $attrs['multiple'] = 'multiple';
        }

        if ($attrs['multiple'] === 'multiple' && !strpos($name, '[]')) {
            $name .= '[]';
        }

        $attrs['name'] = $name;

        $attrs   = $this->_mergeAttr($attrs, $this->_jbSrt('select'));
        $options = $this->_getOptions($options, $selected, $attrs['multiple']);

        return '<select ' . $this->buildAttrs($attrs) . '>' . $options . '</select>';
    }
440443
public function select($options = [])
    {
        $source = [];

        foreach ($options as $key => $value) {
            $source[] = [
                'value' => $key,
                'text' => $value,
            ];
        }

        $this->addOptions(['source' => $source]);
    }
144556
public function select($name, $options = array(), $selected = null, array $attributes = array(), array $extra = array())
    {
        /**
         * Swap values so programmers can skip the $value argument
         * and pass the $attributes array directly.
         */
        if (is_array($selected) && empty($attributes)) {
            $extra = $attributes;
            $attributes = $selected;
            $selected = null;
        }

        return $this->doBuild('select', $name, $selected, $attributes, $extra, $options);
    }
1070432
public function serialize(CellChoice $choice, array $options = [])
    {
        $serialized = [
            'text' => $choice->getText(),
            'caseSensitive' => $choice->isCaseSensitive(),
            'score' => $choice->getScore(),
            'expected' => $choice->isExpected(),
        ];

        if ($choice->getFeedback()) {
            $serialized['feedback'] = $choice->getFeedback();
        }

        return $serialized;
    }
232145
public function selectPdo($select, $param = null)
    {
        $statement = $this->getAdapter()->query($select, ADT::QUERY_MODE_PREPARE);
        $result = $statement->execute($param);

        $resultSet = clone $this->resultSetPrototype;

        return $resultSet->initialize($result);
    }
1309496
protected function _meridianSelect($options, $context)
    {
        $options += [
            'name' => '',
            'val' => null,
            'options' => ['am' => 'am', 'pm' => 'pm'],
            'templateVars' => [],
        ];

        return $this->_select->render($options, $context);
    }
470004
public function select(
        $name,
        $list = [],
        $selected = null,
        array $selectAttributes = [],
        array $optionsAttributes = [],
        array $optgroupsAttributes = []
    ) {
        $selectAttributes = $this->appendClassToOptions(Config::get('form-builder.control-class'), $selectAttributes);

        return parent::select($name, $list, $selected, $selectAttributes, $optionsAttributes);
    }
73797
public function plainSelect($name, $list = array(), $selected = null, $options = array())
    {
        return parent::select($name, $list, $selected, $options);
    }