62 if (!isset($this->htmlOptions[
'id'])) {
63 $this->htmlOptions[
'id'] = $this->getId();
66 if (isset($this->parent) && !isset($this->options[
'parent'])) {
70 if (isset($this->toggle) && !isset($this->options[
'toggle'])) {
75 if (empty($this->htmlOptions[
'class'])) {
76 $this->htmlOptions[
'class'] =
'collapse';
78 $this->htmlOptions[
'class'] .=
' collapse';
80 echo CHtml::openTag($this->tagName, $this->htmlOptions);
88 public function run() {
90 $id = $this->htmlOptions[
'id'];
92 echo CHtml::closeTag($this->tagName);
95 $cs = Yii::app()->getClientScript();
96 $options = !empty($this->options) ? CJavaScript::encode($this->options) :
'';
97 $cs->registerScript(__CLASS__ .
'#' . $id,
"jQuery('#{$id}').collapse({$options});");
99 foreach ($this->events as $name => $handler) {
100 $handler = CJavaScript::encode($handler);
101 $cs->registerScript(__CLASS__ .
'#' . $id .
'_' . $name,
"jQuery('#{$id}').on('{$name}', {$handler});");
114 return self::CONTAINER_PREFIX . self::$_containerId++;