DAViCal
Loading...
Searching...
No Matches
Principal Class Reference
Inheritance diagram for Principal:

Public Member Functions

 __construct ( $type, $value, $use_cache=true)
 __get ( $property)
 __isset ( $property)
 Exists ()
 byEmail ()
 username ()
 setUsername ($new_username)
 user_no ()
 principal_id ()
 email ()
 dav_name ()
 default_calendar ()

Static Public Member Functions

static updateableFields ()

Public Attributes

 $user_active
 $created
 $modified
 $password
 $fullname
 $email_ok
 $date_format_type
 $locale
 $type_id
 $displayname
 $default_privileges
 $is_principal
 $is_calendar
 $collection_id
 $is_addressbook
 $resourcetypes
 $privileges

Protected Member Functions

 FetchDeadProperties ()
 FetchCollections ()

Protected Attributes

 $username
 $user_no
 $principal_id
 $email
 $dav_name
 $exists
 $url
 $original_request_url
 $by_email
 $collections
 $dead_properties
 $default_calendar

Private Member Functions

 assignGuestValues ()
 assignRowValues ( $db_row)
 usernameFromPath ( $path)

Private Attributes

 $cacheNs
 $cacheKey

Static Private Attributes

static $db_tablename = 'dav_principal'
static $db_mandatory_fields
static $byUserno = array()
static $byId = array()
static $byEmail = array()

Detailed Description

Definition at line 19 of file Principal.php.

Constructor & Destructor Documentation

◆ __construct()

Principal::__construct ( $type,
$value,
$use_cache = true )

Construct a new Principal object. The principal record will be retrieved from the database, or (if not found) initialised to a new record. You can test for whether the Principal exists by calling the Exists() method on the returned object.

Depending on the supplied $type, the following behaviour will occur: path: Will attempt to extract a username or email from the supplied path, and then do what those do. dav_name: Expects the dav_name of a principal, exactly, like: /principal/ and will use that as for username. user_no: Expects an integer which is the usr.user_no (deprecated) principal_id: Expects an integer which is the principal.principal_id email: Will try and retrieve a unique principal by using the email address. Will fail (subsequent call to Exists() will be false) if there is not a unique match. username: Will retrieve based on strtolower($value) = lower(usr.username)

Parameters
string$typeOne of 'path', 'dav_name', 'user_no', 'principal_id', 'email' or 'username'
mixed$valueA value appropriate to the $type requested.
boolean$use_cacheWhether to use an available cache source (default true)
Exceptions
ExceptionWhen provided with an invalid $type parameter.
Returns
Principal

There are some values we can construct on the basis of the constructor value.

Definition at line 122 of file Principal.php.

Member Function Documentation

◆ __get()

Principal::__get ( $property)

This will allow protected properties to be referenced for retrieval, but not referenced for update.

Parameters
$property

Definition at line 254 of file Principal.php.

◆ __isset()

Principal::__isset ( $property)

This will allow protected properties to be examined for whether they are set without making them writable. PHP 5.1 or later only.

Parameters
$property

Definition at line 264 of file Principal.php.

◆ assignGuestValues()

Principal::assignGuestValues ( )
private

Definition at line 268 of file Principal.php.

◆ assignRowValues()

Principal::assignRowValues ( $db_row)
private

Definition at line 280 of file Principal.php.

◆ byEmail()

Principal::byEmail ( )

Definition at line 291 of file Principal.php.

◆ dav_name()

Principal::dav_name ( )

Return the partial path representing this principal

Returns
string The dav_name

Definition at line 382 of file Principal.php.

◆ default_calendar()

Principal::default_calendar ( )

Return the default calendar for this principal

Returns
string The internal dav_name for the home_calendar, or false if there is none

Definition at line 430 of file Principal.php.

◆ email()

Principal::email ( )

Return the email

Returns
string The email

Definition at line 373 of file Principal.php.

◆ Exists()

Principal::Exists ( )

Definition at line 286 of file Principal.php.

◆ FetchCollections()

Principal::FetchCollections ( )
protected

Fetch the list of collections for this principal

Returns
string The internal dav_name for the home_calendar, or null if there is none

Definition at line 413 of file Principal.php.

◆ FetchDeadProperties()

Principal::FetchDeadProperties ( )
protected

Ensure the principal's dead properties are loaded

Definition at line 396 of file Principal.php.

◆ principal_id()

