Class rcube_contacts

Description

Model class for the local address book database

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

rcube_addressbook
   |
   --rcube_contacts
Class Constant Summary
 SEPARATOR = ','
Variable Summary
 mixed $coltypes
 mixed $date_cols
 mixed $db_groups
 mixed $db_name
 mixed $groups
 mixed $group_id
 mixed $list_page
 mixed $name
 mixed $page_size
 mixed $primary_key
 mixed $readonly
 mixed $ready
 mixed $undelete
Method Summary
 rcube_contacts __construct (object Instance $dbconn, integer $user)
 int add_to_group (string $group_id, array|string $ids)
 mixed create_group (string $name)
 void delete (array $ids, [boolean $force = true])
 void delete_all ()
 boolean delete_group (string $gid)
 array get_group (string $group_id)
 void get_name ()
 mixed get_record (mixed $id, [ $assoc = false])
 array get_record_groups (mixed $id)
 mixed get_result ()
 mixed get_search_set ()
 integer|boolean insert (array $save_data, [ $check = false])
 array list_groups ([string $search = null], [int $mode = 0])
 array list_records ([array $cols = null], [int $subset = 0], [boolean $nocount = false])
 int remove_from_group (string $group_id, array|string $ids)
 boolean rename_group (string $gid, string $newname,  &$new_gid)
 void reset ()
 object rcube_result_set search (mixed $fields, mixed $value, [int $mode = 0], [boolean $select = true], [boolean $nocount = false], [array $required = array()])
 void set_group ( $gid)
 void set_search_set (string $filter)
 void undelete (array $ids)
 boolean update (mixed $id, array $save_cols)
 boolean validate (array &$save_data, [boolean $autofix = false])
Variables
mixed $coltypes = array('name', 'firstname', 'surname', 'middlename', 'prefix', 'suffix', 'nickname',
'jobtitle', 'organization', 'department', 'assistant', 'manager',
'gender', 'maidenname', 'spouse', 'email', 'phone', 'address',
'birthday', 'anniversary', 'website', 'im', 'notes', 'photo')
(line 59)
  • access: public

Redefinition of:
rcube_addressbook::$coltypes
mixed $date_cols = array('birthday', 'anniversary') (line 63)
  • access: public

Redefinition of:
rcube_addressbook::$date_cols
mixed $db_groupmembers = 'contactgroupmembers' (line 31)
  • access: protected
mixed $db_groups = 'contactgroups' (line 30)
  • access: protected
mixed $db_name = 'contacts' (line 29)
  • access: protected
mixed $groups = true (line 53)
  • access: public

Redefinition of:
rcube_addressbook::$groups
mixed $group_id = 0 (line 57)
  • access: public

Redefinition of:
rcube_addressbook::$group_id
mixed $list_page = 1 (line 55)
  • access: public

Redefinition of:
rcube_addressbook::$list_page
mixed $name (line 51)
  • access: public
mixed $page_size = 10 (line 56)
  • access: public

Redefinition of:
rcube_addressbook::$page_size
mixed $primary_key = 'contact_id' (line 50)
  • access: public

Redefinition of:
rcube_addressbook::$primary_key
public properties (mandatory)
mixed $readonly = false (line 52)
  • access: public

Redefinition of:
rcube_addressbook::$readonly
mixed $ready = false (line 58)
  • access: public

Redefinition of:
rcube_addressbook::$ready
mixed $undelete = true (line 54)
  • access: public

Redefinition of:
rcube_addressbook::$undelete
mixed $vcard_fieldmap = array() (line 32)
  • access: protected

Inherited Variables

Inherited from rcube_addressbook

rcube_addressbook::$error
rcube_addressbook::$searchonly
rcube_addressbook::$sort_col
rcube_addressbook::$sort_order
Methods
Constructor __construct (line 74)

Object constructor

rcube_contacts __construct (object Instance $dbconn, integer $user)
  • object Instance $dbconn: of the rcube_db class
  • integer $user: User-ID
add_to_group (line 905)

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

Redefinition of:
rcube_addressbook::add_to_group()
Add the given contact records the a certain group
count (line 473)

Count number of available contacts in database

  • return: Result object
rcube_result_set count ()

Redefinition of:
rcube_addressbook::count()
Count number of available contacts in database
create_group (line 830)

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

Redefinition of:
rcube_addressbook::create_group()
Create a contact group with the given name
delete (line 760)

Mark one or more contact records as deleted

void delete (array $ids, [boolean $force = true])
  • array $ids: Record identifiers
  • boolean $force: Remove record(s) irreversible (unsupported)

Redefinition of:
rcube_addressbook::delete()
Mark one or more contact records as deleted
delete_all (line 812)

Remove all records from the database

void delete_all ()

Redefinition of:
rcube_addressbook::delete_all()
Mark all records in database as deleted
delete_group (line 856)

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

Redefinition of:
rcube_addressbook::delete_group()
Delete the given group and all linked group members
get_group (line 192)

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

Redefinition of:
rcube_addressbook::get_group()
Get group properties such as name and email address(es)
get_name (line 85)

