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;
19 public function __construct()
24 public function set_search_set($filter)
26 $this->filter = $filter;
29 public function get_search_set()
34 public function reset()
40 function list_groups($search = null)
43 array('ID' => 'testgroup1', 'name' => "Testgroup"),
44 array('ID' => 'testgroup2', 'name' => "Sample Group"),
48 public function list_records($cols=null, $subset=0)
50 $this->result = $this->count();
51 $this->result->add(array('ID' => '111', 'name' => "Example Contact", 'firstname' => "Example", 'surname' => "Contact", 'email' => "example@roundcube.net"));
56 public function search($fields, $value, $strict=false, $select=true, $nocount=false, $required=array())
58 // no search implemented, just list all records
59 return $this->list_records();
62 public function count()
64 return new rcube_result_set(1, ($this->list_page-1) * $this->page_size);
67 public function get_result()
72 public function get_record($id, $assoc=false)
74 $this->list_records();
75 $first = $this->result->first();
76 $sql_arr = $first['ID'] == $id ? $first : null;
78 return $assoc && $sql_arr ? $sql_arr : $this->result;
82 function create_group($name)
89 function delete_group($gid)
94 function rename_group($gid, $newname)
99 function add_to_group($group_id, $ids)
104 function remove_from_group($group_id, $ids)