rcube_contacts

Extends \rcube_addressbook

Model class for the local address book database

package

Framework

subpackage

Addressbook

Methods

Object constructor

__construct(object $dbconn, integer $user) 

Arguments

$dbconn

object

Instance of the rcube_db class

$user

integer

User-ID

Count number of available contacts in database

_count() : integer

Response

integer

Contacts count

Add the given contact records the a certain group

add_to_group( $group_id,  $ids) : integer
inherited

Arguments

$group_id

$ids

Response

integer

Number of contacts added

Close connection to source Called on script shutdown

close() 
inherited

Compare search value with contact data

compare_search_value(string $colname, string|array $value, string $search, integer $mode) : boolean
inherited

Arguments

$colname

string

Data name

$value

string|array

Data value

$search

string

Search value

$mode

integer

Search mode

Response

boolean

Comparision result

Create a unique key for sorting contacts

compose_contact_key( $contact,  $sort_col) 
inherited static

Arguments

$contact

$sort_col

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

Build contact display name for autocomplete listing

compose_search_name( $contact,  $email = null,  $name = null,  $templ = null) : string
inherited static

Arguments

$contact

$email

$name

$templ

Response

string

Display name

Convert data stored in the database into output format

convert_db_data( $sql_arr) 

Arguments

$sql_arr

Convert input data for storing in the database

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

Arguments

$save_data

$record

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'

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

Mark one or more contact records as deleted

delete( $ids,  $force = true) 
inherited

Arguments

$ids

$force

Mark all records in database as deleted

delete_all(boolean $with_groups = false) 
inherited

Arguments

$with_groups

boolean

Remove also groups

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

Helper method to compose SQL where statements for fulltext searching

fulltext_sql_where( $value,  $mode,  $col = 'words',  $bool = 'AND') 

Arguments

$value

$mode

$col

$bool

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

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

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

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

get_name() 
inherited abstract

Get a specific contact record

get_record( $id,  $assoc = false) : \rcube_result_set|array
inherited abstract

Arguments

$id

$assoc

Response

\rcube_result_set|array

Result object with all record fields

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

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

Getter for saved search properties

get_search_set() : mixed
inherited abstract

Response

mixed

Search properties used by this class

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

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

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

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

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

Remove the given contact records from a certain group

remove_from_group( $group_id,  $ids) : integer
inherited

Arguments

$group_id

$ids

Response

integer

Number of deleted group members

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

Reset saved results and search parameters

reset() 
inherited abstract

Setter for errors for internal use

set_error( $type,  $message) 
inherited

Arguments

$type

$message

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

set_group( $gid) 
inherited

Arguments

$gid

Set internal list page

set_page( $page) 
inherited

Arguments

$page

Set internal page size

set_pagesize( $size) 
inherited

Arguments

$size

Save a search string for future listings

set_search_set( $filter) 
inherited abstract

Arguments

$filter

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

Unmark delete flag on contact record(s)

undelete( $ids) 
inherited

Arguments

$ids

Check for existing groups with the same name

unique_groupname(string $name) : string

Arguments

$name

string

Name to check

Response

string

A group name which is unique for the current use

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

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.

Constants

SEPARATOR

SEPARATOR

ERROR_READ_ONLY

ERROR_READ_ONLY
inherited

ERROR_NO_CONNECTION

ERROR_NO_CONNECTION
inherited

ERROR_VALIDATE

ERROR_VALIDATE
inherited

ERROR_SAVING

ERROR_SAVING
inherited

SEARCH_ALL

SEARCH_ALL
inherited

SEARCH_STRICT

SEARCH_STRICT
inherited

SEARCH_PREFIX

SEARCH_PREFIX
inherited

SEARCH_GROUPS

SEARCH_GROUPS
inherited

Properties

db_name

db_name : 

Type(s)

db_groups

db_groups : 

Type(s)

db_groupmembers

db_groupmembers : 

Type(s)

vcard_fieldmap

vcard_fieldmap : 

Type(s)

Store database connection.

db : \rcube_db
var

Type(s)

\rcube_db

user_id

user_id : 

Type(s)

filter

filter : 

Type(s)

result

result : 

Type(s)

cache

cache : 

Type(s)

table_cols

table_cols : 

Type(s)

fulltext_cols

fulltext_cols : 

Type(s)

primary_key

primary_key : 
inherited

Type(s)

name

name : 

Type(s)

readonly

readonly : 
inherited

Type(s)

groups

groups : 
inherited

Type(s)

undelete

undelete : 
inherited

Type(s)

list_page

list_page : 
inherited

Type(s)

page_size

page_size : 
inherited

Type(s)

group_id

group_id : 
inherited

Type(s)

ready

ready : 
inherited

Type(s)

coltypes

coltypes : 
inherited

Type(s)

date_cols

date_cols : 
inherited

Type(s)

export_groups

export_groups : 
inherited

Type(s)

searchonly

searchonly : 
inherited

Type(s)

sort_col

sort_col : 
inherited

Type(s)

sort_order

sort_order : 
inherited

Type(s)

error

error : 
inherited

Type(s)