Administrator
        
        extends PersistentObject
    
    
            
            in package
            
        
    
    
    
This is a simple class so that we have a convienient "handle" for manipulating Administrators.
NOTE: one should use the Authority::newAdministrator() method rather than directly instantiating an administrator object
Table of Contents
Properties
- $exists : mixed
 - $loaded : mixed
 - $logout_link : mixed
 - $master : mixed
 - $msg : mixed
 - $objects : mixed
 - $passhash : mixed
 - $reset : mixed
 - $table : mixed
 - $transient : mixed
 - $id : mixed
 - $cache_by : mixed
 - $data : mixed
 - $tempdata : mixed
 - $unique_set : mixed
 - $updates : mixed
 - $use_cache : mixed
 
Methods
- __construct() : Administrator
 - Constructor for an Administrator
 - __toString() : string
 - "Magic" function to return a string identifying the object when it is treated as a string
 - checkChanges() : bool
 - By default the object is saved if there are any updates within the property `$updates` no matter if these are actual changes to existing data.
 - clearCache() : mixed
 - Clears the object cache by setting it to an empty array completely or a specific object (class name) cache.
 - clearObjectCache() : mixed
 - Shortcut to clear the cache of the current object class only
 - copy() : mixed
 - Copy this record to another unique set. Checks if the record exists there first, if so returns false. If successful returns true. No changes are made to this object and no other objects are created, just the database entry.
 - createPrimealbum() : mixed
 - Creates a "prime" album for the user. Album name is based on the userid
 - get() : mixed
 - Get the value of a variable. If $current is false, return the value as of the last save of this object.
 - getAlbum() : object
 - Returns the user's "prime" album object. See setAlbum().
 - getChallengePhraseInfo() : mixed
 - getCredentials() : mixed
 - Data to support other credential systems integration
 - getCurrentLogon() : string
 - The current login datetime the user has logged on
 - getCustomData() : mixed
 - Returns custom data
 - getData() : array<string|int, mixed>
 - returns the database record of the object
 - getDateTime() : date
 - Returns the unformatted date
 - getEmail() : mixed
 - Returns the user email
 - getGroup() : mixed
 - Returns user's group
 - getID() : string
 - Returns the id
 - getLanguage() : mixed
 - Returns the user's prefered language
 - getLastChange() : string
 - Returns the last change user
 - getLastChangeUser() : string
 - Returns the last change user
 - getLastLogon() : string
 - returns the last previous datetime the user has logged on
 - getLastVisit() : strig
 - Returns the last time the user visited the site being loggedin
 - getName() : mixed
 - Returns the user name
 - getNameByUser() : string
 - Gets the full name if set
 - getObjects() : mixed
 - Returns local copy of managed objects.
 - getPass() : mixed
 - Returns stored password hash
 - getQuota() : mixed
 - Returns the users quota
 - getRights() : mixed
 - Returns user rights
 - getUser() : mixed
 - Returns user's user id
 - getValid() : mixed
 - Returns the valid flag
 - instantiate() : bool
 - }
 - isPending() : bool
 - Checks if the user is pending verification (no rights set)
 - move() : mixed
 - Change one or more values of the unique set assigned to this record.
 - preservePrimeAlbum() : mixed
 - Preserves the user's prime album as managed album even if he is in a group the album is actually set as managed
 - remove() : bool
 - Removes a user from the system
 - save() : mixed
 - Uptates the database with all changes
 - set() : mixed
 - Set a variable in this object. Does not persist to the database until save() is called. So, IMPORTANT: Call save() after set() to persist.
 - setAlbum() : mixed
 - Records the "prime album" of a user. Prime albums are linked to the user and removed if the user is removed.
 - setChallengePhraseInfo() : mixed
 - setCredentials() : mixed
 - setCustomData() : mixed
 - Stores custom data
 - setDateTime() : mixed
 - Stores the date
 - setEmail() : mixed
 - Stores the user email
 - setGroup() : mixed
 - Sets the user's group.
 - setLanguage() : mixed
 - Sets the user's preferec language
 - setLastChange() : mixed
 - stores the current date in the format 'Y-m-d H:i:s' as the last change date
 - setLastchangeUser() : mixed
 - stores the last change user
 - setLastVisit() : mixed
 - Sets the last time the user visited the site being loggedin
 - setName() : mixed
 - Stores the user name
 - setObjects() : mixed
 - Saves local copy of managed objects.
 - setPass() : mixed
 - Hashes and stores the password
 - setQuota() : mixed
 - Sets the users quota
 - setRights() : mixed
 - Stores user rights
 - setUser() : mixed
 - Sets the user's user id
 - setValid() : mixed
 - Sets the "valid" flag. Valid is 1 for users, 0 for groups and templates
 - updateLastVisit() : mixed
 - Updates the last visit date if enabled on the options and the time frame defined has passed.
 - setDefaults() : mixed
 - Sets default values for new objects using the set() method.
 - addToCache() : mixed
 - add the entry to the cache
 - getFromCache() : mixed
 - check the cache for presence of the entry and return it if found
 - load() : false
 - Load the data array from the database, using the unique id set to get the unique record.
 
