rcube_contacts

Extends \rcube_addressbook

Model class for the local address book database

package

Framework

subpackage

Addressbook

Methods

Object constructor

__construct($dbconn, $user) 

Arguments

$dbconn

$user

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

get_name() 
inherited abstract

Save a search string for future listings

set_search_set($filter) 
inherited abstract

Arguments

$filter

Getter for saved search properties

get_search_set() : mixed
inherited abstract

Response

mixed

Search properties used by this class

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

set_group($gid) 
inherited

Arguments

$gid

Reset saved results and search parameters

reset() 
inherited abstract

List all active contact groups of this source

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

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
inherited

Arguments

$group_id

Response

array

Group properties as hash array

List the current set of contact records

list_records($cols = null, $subset) : array
inherited 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
inherited abstract

Response

\rcube_result_set

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

Count number of available contacts in database

_count() : int

Response

int

Contacts count

Return the last result set

get_result() : \rcube_result_set
inherited 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
inherited abstract

Arguments

$id

$assoc

Response

mixed

Result object with all record fields or False if not found

Get group assignments of a specific contact record

get_record_groups($id) : array
inherited
since 0.5-beta

Arguments

$id

Response

array

List of assigned groups as ID=>Name pairs

Check the given data before saving.

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

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
inherited

Arguments

$save_data

$check

Response

mixed

The created record ID on success, False on error

Update a specific contact record

update($id, $save_cols) : mixed
inherited

Arguments

$id

$save_cols

Response

mixed

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

convert_db_data

convert_db_data($sql_arr) 

Arguments

$sql_arr

convert_save_data

convert_save_data($save_data, $record = array()) 

Arguments

$save_data

$record

Mark one or more contact records as deleted

delete($ids, $force = true) 
inherited

Arguments

$ids

$force

Unmark delete flag on contact record(s)

undelete($ids) 
inherited

Arguments

$ids

Mark all records in database as deleted

delete_all(bool $with_groups = false) 
inherited

Arguments

$with_groups

bool

Remove also groups

Create a contact group with the given name

create_group($name) : mixed
inherited

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
inherited

Arguments

$gid

Response

boolean

True on success, false if no data was changed

Rename a specific contact group

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

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
inherited

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
inherited

Arguments

$group_id

$ids

Response

int

Number of deleted group members

Check for existing groups with the same name

unique_groupname($name) : string

Arguments

$name

Response

string

A group name which is unique for the current use

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

get_error() : array
inherited

Response

array

Hash array with the following fields: type, message

Setter for errors for internal use

set_error($type, $message) 
inherited

Arguments

$type

$message

Close connection to source Called on script shutdown

close() 
inherited

Set internal list page

set_page($page) 
inherited
access

public

Arguments

$page

Set internal page size

set_pagesize($size) 
inherited
access

public

Arguments

$size

Set internal sort settings

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

Arguments

$sort_col

string

Sort column

$sort_order

string

Sort order

Create new contact records for every item in the record set

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

Arguments

$recset

$check

Response

array

List of created record IDs

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
inherited static

Arguments

$col

$data

$flat

Response

array

List of column values

Normalize the given string for fulltext search.

normalize_string($str) : string
inherited 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
inherited 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
inherited 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) 
inherited static

Arguments

$contact

$sort_col

Compare search value with contact data

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

Arguments

$colname

string

Data name

$value

string|array

Data value

$search

string

Search value

$mode

int

Search mode

Response

bool

Comparision result

Constants

SEPARATOR

SEPARATOR

constants for error reporting *

ERROR_READ_ONLY
inherited

ERROR_NO_CONNECTION

ERROR_NO_CONNECTION
inherited

ERROR_VALIDATE

ERROR_VALIDATE
inherited

ERROR_SAVING

ERROR_SAVING
inherited

Properties

db_name

db_name : 

db_groups

db_groups : 

db_groupmembers

db_groupmembers : 

vcard_fieldmap

vcard_fieldmap : 

Store database connection.

db : \rcube_db
var

Type(s)

\rcube_db

user_id

user_id : 

filter

filter : 

result

result : 

cache

cache : 

table_cols

table_cols : 

fulltext_cols

fulltext_cols : 

public properties (mandatory)

primary_key : 
inherited

name

name : 

readonly

readonly : 
inherited

groups

groups : 
inherited

undelete

undelete : 
inherited

list_page

list_page : 
inherited

page_size

page_size : 
inherited

group_id

group_id : 
inherited

ready

ready : 
inherited

coltypes

coltypes : 
inherited

date_cols

date_cols : 
inherited

export_groups

export_groups : 
inherited

searchonly

searchonly : 
inherited

sort_col

sort_col : 
inherited

sort_order

sort_order : 
inherited

error

error : 
inherited