/** * Renders the main body content * @param CActiveForm $form The Form we're working with */ private function renderMain($form) { // #main .content echo CHtml::openTag('div', array('id' => 'main', 'class' => 'nano')); echo CHtml::openTag('div', array('class' => 'nano-content')); echo CHtml::openTag('fieldset'); // If we want a custom form view, render that view instead of the default behavior if ($this->model->form !== NULL) { $this->controller->renderPartial($this->model->form, array('model' => $this->model, 'properties' => $this->properties, 'form' => $form)); } else { if (count($this->properties) == 0) { echo CHtml::tag('legend', array(), Yii::t('Dashboard.main', 'Change Theme Settings')); echo CHtml::tag('div', array('class' => 'alert alert-info'), Yii::t('Dashboard.main', 'There are no settings for this section.')); } else { $groups = $this->model->groups(); if (!empty($groups)) { foreach ($groups as $name => $attributes) { echo CHtml::tag('legend', array(), $name); echo CHtml::tag('div', array('class' => 'clearfix'), NULL); foreach ($attributes as $property) { $p = new StdClass(); $p->name = $property; $this->renderProperties($form, $p); } } } else { echo CHtml::tag('legend', array(), CiiInflector::titleize(get_class($this->model))); foreach ($this->properties as $property) { $this->renderProperties($form, $property); } } } } echo CHtml::closeTag('div'); echo CHtml::closeTag('div'); echo CHtml::closeTag('div'); }
/** * Renders the main body content * @param CActiveForm $Form The Form we're working with */ private function renderMain($form) { // #main .content echo CHtml::openTag('div', array('id' => 'main', 'class' => 'nano')); echo CHtml::openTag('div', array('class' => 'content')); echo CHtml::openTag('fieldset'); // If we want a custom form view, render that view instead of the default behavior if ($this->model->form !== NULL) { $this->controller->renderPartial($this->model->form, array('model' => $this->model, 'properties' => $this->properties, 'form' => $form)); } else { if (count($this->properties) == 0 && $this->model->preContentView == NULL) { echo CHtml::tag('legend', array(), Yii::t('Dashboard.main', 'Change Theme Settings')); echo CHtml::tag('div', array('class' => 'alert alert-info'), Yii::t('Dashboard.main', 'There are no settings for this section.')); } else { $groups = $this->model->groups(); if (!empty($groups)) { foreach ($groups as $name => $attributes) { echo CHtml::tag('legend', array(), $name); echo CHtml::tag('div', array('class' => 'clearfix'), NULL); foreach ($attributes as $property) { $p = new StdClass(); $p->name = $property; $this->renderProperties($form, $p); } } } else { echo CHtml::tag('legend', array(), Cii::titleize(get_class($this->model))); foreach ($this->properties as $property) { $this->renderProperties($form, $property); } } echo CHtml::tag('button', array('id' => 'header-button', 'escape' => false, 'class' => 'pure-button pure-button-primary pure-button-small pull-right'), CHtml::tag('i', array('class' => 'icon-spinner icon-spin icon-spinner-form2', 'style' => 'display: none'), NULL) . $this->header['save-text']); } } echo CHtml::closeTag('div'); echo CHtml::closeTag('div'); echo CHtml::closeTag('div'); Yii::app()->getClientScript()->registerScript('change', ' $("input:not([no-field-change=\'true\']").on("input onpropertychange change", function() { try { $(".icon-spinner-form2").fadeIn(); clearTimeout(timeout); } catch (e) {} timeout = setTimeout(function() { var values = $("form").serializeArray(); $("form input[type=checkbox]:not(:checked)").each(function() { values.push({ "name" : this.name, "value" : 0 }) }); $.post($("form").attr("action"), values, function(data, textStatus) { var d = $("#yw2", $.parseHTML(data)); $("#yw2").html($(d).html()); $(".alert").not(".alert-secondary").fadeIn(1000); $(".icon-spinner-form2").fadeOut(); setTimeout(function() { $(".alert").not(".alert-secondary").fadeOut(1000); }, 5000); }); }, 1000); }); '); }