Your IP : 216.73.217.64


Current Path : /home3/gp97/sondages.fbg.97gp.net/application/extensions/ButtonGroupWidget/
Upload File :
Current File : //home3/gp97/sondages.fbg.97gp.net/application/extensions/ButtonGroupWidget/ButtonGroupWidget.php

<?php

/**
 * Creates a Buttongroup that behaves like a switch with radio input type
 */
class ButtonGroupWidget extends CInputWidget
{
    /**
     * @var array Available buttons as value=>caption array
     */
    public $selectOptions = [];

    /** @var string aria label for btn-group */
    public $ariaLabel = '';

    /** @var array html options */
    public $htmlOptions = [];

    /** @var array the value that is currently checked/selected */
    public $checkedOption = '';

    /** Initializes the widget */
    public function init()
    {
        $this->registerClientScript();
    }

    /** Executes the widget */
    public function run()
    {
        $this->renderButtons();
    }

    /** Renders the button group */
    public function renderButtons()
    {
        list($name, $id) = $this->resolveNameID();
        $this->render('buttongroup', [
            'ariaLabel' => $this->ariaLabel,
            'name' => $name,
            'id' => $id,
            'selectOptions' => $this->selectOptions,
            'checkedOption' => $this->checkedOption,
            'htmlOptions' => $this->htmlOptions
        ]);
    }


    /** Registers required script files */
    public function registerClientScript()
    {
    }
}