Commit | Line | Data |
---|---|---|
7f254ad8 AE |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.6 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | This file is a part of CiviCRM. | | |
7 | | | | |
8 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
9 | | under the terms of the GNU Affero General Public License | | |
10 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
11 | | | | |
12 | | CiviCRM is distributed in the hope that it will be useful, but | | |
13 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
14 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
15 | | See the GNU Affero General Public License for more details. | | |
16 | | | | |
17 | | You should have received a copy of the GNU Affero General Public | | |
18 | | License and the CiviCRM Licensing Exception along | | |
19 | | with this program; if not, contact CiviCRM LLC | | |
20 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
21 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
22 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
23 | +--------------------------------------------------------------------+ | |
24 | */ | |
25 | ||
26 | // $Id: civicrm_group_roles.module,v 1.1.4.2 2008/10/14 00:20:36 matt2000 Exp $ | |
27 | ||
28 | ||
29 | /* @file | |
30 | * A simple module to synchronize Drupal Roles with Specified CiviCRM Groups | |
31 | */ | |
32 | ||
33 | /** | |
34 | * Implementation of hook_install(). | |
35 | */ | |
36 | function civicrm_group_roles_install() { | |
37 | ||
38 | $here = l(t('here'), 'admin/config/civicrm/civicrm_group_roles/add_rule'); | |
39 | drupal_set_message(t('CiviGroup Roles Sync installed. You will need to specify sync rules !1.', array('!1' => $here))); | |
40 | } | |
41 | ||
42 | /** | |
43 | * Implementation of hook_enable(). | |
44 | */ | |
45 | function civicrm_group_roles_enable() { | |
46 | db_query("UPDATE {system} SET weight = 110 WHERE name = 'civicrm_group_roles'"); | |
47 | } | |
48 | ||
49 | /** | |
50 | * Implementation of hook_schema(). | |
51 | */ | |
52 | function civicrm_group_roles_schema() { | |
53 | $schema['civicrm_group_roles_rules'] = array( | |
54 | 'fields' => array( | |
55 | 'id' => array( | |
56 | 'type' => 'serial', | |
57 | 'not null' => TRUE, | |
58 | ), | |
59 | 'role_id' => array( | |
60 | 'type' => 'int', | |
61 | 'unsigned' => TRUE, | |
62 | 'not null' => TRUE, | |
63 | ), | |
64 | 'group_id' => array( | |
65 | 'type' => 'int', | |
66 | 'unsigned' => TRUE, | |
67 | 'not null' => TRUE, | |
68 | ), | |
69 | ), | |
70 | 'primary key' => array('id'), | |
71 | ); | |
72 | ||
73 | return $schema; | |
74 | } | |
75 | ||
76 | /** | |
77 | * Implementation of hook_uninstall(). | |
78 | */ | |
79 | function civicrm_group_roles_uninstall() {} | |
80 | ||
81 | /** | |
82 | * Update CiviGroup Roles Sync module weight to be greater than CiviCRM's. | |
83 | */ | |
84 | function civicrm_group_roles_update_7400(&$sandbox) { | |
85 | db_query("UPDATE {system} SET weight = 101 WHERE name = 'civicrm_group_roles'"); | |
86 | } |