示例#1
0
    public function getForm()
    {
        $themesNames = Yii::app()->themeManager->themeNames;
        $themes = array_combine($themesNames, $themesNames);
        $df = Yii::app()->dateFormatter;
        Yii::app()->controller->widget('ext.tinymce.TinymceWidget');
        Yii::import('zii.widgets.jui.CJuiDatePicker');
        Yii::import('ext.BootstrapTagInput');
        return new TabForm(array('showErrorSummary' => true, 'attributes' => array('enctype' => 'multipart/form-data', 'class' => 'form-horizontal', 'id' => __CLASS__), 'elements' => array('global' => array('type' => 'form', 'title' => $this->t('TAB_GENERAL'), 'elements' => array('logo' => array('type' => 'file'), '<div class="form-group">
				<div class="col-sm-4"></div>
				<div class="col-sm-8">' . $this->renderLogo() . '</div>
				</div>', 'translate_object_url' => array('type' => 'checkbox', 'hint' => $this->t('HINT_TRANSLATE_OBJ_URL')), 'site_name' => array('type' => 'text', 'attributes' => array('class' => 'form-control')), 'admin_email' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-envelope"></span>'), 'session_time' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-alarm-2"></span>'), 'cookie_time' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-alarm-2"></span>'), 'cache_time' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-alarm-2"></span>'), 'pagenum' => array('type' => 'text'), 'multi_language' => array('type' => 'checkbox'), 'auto_detect_language' => array('type' => 'checkbox', 'hint' => $this->t('HINT_AUTO_DETECT_LANG', array('{default_lang}' => Yii::app()->languageManager->default->code))), 'theme' => array('type' => 'dropdownlist', 'items' => $themes), 'etheme' => array('type' => 'dropdownlist', 'items' => $themes, 'empty' => 'no'), 'etheme_start' => array('type' => 'CJuiDatePicker', 'options' => array('dateFormat' => 'yy-mm-dd ' . date('H:i:s')), 'htmlOptions' => array('class' => 'form-control datatime')), 'etheme_end' => array('type' => 'CJuiDatePicker', 'options' => array('dateFormat' => 'yy-mm-dd ' . date('H:i:s')), 'htmlOptions' => array('class' => 'form-control datatime')), 'btn_grid_size' => array('type' => 'dropdownlist', 'items' => array('btn' => Yii::t('CoreModule.admin', 'normal'), 'btn-xs' => Yii::t('CoreModule.admin', 'xs'), 'btn-sm' => Yii::t('CoreModule.admin', 'sm'), 'btn-lg' => Yii::t('CoreModule.admin', 'lg'))))), 'close_site' => array('type' => 'form', 'title' => $this->t('TAB_CLOSESITE'), 'elements' => array('site_close' => array('type' => 'checkbox'), 'site_close_text' => array('type' => 'textarea', 'class' => 'editor'), 'site_close_allowed_users' => array('type' => 'BootstrapTagInput', 'htmlOptions' => array('placeholder' => $this->t('ADD_USER')), 'hint' => Yii::t('hints', 'HINT_TAGS_PLUGIN')), 'site_close_allowed_ip' => array('type' => 'text', 'type' => 'BootstrapTagInput', 'htmlOptions' => array('placeholder' => $this->t('ADD_IP')), 'hint' => Yii::t('hints', 'HINT_TAGS_PLUGIN')))), 'censor' => array('type' => 'form', 'title' => $this->t('TAB_CENSOR'), 'elements' => array('censor' => array('type' => 'checkbox'), 'censor_array' => array('type' => 'BootstrapTagInput', 'htmlOptions' => array('placeholder' => $this->t('ADD_WORD')), 'hint' => Yii::t('hints', 'HINT_TAGS_PLUGIN')), 'censor_replace' => array('type' => 'text'))), 'datetime' => array('type' => 'form', 'title' => $this->t('TAB_DATETIME'), 'elements' => array('format_date' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-calendar-2 "></span>', 'hint' => "<div>День (d или dd): " . $df->format('dd', date('Y-m-d H:i:s')) . "</div>\n                    <div>Месяц (MM): " . $df->format('MM', date('Y-m-d H:i:s')) . "</div>\n                    <div>Месяц (MMM): " . $df->format('MMM', date('Y-m-d H:i:s')) . "</div>\n                    <div>Месяц (MMMM): " . $df->format('MMMM', date('Y-m-d H:i:s')) . "</div>\n                    <div>Год (yy): " . $df->format('yy', date('Y-m-d H:i:s')) . "</div>\n                    <div>Год (yyyy): " . $df->format('yyyy', date('Y-m-d H:i:s')) . "</div>"), 'default_timezone' => array('type' => 'dropdownlist', 'items' => TimeZoneHelper::getTimeZoneData())))), 'buttons' => array('submit' => array('type' => 'submit', 'class' => 'btn btn-success', 'label' => Yii::t('app', 'SAVE')))), $this);
    }
示例#2
0
 public function getForm()
 {
     Yii::import('zii.widgets.jui.CJuiDatePicker');
     return new CMSForm(array('attributes' => array('id' => __CLASS__, 'class' => 'form-horizontal'), 'enctype' => 'multipart/form-data', 'showErrorSummary' => false, 'elements' => array('login' => array('type' => 'text', 'disabled' => $this->isService, 'afterField' => '<span class="fieldIcon icon-user"></span>'), 'username' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-user"></span>'), 'email' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-envelope"></span>'), 'address' => array('type' => 'text'), 'role' => array('type' => 'text'), 'phone' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-phone"></span>'), 'subscribe' => array('type' => 'checkbox'), 'last_login' => array('type' => 'CJuiDatePicker', 'options' => array('dateFormat' => 'yy-mm-dd ' . date('H:i:s')), 'afterField' => '<span class="fieldIcon icon-calendar-2"></span>'), 'date_birthday' => array('type' => 'CJuiDatePicker', 'options' => array('dateFormat' => 'yy-mm-dd'), 'afterField' => '<span class="fieldIcon icon-calendar-2"></span>'), 'timezone' => array('type' => 'dropdownlist', 'items' => TimeZoneHelper::getTimeZoneData()), 'language' => array('type' => 'dropdownlist', 'items' => Yii::app()->languageManager->getLangsByArray(), 'empty' => 'По умолчанию'), 'gender' => array('type' => 'dropdownlist', 'items' => self::getSelectGender(), 'disabled' => $this->isService), 'group_id' => array('type' => 'dropdownlist', 'items' => Html::listData(UserGroup::model()->findAll(), 'id', 'name')), 'avatar' => array('type' => 'file', 'disabled' => $this->isService), 'new_password' => array('type' => 'password', 'disabled' => $this->isService, 'afterField' => '<span class="fieldIcon icon-lock"></span>'), 'banned' => array('type' => 'checkbox')), 'buttons' => array('submit' => array('type' => 'submit', 'class' => 'btn btn-success', 'label' => $this->isNewRecord ? Yii::t('app', 'CREATE', 1) : Yii::t('app', 'SAVE')))), $this);
 }