当前位置: 首页>>代码示例>>PHP>>正文


PHP Setting::findAll方法代码示例

本文整理汇总了PHP中Setting::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::findAll方法的具体用法?PHP Setting::findAll怎么用?PHP Setting::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Setting的用法示例。


在下文中一共展示了Setting::findAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeSave

 public function executeSave()
 {
     $settings = $this->post('setting', 'ARRAY', []);
     $oms = \Setting::findAll('setting_key');
     foreach ($this->form_cfg as $gk => $group) {
         foreach ($group['settings'] as $key => $options) {
             if (isset($settings[$key])) {
                 //form was set
                 if (isset($oms[$key])) {
                     $om = $oms[$key];
                 } else {
                     $om = new \Setting();
                     $om->setSettingKey($key);
                 }
                 $om->setSettingValue($settings[$key]);
                 $om->save();
             } else {
                 if ($options['control'] == 'checkbox') {
                     if (isset($oms[$key])) {
                         $om = $oms[$key];
                     } else {
                         $om = new \Setting();
                         $om->setSettingKey($key);
                     }
                     $om->setSettingValue('');
                     $om->save();
                 }
             }
             $this->dispatch('onAfterChangeSetting', new CMSBackendEvent($this, ['setting' => $om]));
         }
     }
     Session::getInstance()->setFlash('setting.message', t('Site\'s settings was saved!'));
     $this->redirect($this->createUrl('system_setting'));
 }
开发者ID:hosivan90,项目名称:toxotes,代码行数:34,代码来源:SystemSetting.php

示例2: getSetting

 public static function getSetting($type = 'system', $setting_name = NULL, $user_id = NULL)
 {
     if (!is_null($setting_name)) {
         if (is_numeric($user_id) && $type == 'user') {
             $setting = Setting::findAll(array('type' => $type, 'name' => $setting_name, 'owner_id' => $user_id));
             //$value = $setting->getValue();
         } elseif ($type == 'system') {
             $setting = Setting::findAll(array('type=' => $type, 'name=' => $setting_name, 'owner_id=' => '0'));
             // $value = $setting->getValue();
         }
         return $setting;
     } else {
         return false;
     }
 }
开发者ID:nagyist,项目名称:Tattle,代码行数:15,代码来源:Setting.php

示例3: catch

    } else {
        $setting->setOwnerId(0);
    }
    if (fRequest::isPost()) {
        try {
            $setting->populate();
            fRequest::validateCSRFToken(fRequest::get('token'));
            $setting->store();
            $setting_url = Setting::makeUrl('list', $setting_type);
            fMessaging::create('affected', fURL::get());
            fMessaging::create('success', fURL::get(), 'The setting ' . $setting->getFriendlyName() . ' was successfully created');
            fURL::redirect($setting_url);
        } catch (fExpectedException $e) {
            fMessaging::create('error', fURL::get(), $e->getMessage());
        }
    } else {
        $setting->setValue($list_plugin_settings[$setting_name]['default']);
    }
    include VIEW_PATH . '/add_edit_setting.php';
} else {
    if ('user' == $setting_type) {
        $current_plugin_user_settings = Setting::findAll(array('type=' => 'user', 'owner_id=' => $owner_id));
        foreach ($current_plugin_user_settings as $user_setting) {
            $plugin_user_settings[$user_setting->getName()]['value'] = $user_setting->getValue();
        }
        $list_plugin_settings = $plugin_user_settings;
    } else {
        $list_plugin_settings = $plugin_settings;
    }
    include VIEW_PATH . '/list_settings.php';
}
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:setting.php

示例4: fDatabase

try {
    //Set DB connection (using flourish it isn't actually connected to until the first use)
    $mysql_db = new fDatabase('mysql', $GLOBALS['DATABASE_NAME'], $GLOBALS['DATABASE_USER'], $GLOBALS['DATABASE_PASS'], $GLOBALS['DATABASE_HOST']);
    // Please note that calling this method is not required, and simply
    // causes an exception to be thrown if the connection can not be made
    $mysql_db->connect();
} catch (fAuthorizationException $e) {
    $config_error = "DB error : " . $e->getMessage();
    $config_exit = true;
}
//Connect the db to the ORM functions
fORMDatabase::attach($mysql_db);
$default_plugin_settings = plugin_hook('plugin_settings');
$default_plugin_user_settings = plugin_hook('plugin_user_settings');
$send_methods = plugin_hook('send_methods');
$current_plugin_settings = Setting::findAll(array('type=' => 'system'));
$plugin_settings = $default_plugin_settings;
$plugin_user_settings = $default_plugin_user_settings;
foreach ($current_plugin_settings as $setting) {
    $plugin_settings[$setting->getName()]['value'] = $setting->getValue();
}
if (!is_dir(JS_CACHE)) {
    $config_error .= "<br/>Tattle Error <br />" . "Can't write to the js cache folder : " . JS_CACHE;
}
if (!is_dir($GLOBALS['SESSION_FILES']) || !is_writable($GLOBALS['SESSION_FILES'])) {
    $config_error .= "<br/>Tattle Error <br />" . "Flourishlib Session path is not write-able. Path at : " . $GLOBALS['SESSION_FILES'];
    $config_error = true;
}
if ($config_exit) {
    print $config_error;
    exit;
开发者ID:nleskiw,项目名称:Graphite-Tattle,代码行数:31,代码来源:config.php


注:本文中的Setting::findAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。