public function __construct($name, $options = array(), $attributes = NULL)
 {
     parent::__construct($name, $attributes);
     $list = new HtmlSelect($name);
     $list->setTagName("select");
     $this->renderer = new PhBsRenderer(new Select($name, array(), $attributes), $list);
     $this->setOptions($options);
 }
 public function frmAction($id = NULL)
 {
     $user = $this->getInstance($id);
     $select = new HtmlSelect("role", "Rôle", "Sélectionnez un rôle...");
     $select->fromArray(array("admin", "user", "author"));
     $select->setValue($user->getRole());
     $select->compile($this->jquery, $this->view);
     $this->view->setVars(array("user" => $user, "siteUrl" => $this->url->getBaseUri(), "baseHref" => $this->dispatcher->getControllerName()));
     parent::frmAction($id);
 }
 public function compile(JsUtils $js = NULL, View $view = NULL)
 {
     if (isset($js)) {
         $this->formElementsPrefix = $js->config()->getVar("formElementsPrefix");
         foreach ($this->futureElements as $futureElement) {
             $futureElementValue = $this->getPrefix($futureElement);
             $futureElementValues = explode("_", $futureElementValue);
             switch ($futureElementValues[0]) {
                 case "input":
                     $control = new HtmlInput($futureElement);
                     $control->setClass("form-control");
                     $control->setLabel($this->getPart($futureElement));
                     break;
                 case "checkbox":
                     $control = new HtmlInputCheckbox($futureElement);
                     $control->setLabel($this->getPart($futureElement), false);
                     break;
                 case "radio":
                     $name = $this->getPart($futureElement);
                     $label = $this->getPart($futureElement, 2);
                     $control = new HtmlInputRadio($futureElement);
                     $control->setProperty("name", strtolower($name));
                     $control->setLabel($label, false);
                     break;
                 case "select":
                     $control = new HtmlSelect($futureElement);
                     $control->setProperty("size", $futureElementValues[1]);
                     $control->setClass("form-control");
                     $control->setLabel($this->getPart($futureElement));
                     break;
                 default:
                     $control = new HtmlInput($futureElement);
                     $control->setClass("form-control");
                     $control->setLabel($this->getPart($futureElement));
                     break;
             }
             $this->addElement($control);
         }
     }
     foreach ($this->formGroups as $group) {
         $this->addContent($group);
     }
     return parent::compile($js, $view);
 }