public static function addSettingGroup($key, $name_lang, $desc_lang = '')
 {
     $group = self::findSettingGroup($key);
     if (!$group) {
         $group = new SettingGroupItem();
     }
     $group->setting_group_key = $key;
     $group->setting_group_name_lang = $name_lang;
     $group->setting_group_desc_lang = $desc_lang;
     $group->save();
     return $group;
 }
 public function index()
 {
     setPageData('groups', SettingGroupItem::all());
     $this->_render();
 }
Пример #3
0
 public static function addSetting($group, $key, $value, $lang_key, $autoload = 1, $required = 1, $desc_key = '', $type = 'text', $options = '', $mchoice = 0, $has_interface = true)
 {
     $settingGroup = SettingGroupItem::findSettingGroup($group);
     if ($settingGroup) {
         if ($type == "choices") {
             $mchoice = 1;
         }
         $new = false;
         $setting = self::findSetting($key);
         if (!$setting) {
             $new = true;
             $setting = new SettingItem();
             $setting->setting_group_id = $settingGroup->id;
         }
         if ($setting->setting_group_id == $settingGroup->id) {
             $setting->setting_name_lang = $lang_key;
             $setting->setting_desc_lang = $desc_key;
             $setting->setting_key = $key;
             if ($new) {
                 $setting->setting_value = $value;
             }
             $setting->setting_required = $required;
             $setting->setting_type = $type;
             $setting->setting_options = $options;
             $setting->setting_mchoice = (int) $mchoice;
             $setting->has_interface = (int) $has_interface;
             $setting->autoload = (int) $autoload;
             $setting->save();
         }
     }
 }
Пример #4
0
/**
 * Add/Update Setting Group
 * 
 * @param type $key
 * @param type $name_lang
 * @param type $desc_lang
 * @return type
 */
function setSettingGroup($key, $name_lang, $desc_lang = '')
{
    return \Developeryamhi\SettingsModule\SettingGroupItem::setSettingGroup($key, $name_lang, $desc_lang);
}