Class TableRoles
-
TableAccess
-
TableRoles
Copyright:
2004-2016 The Admidio Team
License:
GNU General Public License v2.0 only
**********************************************************************************************
Class:
TableRoles
Diese Klasse dient dazu einen Rollenobjekt zu erstellen.
Eine Rolle kann ueber diese Klasse in der Datenbank verwaltet werden.
Dazu werden die Informationen der Rolle sowie der zugehoerigen Kategorie
ausgelesen. Geschrieben werden aber nur die Rollendaten
Beside the methods of the parent class there are the following additional methods:
allowedToAssignMembers - checks if user is allowed to assign members to this role
requires userObject of user for this should be checked
allowedToEditMembers - checks if user is allowed to edit members of this role
requires userObject of user for this should be checked
countVacancies($count_leaders = false) - gibt die freien Plaetze der Rolle zurueck
dies ist interessant, wenn rol_max_members gesetzt wurde
hasFormerMembers() - Methode gibt true zurueck, wenn die Rolle ehemalige Mitglieder besitzt
setInactive() - setzt die Rolle auf inaktiv
setActive() - setzt die Rolle wieder auf aktiv
viewRole() - diese Methode basiert auf viewRole des Usersobjekts, geht aber noch weiter
und prueft auch Rollen zu Terminen (hier muss man nicht Mitglied der Rolle
sein, sondern nur in einer Rolle sein, die den Termin sehen darf)
Located at tableroles.php
Methods summary
public
|
#
__construct( Database & $database, integer $rol_id = 0 )
Constructor that will create an object of a recordset of the table adm_roles.
If the id is set than the specific role will be loaded.
Constructor that will create an object of a recordset of the table adm_roles.
If the id is set than the specific role will be loaded.
Parameters
- $database
- Object of the class Database. This should be the default global object @b $gDb.
- $rol_id
The recordset of the role with this id will be loaded.
If id isn't set than an empty object of the table is created.
Overrides
|
public
boolean
|
#
allowedToAssignMembers( User $user )
checks if user is allowed to assign members to this role
checks if user is allowed to assign members to this role
Parameters
- $user
- UserObject of user who should be checked
Returns
boolean
|
public
boolean
|
#
allowedToEditMembers( User $user )
checks if user is allowed to edit members of this role
checks if user is allowed to edit members of this role
Parameters
- $user
- UserObject of user who should be checked
Returns
boolean
|
public
|
#
clear( )
Calls clear() Method of parent class and initialize child class specific parameters
Calls clear() Method of parent class and initialize child class specific parameters
Overrides
|
public
integer
|
#
countLeaders( )
Method determines the number of active leaders of this role
Method determines the number of active leaders of this role
Returns
integer Returns the number of leaders of this role
|
public
integer
|
#
countMembers( integer $exceptUserId = null )
Method determines the number of active members (without leaders) of this role
Method determines the number of active members (without leaders) of this role
Parameters
- $exceptUserId
- UserId witch shouldn't be counted
Returns
integer Returns the number of members of this role
|
public
integer|float
|
#
countVacancies( boolean $countLeaders = false )
die Funktion gibt die Anzahl freier Plaetze zurueck
ist rol_max_members nicht gesetzt so wird INF zurueckgegeben
die Funktion gibt die Anzahl freier Plaetze zurueck
ist rol_max_members nicht gesetzt so wird INF zurueckgegeben
Parameters
Returns
integer|float
|
public
boolean
|
#
delete( )
Deletes the selected role of the table and all references in other tables.
After that the class will be initialize.
Deletes the selected role of the table and all references in other tables.
After that the class will be initialize.
Returns
boolean @b true if no error occurred
Throws
Overrides
|
public static
string[]|string
|
#
getCostPeriods( integer $costPeriod = 0 )
Returns an array with all cost periods with full name in the specific language.
Returns an array with all cost periods with full name in the specific language.
Parameters
- $costPeriod
The number of the cost period for which the name should be returned
(-1 = unique, 1 = annually, 2 = semiyearly, 4 = quarterly, 12 = monthly)
Returns
string[]|string Array with all cost or if param costPeriod is set than the full name of that cost period
|
public
integer
|
#
getDefaultList( )
Read the id of the default list of this role. The list is stored in the column @b rol_lst_id.
If there is no list stored then the system default list will be returned
Read the id of the default list of this role. The list is stored in the column @b rol_lst_id.
If there is no list stored then the system default list will be returned
Returns
integer Returns the default list id of this role
|
public
integer|float|string|boolean
|
#
getValue( string $columnName, string $format = '' )
Get the value of a column of the database table.
If the value was manipulated before with @b setValue than the manipulated value is returned.
Get the value of a column of the database table.
If the value was manipulated before with @b setValue than the manipulated value is returned.
Parameters
- $columnName
- The name of the database column whose value should be read
- $format
For date or timestamp columns the format should be the date/time format e.g. @b d.m.Y = '02.04.2011'. @n
For text columns the format can be @b database that would return the original database value without any transformations
Returns
integer|float|string|boolean Returns the value of the database column.
If the value was manipulated before with @b setValue than the manipulated value is returned.
Overrides
|
public
boolean
|
#
hasFormerMembers( )
Checks if this role has former members
Checks if this role has former members
Returns
boolean Returns @b true if the role has former memberships
|
public
boolean
|
#
save( boolean $updateFingerPrint = true )
Save all changed columns of the recordset in table of database. Therefore the class remembers if it's
a new record or if only an update is necessary. The update statement will only update the changed columns.
If the table has columns for creator or editor than these column with their timestamp will be updated.
For new records the organization and ip address will be set per default.
Save all changed columns of the recordset in table of database. Therefore the class remembers if it's
a new record or if only an update is necessary. The update statement will only update the changed columns.
If the table has columns for creator or editor than these column with their timestamp will be updated.
For new records the organization and ip address will be set per default.
Parameters
- $updateFingerPrint
- Default @b true. Will update the creator or editor of the recordset if table has columns like @b usr_id_create or @b usr_id_changed
Returns
boolean If an update or insert into the database was done then return true, otherwise false.
Overrides
|
public
integer
|
#
setActive( )
aktuelle Rolle wird auf aktiv gesetzt
aktuelle Rolle wird auf aktiv gesetzt
Returns
integer
|
public
integer
|
#
setInactive( )
aktuelle Rolle wird auf inaktiv gesetzt
aktuelle Rolle wird auf inaktiv gesetzt
Returns
integer
|
public
boolean
|
#
setValue( string $columnName, mixed $newValue, boolean $checkValue = true )
Set a new value for a column of the database table. The value is only saved in the object.
You must call the method @b save to store the new value to the database.
Set a new value for a column of the database table. The value is only saved in the object.
You must call the method @b save to store the new value to the database.
Parameters
- $columnName
- The name of the database column whose value should get a new value
- $newValue
- The new value that should be stored in the database field
- $checkValue
- The value will be checked if it's valid. If set to @b false than the value will not be checked.
Returns
boolean Returns @b true if the value is stored in the current object and @b false if a check failed
Overrides
|
public
boolean
|
#
viewRole( )
diese Methode basiert auf viewRole des Usersobjekts, geht aber noch weiter
und prueft auch Rollen zu Terminen (hier muss man nicht Mitglied der Rolle
sein, sondern nur in einer Rolle sein, die den Termin sehen darf)
diese Methode basiert auf viewRole des Usersobjekts, geht aber noch weiter
und prueft auch Rollen zu Terminen (hier muss man nicht Mitglied der Rolle
sein, sondern nur in einer Rolle sein, die den Termin sehen darf)
Returns
boolean
|