rcube_addressbook

Abstract skeleton of an address book/repository

package

Framework

subpackage

Addressbook

Methods

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

get_name() 
abstract

Save a search string for future listings

set_search_set($filter) 
abstract

Arguments

$filter

Getter for saved search properties

get_search_set() : mixed
abstract

Response

mixed

Search properties used by this class

Reset saved results and search parameters

reset() 
abstract

List the current set of contact records

list_records($cols = null, $subset) : array
abstract

Arguments

$cols

$subset

Response

array

Indexed list of contact records, each a hash array

Count number of available contacts in database

count() : \rcube_result_set
abstract

Response

\rcube_result_set

Result set with values for 'count' and 'first'

Return the last result set

get_result() : \rcube_result_set
abstract

Response

\rcube_result_set

Current result set or NULL if nothing selected yet

Get a specific contact record

get_record($id, $assoc = false) : mixed
abstract

Arguments

$id

$assoc

Response

mixed

Result object with all record fields or False if not found

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

get_error() : array

Response

array

Hash array with the following fields: type, message

Setter for errors for internal use

set_error($type, $message) 

Arguments

$type

$message

Close connection to source Called on script shutdown

close() 

Set internal list page

set_page($page) 
access

public

Arguments

$page

Set internal page size

set_pagesize($size) 
access

public

Arguments

$size

Set internal sort settings

set_sort_order(string $sort_col, string $sort_order = null) 

Arguments

$sort_col

string

Sort column

$sort_order

string

Sort order

Check the given data before saving.

validate(&$save_data, $autofix = false) : boolean

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

Arguments

$save_data

$autofix

Response

boolean

True if input is valid, False if not.

Create a new contact record

insert($save_data, $check = false) : mixed

Arguments

$save_data

$check

Response

mixed

The created record ID on success, False on error

Create new contact records for every item in the record set

insertMultiple($recset, $check = false) : array

Arguments

$recset

$check

Response

array

List of created record IDs

Update a specific contact record

update($id, $save_cols) : mixed

Arguments

$id

$save_cols

Response

mixed

On success if ID has been changed returns ID, otherwise True, False on error

Mark one or more contact records as deleted

delete($ids, $force = true) 

Arguments

$ids

$force

Unmark delete flag on contact record(s)

undelete($ids) 

Arguments

$ids

Mark all records in database as deleted

delete_all(bool $with_groups = false) 

Arguments

$with_groups

bool

Remove also groups

Setter for the current group (empty, has to be re-implemented by extending class)

set_group($gid) 

Arguments

$gid

List all active contact groups of this source

list_groups($search = null, $mode) : array

Arguments

$search

$mode

Response

array

Indexed list of contact groups, each a hash array

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

get_group($group_id) : array

Arguments

$group_id

Response

array

Group properties as hash array

Create a contact group with the given name

create_group($name) : mixed

Arguments

$name

Response

mixed

False on error, array with record props in success

Delete the given group and all linked group members

delete_group($gid) : boolean

Arguments

$gid

Response

boolean

True on success, false if no data was changed

Rename a specific contact group

rename_group($gid, $newname, &$newid) : boolean

Arguments

$gid

$newname

$newid

Response

boolean

New name on success, false if no data was changed

Add the given contact records the a certain group

add_to_group($group_id, $ids) : int

Arguments

$group_id

$ids

Response

int

Number of contacts added

Remove the given contact records from a certain group

remove_from_group($group_id, $ids) : int

Arguments

$group_id

$ids

Response

int

Number of deleted group members

Get group assignments of a specific contact record

get_record_groups($id) : array
since 0.5-beta

Arguments

$id

Response

array

List of assigned groups as ID=>Name pairs

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

get_col_values($col, $data, $flat = false) : array
static

Arguments

$col

$data

$flat

Response

array

List of column values

Normalize the given string for fulltext search.

normalize_string($str) : string
static

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

deprecated

since 0.9-beta

Arguments

$str

Response

string

Normalized string

Compose a valid display name from the given structured contact data

compose_display_name($contact, $full_email = false) : string
static

Arguments

$contact

$full_email

Response

string

Display name

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

compose_list_name($contact) : string
static

This respects the settings parameter how to list conacts.

Arguments

$contact

Response

string

List name

Create a unique key for sorting contacts

compose_contact_key($contact, $sort_col) 
static

Arguments

$contact

$sort_col

Compare search value with contact data

compare_search_value(string $colname, string|array $value, string $search, int $mode) : bool

Arguments

$colname

string

Data name

$value

string|array

Data value

$search

string

Search value

$mode

int

Search mode

Response

bool

Comparision result

Constants

constants for error reporting *

ERROR_READ_ONLY

ERROR_NO_CONNECTION

ERROR_NO_CONNECTION

ERROR_VALIDATE

ERROR_VALIDATE

ERROR_SAVING

ERROR_SAVING

Properties

public properties (mandatory)

primary_key : 

groups

groups : 

export_groups

export_groups : 

readonly

readonly : 

searchonly

searchonly : 

undelete

undelete : 

ready

ready : 

group_id

group_id : 

list_page

list_page : 

page_size

page_size : 

sort_col

sort_col : 

sort_order

sort_order : 

coltypes

coltypes : 

date_cols

date_cols : 

error

error :