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;
18 public function __construct()
23 public function set_search_set($filter)
25 $this->filter = $filter;
28 public function get_search_set()
33 public function reset()
39 public function list_records($cols=null, $subset=0)
41 $this->result = $this->count();
42 $this->result->add(array('ID' => '111', 'name' => "Example Contact", 'firstname' => "Example", 'surname' => "Contact", 'email' => "example@roundcube.net"));
47 public function search($fields, $value, $strict=false, $select=true)
49 // no search implemented, just list all records
50 return $this->list_records();
53 public function count()
55 return new rcube_result_set(1, ($this->list_page-1) * $this->page_size);
58 public function get_result()
63 public function get_record($id, $assoc=false)
65 $this->list_records();
66 $first = $this->result->first();
67 $sql_arr = $first['ID'] == $id ? $first : null;
69 return $assoc && $sql_arr ? $sql_arr : $this->result;