Principal::principal_id ( )

Return the principal_id

Returns
string The principal_id

Definition at line 364 of file Principal.php.

◆ setUsername()

Principal::setUsername ( $new_username)

Set the username - but only if the record does not yet exist!

Returns
string The username

Definition at line 344 of file Principal.php.

◆ updateableFields()

Principal::updateableFields ( )
static

Definition at line 30 of file Principal.php.

◆ user_no()

Principal::user_no ( )

Return the user_no

Returns
int The user_no

Definition at line 355 of file Principal.php.

◆ username()

Principal::username ( )

Return the username

Returns
string The username

Definition at line 335 of file Principal.php.

◆ usernameFromPath()

Principal::usernameFromPath ( $path)
private

Work out the username, based on elements of the path.

Parameters
string$pathThe path to be used.

Definition at line 300 of file Principal.php.

Member Data Documentation

◆ $by_email

Principal::$by_email
protected

Definition at line 92 of file Principal.php.

◆ $byEmail

Principal::$byEmail = array()
staticprivate

Definition at line 44 of file Principal.php.

◆ $byId

Principal::$byId = array()
staticprivate

Definition at line 43 of file Principal.php.

◆ $byUserno

Principal::$byUserno = array()
staticprivate

Definition at line 42 of file Principal.php.

◆ $cacheKey

Principal::$cacheKey
private

Definition at line 99 of file Principal.php.

◆ $cacheNs

Principal::$cacheNs
private

Definition at line 98 of file Principal.php.

◆ $collection_id

Principal::$collection_id

Definition at line 67 of file Principal.php.

◆ $collections

Principal::$collections
protected

Definition at line 101 of file Principal.php.

◆ $created

Principal::$created

Definition at line 55 of file Principal.php.

◆ $date_format_type

Principal::$date_format_type

Definition at line 60 of file Principal.php.

◆ $dav_name

Principal::$dav_name
protected

Definition at line 53 of file Principal.php.

◆ $db_mandatory_fields

Principal::$db_mandatory_fields
staticprivate
Initial value:
= array(
'username',
)

Definition at line 26 of file Principal.php.

◆ $db_tablename

Principal::$db_tablename = 'dav_principal'
staticprivate

Definition at line 25 of file Principal.php.

◆ $dead_properties

Principal::$dead_properties
protected

Definition at line 102 of file Principal.php.

◆ $default_calendar

Principal::$default_calendar
protected

Definition at line 103 of file Principal.php.

◆ $default_privileges

Principal::$default_privileges

Definition at line 64 of file Principal.php.

◆ $displayname

Principal::$displayname

Definition at line 63 of file Principal.php.

◆ $email

Principal::$email
protected

Definition at line 52 of file Principal.php.

◆ $email_ok

Principal::$email_ok

Definition at line 59 of file Principal.php.

◆ $exists

Principal::$exists
protected

Definition at line 76 of file Principal.php.

◆ $fullname

Principal::$fullname

Definition at line 58 of file Principal.php.

◆ $is_addressbook

Principal::$is_addressbook

Definition at line 68 of file Principal.php.

◆ $is_calendar

Principal::$is_calendar

Definition at line 66 of file Principal.php.

◆ $is_principal

Principal::$is_principal

Definition at line 65 of file Principal.php.

◆ $locale

Principal::$locale

Definition at line 61 of file Principal.php.

◆ $modified

Principal::$modified

Definition at line 56 of file Principal.php.

◆ $original_request_url

Principal::$original_request_url
protected

Definition at line 86 of file Principal.php.

◆ $password

Principal::$password

Definition at line 57 of file Principal.php.

◆ $principal_id

Principal::$principal_id
protected

Definition at line 51 of file Principal.php.

◆ $privileges

Principal::$privileges

Definition at line 70 of file Principal.php.

◆ $resourcetypes

Principal::$resourcetypes

Definition at line 69 of file Principal.php.

◆ $type_id

Principal::$type_id

Definition at line 62 of file Principal.php.

◆ $url

Principal::$url
protected

Definition at line 81 of file Principal.php.

◆ $user_active

Principal::$user_active

Definition at line 54 of file Principal.php.

◆ $user_no

Principal::$user_no
protected

Definition at line 50 of file Principal.php.

◆ $username

Principal::$username
protected

Columns from the database

Definition at line 49 of file Principal.php.


The documentation for this class was generated from the following file: