Abstract Class rcube_addressbook

Description

Abstract skeleton of an address book/repository

  • abstract:

Located in /lib/Roundcube/rcube_addressbook.php (line 26)


	
			
Direct descendents
Class Description
 class rcube_contacts Model class for the local address book database
 class rcube_ldap Model class to access an LDAP address directory
 class rcube_ldap_addressbook Model class to access an LDAP address directory
Class Constant Summary
Variable Summary
 mixed $coltypes
 mixed $date_cols
 mixed $error
 mixed $groups
 mixed $group_id
 mixed $list_page
 mixed $page_size
 mixed $primary_key
 mixed $readonly
 mixed $ready
 mixed $searchonly
 mixed $sort_col
 mixed $sort_order
 mixed $undelete
Method Summary
 static void compose_contact_key ( $contact,  $sort_col)
 static string compose_display_name (array $contact, [bool $full_email = false])
 static string compose_list_name (array $contact)
 static string normalize_string (string $str)
 int add_to_group (string $group_id, array|string $ids)
 void close ()
 bool compare_search_value (string $colname, string|array $value, string $search, int $mode)
 mixed create_group (string $name)
 void delete (array $ids, [bool $force = true])
 void delete_all ()
 boolean delete_group (string $gid)
 array get_col_values (string $col, array $data, [boolean $flat = false])
 array get_error ()
 array get_group (string $group_id)
 void get_name ()
 mixed get_record (mixed $id, [boolean $assoc = false])
 array get_record_groups (mixed $id)
 mixed get_search_set ()
 mixed insert (array $save_data, [boolean $check = false])
 array insertMultiple (object rcube_result_set $recset, [boolean $check = false])
 array list_groups ([string $search = null], [int $mode = 0])
 array list_records ([array $cols = null], [int $subset = 0])
 mixed refresh_search ()
 int remove_from_group (string $group_id, array|string $ids)
 boolean rename_group (string $gid, string $newname, string &$newid)
 void reset ()
 object rcube_result_set search (array $fields, string $value, [int $mode = 0], [boolean $select = true], [boolean $nocount = false], [array $required = array()])
 void set_error (int $type, string $message)
 void set_group ( $gid)
 void set_page (number $page)
 void set_pagesize (number $size)
 void set_search_set (mixed $filter)
 void set_sort_order (string $sort_col, [string $sort_order = null])
 void undelete (array $ids)
 boolean update (mixed $id, array $save_cols)
 boolean validate (array &$save_data, [boolean $autofix = false])
Variables
mixed $coltypes = array('name' => array('limit'=>1),'firstname'=>array('limit'=>1),'surname'=>array('limit'=>1),'email'=>array('limit'=>1)) (line 47)
  • access: public

Redefined in descendants as:
mixed $date_cols = array() (line 48)
  • access: public

Redefined in descendants as:
mixed $error (line 50)
  • access: protected
mixed $groups = false (line 37)
  • access: public

Redefined in descendants as:
mixed $group_id = null (line 42)
  • access: public

Redefined in descendants as:
mixed $list_page = 1 (line 43)
  • access: public

Redefined in descendants as:
mixed $page_size = 10 (line 44)
  • access: public

Redefined in descendants as:
mixed $primary_key (line 36)

public properties (mandatory)

  • access: public

Redefined in descendants as:
mixed $readonly = true (line 38)
  • access: public

Redefined in descendants as:
mixed $ready = false (line 41)
  • access: public

Redefined in descendants as:
mixed $searchonly = false (line 39)
  • access: public
mixed $sort_col = 'name' (line 45)
  • access: public
mixed $sort_order = 'ASC' (line 46)
  • access: public
mixed $undelete = false (line 40)
  • access: public

Redefined in descendants as:
Methods
static compose_contact_key (line 536)

Create a unique key for sorting contacts

  • access: public
void compose_contact_key ( $contact,  $sort_col)
  • $contact
  • $sort_col
static compose_display_name (line 470)

Compose a valid display name from the given structured contact data

  • return: Display name
  • access: public
string compose_display_name (array $contact, [bool $full_email = false])
  • array $contact: Hash array with contact data as key-value pairs
  • bool $full_email: Don't attempt to extract components from the email address
static compose_list_name (line 503)

Compose the name to display in the contacts list for the given contact record.

