3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 class CRM_Bridge_OG_CiviCRM
{
24 public static function group($groupID, $group, $op) {
26 self
::groupAdd($groupID, $group);
29 self
::groupDelete($groupID, $group);
37 public static function groupAdd($groupID, $group) {
38 $ogID = CRM_Bridge_OG_Utils
::ogID($groupID);
40 $node = new StdClass();
46 $node->uid
= $user->uid
;
47 $node->title
= $group->title
;
52 $node->og_description
= $group->description
;
53 $node->og_selective
= OF_OPEN
;
54 $node->og_register
= 0;
55 $node->og_directory
= 1;
59 // also change the source field of the group
60 CRM_Core_DAO
::setFieldValue('CRM_Contact_DAO_Group',
63 CRM_Bridge_OG_Utils
::ogSyncName($node->nid
)
71 public static function groupDelete($groupID, $group) {
72 $ogID = CRM_Bridge_OG_Utils
::ogID($groupID);
85 public static function groupContact($groupID, $contactIDs, $op) {
86 $config = CRM_Core_Config
::singleton();
87 $ogID = CRM_Bridge_OG_Utils
::ogID($groupID);
93 foreach ($contactIDs as $contactID) {
94 $drupalID = CRM_Core_BAO_UFMatch
::getUFId($contactID);
97 $group_membership = $config->userSystem
->og_membership_create($ogID, $drupalID);
100 $group_membership = $config->userSystem
->og_membership_delete($ogID, $drupalID);