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


PHP Preference::update_all方法代码示例

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


在下文中一共展示了Preference::update_all方法的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;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:21,代码来源:democratic.class.php

示例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;
}
开发者ID:cheese1,项目名称:ampache,代码行数:25,代码来源:preferences.php


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