4 +-----------------------------------------------------------------------+
5 | program/include/rcube_addressbook.php |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2006-2009, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Interface to the local address book database |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
24 * Abstract skeleton of an address book/repository
26 * @package Addressbook
28 abstract class rcube_addressbook
30 /** public properties */
38 * Save a search string for future listings
40 * @param mixed Search params to use in listing method, obtained by get_search_set()
42 abstract function set_search_set($filter);
45 * Getter for saved search properties
47 * @return mixed Search properties used by this class
49 abstract function get_search_set();
52 * Reset saved results and search parameters
54 abstract function reset();
57 * List the current set of contact records
59 * @param array List of cols to show
60 * @param int Only return this number of records, use negative values for tail
61 * @return array Indexed list of contact records, each a hash array
63 abstract function list_records($cols=null, $subset=0);
68 * @param array List of fields to search in
69 * @param string Search value
70 * @param boolean True if results are requested, False if count only
71 * @return Indexed list of contact records and 'count' value
73 abstract function search($fields, $value, $strict=false, $select=true);
76 * Count number of available contacts in database
78 * @return object rcube_result_set Result set with values for 'count' and 'first'
80 abstract function count();
83 * Return the last result set
85 * @return object rcube_result_set Current result set or NULL if nothing selected yet
87 abstract function get_result();
90 * Get a specific contact record
92 * @param mixed record identifier(s)
93 * @param boolean True to return record as associative array, otherwise a result set is returned
94 * @return mixed Result object with all record fields or False if not found
96 abstract function get_record($id, $assoc=false);
99 * Close connection to source
100 * Called on script shutdown
105 * Set internal list page
107 * @param number Page number to list
110 function set_page($page)
112 $this->list_page = (int)$page;
116 * Set internal page size
118 * @param number Number of messages to display on one page
121 function set_pagesize($size)
123 $this->page_size = (int)$size;
127 * Create a new contact record
129 * @param array Assoziative array with save data
130 * @param boolean True to check for duplicates first
131 * @return The created record ID on success, False on error
133 function insert($save_data, $check=false)
135 /* empty for read-only address books */
139 * Update a specific contact record
141 * @param mixed Record identifier
142 * @param array Assoziative array with save data
143 * @return True on success, False on error
145 function update($id, $save_cols)
147 /* empty for read-only address books */
151 * Mark one or more contact records as deleted
153 * @param array Record identifiers
155 function delete($ids)
157 /* empty for read-only address books */
161 * Remove all records from the database
163 function delete_all()
165 /* empty for read-only address books */