52 if (!isset($this->htmlOptions[
'id'])) {
53 $this->htmlOptions[
'id'] = $this->getId();
56 if ($this->autoOpen ===
false && !isset($this->options[
'show'])) {
57 $this->options[
'show'] =
false;
60 $classes = array(
'modal');
62 if ($this->fade ===
true) {
66 if (!empty($classes)) {
67 $classes = implode(
' ', $classes);
68 if (isset($this->htmlOptions[
'class'])) {
69 $this->htmlOptions[
'class'] .=
' ' . $classes;
71 $this->htmlOptions[
'class'] = $classes;
74 echo CHtml::openTag(
'div', $this->htmlOptions);
75 echo
'<div class="modal-dialog"><div class="modal-content">';
83 public function run() {
85 $id = $this->htmlOptions[
'id'];
87 echo
'</div></div></div>';
90 $cs = Yii::app()->getClientScript();
92 $options = !empty($this->options) ? CJavaScript::encode($this->options) :
'';
93 $cs->registerScript(__CLASS__ .
'#' . $id,
"jQuery('#{$id}').modal({$options});");
95 foreach ($this->events as $name => $handler) {
96 $handler = CJavaScript::encode($handler);
97 $cs->registerScript(__CLASS__ .
'#' . $id .
'_' . $name,
"jQuery('#{$id}').on('{$name}', {$handler});");