4 * Example backend class for a custom address book
6 * This one just holds a static list of address records
8 * @author Thomas Bruederli
10 class example_addressbook_backend extends rcube_addressbook
12 public $primary_key = 'ID';
13 public $readonly = true;
14 public $groups = true;
20 public function __construct($name)
26 public function get_name()
31 public function set_search_set($filter)
33 $this->filter = $filter;
36 public function get_search_set()
41 public function reset()
47 function list_groups($search = null)
50 array('ID' => 'testgroup1', 'name' => "Testgroup"),
51 array('ID' => 'testgroup2', 'name' => "Sample Group"),
55 public function list_records($cols=null, $subset=0)
57 $this->result = $this->count();
58 $this->result->add(array('ID' => '111', 'name' => "Example Contact", 'firstname' => "Example", 'surname' => "Contact", 'email' => "example@roundcube.net"));
63 public function search($fields, $value, $strict=false, $select=true, $nocount=false, $required=array())
65 // no search implemented, just list all records
66 return $this->list_records();
69 public function count()
71 return new rcube_result_set(1, ($this->list_page-1) * $this->page_size);
74 public function get_result()
79 public function get_record($id, $assoc=false)
81 $this->list_records();
82 $first = $this->result->first();
83 $sql_arr = $first['ID'] == $id ? $first : null;
85 return $assoc && $sql_arr ? $sql_arr : $this->result;
89 function create_group($name)
96 function delete_group($gid)
101 function rename_group($gid, $newname)
106 function add_to_group($group_id, $ids)
111 function remove_from_group($group_id, $ids)