[ Index ]
 

Code source de Plume CMS 1.2.2

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/manager/inc/ -> class.user.php (sommaire)

(pas de description)

Poids: 552 lignes (18 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 2 classes

User:: (20 méthodes):
  User()
  load()
  getId()
  getListResources()
  getWebsiteLevel()
  getWebsiteLevels()
  clear()
  logout()
  checkUser()
  loadPrefs()
  getPref()
  loadWebsites()
  setWebsite()
  removePref()
  savePref()
  synchronize()
  increase()
  decrease()
  getTheme()
  getPluginTheme()

User:: (20 méthodes):
  User()
  load()
  getId()
  getListResources()
  getWebsiteLevel()
  getWebsiteLevels()
  clear()
  logout()
  checkUser()
  loadPrefs()
  getPref()
  loadWebsites()
  setWebsite()
  removePref()
  savePref()
  synchronize()
  increase()
  decrease()
  getTheme()
  getPluginTheme()


Classe: User  - X-Ref

User($user='')   X-Ref
Constructor.
The user object is initialized from the id (integer) or
username (string). If no id or username is given, an empty
User object is created.

param: mixed Id or username ('')

load($user='')   X-Ref
Load user data from the database.
Given an id (integer) or a username (string) the data from the
corresponding user are loaded from the database.
If no id or username are given, try to load from the user_id
taken from $this->f('user_id')

param: mixed Id or username of the user ('')
return: bool Success

getId()   X-Ref
Return the user id.

return: int User id

getListResources($website='')   X-Ref
Get the list of resources created by the user.

param: string Website id, all the websites if empty ('')
return: mixed Recordset object with the resources or false

getWebsiteLevel($website)   X-Ref
Get the rights on a given website.

param: string Website id
return: int Level

getWebsiteLevels($user_id='')   X-Ref
Get the levels for the websites.

If no user id is given, uses the current one.

param: int User id ('')
return: array Associative array array('websiteid' => level, ...);

clear()   X-Ref
Clean the current user object.
This is a basic cleaning, some state variables from the recordset
and CError parents are not cleaned.

return: void

logout()   X-Ref
Clean the current user object and remove it from the session.
The session is closed and destroyed.

return: void

checkUser($user, $pswd)   X-Ref
Check the login/password of a user.
This method can be used as a static method. Thus it is
not possible to get directly the error message from
the Connection object if an error occured in the DB query.
To get the message, use pxDBConnect() to get a Connection object and
check the last error message.

param: string Username
param: string Password
return: bool The pair is valid or not

loadPrefs()   X-Ref
Load user preferences.
The preferences are stored in the $this->prefs member variable.

return: bool Success

getPref($key, $websiteid = '')   X-Ref
Get one preference.

param: string key
param: string website id
return: string preference or empty string if no pref

loadWebsites()   X-Ref
Load user website grants and data.
The website grants are saved in $this->webs
The website data are saved in $this->wdata

return: bool Success

setWebsite($website)   X-Ref
Set the current website.
It loads the lang preference of the website and try to set the
locale.

param: string Website id
return: bool True

removePref($key, $website=')   X-Ref
Remove a pref for a user in the database, and in the
user object.

param: string Key
param: string Website id ('#all#')
param: bool Remove in all the websites (false)
param: bool Remove only in the session (false)
return: bool success

savePref($key, $value, $website='', $sessiononly=false)   X-Ref
Save a user preference.
The user preference can be saved only in the session or in the session
and the database.

param: string Key of the preference
param: mixed Value of the preference
param: string Website id ('') Set as current is none given
param: bool Save only in the session (false)

synchronize($dir=PX_USER_SYNCHRO_FROM_SESSION)   X-Ref
Synchronize the User object from or to the session.
The User object is used in the manager to store the data of the
currently logged user. To avoid a set of queries against the database
for each page in the manager, the object can be saved in the session
and restored from the session. This is the purpose of this method.

param: int Direction of the synchro (PX_USER_SYNCHRO_FROM_SESSION)
return: bool Success

increase($area)   X-Ref
Increase the size of the textarea preference.

param: string Textarea to increase the size
return: int New size, max value 100

decrease($area)   X-Ref
Decrease the size of the textarea preference.

param: string Textarea to decrease the size
return: int New size, min value 5

getTheme()   X-Ref
Get the current "main" theme for the user.
It can be used for the path to the images and css.
If the user's theme is not available anymore or if no
theme is defined yet, 'default' is returned.

return: string Theme id.

getPluginTheme($plugin)   X-Ref
Get the current "plugin" theme for the user.
It can be used for the path to the images and css of the current plugin,
as the "main" theme may not be available for the plugin.

param: string Id of the plugin (plugin folder)
return: string Theme id

Classe: User  - X-Ref

The User class stores the user data when doing manipulation on the user.
Through RecordSet the User class extends the CError class. When a call
to a method is not successfull it is always possible to get the reason
by accessing the error message through the methods provided by CError.

User($user='')   X-Ref
Constructor.
The user object is initialized from the id (integer) or
username (string). If no id or username is given, an empty
User object is created.

param: mixed Id or username ('')

load($user='')   X-Ref
Load user data from the database.
Given an id (integer) or a username (string) the data from the
corresponding user are loaded from the database.
If no id or username are given, try to load from the user_id
taken from $this->f('user_id')

param: mixed Id or username of the user ('')
return: bool Success

getId()   X-Ref
Return the user id.

return: int User id

getListResources($website='')   X-Ref
Get the list of resources created by the user.

param: string Website id, all the websites if empty ('')
return: mixed Recordset object with the resources or false

getWebsiteLevel($website)   X-Ref
Get the rights on a given website.

param: string Website id
return: int Level

getWebsiteLevels($user_id='')   X-Ref
Get the levels for the websites.

If no user id is given, uses the current one.

param: int User id ('')
return: array Associative array array('websiteid' => level, ...);

clear()   X-Ref
Clean the current user object.
This is a basic cleaning, some state variables from the recordset
and CError parents are not cleaned.

return: void

logout()   X-Ref
Clean the current user object and remove it from the session.
The session is closed and destroyed.

return: void

checkUser($user, $pswd)   X-Ref
Check the login/password of a user.
This method can be used as a static method. Thus it is
not possible to get directly the error message from
the Connection object if an error occured in the DB query.
To get the message, use pxDBConnect() to get a Connection object and
check the last error message.

param: string Username
param: string Password
return: bool The pair is valid or not

loadPrefs()   X-Ref
Load user preferences.
The preferences are stored in the $this->prefs member variable.

return: bool Success

getPref($key, $websiteid = '')   X-Ref
Get one preference.

param: string key
param: string website id
return: string preference or empty string if no pref

loadWebsites()   X-Ref
Load user website grants and data.
The website grants are saved in $this->webs
The website data are saved in $this->wdata

return: bool Success

setWebsite($website)   X-Ref
Set the current website.
It loads the lang preference of the website and try to set the
locale.

param: string Website id
return: bool True

removePref($key, $website=')   X-Ref
Remove a pref for a user in the database, and in the
user object.

param: string Key
param: string Website id ('#all#')
param: bool Remove in all the websites (false)
param: bool Remove only in the session (false)
return: bool success

savePref($key, $value, $website='', $sessiononly=false)   X-Ref
Save a user preference.
The user preference can be saved only in the session or in the session
and the database.

param: string Key of the preference
param: mixed Value of the preference
param: string Website id ('') Set as current is none given
param: bool Save only in the session (false)

synchronize($dir=PX_USER_SYNCHRO_FROM_SESSION)   X-Ref
Synchronize the User object from or to the session.
The User object is used in the manager to store the data of the
currently logged user. To avoid a set of queries against the database
for each page in the manager, the object can be saved in the session
and restored from the session. This is the purpose of this method.

param: int Direction of the synchro (PX_USER_SYNCHRO_FROM_SESSION)
return: bool Success

increase($area)   X-Ref
Increase the size of the textarea preference.

param: string Textarea to increase the size
return: int New size, max value 100

decrease($area)   X-Ref
Decrease the size of the textarea preference.

param: string Textarea to decrease the size
return: int New size, min value 5

getTheme()   X-Ref
Get the current "main" theme for the user.
It can be used for the path to the images and css.
If the user's theme is not available anymore or if no
theme is defined yet, 'default' is returned.

return: string Theme id.

getPluginTheme($plugin)   X-Ref
Get the current "plugin" theme for the user.
It can be used for the path to the images and css of the current plugin,
as the "main" theme may not be available for the plugin.

param: string Id of the plugin (plugin folder)
return: string Theme id



Généré le : Mon Nov 26 11:57:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics