-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcivicrm_addressbook.php
40 lines (31 loc) · 1004 Bytes
/
civicrm_addressbook.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
//ini_set('display_errors', 1);
require_once(__DIR__ . '/civicrm_addressbook_instance.php');
class civicrm_addressbook extends rcube_plugin {
public $task = 'mail|addressbook';
public function init() {
$this->add_hook('addressbooks_list', array($this, 'addressbooks_list'));
$this->add_hook('addressbook_get', array($this, 'addressbook_get'));
$rcmail = rcmail::get_instance();
$config = $rcmail->config;
$sources= (array) $config->get('autocomplete_addressbooks', array());
$sources[] = 'civicrm';
$config->set('autocomplete_addressbooks', $sources);
}
public function addressbook_get($addressbook) {
if ($addressbook['id'] == 'civicrm') {
$addressbook['instance'] = new civicrm_addressbook_instance();
}
return $addressbook;
}
public function addressbooks_list($addressbooks) {
$addressbooks['sources']['civicrm'] = array(
'id' => 'civicrm',
'name' => 'CiviCRM',
'readonly' => true,
'groups' => true,
);
return $addressbooks;
}
}
?>