Properties
$exists
    public
        mixed
    $exists
     = \false
    
    
    
    
$loaded
    public
        mixed
    $loaded
     = \false
    
    
    
    
$logout_link
    public
        mixed
    $logout_link
     = \true
    
    
    
    
$master
    public
        mixed
    $master
     = \false
    
    
    
    
$msg
    public
        mixed
    $msg
     = \NULL
    
    
    
    
$objects
    public
        mixed
    $objects
     = \NULL
    
    
    
    
$passhash
    public
        mixed
    $passhash
    
    
    
    
    
$reset
    public
        mixed
    $reset
     = \false
    
    
    
    
$table
    public
        mixed
    $table
    
    
    
    
    
$transient
    public
        mixed
    $transient
    
    
    
    
    
$id
    protected
        mixed
    $id
     = 0
    
    
    
    
$cache_by
    private
        mixed
    $cache_by
    
    
    
    
    
$data
    private
        mixed
    $data
     = \NULL
    
    
    
    
$tempdata
    private
        mixed
    $tempdata
     = \NULL
    
    
    
    
$unique_set
    private
        mixed
    $unique_set
     = \NULL
    
    
    
    
$updates
    private
        mixed
    $updates
     = \NULL
    
    
    
    
$use_cache
    private
        mixed
    $use_cache
     = \false
    
    
    
    
Methods
__construct()
Constructor for an Administrator
    public
                    __construct(string $user, int $valid) : Administrator
    Parameters
- $user : string
 - 
                    
.
 - $valid : int
 - 
                    
used to signal kind of admin object
 
Return values
Administrator__toString()
"Magic" function to return a string identifying the object when it is treated as a string
    public
                    __toString() : string
    Return values
stringcheckChanges()
By default the object is saved if there are any updates within the property `$updates` no matter if these are actual changes to existing data.
    public
                    checkChanges([bool $update = true ]) : bool
    This checks that and internally updates the $updates property with the actual changes obky so you optionally can skip unnecessary object saves.
Standard object fields lastchange and lastchangeuser are exclude because lastchange always changes and both make no sense
if there is no actual content change at all.
This can be used before calling the save() method or enabled within the save() method optionally
Parameters
- $update : bool = true
 - 
                    
True (default) to also update the $updates property with changes found or clear it. False to only check for changes.
 
Tags
Return values
boolclearCache()
Clears the object cache by setting it to an empty array completely or a specific object (class name) cache.
    public
            static        clearCache([mixed $class = null ]) : mixed
    Note: You normally never need to use this. But on certain occasions it may be necessary to avoid memory issues if you loop through a lot of object creations.
Parameters
- $class : mixed = null
 
Tags
clearObjectCache()
Shortcut to clear the cache of the current object class only
    public
                    clearObjectCache() : mixed
    Tags
copy()
Copy this record to another unique set. Checks if the record exists there first, if so returns false. If successful returns true. No changes are made to this object and no other objects are created, just the database entry.
    public
                    copy(mixed $new_unique_set) : mixed
    A call to copy is instant, it does not require a save() following it.
Parameters
- $new_unique_set : mixed
 
