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

Class: Auth_PrefManager

Source Location: /Auth_PrefManager-1.1.3/PrefManager.php

Class Overview


A simple preference manager, takes userid, preference name pairs and returns the value of that preference.


Author(s):

Methods


Inherited Variables

Inherited Methods


Class Details

[line 19]
A simple preference manager, takes userid, preference name pairs and returns the value of that preference.

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 120]

bool 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?

  • Return: Success or failure.
  • 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 174]

void clearCache( )

Cleans out the cache.
  • Access: public

[ Top ]

deleteDefaultPref   [line 353]

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 322]

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 254]

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 189]

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 309]

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 268]

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 151]

void setReturnDefaults( [ $returnDefaults = true])


Parameters:

   $returnDefaults   — 

[ Top ]

useCache   [line 164]

void useCache( [bool $use = true])

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

Parameters:

bool   $use   —  Should the cache be used.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 13:51:37 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.