[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/core/ -> user_pref_api.php (summary)

User Preferences API

Copyright: Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
Copyright: Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
File Size: 592 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

UserPreferences:: (18 methods):
  UserPreferences()
  __set()
  __get()
  Get()
  user_pref_cache_row()
  user_pref_cache_array_rows()
  user_pref_clear_cache()
  user_pref_exists()
  user_pref_insert()
  user_pref_update()
  user_pref_delete()
  user_pref_delete_all()
  user_pref_delete_project()
  user_pref_get()
  user_pref_get_pref()
  user_pref_get_language()
  user_pref_set_pref()
  user_pref_set()


Class: UserPreferences  - X-Ref

Preference Structure Definition

UserPreferences( $p_user_id, $p_project_id )   X-Ref
Constructor

param: int $p_user_id
param: int $p_project_id

__set($name, $value)   X-Ref

param: string $name
param: string $value

__get( $p_string )   X-Ref

param: string $t_string

Get( $p_string )   X-Ref

param: string $t_string

user_pref_cache_row( $p_user_id, $p_project_id = ALL_PROJECTS, $p_trigger_errors = true )   X-Ref
Cache a user preferences row if necessary and return the cached copy
If the third parameter is true (default), trigger an error
if the preferences can't be found.  If the second parameter is
false, return false if the preferences can't be found.

param: int $p_user_id
param: int $p_project_id
param: bool $p_trigger_errors
return: false|array

user_pref_cache_array_rows( $p_user_id_array, $p_project_id = ALL_PROJECTS )   X-Ref
Cache user preferences for a set of users

param: array $p_user_id_array
param: int $p_project_id
return: null

user_pref_clear_cache( $p_user_id = null, $p_project_id = null )   X-Ref
Clear the user preferences cache (or just the given id if specified)

param: $p_user_id
param: $p_project_id
return: true

user_pref_exists( $p_user_id, $p_project_id = ALL_PROJECTS )   X-Ref
return true if the user has prefs assigned for the given project,
false otherwise

param: int $p_user_id
param: int $p_project_id
return: bool

user_pref_insert( $p_user_id, $p_project_id, $p_prefs )   X-Ref
perform an insert of a preference object into the DB

param: int $p_user_id
param: int $p_project_id
param: UserPreferences $p_prefs
return: true

user_pref_update( $p_user_id, $p_project_id, $p_prefs )   X-Ref
perform an update of a preference object into the DB

param: int $p_user_id
param: int $p_project_id
param: UserPreferences $p_prefs
return: true

user_pref_delete( $p_user_id, $p_project_id = ALL_PROJECTS )   X-Ref
delete a preferencess row
returns true if the prefs were successfully deleted

param: int $p_user_id
param: int $p_project_id
return: true

user_pref_delete_all( $p_user_id )   X-Ref
delete all preferences for a user in all projects
returns true if the prefs were successfully deleted

It is far more efficient to delete them all in one query than to
call user_pref_delete() for each one and the code is short so that's
what we do
param: int $p_user_id
return: true

user_pref_delete_project( $p_project_id )   X-Ref
delete all preferences for a project for all users (part of deleting the project)
returns true if the prefs were successfully deleted

It is far more efficient to delete them all in one query than to
call user_pref_delete() for each one and the code is short so that's
what we do
param: $p_project_id
return: true

user_pref_get( $p_user_id, $p_project_id = ALL_PROJECTS )   X-Ref
return the user's preferences in a UserPreferences object

param: int $p_user_id
param: int $p_project_id
return: UserPreferences

user_pref_get_pref( $p_user_id, $p_pref_name, $p_project_id = ALL_PROJECTS )   X-Ref
Return the specified preference field for the user id
If the preference can't be found try to return a defined default
If that fails, trigger a WARNING and return ''

param: int $p_user_id
param: string $p_pref_name
param: int $p_project_id
return: string

user_pref_get_language( $p_user_id, $p_project_id = ALL_PROJECTS )   X-Ref
returns user language

param: int $p_user_id
param: int $p_project_id
return: string language name or null if invalid language specified

user_pref_set_pref( $p_user_id, $p_pref_name, $p_pref_value, $p_project_id = ALL_PROJECTS )   X-Ref
Set a user preference

By getting the prefs for the project first we deal fairly well with defaults.
If there are currently no prefs for that project, the ALL_PROJECTS prefs will
be returned so we end up storing a new set of prefs for the given project
based on the prefs for ALL_PROJECTS.  If there isn't even an entry for
ALL_PROJECTS, we'd get returned a default UserPreferences object to modify.
param: int $p_user_id
param: string $p_pref_name
param: string $p_pref_value
param: int $p_project_id
return: true

user_pref_set( $p_user_id, $p_prefs, $p_project_id = ALL_PROJECTS )   X-Ref
set the user's preferences for the project from the given preferences object
Do the work by calling user_pref_update() or user_pref_insert() as appropriate

param: int $p_user_id
param: UserPreferences $p_prefs
param: int $p_project_id
return: true



Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7