Returns addressbook name

void get_name ()

Redefinition of:
rcube_addressbook::get_name()
Returns addressbook name (e.g. for addressbooks listing)
get_record (line 530)

Get a specific contact record

  • return: Result object with all record fields or False if not found
mixed get_record (mixed $id, [ $assoc = false])
  • mixed $id: record identifier(s)
  • $assoc

Redefinition of:
rcube_addressbook::get_record()
Get a specific contact record
get_record_groups (line 561)

Get group assignments of a specific contact record

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

Redefinition of:
rcube_addressbook::get_record_groups()
Get group assignments of a specific contact record
get_result (line 518)

Return the last result set

  • return: Result array or NULL if nothing selected yet
mixed get_result ()

Redefinition of:
rcube_addressbook::get_result()
Return the last result set
get_search_set (line 108)

Getter for saved search properties

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

Redefinition of:
rcube_addressbook::get_search_set()
Getter for saved search properties
insert (line 611)

Create a new contact record

  • return: The created record ID on success, False on error
integer|boolean insert (array $save_data, [ $check = false])
  • array $save_data: Associative array with save data
  • $check

Redefinition of:
rcube_addressbook::insert()
Create a new contact record
list_groups (line 147)

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: Search string to match group name
  • int $mode: Matching mode:
    1. - partial (*abc*),
    2. - strict (=),
    3. - prefix (abc*)

Redefinition of:
rcube_addressbook::list_groups()
List all active contact groups of this source
list_records (line 217)

List the current set of contact records

  • return: Indexed list of contact records, each a hash array
array list_records ([array $cols = null], [int $subset = 0], [boolean $nocount = false])
  • array $cols: List of cols to show, Null means all
  • int $subset: Only return this number of records, use negative values for tail
  • boolean $nocount: True to skip the count query (select only)

Redefinition of:
rcube_addressbook::list_records()
List the current set of contact records
remove_from_group (line 953)

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

Redefinition of:
rcube_addressbook::remove_from_group()
Remove the given contact records from a certain group
rename_group (line 880)

Rename a specific contact group

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

Redefinition of:
rcube_addressbook::rename_group()
Rename a specific contact group
reset (line 128)

Reset all saved results and search parameters

void reset ()

Redefinition of:
rcube_addressbook::reset()
Reset saved results and search parameters
search (line 307)

Search contacts

  • return: Contact records and 'count' value
object rcube_result_set search (mixed $fields, mixed $value, [int $mode = 0], [boolean $select = true], [boolean $nocount = false], [array $required = array()])
  • mixed $fields: The field name of array of field names to search in
  • mixed $value: Search value (or array of values when $fields is array)
  • 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

Redefinition of:
rcube_addressbook::search()
Search records
set_group (line 118)

Setter for the current group

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

void set_group ( $gid)
  • $gid

Redefinition of:
rcube_addressbook::set_group()
Setter for the current group
set_search_set (line 96)

Save a search string for future listings

void set_search_set (string $filter)
  • string $filter: SQL params to use in listing method

Redefinition of:
rcube_addressbook::set_search_set()
Save a search string for future listings
undelete (line 787)

Undelete one or more contact records

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

Redefinition of:
rcube_addressbook::undelete()
Unmark delete flag on contact record(s)
update (line 660)

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

Redefinition of:
rcube_addressbook::update()
Update a specific contact record
validate (line 590)

Check the given data before saving.

If input not 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: Try to fix/complete record automatically

Redefinition of:
rcube_addressbook::validate()
Check the given data before saving.

Inherited Methods

Inherited From rcube_addressbook

 rcube_addressbook::add_to_group()
 rcube_addressbook::close()
 rcube_addressbook::compare_search_value()
 rcube_addressbook::compose_contact_key()
 rcube_addressbook::compose_display_name()
 rcube_addressbook::compose_list_name()
 rcube_addressbook::count()
 rcube_addressbook::create_group()
 rcube_addressbook::delete()
 rcube_addressbook::delete_all()
 rcube_addressbook::delete_group()
 rcube_addressbook::get_col_values()
 rcube_addressbook::get_error()
 rcube_addressbook::get_group()
 rcube_addressbook::get_name()
 rcube_addressbook::get_record()
 rcube_addressbook::get_record_groups()
 rcube_addressbook::get_result()
 rcube_addressbook::get_search_set()
 rcube_addressbook::insert()
 rcube_addressbook::insertMultiple()
 rcube_addressbook::list_groups()
 rcube_addressbook::list_records()
 rcube_addressbook::normalize_string()
 rcube_addressbook::refresh_search()
 rcube_addressbook::remove_from_group()
 rcube_addressbook::rename_group()
 rcube_addressbook::reset()
 rcube_addressbook::search()
 rcube_addressbook::set_error()
 rcube_addressbook::set_group()
 rcube_addressbook::set_page()
 rcube_addressbook::set_pagesize()
 rcube_addressbook::set_search_set()
 rcube_addressbook::set_sort_order()
 rcube_addressbook::undelete()
 rcube_addressbook::update()
 rcube_addressbook::validate()
Class Constants

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