Revize 2062
Přidáno uživatelem David Raška před více než 11 roky(ů)
freenetis/branches/1.1/application/controllers/monitoring.php | ||
---|---|---|
else
|
||
{
|
||
$group_by = 'all';
|
||
$user_model->set_user_setting(User_Model::SETTINGS_MONITORING_ORDER_BY, $group_by);
|
||
}
|
||
|
||
$form->dropdown('group_by')
|
freenetis/branches/1.1/application/models/user.php | ||
---|---|---|
* @param string $key Key
|
||
* @return mixed Value
|
||
*/
|
||
public function get_user_setting($key)
|
||
public function get_user_setting($key, $default = NULL)
|
||
{
|
||
$json_settings = $this->settings;
|
||
|
||
// return empty value on no settings
|
||
if (empty($json_settings))
|
||
{
|
||
return '';
|
||
return $default;
|
||
}
|
||
|
||
// decode json
|
||
... | ... | |
// return empty value on no settings
|
||
if (empty($settings))
|
||
{
|
||
return '';
|
||
return $default;
|
||
}
|
||
// return value
|
||
else if (isset($settings[$key]))
|
||
... | ... | |
// no value found
|
||
else
|
||
{
|
||
return '';
|
||
return $defaut;
|
||
}
|
||
}
|
||
|
||
... | ... | |
*/
|
||
public function set_user_setting($key, $value)
|
||
{
|
||
try
|
||
{
|
||
$this->transaction_start();
|
||
|
||
$json_settings = $this->settings;
|
||
$json_settings = $this->settings;
|
||
|
||
// decode json
|
||
$settings = json_decode($json_settings, TRUE);
|
||
// decode json
|
||
$settings = json_decode($json_settings, TRUE);
|
||
|
||
// add new settings
|
||
$settings[$key] = $value;
|
||
// add new settings
|
||
$settings[$key] = $value;
|
||
|
||
// encode settings to json
|
||
$json_settings = json_encode($settings);
|
||
// encode settings to json
|
||
$json_settings = json_encode($settings);
|
||
|
||
$this->settings = $json_settings;
|
||
$this->settings = $json_settings;
|
||
|
||
// save
|
||
$this->save_throwable();
|
||
|
||
$this->transaction_commit();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
$this->transaction_rollback();
|
||
}
|
||
|
||
// save
|
||
$this->save_throwable();
|
||
}
|
||
}
|
Také k dispozici: Unified diff
Upravy:
- Drobne upravy predchoziho commitu