createPrimealbum()
Creates a "prime" album for the user. Album name is based on the userid
    public
                    createPrimealbum([mixed $new = true ][, mixed $name = NULL ]) : mixed
    Parameters
- $new : mixed = true
 - $name : mixed = NULL
 
get()
Get the value of a variable. If $current is false, return the value as of the last save of this object.
    public
                    get(mixed $var[, mixed $current = true ]) : mixed
    Parameters
- $var : mixed
 - $current : mixed = true
 
getAlbum()
Returns the user's "prime" album object. See setAlbum().
    public
                    getAlbum() : object
    Return values
objectgetChallengePhraseInfo()
    public
                    getChallengePhraseInfo() : mixed
    getCredentials()
Data to support other credential systems integration
    public
                    getCredentials() : mixed
    getCurrentLogon()
The current login datetime the user has logged on
    public
                    getCurrentLogon() : string
    Tags
Return values
stringgetCustomData()
Returns custom data
    public
                    getCustomData() : mixed
    getData()
returns the database record of the object
    public
                    getData() : array<string|int, mixed>
    Return values
array<string|int, mixed>getDateTime()
Returns the unformatted date
    public
                    getDateTime() : date
    Return values
dategetEmail()
Returns the user email
    public
                    getEmail() : mixed
    getGroup()
Returns user's group
    public
                    getGroup() : mixed
    getID()
Returns the id
    public
                    getID() : string
    Return values
stringgetLanguage()
Returns the user's prefered language
    public
                    getLanguage() : mixed
    getLastChange()
Returns the last change user
    public
                    getLastChange() : string
    Return values
stringgetLastChangeUser()
Returns the last change user
    public
                    getLastChangeUser() : string
    Tags
Return values
stringgetLastLogon()
returns the last previous datetime the user has logged on
    public
                    getLastLogon() : string
    Return values
stringgetLastVisit()
Returns the last time the user visited the site being loggedin
    public
                    getLastVisit() : strig
    Tags
Return values
striggetName()
Returns the user name
    public
                    getName() : mixed
    getNameByUser()
Gets the full name if set
    public
            static        getNameByUser(string $user) : string
    Parameters
- $user : string
 - 
                    
User id
 
Tags
Return values
stringgetObjects()
Returns local copy of managed objects.
    public
                    getObjects([string $what = NULL ]) : mixed
    Parameters
- $what : string = NULL
 - 
                    
Type of objects to get
 
getPass()
Returns stored password hash
    public
                    getPass() : mixed
    getQuota()
Returns the users quota
    public
                    getQuota() : mixed
    getRights()
Returns user rights
    public
                    getRights() : mixed
    getUser()
Returns user's user id
    public
                    getUser() : mixed
    getValid()
Returns the valid flag
    public
                    getValid() : mixed
    instantiate()
}
    public
                    instantiate(mixed $tablename, mixed $unique_set[, mixed $cache_by = NULL ][, mixed $use_cache = true ][, mixed $is_transient = false ][, mixed $allowCreate = true ]) : bool
    Prime instantiator for Zenphoto objects
Parameters
- $tablename : mixed
 - 
                    
The name of the database table
 - $unique_set : mixed
 - 
                    
An array of unique fields
 - $cache_by : mixed = NULL
 - $use_cache : mixed = true
 - $is_transient : mixed = false
 - 
                    
Set true to prevent database insertion
 - $allowCreate : mixed = true
 - 
                    
Set true to allow a new object to be made.
 
Return values
bool —will be true if the unique_set does not already exist
isPending()
Checks if the user is pending verification (no rights set)
    public
                    isPending() : bool
    Tags
Return values
boolmove()
Change one or more values of the unique set assigned to this record.
    public
                    move(mixed $new_unique_set) : mixed
    Checks if the record already exists first, if so returns false. If successful returns true and changes $this->unique_set A call to move is instant, it does not require a save() following it.
Parameters
- $new_unique_set : mixed
 
preservePrimeAlbum()
Preserves the user's prime album as managed album even if he is in a group the album is actually set as managed
    public
                    preservePrimeAlbum() : mixed
    remove()
Removes a user from the system
    public
                    remove() : bool
    Return values
boolsave()
Uptates the database with all changes
    public
                    save([bool $checkupdates = false ]) : mixed
    Parameters
