예제 #1
0
 /**
  * Clear the preferences for this particular table
  * @param $bResetAll boolean If true,the settings for all tables of the same class(es)/alias(es) are reset
  */
 public function ResetToDefault($bResetAll)
 {
     if ($this->sTableId == null && !$bResetAll) {
         return false;
     }
     // Cannot reset, the table is not identified, use force $bResetAll instead
     if ($bResetAll) {
         // Turn the key into a suitable PCRE pattern
         $sKey = $this->GetPrefsKey(null);
         $sPattern = str_replace(array('|'), array('\\|'), $sKey);
         // escape the | character
         $sPattern = '#^' . str_replace(array('*'), array('.*'), $sPattern) . '$#';
         // Don't use slash as the delimiter since it's used in our key to delimit aliases
         appUserPreferences::UnsetPref($sPattern, true);
     } else {
         appUserPreferences::UnsetPref($this->GetPrefsKey($this->sTableId), false);
     }
     return true;
 }