PrefManager
[ class tree: PrefManager ] [ index: PrefManager ] [ all elements ]

Class: Auth_PrefManager

Source Location: /Auth_PrefManager-1.2.2/Auth/PrefManager.php

Class Overview


Main PrefManager class.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2003-2005 Substance IT, 2007 The PHP Group

Methods


Inherited Variables

Inherited Methods


Class Details

[line 52]
Main PrefManager class.

Uses a table with the following spec:

CREATE TABLE `preferences` ( `user_id` varchar( 255 ) NOT null default '', `pref_id` varchar( 32 ) NOT null default '', `pref_value` longtext NOT null , PRIMARY KEY ( `user_id` , `pref_id` ) )



[ Top ]


Method Detail

Auth_PrefManager (Constructor)   [line 186]

void Auth_PrefManager( string $dsn, [array $properties = null], string $defaultUser)

Constructor

Options: table: The table to get prefs from. [preferences] userColumn: The field name to search for userid's [user_id] nameColumn: The field name to search for preference names [pref_name] valueColumn: The field name to search for preference values [pref_value] defaultUser: The userid assigned to default values [__default__] cacheName: The name of cache in the session variable ($_SESSION[cacheName]) [prefsCache] useCache: Whether or not values should be cached. serialize: Should preference values be serialzed before saving?

  • Access: public

Parameters:

string   $dsn   —  The DSN of the database connection to make, or a DB object.
array   $properties   —  An array of properties to set.
string   $defaultUser   —  The default user to manage for.

[ Top ]

clearCache   [line 230]

void clearCache( )

Cleans out the cache.
  • Access: public

[ Top ]

deleteDefaultPref   [line 514]

bool deleteDefaultPref( string $pref_id)

Deletes a preference for the default user.
  • Return: Success/Failure
  • Access: public

Parameters:

string   $pref_id   —  The preference to delete.

[ Top ]

deletePref   [line 466]

bool deletePref( string $user_id, string $pref_id)

Deletes a preference for the specified user.
  • Return: Success/Failure
  • Access: public

Parameters:

string   $user_id   —  The userid of the user to delete from.
string   $pref_id   —  The preference to delete.

[ Top ]

getDefaultPref   [line 367]

mixed getDefaultPref( string $pref_id)

A shortcut function for getPref($this->_defaultUser, $pref_id, $value), useful if you have a logged in user, but want to get defaults anyway.
  • Return: The value if it's found, or null if it isn't.
  • Access: public

Parameters:

string   $pref_id   —  The name of the preference to get.

[ Top ]

getPref   [line 297]

mixed getPref( string $user_id, string $pref_id, [bool $showDefaults = true])

Get a preference for the specified user, or, if returning default values is enabled, the default.
  • Return: The value if it's found, or null if it isn't.
  • Access: public

Parameters:

string   $user_id   —  The user to get the preference for.
string   $pref_id   —  The preference to get.
bool   $showDefaults   —  Should default values be searched (overrides the global setting).

[ Top ]

setDefaultPref   [line 449]

bool setDefaultPref( string $pref_id, mixed $value)

A shortcut function for setPref($this->_defaultUser, $pref_id, $value)
  • Return: Sucess or failure.
  • Access: public

Parameters:

string   $pref_id   —  The name of the preference to set.
mixed   $value   —  The value to set it to.

[ Top ]

setPref   [line 385]

bool setPref( string $user_id, string $pref_id, mixed $value)

Set a preference for the specified user.
  • Return: Sucess or failure.
  • Access: public

Parameters:

string   $user_id   —  The user to set for.
string   $pref_id   —  The preference to set.
mixed   $value   —  The value it should be set to.

[ Top ]

setReturnDefaults   [line 244]

void setReturnDefaults( [bool $returnDefaults = true])

Sets whether defaults should be returned if a user doesn't have a specific value set
  • Access: public

Parameters:

bool   $returnDefaults   —  Should defaults be returned

[ Top ]

useCache   [line 258]

void useCache( [bool $use = true])

Sets whether the cache should be used.
  • Access: public

Parameters:

bool   $use   —  Should the cache be used.

[ Top ]

usePEARError   [line 278]

void usePEARError( [bool $use = true])

Sets whether PEAR Error objects should be returned on errors
  • Access: public

Parameters:

bool   $use   —  Should PEAR Errors be returned on error

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:48:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.