- $checkupdates : bool = false
 - 
                    
Default false. If true the internal $updates property is checked for actual changes so unnecessary saving is skipped. Applies to already existing objects only.
 
set()
Set a variable in this object. Does not persist to the database until save() is called. So, IMPORTANT: Call save() after set() to persist.
    public
                    set(mixed $var, mixed $value) : mixed
    If the requested variable is not in the database, sets it in temp storage, which won't be persisted to the database.
Parameters
- $var : mixed
 - $value : mixed
 
setAlbum()
Records the "prime album" of a user. Prime albums are linked to the user and removed if the user is removed.
    public
                    setAlbum(mixed $album) : mixed
    Parameters
- $album : mixed
 
setChallengePhraseInfo()
    public
                    setChallengePhraseInfo(mixed $challenge, mixed $response) : mixed
    Parameters
- $challenge : mixed
 - $response : mixed
 
setCredentials()
    public
                    setCredentials(mixed $cred) : mixed
    Parameters
- $cred : mixed
 
setCustomData()
Stores custom data
    public
                    setCustomData(mixed $custom_data) : mixed
    Parameters
- $custom_data : mixed
 
setDateTime()
Stores the date
    public
                    setDateTime(string $datetime) : mixed
    Parameters
- $datetime : string
 - 
                    
formatted date
 
setEmail()
Stores the user email
    public
                    setEmail(mixed $admin_e) : mixed
    Parameters
- $admin_e : mixed
 
setGroup()
Sets the user's group.
    public
                    setGroup(mixed $group) : mixed
    NOTE this does NOT set rights, etc. that must be done separately
Parameters
- $group : mixed
 
setLanguage()
Sets the user's preferec language
    public
                    setLanguage(mixed $locale) : mixed
    Parameters
- $locale : mixed
 
setLastChange()
stores the current date in the format 'Y-m-d H:i:s' as the last change date
    public
                    setLastChange() : mixed
    setLastchangeUser()
stores the last change user
    public
                    setLastchangeUser(mixed $a) : mixed
    Parameters
- $a : mixed
 
Tags
setLastVisit()
Sets the last time the user visited the site being loggedin
    public
                    setLastVisit([mixed $datetime = '' ]) : mixed
    Parameters
- $datetime : mixed = ''
 
Tags
setName()
Stores the user name
    public
                    setName(mixed $admin_n) : mixed
    Parameters
- $admin_n : mixed
 
setObjects()
Saves local copy of managed objects.
    public
                    setObjects(mixed $objects) : mixed
    NOTE: The database is NOT updated by this, the user object MUST be saved to cause an update
Parameters
- $objects : mixed
 
setPass()
Hashes and stores the password
    public
                    setPass(mixed $pwd) : mixed
    Parameters
- $pwd : mixed
 
setQuota()
Sets the users quota
    public
                    setQuota(mixed $v) : mixed
    Parameters
- $v : mixed
 
setRights()
Stores user rights
    public
                    setRights(mixed $rights) : mixed
    Parameters
- $rights : mixed
 
setUser()
Sets the user's user id
    public
                    setUser(mixed $user) : mixed
    Parameters
- $user : mixed
 
setValid()
Sets the "valid" flag. Valid is 1 for users, 0 for groups and templates
    public
                    setValid(mixed $valid) : mixed
    Parameters
- $valid : mixed
 
updateLastVisit()
Updates the last visit date if enabled on the options and the time frame defined has passed.
    public
                    updateLastVisit() : mixed
    Tags
setDefaults()
Sets default values for new objects using the set() method.
    protected
                    setDefaults() : mixed
    Should do nothing in the base class; subclasses should override.
addToCache()
add the entry to the cache
    private
                    addToCache(mixed $entry) : mixed
    Parameters
- $entry : mixed
 
getFromCache()
check the cache for presence of the entry and return it if found
    private
                    getFromCache() : mixed
    load()
Load the data array from the database, using the unique id set to get the unique record.
    private
                    load(bool $allowCreate) : false
    Parameters
- $allowCreate : bool
 - 
                    
set to true to enable new object creation.
 
Return values
false —if the record already exists, true if a new record was created.