DAViCal
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 ()
 
 url ($type='principal', $internal=false)
 
 internal_url ($type='principal')
 
 unCache ()
 
 Create ( $field_values)
 
 Update ( $field_values)
 

Static Public Member Functions

static updateableFields ()
 
static cacheFlush ( $where, $whereparams=array())
 
static cacheDelete ( $type, $value)
 

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)
 
 Write ( $field_values, $inserting=true)
 

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.

◆ 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.

◆ 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.

◆ url()

Principal::url (   $type = 'principal',
  $internal = false 
)

Return the URL for this principal

Parameters
string$typeThe type of URL we want (the principal, by default)
boolean$internalWhether an internal reference is requested
Returns
string The principal-URL

Definition at line 470 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

◆ $db_mandatory_fields

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

Definition at line 26 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: