Enregistre une liste de sélection.

@param string $name    Clé unique.
@param string $id      Selecteur CSS.
@param array  $options Liste d'options [ 'value'=>'', 'label'=>'','selected' => 0|1 ].
@param array  $attr    Liste d'attributs.

@return $this
16477
public function select($name, $id, $options = [], array $attr = null)
    {
        $basic = $this->merge_attr([ 'id' => $id ], $attr);

        return $this->input($name, [ 'type' => 'select', 'options' => $options, 'attr' => $basic ]);
    }
554214
public function setName($id, $name)
    {
        return $this->put($this->getPath().'/'.rawurlencode($id).'/name', array('value' => $name));
    }
852435
public static function select($name, $options, $selected = NULL, Array $attributes = NULL) {
    $name = self::getName($name);
    
    if (is_string($options)) {
      // nothing, wir haben hier vermutlich schon was zusammengebaut, was so hinkommt
    } else {
      $options = self::selectOptions($options, $selected);
    }
    
    $select = static::tag('select',$options, $attributes)
      ->setAttribute('name',$name)
      ->setGlueContent("%s \n");
    
    return $select;
  }
725061
public function remove($selector, $name = true, $options = null)
    {
        if (!array_key_exists($selector, $this->rules)) {
            return $this;
        }
        /* @var $collection \Sirius\Validation\ValueValidator */
        $collection = $this->rules[$selector];
        $collection->remove($name, $options);

        return $this;
    }
685629
public function registerScript($id, $name)
    {
        $view = $this->getView();
        AjaxDropdownAsset::register($view);
        $options = Json::encode($this->prepareOptions($name));
        $view->registerJs("jQuery('#$id').ajaxDropDown($options);");
    }
1040197
public function choice(string $name, array $options = []): FieldTypeInterface
    {
        return (new ChoiceType($name))
            ->setLocale($this->app->getLocale())
            ->setViewFactory($this->viewFactory)
            ->setOptions($options);
    }
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>';
    }
400024
protected function _addIdAttribute($name, array &$options) {
        $names = array(
            $this->getName(),
            $name
        );
        $parent = $this;
        while ($parent = $parent->getParent()) {
            $name = $parent->getName();
            if (!is_null($name)) {
                array_unshift($names, $parent->getName());
            }
        }
        $name = implode('-', $names);
        // if the root form has no name, the id will start with "-"
        $name = ltrim($name, '-');
        $options['id'] = strtolower($name) . '-field';
    }
23554
public function input($name, $options = array())
    {
        $options += array(
            "type"  => "text",
            "id"    => $this->id($name),
            "name"  => $this->name($name),
            "error" => true,
            "class" => "",
            "value" => "",
            "label" => null
        );

        $currentValue = $this->getCurrentValue($options['name']);

        $errorHtml = "";
        $fieldHasErrors = false;

        if (!is_null($this->associatedEntity)) {
            // Checkboxes may be posted has data[name][0] and therefore
            // we need to remove it to get the absolute field name.
            $validationName = $options["type"] === "checkbox" ?
                preg_replace('/\[\d+\]$/', '', $name) :
                $name;

            if ($this->associatedEntity->hasErrors($validationName)) {
                if ((bool)$options['error']) {
                    $errorHtml = $this->generateInlineErrors($validationName);
                }
                $fieldHasErrors = true;
                $options['class'] .= " error ";
            }
        }
        unset($options["error"]);

        $label = "";
        if (!is_null($options['label'])) {
            $labelOptions = array(
                "for"    => $options["id"],
                "class" => $fieldHasErrors ? "error" : "",
                "label" => $options["label"],
            );

            $label .= $this->label($options['name'], $labelOptions);
        }
        unset($options['label']);

        switch (strtolower($options['type'])) {
            case "textarea":
                return $label . "\n" . $this->generateTextarea($options, $currentValue) . $errorHtml . "\n";
            case "select":
                return $label . "\n" . $this->generateSelect($options, $currentValue) . $errorHtml . "\n";
            case "radio":
                return $this->generateRadio($options, $currentValue) . $errorHtml . "\n" . $label . "\n";
            case "checkbox":
                return $this->generateCheckbox($options, $currentValue) . $errorHtml . "\n" . $label . "\n";
            case "hidden":
                return $label . "\n" . $this->generateHidden($options, $currentValue) . $errorHtml . "\n";
            default:
                return $label . "\n" . $this->generateTextinput($options, $currentValue) . $errorHtml . "\n";
        }
    }
