Example #1
0
 /**
  * Charge les préférences à partir de la base de données si ce n'est pas
  * déjà fait.
  *
  * @static
  * @access protected
  * @return void
  */
 protected static function load()
 {
     if (self::$preferencesLoaded) {
         return;
     }
     $sql = 'SELECT * FROM FW_Preferences';
     if (defined('DATABASE_ID') && !Object::isPublicEntity('FW_Preferences')) {
         $sql .= ' WHERE dbid IS NULL OR dbid=' . DATABASE_ID;
     }
     $rs = Database::connection()->execute($sql);
     if ($rs) {
         while (!$rs->EOF) {
             $type = $rs->fields['type'];
             $name = $rs->fields['name'];
             $col = self::$typeMap[$type];
             $value = $rs->fields[$col];
             self::$prefs[$name] = array($type, $value, true, false);
             $rs->moveNext();
         }
         $rs->close();
     }
     self::$preferencesLoaded = true;
 }