Пример #1
0
 /**
  * Delete a user preference
  *
  * @param string $name Name of the preference
  *
  * @return void
  */
 function delPrefQuery($name)
 {
     return;
     // FIXME: les fonctions addPrefQuery et delPrefQuery sont EXECUTEES
     // a CHAQUE fois quon va sur la page de setup ! cf. pure SQL
     $pref = new CPreferences();
     $where = array();
     $where['key'] = " = '{$name}'";
     foreach ($pref->loadList($where) as $_pref) {
         if ($msg = $_pref->delete()) {
             CAppUI::setMsg($msg, UI_MSG_ERROR);
         }
     }
 }
Пример #2
0
 * $Id$
 *
 * @category Admin
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$key = CValue::get("key");
// Load preferences
$preference = new CPreferences();
$where["key"] = "= '{$key}'";
$where["value"] = "IS NOT NULL";
$preferences = $preference->loadList($where);
// Mass preloading
/** @var CUser[] $users */
$users = CMbObject::massLoadFwdRef($preferences, "user_id");
$profiles = CMbObject::massLoadFwdRef($users, "profile_id");
// Attach preferences to users
$default = null;
foreach ($preferences as $_preference) {
    if (!$_preference->user_id) {
        $default = $_preference;
        continue;
    }
    $users[$_preference->user_id]->_ref_preference = $_preference;
}
// Build profile hierarchy
$hierarchy = array("default" => array());