39 if (!is_array($this->options)) {
40 $this->options = array();
43 if (!is_array($this->htmlOptions)) {
44 $this->htmlOptions = array();
54 $cs = Yii::app()->getClientScript();
57 if (empty($this->jsVarName)) {
58 $this->jsVarName = $this->getId() .
'Layout';
62 if (!isset($this->htmlOptions[
'id'])) {
63 $this->htmlOptions[
'id'] = $this->getId();
66 $id = $this->htmlOptions[
'id'];
68 echo CHtml::openTag(
'div', $this->htmlOptions);
73 $options = CMap::mergeArray($this->options, $layoutsOptions);
77 $cs->registerScript(__CLASS__ .
'#jsVar#' . $this->getId(),
'var '.$this->jsVarName.
';', CClientScript::POS_HEAD);
79 $cs->registerScript(__CLASS__ .
'#init#' . $this->getId(), $this->jsVarName.
' = $("#'.$id.
'").layout('.
$options.
');', CClientScript::POS_READY);
87 $layoutsOptions = array();
88 $availableLayouts = array(
'center',
'north',
'south',
'east',
'west');
90 foreach ($availableLayouts as $layoutName) {
91 if (!isset($this->layouts[$layoutName])) {
94 $layout = $this->layouts[$layoutName];
97 if (!is_array($layout) && !isset($layout[
'content'])) {
102 $content = $layout[
'content'];
103 if (is_array($content) && !empty($content[
'class'])) {
104 $class = $content[
'class'];
105 unset($content[
'class']);
106 $content = $this->widget(
$class, $content,
true);
110 if (isset($layout[
'options']) && is_array($layout[
'options'])) {
111 foreach ($layout[
'options'] as $key => $value) {
112 if (strpos($key, $layoutName .
'__') ===
false) {
113 $key = $layoutName .
'__' . $key;
115 $layoutsOptions[$key] = $value;
119 $htmlOptions = !empty($layout[
'htmlOptions']) ? $layout[
'htmlOptions'] : array();
130 echo $content.
'</div>';
133 return $layoutsOptions;