Example #1
0
 public function form()
 {
     $timezoneList = timezone_identifiers_list();
     sort($timezoneList);
     $timezoneList = array_combine($timezoneList, $timezoneList);
     // Общие настроки
     $ret = array('elements' => array(Form::tab(Yii::t('cms', 'General settings')), 'sitename' => array('type' => 'text', 'size' => 60), 'adminEmail' => array('type' => 'text', 'size' => 60), 'language' => array('type' => 'LanguageSelect', 'empty' => null), 'timezone' => array('type' => 'dropdownlist', 'items' => $timezoneList), 'autoSave' => array('type' => 'checkbox'), 'slugTransliterate' => array('type' => 'checkbox'), 'slugLowercase' => array('type' => 'checkbox'), 'pageOnError403' => array('type' => 'PageSelect'), 'pageOnError404' => array('type' => 'PageSelect'), Form::tab(Yii::t('cms', 'Appearance')), 'theme' => array('type' => 'ThemeSelect', 'empty' => null), 'defaultsPerPage' => array('type' => 'Slider', 'options' => array('min' => 1, 'max' => 50)), 'showWidgetAppearance' => array('type' => 'checkbox'), 'ajaxPager' => array('type' => 'checkbox'), 'ajaxPagerScroll' => array('type' => 'checkbox'), Form::tab(Yii::t('cms', 'Users')), 'defaultsShowEmail' => array('type' => 'dropdownlist', 'items' => Role::builtInRoles()), 'defaultsSendMessage' => array('type' => 'dropdownlist', 'items' => Role::builtInRoles()), 'userExtraFields' => array('type' => 'FieldSet'), Form::tab(Yii::t('cms', 'Performance')), 'cacheTime' => array('type' => 'Slider', 'options' => array('min' => 0, 'max' => 3600, 'step' => 60), 'hint' => Yii::t('cms', 'in seconds, 0 = off, 3600 - one hour'))));
     // Настройки для юнитов
     $units = ContentUnit::getInstalledUnits();
     $ret['elements'][] = Form::tab(Yii::t('cms', 'Units settings'));
     foreach ($units as $unitClass) {
         if (method_exists($unitClass, 'settings')) {
             $elems = call_user_func(array($unitClass, 'settings'), $unitClass);
             if (is_array($elems) && !empty($elems)) {
                 $ret['elements'][] = Form::section(call_user_func(array($unitClass, 'name')));
                 foreach ($elems as $k => $elem) {
                     $ret['elements'][$unitClass . '.' . $k] = $elem;
                 }
             }
         }
     }
     return self::localizedForm($ret);
 }