本文整理汇总了PHP中Preference::update_level方法的典型用法代码示例。如果您正苦于以下问题:PHP Preference::update_level方法的具体用法?PHP Preference::update_level怎么用?PHP Preference::update_level使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preference
的用法示例。
在下文中一共展示了Preference::update_level方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_user_preferences
/**
* set_user_preferences
* This sets up a (or all) user(s) to use democratic play. This sets
* their play method and playlist method (clear on send) If no user is
* passed it does it for everyone and also locks down the ability to
* change to admins only
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public static function set_user_preferences($user = null)
{
//FIXME: Code in single user stuff
$preference_id = Preference::id_from_name('play_type');
Preference::update_level($preference_id, '75');
Preference::update_all($preference_id, 'democratic');
$allow_demo = Preference::id_from_name('allow_democratic_playback');
Preference::update_all($allow_demo, '1');
$play_method = Preference::id_from_name('playlist_method');
Preference::update_all($play_method, 'clear');
return true;
}
示例2: update_preference
/**
* update_preference
* This function updates a single preference and is called by the update_preferences function
*/
function update_preference($user_id, $name, $pref_id, $value)
{
$apply_check = "check_" . $name;
$level_check = "level_" . $name;
/* First see if they are an administrator and we are applying this to everything */
if ($GLOBALS['user']->has_access(100) and make_bool($_REQUEST[$apply_check])) {
Preference::update_all($pref_id, $value);
return true;
}
/* Check and see if they are an admin and the level def is set */
if ($GLOBALS['user']->has_access(100) and make_bool($_REQUEST[$level_check])) {
Preference::update_level($pref_id, $_REQUEST[$level_check]);
}
/* Else make sure that the current users has the right to do this */
if (Preference::has_access($name)) {
$sql = "UPDATE `user_preference` SET `value` = ? WHERE `preference` = ? AND `user` = ?";
Dba::write($sql, array($value, $pref_id, $user_id));
return true;
}
return false;
}