This respects the settings parameter how to list conacts.

  • return: List name
  • access: public
string compose_list_name (array $contact)
  • array $contact: Hash array with contact data as key-value pairs
static normalize_string (line 457)

Normalize the given string for fulltext search.

Currently only optimized for Latin-1 characters; to be extended

  • return: Normalized string
  • deprecated: since 0.9-beta
  • access: protected
string normalize_string (string $str)
  • string $str: Input string (UTF-8)
add_to_group (line 383)

Add the given contact records the a certain group

  • return: Number of contacts added
int add_to_group (string $group_id, array|string $ids)
  • string $group_id: Group identifier
  • array|string $ids: List of contact identifiers to be added

Redefined in descendants as:
close (line 160)

Close connection to source

Called on script shutdown

void close ()

Redefined in descendants as:
compare_search_value (line 559)

Compare search value with contact data

  • return: Comparision result
  • access: protected
bool compare_search_value (string $colname, string|array $value, string $search, int $mode)
  • string $colname: Data name
  • string|array $value: Data value
  • string $search: Search value
  • int $mode: Search mode
count (line 116)

Count number of available contacts in database

  • return: Result set with values for 'count' and 'first'
  • abstract:
rcube_result_set count ()

Redefined in descendants as:
create_group (line 343)

Create a contact group with the given name

  • return: False on error, array with record props in success
mixed create_group (string $name)
  • string $name: The group name

Redefined in descendants as:
delete (line 279)

Mark one or more contact records as deleted

void delete (array $ids, [bool $force = true])
  • array $ids: Record identifiers
  • bool $force: Remove records irreversible (see self::undelete)

Redefined in descendants as:
delete_all (line 297)

Mark all records in database as deleted

void delete_all ()

Redefined in descendants as:
delete_group (line 355)

Delete the given group and all linked group members

  • return: True on success, false if no data was changed
boolean delete_group (string $gid)
  • string $gid: Group identifier

Redefined in descendants as:
get_col_values (line 426)

Utility function to return all values of a certain data column either as flat list or grouped by subtype

  • return: List of column values
array get_col_values (string $col, array $data, [boolean $flat = false])
  • string $col: Col name
  • array $data: Record data array as used for saving
  • boolean $flat: True to return one array with all values, False for hash array with values grouped by type
get_error (line 140)

Returns the last error occured (e.g. when updating/inserting failed)

  • return: Hash array with the following fields: type, message
array get_error ()
get_group (line 331)

Get group properties such as name and email address(es)

  • return: Group properties as hash array
array get_group (string $group_id)
  • string $group_id: Group identifier

Redefined in descendants as:
get_name (line 55)

Returns addressbook name (e.g. for addressbooks listing)

  • abstract:
void get_name ()

Redefined in descendants as:
get_record (line 133)

Get a specific contact record

  • return: Result object with all record fields or False if not found
  • abstract:
mixed get_record (mixed $id, [boolean $assoc = false])
  • mixed $id: record identifier(s)
  • boolean $assoc: True to return record as associative array, otherwise a result set is returned

Redefined in descendants as:
get_record_groups (line 411)

Get group assignments of a specific contact record

  • return: List of assigned groups as ID=>Name pairs
  • since: 0.5-beta
array get_record_groups (mixed $id)
  • mixed $id: Record identifier

Redefined in descendants as:
get_result (line 123)

Return the last result set

  • return: Current result set or NULL if nothing selected yet
  • abstract:
rcube_result_set get_result ()

Redefined in descendants as:
get_search_set (line 69)

Getter for saved search properties

  • return: Search properties used by this class
  • abstract:
mixed get_search_set ()

Redefined in descendants as:
insert (line 235)

Create a new contact record

  • return: The created record ID on success, False on error
mixed insert (array $save_data, [boolean $check = false])
  • array $save_data: Assoziative array with save data Keys: Field name with optional section in the form FIELD:SECTION Values: Field value. Can be either a string or an array of strings for multiple values
  • boolean $check: True to check for duplicates first

Redefined in descendants as:
insertMultiple (line 247)

Create new contact records for every item in the record set

  • return: List of created record IDs
array insertMultiple (object rcube_result_set $recset, [boolean $check = false])
list_groups (line 319)

List all active contact groups of this source

  • return: Indexed list of contact groups, each a hash array
