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

Procedural File: user_pref_api.php

Source Location: /core/user_pref_api.php



Classes:

UserPreferences
Preference Structure Definition


Page Details:

User Preferences API



Tags:

copyright:  Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
copyright:  Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
link:  http://www.mantisbt.org








user_pref_cache_array_rows [line 199]

null user_pref_cache_array_rows( array $p_user_id_array, [int $p_project_id = ALL_PROJECTS])

Cache user preferences for a set of users



Parameters

array   $p_user_id_array  
int   $p_project_id  
[ Top ]



user_pref_cache_row [line 159]

false|array user_pref_cache_row( int $p_user_id, [int $p_project_id = ALL_PROJECTS], [bool $p_trigger_errors = true])

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.



Parameters

int   $p_user_id  
int   $p_project_id  
bool   $p_trigger_errors  
[ Top ]



user_pref_clear_cache [line 246]

true user_pref_clear_cache( [$p_user_id $p_user_id = null], [$p_project_id $p_project_id = null])

Clear the user preferences cache (or just the given id if specified)



Parameters

$p_user_id   $p_user_id  
$p_project_id   $p_project_id  
[ Top ]



user_pref_delete [line 368]

true user_pref_delete( int $p_user_id, [int $p_project_id = ALL_PROJECTS])

delete a preferencess row

returns true if the prefs were successfully deleted




Parameters

int   $p_user_id  
int   $p_project_id  
[ Top ]



user_pref_delete_all [line 397]

true user_pref_delete_all( int $p_user_id)

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




Parameters

int   $p_user_id  
[ Top ]



user_pref_delete_project [line 423]

true user_pref_delete_project( $p_project_id $p_project_id)

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




Parameters

$p_project_id   $p_project_id  
[ Top ]



user_pref_exists [line 267]

bool user_pref_exists( int $p_user_id, [int $p_project_id = ALL_PROJECTS])

return true if the user has prefs assigned for the given project,

false otherwise




Parameters

int   $p_user_id  
int   $p_project_id  
[ Top ]



user_pref_get [line 441]

UserPreferences user_pref_get( int $p_user_id, [int $p_project_id = ALL_PROJECTS])

return the user's preferences in a UserPreferences object



Parameters

int   $p_user_id  
int   $p_project_id  
[ Top ]



user_pref_get_language [line 523]

string user_pref_get_language( int $p_user_id, [int $p_project_id = ALL_PROJECTS])

returns user language



Tags:

return:  language name or null if invalid language specified


Parameters

int   $p_user_id  
int   $p_project_id  
[ Top ]



user_pref_get_pref [line 498]

string user_pref_get_pref( int $p_user_id, string $p_pref_name, [int $p_project_id = ALL_PROJECTS])

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 ''




Parameters

int   $p_user_id  
string   $p_pref_name  
int   $p_project_id  
[ Top ]



user_pref_insert [line 282]

true user_pref_insert( int $p_user_id, int $p_project_id, UserPreferences $p_prefs)

perform an insert of a preference object into the DB



Parameters

int   $p_user_id  
int   $p_project_id  
UserPreferences   $p_prefs  
[ Top ]



user_pref_set [line 566]

true user_pref_set( int $p_user_id, UserPreferences $p_prefs, [int $p_project_id = ALL_PROJECTS])

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




Parameters

int   $p_user_id  
UserPreferences   $p_prefs  
int   $p_project_id  
[ Top ]



user_pref_set_pref [line 548]

true user_pref_set_pref( int $p_user_id, string $p_pref_name, string $p_pref_value, [int $p_project_id = ALL_PROJECTS])

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.




Parameters

int   $p_user_id  
string   $p_pref_name  
string   $p_pref_value  
int   $p_project_id  
[ Top ]



user_pref_update [line 325]

true user_pref_update( int $p_user_id, int $p_project_id, UserPreferences $p_prefs)

perform an update of a preference object into the DB



Parameters

int   $p_user_id  
int   $p_project_id  
UserPreferences   $p_prefs  
[ Top ]



Documentation generated on Sun, 12 Dec 2010 23:50:54 +0900 by phpDocumentor 1.4.3
inserted by FC2 system