alecpl
2010-11-24 576b330ebd2541d89319ca4ef04e2fde172d2cc8
program/include/rcube_addressbook.php
@@ -4,8 +4,8 @@
 +-----------------------------------------------------------------------+
 | program/include/rcube_addressbook.php                                 |
 |                                                                       |
 | This file is part of the RoundCube Webmail client                     |
 | Copyright (C) 2006-2009, RoundCube Dev. - Switzerland                 |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2006-2009, Roundcube Dev. - Switzerland                 |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | PURPOSE:                                                              |
@@ -15,7 +15,7 @@
 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
 +-----------------------------------------------------------------------+
 $Id:  $
 $Id$
*/
@@ -29,6 +29,7 @@
{
    /** public properties */
    var $primary_key;
    var $groups = false;
    var $readonly = true;
    var $ready = false;
    var $list_page = 1;
@@ -75,14 +76,14 @@
    /**
     * Count number of available contacts in database
     *
     * @return object rcube_result_set Result set with values for 'count' and 'first'
     * @return rcube_result_set Result set with values for 'count' and 'first'
     */
    abstract function count();
    /**
     * Return the last result set
     *
     * @return object rcube_result_set Current result set or NULL if nothing selected yet
     * @return rcube_result_set Current result set or NULL if nothing selected yet
     */
    abstract function get_result();
@@ -91,6 +92,7 @@
     *
     * @param mixed record identifier(s)
     * @param boolean True to return record as associative array, otherwise a result set is returned
     *
     * @return mixed Result object with all record fields or False if not found
     */
    abstract function get_record($id, $assoc=false);
@@ -109,7 +111,7 @@
     */
    function set_page($page)
    {
      $this->list_page = (int)$page;
        $this->list_page = (int)$page;
    }
    /**
@@ -120,7 +122,7 @@
     */
    function set_pagesize($size)
    {
      $this->page_size = (int)$size;
        $this->page_size = (int)$size;
    }
    /**
@@ -128,11 +130,11 @@
     *
     * @param array Assoziative array with save data
     * @param boolean True to check for duplicates first
     * @return The created record ID on success, False on error
     * @return mixed The created record ID on success, False on error
     */
    function insert($save_data, $check=false)
    {
      /* empty for read-only address books */
        /* empty for read-only address books */
    }
    /**
@@ -140,11 +142,11 @@
     *
     * @param mixed Record identifier
     * @param array Assoziative array with save data
     * @return True on success, False on error
     * @return boolean True on success, False on error
     */
    function update($id, $save_cols)
    {
      /* empty for read-only address books */
        /* empty for read-only address books */
    }
    /**
@@ -154,7 +156,7 @@
     */
    function delete($ids)
    {
      /* empty for read-only address books */
        /* empty for read-only address books */
    }
    /**
@@ -162,8 +164,101 @@
     */
    function delete_all()
    {
      /* empty for read-only address books */
        /* empty for read-only address books */
    }
    /**
     * Setter for the current group
     * (empty, has to be re-implemented by extending class)
     */
    function set_group($gid) { }
    /**
     * List all active contact groups of this source
     *
     * @return array  Indexed list of contact groups, each a hash array
     */
    function list_groups()
    {
        /* empty for address books don't supporting groups */
        return array();
    }
    /**
     * Create a contact group with the given name
     *
     * @param string The group name
     * @return mixed False on error, array with record props in success
     */
    function create_group($name)
    {
        /* empty for address books don't supporting groups */
        return false;
    }
    /**
     * Delete the given group and all linked group members
     *
     * @param string Group identifier
     * @return boolean True on success, false if no data was changed
     */
    function delete_group($gid)
    {
        /* empty for address books don't supporting groups */
        return false;
    }
    /**
     * Rename a specific contact group
     *
     * @param string Group identifier
     * @param string New name to set for this group
     * @return boolean New name on success, false if no data was changed
     */
    function rename_group($gid, $newname)
    {
        /* empty for address books don't supporting groups */
        return false;
    }
    /**
     * Add the given contact records the a certain group
     *
     * @param string  Group identifier
     * @param array   List of contact identifiers to be added
     * @return int    Number of contacts added
     */
    function add_to_group($group_id, $ids)
    {
        /* empty for address books don't supporting groups */
        return 0;
    }
    /**
     * Remove the given contact records from a certain group
     *
     * @param string  Group identifier
     * @param array   List of contact identifiers to be removed
     * @return int    Number of deleted group members
     */
    function remove_from_group($group_id, $ids)
    {
        /* empty for address books don't supporting groups */
        return 0;
    }
    /**
     * Get group assignments of a specific contact record
     *
     * @param mixed Record identifier
     *
     * @return array List of assigned groups as ID=>Name pairs
     * @since 0.5-beta
     */
    function get_record_groups($id)
    {
        /* empty for address books don't supporting groups */
        return array();
    }
}