array list_groups ([string $search = null], [int $mode = 0])
  • string $search: Optional search string to match group name
  • int $mode: Matching mode:
    1. - partial (*abc*),
    2. - strict (=),
    3. - prefix (abc*)

Redefined in descendants as:
list_records (line 93)

List the current set of contact records

  • return: Indexed list of contact records, each a hash array
  • abstract:
array list_records ([array $cols = null], [int $subset = 0])
  • array $cols: List of cols to show
  • int $subset: Only return this number of records, use negative values for tail

Redefined in descendants as:
refresh_search (line 81)

Refresh saved search set after data has changed

  • return: New search set
mixed refresh_search ()
remove_from_group (line 397)

Remove the given contact records from a certain group

  • return: Number of deleted group members
int remove_from_group (string $group_id, array|string $ids)
  • string $group_id: Group identifier
  • array|string $ids: List of contact identifiers to be removed

Redefined in descendants as:
rename_group (line 369)

Rename a specific contact group

  • return: New name on success, false if no data was changed
boolean rename_group (string $gid, string $newname, string &$newid)
  • string $gid: Group identifier
  • string $newname: New name to set for this group
  • string &$newid: New group identifier (if changed, otherwise don't set)

Redefined in descendants as:
reset (line 74)

Reset saved results and search parameters

  • abstract:
void reset ()

Redefined in descendants as:
search (line 109)

Search records

  • return: List of contact records and 'count' value
  • abstract:
object rcube_result_set search (array $fields, string $value, [int $mode = 0], [boolean $select = true], [boolean $nocount = false], [array $required = array()])
  • array $fields: List of fields to search in
  • string $value: Search value
  • int $mode: Matching mode:
    1. - partial (*abc*),
    2. - strict (=),
    3. - prefix (abc*)
  • boolean $select: True if results are requested, False if count only
  • boolean $nocount: True to skip the count query (select only)
  • array $required: List of fields that cannot be empty

Redefined in descendants as:
set_error (line 151)

Setter for errors for internal use

  • access: protected
void set_error (int $type, string $message)
  • int $type: Error type (one of this class' error constants)
  • string $message: Error message (name of a text label)
set_group (line 306)

Setter for the current group

(empty, has to be re-implemented by extending class)

void set_group ( $gid)
  • $gid

Redefined in descendants as:
set_page (line 168)

Set internal list page

  • access: public
void set_page (number $page)
  • number $page: Page number to list

Redefined in descendants as:
set_pagesize (line 179)

Set internal page size

  • access: public
void set_pagesize (number $size)
  • number $size: Number of messages to display on one page

Redefined in descendants as:
set_search_set (line 62)

Save a search string for future listings

  • abstract:
void set_search_set (mixed $filter)
  • mixed $filter: Search params to use in listing method, obtained by get_search_set()

Redefined in descendants as:
set_sort_order (line 190)

Set internal sort settings

void set_sort_order (string $sort_col, [string $sort_order = null])
  • string $sort_col: Sort column
  • string $sort_order: Sort order

Redefined in descendants as:
undelete (line 289)

Unmark delete flag on contact record(s)

void undelete (array $ids)
  • array $ids: Record identifiers

Redefined in descendants as:
update (line 268)

Update a specific contact record

  • return: True on success, False on error
boolean update (mixed $id, array $save_cols)
  • mixed $id: Record identifier
  • array $save_cols: Assoziative array with save data Keys: Field name with optional section in the form FIELD:SECTION Values: Field value. Can be either a string or an array of strings for multiple values

Redefined in descendants as:
validate (line 208)

Check the given data before saving.

If input isn't valid, the message to display can be fetched using get_error()

  • return: True if input is valid, False if not.
  • access: public
boolean validate (array &$save_data, [boolean $autofix = false])
  • array &$save_data: Assoziative array with data to save
  • boolean $autofix: Attempt to fix/complete record automatically

Redefined in descendants as:
Class Constants
ERROR_NO_CONNECTION = 2 (line 30)
ERROR_READ_ONLY = 1 (line 29)

constants for error reporting *

ERROR_SAVING = 4 (line 32)
ERROR_SEARCH = 5 (line 33)
ERROR_VALIDATE = 3 (line 31)

Documentation generated on Fri, 03 May 2013 12:44:57 +0200 by phpDocumentor 1.4.4