protected static function createButton($type, $label, $htmlOptions)
    {
        $url = TbArray::popValue('url', $htmlOptions, '#');
        $ajaxOptions = TbArray::popValue('ajaxOptions', $htmlOptions, array());
        switch ($type) {
            case self::BUTTON_TYPE_HTML:
                return parent::htmlButton($label, $htmlOptions);

            case self::BUTTON_TYPE_SUBMIT:
                $htmlOptions['type'] = 'submit';
                return parent::htmlButton($label, $htmlOptions);

            case self::BUTTON_TYPE_RESET:
                $htmlOptions['type'] = 'reset';
                return parent::htmlButton($label, $htmlOptions);

            case self::BUTTON_TYPE_IMAGE:
                return parent::imageButton($label, $htmlOptions);

            case self::BUTTON_TYPE_LINKBUTTON:
                return parent::linkButton($label, $htmlOptions);

            case self::BUTTON_TYPE_AJAXLINK:
                return parent::ajaxLink($label, $url, $ajaxOptions, $htmlOptions);

            case self::BUTTON_TYPE_AJAXBUTTON:
                $htmlOptions['ajax'] = $ajaxOptions;
                return parent::htmlButton($label, $htmlOptions);

            case self::BUTTON_TYPE_INPUTBUTTON:
                return parent::button($label, $htmlOptions);

            case self::BUTTON_TYPE_INPUTSUBMIT:
                $htmlOptions['type'] = 'submit';
                return parent::button($label, $htmlOptions);

            case self::BUTTON_TYPE_LINK:
                return self::link($label, $url, $htmlOptions);

            default:
                throw new CException('Invalid button type "' . $type . '".');
        }
    }
protected static function createButton($type, $label, $htmlOptions)
    {
        $url = TbArray::popValue('url', $htmlOptions, '#');
        $ajaxOptions = TbArray::popValue('ajaxOptions', $htmlOptions, array());
        switch ($type) {
            case self::BUTTON_TYPE_HTML:
                return parent::htmlButton($label, $htmlOptions);

            case self::BUTTON_TYPE_SUBMIT:
                $htmlOptions['type'] = 'submit';
                return parent::htmlButton($label, $htmlOptions);

            case self::BUTTON_TYPE_RESET:
                $htmlOptions['type'] = 'reset';
                return parent::htmlButton($label, $htmlOptions);

            case self::BUTTON_TYPE_IMAGE:
                return parent::imageButton($label, $htmlOptions);

            case self::BUTTON_TYPE_LINKBUTTON:
                return parent::linkButton($label, $htmlOptions);

            case self::BUTTON_TYPE_AJAXLINK:
                return parent::ajaxLink($label, $url, $ajaxOptions, $htmlOptions);

            case self::BUTTON_TYPE_AJAXBUTTON:
                $htmlOptions['ajax'] = $ajaxOptions;
                return parent::htmlButton($label, $htmlOptions);

            case self::BUTTON_TYPE_INPUTBUTTON:
                return parent::button($label, $htmlOptions);

            case self::BUTTON_TYPE_INPUTSUBMIT:
                $htmlOptions['type'] = 'submit';
                return parent::button($label, $htmlOptions);

            case self::BUTTON_TYPE_LINK:
                return self::link($label, $url, $htmlOptions);

            default:
                throw new CException('Invalid button type "' . $type . '".');
        }
    }
protected static function createButton ( $ type , $ label , $ htmlOptions ) { $ url = TbArray :: popValue ( 'url' , $ htmlOptions , '#' ) ; $ ajaxOptions = TbArray :: popValue ( 'ajaxOptions' , $ htmlOptions , array ( ) ) ; switch ( $ type ) { case self :: BUTTON_TYPE_HTML : return parent :: htmlButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_SUBMIT : $ htmlOptions [ 'type' ] = 'submit' ; return parent :: htmlButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_RESET : $ htmlOptions [ 'type' ] = 'reset' ; return parent :: htmlButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_IMAGE : return parent :: imageButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_LINKBUTTON : return parent :: linkButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_AJAXLINK : return parent :: ajaxLink ( $ label , $ url , $ ajaxOptions , $ htmlOptions ) ; case self :: BUTTON_TYPE_AJAXBUTTON : $ htmlOptions [ 'ajax' ] = $ ajaxOptions ; return parent :: htmlButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_INPUTBUTTON : return parent :: button ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_INPUTSUBMIT : $ htmlOptions [ 'type' ] = 'submit' ; return parent :: button ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_LINK : return self :: link ( $ label , $ url , $ htmlOptions ) ; default : throw new CException ( 'Invalid button type "' . $ type . '".' ) ; } }
Creates a button the of given type.
@param string $type the button type.
@param string $label the button label.
@param array $htmlOptions additional HTML attributes.
@return string the button.
@throws CException if the button type is valid.
Creates a button the of given type .