TbModal::run PHP Method

run() public method

Runs the widget.
public run ( )
    public function run()
    {
        $id = $this->htmlOptions['id'];
        echo '</div>';
        /** @var CClientScript $cs */
        $cs = Yii::app()->getClientScript();
        $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
        $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').modal({$options});");
        foreach ($this->events as $name => $handler) {
            $handler = CJavaScript::encode($handler);
            $cs->registerScript(__CLASS__ . '#' . $id . '_' . $name, "jQuery('#{$id}').on('{$name}', {$handler});");
        }
    }

Usage Example

示例#1
0
 public function run()
 {
     if ($this->buttons == null) {
         $this->buttons = array(array('type' => 'primary', 'label' => O::t('oprecx', 'OK'), 'url' => '#', 'htmlOptions' => array('data-dismiss' => 'modal')), array('label' => O::t('oprecx', 'Cancel'), 'url' => '#', 'htmlOptions' => array('data-dismiss' => 'modal')));
     }
     echo '</div><div class="modal-footer">';
     foreach ($this->buttons as $btn) {
         $this->controller->widget('bootstrap.widgets.TbButton', $btn);
     }
     echo '</div>';
     parent::run();
 }
All Usage Examples Of TbModal::run