272814
public static function select($name, $list = [], $selected = null, $options = [])
    {
        self::exclure($options, ['name']);
        //
        $options['name'] = $name;
        //
        $sub = '';
        //
        if (!empty($list)) {
            foreach ($list as $value) {
                $sub .= self::option($value, (!is_null($selected) && $value == $selected));
            }
        }
        //
        $options = Html::attributes($options);
        //
        return '<select'.$options.">\n".$sub."</select>\n";
    }
1064003
public function start(string $id, string $name = 'PHPSESSID', array $options = []): self
        {
            if ($this->disabled()) {
                throw new \RuntimeException('PHP sessions are disabled');
            }
            
            if ($this->active()) {
                throw new \RuntimeException('Failed to start the session: already started by PHP.');
            }

            session_name($name);
            session_id($id);
            session_start($options);

            $this->name    = $name;
            $this->id      = $id;
            $this->options = $options;
            $this->data    = $_SESSION;
            return $this;
        }
603806
protected function renderStars($id,$name)
	{
		$inputCount=(int)(($this->maxRating-$this->minRating)/$this->ratingStepSize+1);
		$starSplit=(int)($inputCount/$this->starCount);
		if($this->hasModel())
		{
			$attr=$this->attribute;
			CHtml::resolveName($this->model,$attr);
			$selection=$this->model->$attr;
		}
		else
			$selection=$this->value;
		$options=$starSplit>1 ? array('class'=>"{split:{$starSplit}}") : array();
		for($value=$this->minRating, $i=0;$i<$inputCount; ++$i, $value+=$this->ratingStepSize)
		{
			$options['id']=$id.'_'.$i;
			$options['value']=$value;
			if(isset($this->titles[$value]))
				$options['title']=$this->titles[$value];
			else
				unset($options['title']);
			echo CHtml::radioButton($name,!strcmp($value,$selection),$options) . "\n";
		}
	}
499022
public function generateSelectOptions($options, $attr)
    {
        $return = '';

        foreach ($options as $key => $value) {
            if (is_array($value)) {
                $subArray = $this->generateSelectOptions($value, $attr);

                $return .= $this->Html->tag(
                    'optgroup',
                    array(
                        'label' => $key
                    ),
                    $subArray,
                    true
                );
            } else {
                $optionsAttr = array('value' => $key);

                if (isset($attr['selected']) && $attr['selected'] == $key) {
                    $optionsAttr[] = 'selected';
                }

                $return .= $this->Html->tag(
                    'option',
                    $optionsAttr,
                    $value,
                    true
                );
            }
        }

        return $return;
    }
948213
public function create($name, $selected='', $attr='')
    {

        // Attributes for select element
        $attrSet = null;
        if (!empty($attr)) {
            if (is_array($attr)) {
                foreach ($attr as $attr_name => $attr_value) {
                    $attrSet .= ' ' .$attr_name. '="' .$attr_value. '"';
                }
            } else {
                $attrSet = ' ' .$attr;
            }
        }

        // start select element
        $listbox = '<select name="' .$name. '"' .$attrSet. '>';

        // Add popular timezones
        $listbox .= '<optgroup label="General">';
        foreach ($this->popularTimezones as $key => $value) {
            $selected_attr = ($selected == $key) ? ' selected="selected"' : '';
            $listbox .= '<option value="' .$key. '"' .$selected_attr. '>' .$value. '</option>';
        }
        $listbox .= '</optgroup>';

        // Add all timezone of continents
        foreach ($this->continents as $continent => $mask) {
            $timezones = DateTimeZone::listIdentifiers($mask);

            // start optgroup tag
            $listbox .= '<optgroup label="' .$continent. '">';

            // create option tags
            foreach ($timezones as $timezone) {
                $selected_attr = ($selected == $timezone) ? ' selected="selected"' : '';

                $listbox .= '<option value="' .$timezone. '"' .$selected_attr. '>';
                $listbox .= $this->formatTimezone($timezone, $continent);
                $listbox .= '</option>';
            }

            // end optgroup tag
            $listbox .= '</optgroup>';
        }

        // end select element
        $listbox .= '</select>';

        return $listbox;
    }
665666
protected function renderElement(string $name, array $options = []) : string
    {
        return $this->config->getView()
            ->element($name, $options);
    }
1229595
public function select($key, $label, FormOptions $options=null, array $attr=[]){
		if ( $options !== null ){
			$attr['options'] = $options;
		}
		$field = $this->factory('select', $key, $label, $attr);
		return $this->addField($field);
	}
1157476
public function select($name, $list = array(), $selected = null, $options = [])
    {
        $this->addErrorClass($name, $options);
        $tags['input'] = parent::select($name, $list, $selected, $options);
        $tags['error'] = $this->getErrorTag($name);
        return $this->buildTags($tags);
    }