Alex Trofimov 10 лет назад
Родитель
Сommit
7c0f316070
52 измененных файлов с 1327 добавлено и 969 удалено
  1. 109 0
      modules/base/groups/classes/BxBaseModGroupsAlertsResponse.php
  2. 83 0
      modules/base/groups/classes/BxBaseModGroupsDb.php
  3. 35 0
      modules/base/groups/classes/BxBaseModGroupsFormEntry.php
  4. 67 0
      modules/base/groups/classes/BxBaseModGroupsFormsEntryHelper.php
  5. 20 0
      modules/base/groups/classes/BxBaseModGroupsGridAdministration.php
  6. 20 0
      modules/base/groups/classes/BxBaseModGroupsGridCommon.php
  7. 180 0
      modules/base/groups/classes/BxBaseModGroupsGridConnections.php
  8. 24 0
      modules/base/groups/classes/BxBaseModGroupsMenuManageTools.php
  9. 46 0
      modules/base/groups/classes/BxBaseModGroupsMenuView.php
  10. 447 0
      modules/base/groups/classes/BxBaseModGroupsModule.php
  11. 23 0
      modules/base/groups/classes/BxBaseModGroupsPageBrowse.php
  12. 45 0
      modules/base/groups/classes/BxBaseModGroupsPageEntry.php
  13. 24 0
      modules/base/groups/classes/BxBaseModGroupsPageJoinedEntries.php
  14. 67 0
      modules/base/groups/classes/BxBaseModGroupsPrivacy.php
  15. 31 0
      modules/base/groups/classes/BxBaseModGroupsPrivacyNotifications.php
  16. 51 0
      modules/base/groups/classes/BxBaseModGroupsTemplate.php
  17. 1 0
      modules/base/groups/template/account_link.html
  18. 1 0
      modules/base/groups/template/cover.html
  19. 19 0
      modules/base/groups/template/css/main.css
  20. 1 0
      modules/base/groups/template/entry-share.html
  21. 1 0
      modules/base/groups/template/image_popup.html
  22. 1 0
      modules/base/groups/template/name_link.html
  23. 1 0
      modules/base/groups/template/picture_preview.html
  24. 1 0
      modules/base/groups/template/set_acl_popup.html
  25. 1 0
      modules/base/groups/template/unit.html
  26. 1 0
      modules/base/groups/template/unit_live_search.html
  27. 1 90
      modules/boonex/groups/classes/BxGroupsAlertsResponse.php
  28. 2 62
      modules/boonex/groups/classes/BxGroupsDb.php
  29. 1 13
      modules/boonex/groups/classes/BxGroupsFormEntry.php
  30. 1 45
      modules/boonex/groups/classes/BxGroupsFormsEntryHelper.php
  31. 1 1
      modules/boonex/groups/classes/BxGroupsGridAdministration.php
  32. 1 1
      modules/boonex/groups/classes/BxGroupsGridCommon.php
  33. 1 161
      modules/boonex/groups/classes/BxGroupsGridConnections.php
  34. 1 1
      modules/boonex/groups/classes/BxGroupsMenuManageTools.php
  35. 1 23
      modules/boonex/groups/classes/BxGroupsMenuView.php
  36. 1 425
      modules/boonex/groups/classes/BxGroupsModule.php
  37. 1 1
      modules/boonex/groups/classes/BxGroupsPageBrowse.php
  38. 1 23
      modules/boonex/groups/classes/BxGroupsPageEntry.php
  39. 1 1
      modules/boonex/groups/classes/BxGroupsPageJoinedEntries.php
  40. 1 48
      modules/boonex/groups/classes/BxGroupsPrivacy.php
  41. 1 14
      modules/boonex/groups/classes/BxGroupsPrivacyNotifications.php
  42. 1 29
      modules/boonex/groups/classes/BxGroupsTemplate.php
  43. 1 1
      modules/boonex/groups/template/account_link.html
  44. 1 1
      modules/boonex/groups/template/cover.html
  45. 1 19
      modules/boonex/groups/template/css/main.css
  46. 1 1
      modules/boonex/groups/template/entry-share.html
  47. 1 1
      modules/boonex/groups/template/image_popup.html
  48. 1 1
      modules/boonex/groups/template/name_link.html
  49. 1 1
      modules/boonex/groups/template/picture_preview.html
  50. 1 1
      modules/boonex/groups/template/set_acl_popup.html
  51. 1 2
      modules/boonex/groups/template/unit.html
  52. 1 3
      modules/boonex/groups/template/unit_live_search.html

+ 109 - 0
modules/base/groups/classes/BxBaseModGroupsAlertsResponse.php

@@ -0,0 +1,109 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxBaseModGroupsAlertsResponse extends BxBaseModProfileAlertsResponse
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+    
+    public function response($oAlert)
+    {
+        parent::response($oAlert);
+
+        $CNF = $this->_oModule->_oConfig->CNF;
+
+        // connection events
+        if ($CNF['OBJECT_CONNECTIONS'] == $oAlert->sUnit && 'connection_added' == $oAlert->sAction) {
+            $this->_oModule->serviceAddMutualConnection($oAlert->aExtras['content'], $oAlert->aExtras['initiator']);
+        }
+        elseif ($CNF['OBJECT_CONNECTIONS'] == $oAlert->sUnit && 'connection_removed' == $oAlert->sAction) {
+            $this->_oModule->serviceOnRemoveConnection($oAlert->aExtras['content'], $oAlert->aExtras['initiator']);
+        }
+
+        // profile delete event
+        if ('profile' == $oAlert->sUnit && 'delete' == $oAlert->sAction) {
+            $this->_oModule->serviceDeleteProfileFromFansAndAdmins($oAlert->iObject);
+            $this->_oModule->serviceReassignEntitiesByAuthor($oAlert->iObject);
+        }
+
+        if ($this->MODULE != $oAlert->sUnit)
+            return;
+
+        // join group events
+        switch ($oAlert->sAction) {
+        case 'join_invitation':
+            $this->sendMailInvitation($oAlert, $oAlert->aExtras['profile'], bx_get_logged_profile_id());
+            break;
+        case 'join_request':
+            $this->sendMailJoinRequest($oAlert, $oAlert->aExtras['profile'], bx_get_logged_profile_id());
+            break;
+        case 'join_request_accepted':
+            $this->sendMailJoinRequestAccepted($oAlert, $oAlert->aExtras['profile'], bx_get_logged_profile_id());
+            break;
+        }
+    }
+
+    protected function sendMailInvitation ($oAlert, $iProfileId, $iSender = 0)
+    {
+        sendMailTemplate($this->_oModule->_oConfig->CNF['EMAIL_INVITATION'], 0, $iProfileId, array(
+            'InviterUrl' => BxDolProfile::getInstance($iSender)->getUrl(),
+            'InviterDisplayName' => BxDolProfile::getInstance($iSender)->getDisplayName(),
+            'EntryUrl' => $oAlert->aExtras['entry_url'],
+            'EntryTitle' => $oAlert->aExtras['entry_title'],
+        ), BX_EMAIL_NOTIFY);
+    }
+
+    protected function sendMailJoinRequest ($oAlert, $iProfileId, $iSender = 0)
+    {
+        $aAdmins = $this->_oModule->_oDb->getAdmins($oAlert->aExtras['group_profile']);
+        foreach ($aAdmins as $iAdminProfileId) {
+            sendMailTemplate($this->_oModule->_oConfig->CNF['EMAIL_JOIN_REQUEST'], 0, $iAdminProfileId, array(
+                'NewMemberUrl' => BxDolProfile::getInstance($iProfileId)->getUrl(),
+                'NewMemberDisplayName' => BxDolProfile::getInstance($iProfileId)->getDisplayName(),
+                'EntryUrl' => $oAlert->aExtras['entry_url'],
+                'EntryTitle' => $oAlert->aExtras['entry_title'],
+            ), BX_EMAIL_NOTIFY);
+        }
+    }
+
+    protected function sendMailJoinRequestAccepted ($oAlert, $iProfileId, $iSender = 0)
+    {
+        sendMailTemplate($this->_oModule->_oConfig->CNF['EMAIL_JOIN_CONFIRM'], 0, $iProfileId, array(
+            'EntryUrl' => $oAlert->aExtras['entry_url'],
+            'EntryTitle' => $oAlert->aExtras['entry_title'],
+        ), BX_EMAIL_NOTIFY);
+    }
+
+    protected function processTimelineShare ($oAlert, $iGroupProfileId)
+    {
+        if ($oAlert->aExtras['check_result'][CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED)
+            return;
+
+        $oGroupProfile = BxDolProfile::getInstance($iGroupProfileId);
+        if (!$oGroupProfile)
+            return;
+
+        $oPrivacy = BxDolPrivacy::getObjectInstance($this->_oModule->_oConfig->CNF['OBJECT_PRIVACY_VIEW']);
+
+        $aContentInfo = $this->_oModule->serviceGetContentInfoById($oGroupProfile->getContentId());
+        if (BX_DOL_PG_ALL == $aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']] || (BX_DOL_PG_MEMBERS == $aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']] && isLogged()) || $oPrivacy->isPartiallyVisible($aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']])) {
+            $oAlert->aExtras['check_result'][CHECK_ACTION_RESULT] = CHECK_ACTION_RESULT_ALLOWED;
+        }
+        else {
+            $oAlert->aExtras['check_result'][CHECK_ACTION_RESULT] = CHECK_ACTION_MESSAGE_NOT_ALLOWED;
+            $oAlert->aExtras['check_result'][CHECK_ACTION_MESSAGE] = _t('_sys_access_denied_to_private_content');
+        }
+    }
+}
+
+/** @} */

+ 83 - 0
modules/base/groups/classes/BxBaseModGroupsDb.php

@@ -0,0 +1,83 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/*
+ * Groups module database queries
+ */
+class BxBaseModGroupsDb extends BxBaseModProfileDb
+{
+    public function __construct(&$oConfig)
+    {
+        parent::__construct($oConfig);
+    }
+
+    public function updateAuthorById ($iContentId, $iProfileId)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $sQuery = "UPDATE `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` SET `" . $CNF['FIELD_AUTHOR'] . "` = :author WHERE `" . $CNF['FIELD_ID'] . "` = :id";
+        return $this->query($sQuery, array(
+    		'id' => $iContentId,
+    		'author' => $iProfileId,
+    	));
+    }
+
+    public function toAdmins ($iGroupProfileId, $mixedFansIds)
+    {
+        if (is_array($mixedFansIds))
+            foreach ($mixedFansIds as $iFanId)
+                $this->toAdmins ($iFanId);
+
+        $iFanId = (int)$mixedFansIds;
+        $sQuery = $this->prepare("INSERT IGNORE INTO `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` SET `group_profile_id` = ?, `fan_id` = ?", $iGroupProfileId, $iFanId);
+        return $this->res($sQuery);
+    }
+
+    public function fromAdmins ($iGroupProfileId, $mixedFansIds)
+    {
+        if (is_array($mixedFansIds))
+            foreach ($mixedFansIds as $iFanId)
+                $this->toAdmins ($iFanId);
+
+        $iFanId = (int)$mixedFansIds;
+        $sQuery = $this->prepare("DELETE FROM `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` WHERE `group_profile_id` = ? AND `fan_id` = ?", $iGroupProfileId, $iFanId);
+        return $this->res($sQuery);
+    }
+
+    public function deleteAdminsByGroupId ($iGroupProfileId)
+    {
+        $sQuery = $this->prepare("DELETE FROM `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` WHERE `group_profile_id` = ?", $iGroupProfileId);
+        return $this->res($sQuery);
+    }
+
+    public function deleteAdminsByProfileId ($iProfileId)
+    {
+        $sQuery = $this->prepare("DELETE FROM `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` WHERE `fan_id` = ?", $iProfileId);
+        return $this->res($sQuery);
+    }
+
+    public function isAdmin ($iGroupProfileId, $iFanId, $aDataEntry = array())
+    {
+        if (isset($aDataEntry[$this->_oConfig->CNF['FIELD_AUTHOR']]) && $iFanId == $aDataEntry[$this->_oConfig->CNF['FIELD_AUTHOR']])
+            return true;
+
+        $sQuery = $this->prepare("SELECT `id` FROM `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` WHERE `group_profile_id` = ? AND `fan_id` = ?", $iGroupProfileId, $iFanId);
+        return $this->getOne($sQuery) ? true : false;
+    }
+
+    public function getAdmins ($iGroupProfileId)
+    {
+        $sQuery = $this->prepare("SELECT `fan_id` FROM `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` WHERE `group_profile_id` = ?", $iGroupProfileId);
+        return $this->getColumn($sQuery);
+    }
+}
+
+/** @} */

+ 35 - 0
modules/base/groups/classes/BxBaseModGroupsFormEntry.php

@@ -0,0 +1,35 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/**
+ * Create/Edit Group Form.
+ */
+class BxBaseModGroupsFormEntry extends BxBaseModProfileFormEntry
+{
+    public function __construct($aInfo, $oTemplate = false)
+    {
+        parent::__construct($aInfo, $oTemplate);
+
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        if (isset($this->aInputs['initial_members']) && !isset($this->aInputs['initial_members']['value'])) {
+            $this->aInputs['initial_members']['value'] = array(bx_get_logged_profile_id());
+        }
+    }
+
+    protected function genCustomInputInitialMembers ($aInput)
+    {
+        $aInput['ajax_get_suggestions'] = BX_DOL_URL_ROOT . "modules/?r=" . $this->_oModule->_oConfig->getUri() . "/ajax_get_initial_members";
+        return $this->genCustomInputUsernamesSuggestions($aInput);
+    }
+}
+
+/** @} */

+ 67 - 0
modules/base/groups/classes/BxBaseModGroupsFormsEntryHelper.php

@@ -0,0 +1,67 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/**
+ * Group profile forms functions
+ */
+class BxBaseModGroupsFormsEntryHelper extends BxBaseModProfileFormsEntryHelper
+{
+    public function __construct($oModule)
+    {
+        parent::__construct($oModule);
+    }
+
+    protected function _processPermissionsCheckForViewDataForm ($aContentInfo, $oProfile)
+    {
+        $sMsg = parent::_processPermissionsCheckForViewDataForm ($aContentInfo, $oProfile);
+
+        $oPrivacy = BxDolPrivacy::getObjectInstance($this->_oModule->_oConfig->CNF['OBJECT_PRIVACY_VIEW']);
+        if ($sMsg && $oPrivacy->isPartiallyVisible($aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']]))
+            return '';
+
+        return $sMsg;
+    }
+
+    public function onDataAddAfter ($iAccountId, $iContentId)
+    {
+        if ($s = parent::onDataAddAfter($iAccountId, $iContentId))
+            return $s;
+
+        if (!($oGroupProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->_oModule->_oConfig->getName())))
+            return '';
+
+        // insert invited members, so they will join without confirmation
+        $aInitialProfiles = bx_get('initial_members');
+        foreach ($aInitialProfiles as $iProfileId) {
+            if (!($oProfile = BxDolProfile::getInstance($iProfileId)))
+                continue;
+            $this->_oModule->serviceAddMutualConnection ($oGroupProfile->id(), $oProfile->id(), true);            
+        }
+        
+        return '';
+    }
+
+    public function onDataDeleteAfter ($iContentId, $aContentInfo, $oProfile)
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->_oModule->_oConfig->getName());
+
+        if ($oGroupProfile)
+            $this->_oModule->_oDb->deleteAdminsByGroupId($oGroupProfile->id());
+
+        if (isset($CNF['OBJECT_CONNECTIONS']) && $oGroupProfile && ($oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS'])))
+            $oConnection->onDeleteInitiatorAndContent($oGroupProfile->id());
+
+        return '';
+    }
+}
+
+/** @} */

+ 20 - 0
modules/base/groups/classes/BxBaseModGroupsGridAdministration.php

@@ -0,0 +1,20 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ * 
+ * @{
+ */
+
+class BxBaseModGroupsGridAdministration extends BxBaseModProfileGridAdministration
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 20 - 0
modules/base/groups/classes/BxBaseModGroupsGridCommon.php

@@ -0,0 +1,20 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ * 
+ * @{
+ */
+
+class BxBaseModGroupsGridCommon extends BxBaseModProfileGridCommon
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 180 - 0
modules/base/groups/classes/BxBaseModGroupsGridConnections.php

@@ -0,0 +1,180 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ * 
+ * @{
+ */
+
+class BxBaseModGroupsGridConnections extends BxDolGridConnections
+{
+    protected $_iGroupProfileId;
+    protected $_oModule;
+    protected $_oConnection;
+    protected $_aContentInfo = array();
+
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_oModule = BxDolModule::getInstance($this->_sContentModule);
+        $this->_sObjectConnections = $this->_oModule->_oConfig->CNF['OBJECT_CONNECTIONS'];
+
+        parent::__construct ($aOptions, $oTemplate);
+
+        $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
+        if (!$iProfileId)
+            return;
+
+        $oProfile = BxDolProfile::getInstance($iProfileId);
+        if (!$oProfile)
+            return;
+
+        $aProfileInfo = $oProfile->getInfo();
+        $this->_iGroupProfileId = $oProfile->id();
+
+        $this->_aContentInfo = BxDolService::call($aProfileInfo['type'], 'get_content_info_by_id', array($aProfileInfo['content_id']));
+        if (CHECK_ACTION_RESULT_ALLOWED === $this->_oModule->checkAllowedEdit($this->_aContentInfo) || $oProfile->id() == bx_get_logged_profile_id())
+            $this->_bOwner = true;
+
+        $aSQLParts = $this->_oConnection->getConnectedInitiatorsAsSQLParts('p', 'id', $this->_iGroupProfileId, $this->_bOwner ? false : true);
+        $this->addMarkers(array(
+            'profile_id' => $oProfile->id(),
+            'join_connections' => $aSQLParts['join'],
+            'content_module' => $this->_sContentModule,
+        ));
+    }
+
+    protected function _getActionAccept ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
+    {
+        if (isset($aRow[$this->_aOptions['field_id']]))
+            $a['attr']['bx_grid_action_data'] = $aRow[$this->_aOptions['field_id']] . ':' . $this->_iGroupProfileId;
+
+        return parent::_getActionAccept ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
+    }
+
+    protected function _getActionDelete ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
+    {
+        if (isset($aRow[$this->_aOptions['field_id']]))
+            $a['attr']['bx_grid_action_data'] = $aRow[$this->_aOptions['field_id']] . ':' . $this->_iGroupProfileId;
+
+        return parent::_getActionDelete ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
+    }
+
+    protected function _getActionToAdmins ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
+    {
+        if ($this->_oModule->_oDb->isAdmin($this->_iGroupProfileId, $aRow[$this->_aOptions['field_id']]))
+            return '';
+
+        return $this->_getAction_Admins ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
+    }
+
+    protected function _getActionFromAdmins ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
+    {
+        if (!$this->_oModule->_oDb->isAdmin($this->_iGroupProfileId, $aRow[$this->_aOptions['field_id']]))
+            return '';
+
+        return $this->_getAction_Admins ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
+    }
+
+    protected function _getAction_Admins ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
+    {
+        if (!$this->_oConnection->isConnected($aRow[$this->_aOptions['field_id']], $this->_iGroupProfileId, true))
+            return '';
+
+        if (CHECK_ACTION_RESULT_ALLOWED !== $this->_oModule->checkAllowedManageAdmins($this->_iGroupProfileId))
+            return '';
+
+        if (isset($aRow[$this->_aOptions['field_id']]))
+            $a['attr']['bx_grid_action_data'] = $aRow[$this->_aOptions['field_id']] . ':' . $this->_iGroupProfileId;
+
+        return parent::_getActionDefault ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
+    }
+
+    /**
+     * 'To Admins' action handler
+     */
+    public function performActionToAdmins()
+    {
+        $this->_performActionAdmins('toAdmins');
+    }
+
+    /**
+     * 'From Admins' action handler
+     */
+    public function performActionFromAdmins()
+    {
+        $this->_performActionAdmins('fromAdmins');        
+    }
+
+    public function _performActionAdmins($sFunc)
+    {
+        list ($iId, $iGroupProfileId) = $this->_prepareIds();
+
+        if (!$iId) {
+            echoJson(array('msg' => _t('_sys_txt_error_occured')));
+            exit;
+        }
+
+        if (CHECK_ACTION_RESULT_ALLOWED !== $this->_oModule->checkAllowedManageAdmins($iGroupProfileId)) {
+            echoJson(array('msg' => _t('_sys_txt_access_denied')));
+            exit;
+        }
+    
+        if (!$this->_oModule->_oDb->$sFunc($iGroupProfileId, $iId)) {
+            echoJson(array('msg' => _t('_sys_txt_error_occured')));
+        } 
+        else {
+
+            $sEmailTemplate = 'toAdmins' == $sFunc ? $this->_oModule->_oConfig->CNF['EMAIL_FAN_BECOME_ADMIN'] : $this->_oModule->_oConfig->CNF['EMAIL_ADMIN_BECOME_FAN'];
+            list($iGroupProfileId, $iProfileId) = $this->_prepareGroupProfileAndMemberProfile($iGroupProfileId, $iId);
+            if (bx_get_logged_profile_id() != $iProfileId) {
+                // notify about admin status
+                sendMailTemplate($sEmailTemplate, 0, $iProfileId, array(
+                    'EntryUrl' => BxDolProfile::getInstance($iGroupProfileId)->getUrl(),
+                    'EntryTitle' => BxDolProfile::getInstance($iGroupProfileId)->getDisplayName(),
+                ), BX_EMAIL_NOTIFY);
+            }
+
+            // subscribe admins automatically
+            if ('toAdmins' == $sFunc && ($oConn = BxDolConnection::getObjectInstance('sys_profiles_subscriptions')))
+                $oConn->addConnection($iProfileId, $iGroupProfileId);
+
+            echoJson(array('grid' => $this->getCode(false), 'blink' => $iId));
+        }
+    }
+
+    protected function _delete ($mixedId)
+    {
+        list ($iId, $iViewedId) = $this->_prepareIds();
+
+        // send email notification
+        $sEmailTemplate = $this->_oConnection->isConnected($iViewedId, $iId, true) ? $this->_oModule->_oConfig->CNF['EMAIL_FAN_REMOVE'] : $this->_oModule->_oConfig->CNF['EMAIL_JOIN_REJECT'];
+        list($iGroupProfileId, $iProfileId) = $this->_prepareGroupProfileAndMemberProfile($iId, $iViewedId);
+        if (bx_get_logged_profile_id() != $iProfileId) {
+            sendMailTemplate($sEmailTemplate, 0, $iProfileId, array(
+                'EntryUrl' => BxDolProfile::getInstance($iGroupProfileId)->getUrl(),
+                'EntryTitle' => BxDolProfile::getInstance($iGroupProfileId)->getDisplayName(),
+            ), BX_EMAIL_NOTIFY);
+        }
+
+        // delete admin associated with profile
+        $this->_oModule->_oDb->deleteAdminsByProfileId($iProfileId);
+
+        return parent::_delete ($mixedId);
+    }
+
+    /**
+     * @return array where first element is group profile id and second element is some other persons profile id
+     */
+    protected function _prepareGroupProfileAndMemberProfile($iId1, $iId2)
+    {
+        if (BxDolProfile::getInstance($iId1)->getModule() == $this->_sContentModule)
+            return array($iId1, $iId2);
+        else
+            return array($iId2, $iId1);
+    }
+}
+
+/** @} */

+ 24 - 0
modules/base/groups/classes/BxBaseModGroupsMenuManageTools.php

@@ -0,0 +1,24 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/**
+ * 'Groups manage tools' menu.
+ */
+class BxBaseModGroupsMenuManageTools extends BxBaseModProfileMenuManageTools
+{
+
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 46 - 0
modules/base/groups/classes/BxBaseModGroupsMenuView.php

@@ -0,0 +1,46 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/**
+ * 'View group' menu.
+ */
+class BxBaseModGroupsMenuView extends BxBaseModProfileMenuView
+{
+
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+
+        if ($this->_oProfile && isLogged()) {
+            $CNF = &$this->_oModule->_oConfig->CNF;
+            
+            $oConn = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS']);
+            if ($oConn && $oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $this->_oProfile->id())) {
+                $this->addMarkers(array(
+                    'title_add_fan' => _t($CNF['T']['menu_item_title_become_fan_sent']),
+                    'title_remove_fan' => _t($CNF['T']['menu_item_title_leave_group_cancel_request']),
+                ));
+            } else {
+                $this->addMarkers(array(
+                    'title_add_fan' => _t($CNF['T']['menu_item_title_become_fan']),
+                    'title_remove_fan' => _t($CNF['T']['menu_item_title_leave_group']),
+                ));
+            }
+
+            if ($oConn && $this->_oModule->isFan($this->_aContentInfo[$CNF['FIELD_ID']])) {
+                $a = $oConn->getConnectedInitiators($this->_oProfile->id());
+                $this->addMarkers(array('recipients' => implode(',', $a)));
+            }
+        }
+    }
+}
+
+/** @} */

+ 447 - 0
modules/base/groups/classes/BxBaseModGroupsModule.php

@@ -0,0 +1,447 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/**
+ * Groups profiles module.
+ */
+class BxBaseModGroupsModule extends BxBaseModProfileModule
+{
+    function __construct(&$aModule)
+    {
+        parent::__construct($aModule);
+    }
+
+    /**
+     * Get possible recipients for start conversation form
+     */
+    public function actionAjaxGetInitialMembers ()
+    {
+        $sTerm = bx_get('term');
+
+        $a = BxDolService::call('system', 'profiles_search', array($sTerm), 'TemplServiceProfiles');
+
+        header('Content-Type:text/javascript; charset=utf-8');
+        echo(json_encode($a));
+    }
+
+    public function serviceActAsProfile ()
+    {
+        return false;
+    }
+
+    /**
+     * Delete profile from fans and admins tables
+     * @param $iProfileId profile id 
+     */
+    public function serviceDeleteProfileFromFansAndAdmins ($iProfileId)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $this->_oDb->deleteAdminsByProfileId($iProfileId);
+
+        if (isset($CNF['OBJECT_CONNECTIONS']) && ($oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS'])))
+            $oConnection->onDeleteInitiatorAndContent($iProfileId);
+    }
+
+    /**
+     * Reset group's author for particular group
+     * @param $iContentId group id 
+     * @return false of error, or number of updated records on success
+     */
+    public function serviceReassignEntityAuthor ($iContentId)
+    {
+        $aContentInfo = $this->_oDb->getContentInfoById((int)$iContentId);
+        if (!$aContentInfo)
+            return false;
+
+        if (!($oGroupProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->getName())))
+            return false;
+
+        $aAdmins = $this->_oDb->getAdmins($oGroupProfile->id());
+
+        return $this->_oDb->updateAuthorById($iContentId, $aAdmins ? array_pop($aAdmins) : 0);
+    }
+
+    /**
+     * Reset group's author when author profile is deleted
+     * @param $iProfileId profile id 
+     * @return number of changed items
+     */
+    public function serviceReassignEntitiesByAuthor ($iProfileId)
+    {
+        $a = $this->_oDb->getEntriesByAuthor((int)$iProfileId);
+        if (!$a)
+            return 0;
+
+        $iCount = 0;
+        foreach ($a as $aContentInfo)
+            $iCount += ('' == $this->serviceReassignEntityAuthor($aContentInfo[$this->_oConfig->CNF['FIELD_ID']]) ? 1 : 0);
+
+        return $iCount;
+    }
+
+    public function servicePrepareFields ($aFieldsProfile)
+    {
+        $CNF = &$this->_oConfig->CNF;
+        
+        $aFieldsProfile[$CNF['FIELD_NAME']] = $aFieldsProfile['name'];
+        $aFieldsProfile[$CNF['FIELD_TEXT']] = isset($aFieldsProfile['description']) ? $aFieldsProfile['description'] : '';
+        unset($aFieldsProfile['name']);
+        unset($aFieldsProfile['description']);
+        return $aFieldsProfile;
+    }
+
+    public function serviceOnRemoveConnection ($iGroupProfileId, $iInitiatorId)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        list ($iProfileId, $iGroupProfileId, $oGroupProfile) = $this->_prepareProfileAndGroupProfile($iGroupProfileId, $iInitiatorId);
+        if (!$oGroupProfile)
+            return false;
+
+        $this->_oDb->fromAdmins($iGroupProfileId, $iProfileId);
+
+        if ($oConn = BxDolConnection::getObjectInstance('sys_profiles_subscriptions'))
+            $oConn->removeConnection($iProfileId, $iGroupProfileId);
+    }
+
+    public function serviceAddMutualConnection ($iGroupProfileId, $iInitiatorId, $iIgnoreJoinConfirmation = false)
+    {        
+        $CNF = &$this->_oConfig->CNF;
+
+        list ($iProfileId, $iGroupProfileId, $oGroupProfile) = $this->_prepareProfileAndGroupProfile($iGroupProfileId, $iInitiatorId);
+        if (!$oGroupProfile)
+            return false;
+
+        if (!($aContentInfo = $this->_oDb->getContentInfoById((int)BxDolProfile::getInstance($iGroupProfileId)->getContentId())))
+            return false;
+
+        if (!($oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS'])))
+            return false;
+
+
+
+        $sEntryTitle = $aContentInfo[$CNF['FIELD_NAME']];
+        $sEntryUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]);
+
+        // send invitation to the group 
+        if ($iIgnoreJoinConfirmation && !$oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id()) && !$oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId) && bx_get_logged_profile_id() != $iProfileId) {
+
+            bx_alert($this->getName(), 'join_invitation', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
+
+        }
+        // send notification to group's admins that new connection is pending confirmation 
+        elseif (!$iIgnoreJoinConfirmation && $oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id()) && !$oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId) && $aContentInfo['join_confirmation']) {
+
+            bx_alert($this->getName(), 'join_request', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
+
+        }
+        // send notification that join request was accepted 
+        else if (!$iIgnoreJoinConfirmation && $oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id(), true) && $oGroupProfile->getModule() != $this->getName() && bx_get_logged_profile_id() != $iProfileId) {
+            
+            bx_alert($this->getName(), 'join_request_accepted', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
+
+        }
+
+        // new fan was added
+        if ($oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId, true)) {
+            bx_alert($this->getName(), 'fan_added', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
+            return false;
+        }
+
+        // don't automatically add back connection (mutual) if group requires manual join confirmation
+        if (!$iIgnoreJoinConfirmation && $aContentInfo['join_confirmation'])
+            return false;
+
+        // check if connection already exists
+        if ($oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId, true) || $oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId))
+            return false;
+
+        if (!$oConnection->addConnection($oGroupProfile->id(), (int)$iInitiatorId))
+            return false;
+
+        return true;
+    }
+
+    public function serviceFansTable ()
+    {
+        $oGrid = BxDolGrid::getObjectInstance($this->_oConfig->CNF['OBJECT_GRID_CONNECTIONS']);
+        if (!$oGrid)
+            return false;
+
+        return $oGrid->getCode();
+    }
+
+    public function serviceFans ($iContentId = 0)
+    {
+        if (!$iContentId)
+            $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
+        if (!$iContentId)
+            return false;
+
+        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+        if (!$aContentInfo)
+            return false;
+
+        if (!($oGroupProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->getName())))
+            return false;
+
+        bx_import('BxDolConnection');
+        $s = $this->serviceBrowseConnectionsQuick ($oGroupProfile->id(), $this->_oConfig->CNF['OBJECT_CONNECTIONS'], BX_CONNECTIONS_CONTENT_TYPE_CONTENT, true);
+        if (!$s)
+            return MsgBox(_t('_sys_txt_empty'));
+        return $s;
+    }
+
+    public function serviceBrowseJoinedEntries ($iProfileId = 0, $bDisplayEmptyMsg = false)
+    {
+        if (!$iProfileId)
+            $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
+        if (!$iProfileId)
+            return '';
+
+        return $this->_serviceBrowse ('joined_entries', array('joined_profile' => $iProfileId), BX_DB_PADDING_DEF, $bDisplayEmptyMsg);
+    }
+
+    /**
+     * Entry social sharing block
+     */
+    public function serviceEntitySocialSharing ($iContentId = 0)
+    {
+        if (!$iContentId)
+            $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
+        if (!$iContentId)
+            return false;
+        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+        if (!$aContentInfo)
+            return false;
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType((int)$iContentId, $this->getName());
+        if (!$oGroupProfile)
+            return false;
+
+        $CNF = &$this->_oConfig->CNF;
+
+        return $this->_entitySocialSharing ($iContentId, $iContentId, 0, $oGroupProfile->getDisplayName(), false, false, $CNF['OBJECT_VOTES'], $CNF['OBJECT_REPORTS'], $CNF['URI_VIEW_ENTRY']);
+    }
+
+	/**
+     * Data for Notifications module
+     */
+    public function serviceGetNotificationsData()
+    {
+    	$sModule = $this->_aModule['name'];
+
+        return array(
+            'handlers' => array(
+                array('group' => $sModule . '_vote', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'doVote', 'module_name' => $sModule, 'module_method' => 'get_notifications_vote', 'module_class' => 'Module'),
+                array('group' => $sModule . '_vote', 'type' => 'delete', 'alert_unit' => $sModule, 'alert_action' => 'undoVote'),
+
+                array('group' => $sModule . '_fan_added', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'fan_added', 'module_name' => $sModule, 'module_method' => 'get_notifications_fan_added', 'module_class' => 'Module'),
+
+                array('group' => $sModule . '_join_request', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'join_request', 'module_name' => $sModule, 'module_method' => 'get_notifications_join_request', 'module_class' => 'Module', 'module_event_privacy' => $this->_oConfig->CNF['OBJECT_PRIVACY_VIEW_NOTIFICATION_EVENT']),
+                
+                array('group' => $sModule . '_timeline_post_common', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'timeline_post_common', 'module_name' => $sModule, 'module_method' => 'get_notifications_timeline_post_common', 'module_class' => 'Module'),
+            ),
+            'alerts' => array(
+                array('unit' => $sModule, 'action' => 'doVote'),
+                array('unit' => $sModule, 'action' => 'undoVote'),
+                array('unit' => $sModule, 'action' => 'fan_added'),
+                array('unit' => $sModule, 'action' => 'join_request'),
+                array('unit' => $sModule, 'action' => 'timeline_post_common'),
+            )
+        );
+    }
+
+    /**
+     * Notification about new member requst in the group
+     */
+    public function serviceGetNotificationsJoinRequest($aEvent)
+    {
+        return $this->_serviceGetNotification($aEvent, $this->_oConfig->CNF['T']['txt_ntfs_join_request']);
+    }
+    
+	/**
+     * Notification about new member in the group
+     */
+    public function serviceGetNotificationsFanAdded($aEvent)
+    {
+        return $this->_serviceGetNotification($aEvent, $this->_oConfig->CNF['T']['txt_ntfs_fan_added']);
+    }
+
+    /**
+     * Entry post for Timeline module
+     */
+    public function serviceGetTimelinePost($aEvent)
+    {
+        $a = parent::serviceGetTimelinePost($aEvent);
+
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aEvent['object_id'], $this->getName());
+
+        $a['content']['url'] = $oGroupProfile->getUrl();
+        $a['content']['title'] = $oGroupProfile->getDisplayName();
+        
+        return $a;
+    }
+
+    /**
+     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
+     */
+    public function checkAllowedViewCoverImage ($aDataEntry, $isPerformAction = false)
+    {
+        $oPrivacy = BxDolPrivacy::getObjectInstance($this->_oConfig->CNF['OBJECT_PRIVACY_VIEW']);
+        if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = parent::checkAllowedViewCoverImage($aDataEntry)) && $oPrivacy->isPartiallyVisible($aDataEntry[$this->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']]))
+            return CHECK_ACTION_RESULT_ALLOWED;
+        
+        return $sMsg;
+    }
+
+    /**
+     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
+     */
+    public function checkAllowedViewProfileImage ($aDataEntry, $isPerformAction = false)
+    {
+        return $this->checkAllowedViewCoverImage($aDataEntry, $isPerformAction);
+    }
+
+    /**
+     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
+     */
+    public function checkAllowedPost ($aDataEntry, $isPerformAction = false)
+    {
+        if ($this->isFan($aDataEntry[$this->_oConfig->CNF['FIELD_ID']]))
+            return CHECK_ACTION_RESULT_ALLOWED;
+
+        return _t('_sys_txt_access_denied');
+    }
+
+    /**
+     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
+     */
+    public function checkAllowedView ($aDataEntry, $isPerformAction = false)
+    {
+        if ($this->isFan($aDataEntry[$this->_oConfig->CNF['FIELD_ID']]))
+            return CHECK_ACTION_RESULT_ALLOWED;
+
+        return parent::checkAllowedView ($aDataEntry, $isPerformAction);
+    }
+
+    /**
+     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
+     */
+    public function checkAllowedFanAdd (&$aDataEntry, $isPerformAction = false)
+    {
+        if (!$this->isFan($aDataEntry[$this->_oConfig->CNF['FIELD_ID']]) && isLogged())
+            return CHECK_ACTION_RESULT_ALLOWED;
+
+        return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, $this->_oConfig->CNF['OBJECT_CONNECTIONS'], true, false);
+    }
+
+    /**
+     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
+     */
+    public function checkAllowedFanRemove (&$aDataEntry, $isPerformAction = false)
+    {
+        if (CHECK_ACTION_RESULT_ALLOWED === $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, $this->_oConfig->CNF['OBJECT_CONNECTIONS'], false, true, true))
+            return CHECK_ACTION_RESULT_ALLOWED;
+        return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, $this->_oConfig->CNF['OBJECT_CONNECTIONS'], false, true, false);
+    }
+
+    public function checkAllowedManageAdmins ($mixedDataEntry, $isPerformAction = false)
+    {
+        if (is_array($mixedDataEntry)) {
+            $aDataEntry = $mixedDataEntry;
+        }
+        else {
+            $oGroupProfile = BxDolProfile::getInstance((int)$mixedDataEntry);
+            $aDataEntry = $oGroupProfile && $this->getName() == $oGroupProfile->getModule() ? $this->_oDb->getContentInfoById($oGroupProfile->getContentId()) : array();
+        }
+
+        return parent::checkAllowedEdit ($aDataEntry, $isPerformAction);
+    }
+
+    public function checkAllowedEdit ($aDataEntry, $isPerformAction = false)
+    {
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aDataEntry[$this->_oConfig->CNF['FIELD_ID']], $this->getName());
+        if ($this->_oDb->isAdmin($oGroupProfile->id(), bx_get_logged_profile_id(), $aDataEntry))
+            return CHECK_ACTION_RESULT_ALLOWED;
+        return parent::checkAllowedEdit ($aDataEntry, $isPerformAction);
+    }
+
+    public function checkAllowedChangeCover ($aDataEntry, $isPerformAction = false)
+    {
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aDataEntry[$this->_oConfig->CNF['FIELD_ID']], $this->getName());
+        if ($this->_oDb->isAdmin($oGroupProfile->id(), bx_get_logged_profile_id(), $aDataEntry))
+            return CHECK_ACTION_RESULT_ALLOWED;
+        return parent::checkAllowedChangeCover ($aDataEntry, $isPerformAction);
+    }
+
+    public function checkAllowedDelete (&$aDataEntry, $isPerformAction = false)
+    {
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aDataEntry[$this->_oConfig->CNF['FIELD_ID']], $this->getName());
+        if ($oGroupProfile && $this->_oDb->isAdmin($oGroupProfile->id(), bx_get_logged_profile_id(), $aDataEntry))
+            return CHECK_ACTION_RESULT_ALLOWED;
+        return parent::checkAllowedDelete ($aDataEntry, $isPerformAction);
+    }
+
+    public function checkAllowedSubscribeAdd (&$aDataEntry, $isPerformAction = false)
+    {
+        if (!$this->isFan($aDataEntry[$this->_oConfig->CNF['FIELD_ID']]))
+            return _t('_sys_txt_access_denied');
+
+        return parent::checkAllowedSubscribeAdd ($aDataEntry, $isPerformAction);
+    }
+
+    protected function _checkAllowedConnect (&$aDataEntry, $isPerformAction, $sObjConnection, $isMutual, $isInvertResult, $isSwap = false)
+    {
+        $sResult = $this->checkAllowedView($aDataEntry);
+
+        $oPrivacy = BxDolPrivacy::getObjectInstance($this->_oConfig->CNF['OBJECT_PRIVACY_VIEW']);
+
+        if (CHECK_ACTION_RESULT_ALLOWED !== $sResult && !$oPrivacy->isPartiallyVisible($aDataEntry[$this->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']]))
+            return $sResult;
+
+        return parent::_checkAllowedConnect ($aDataEntry, $isPerformAction, $sObjConnection, $isMutual, $isInvertResult, $isSwap);
+    }
+
+    public function isFan ($iContentId, $iProfileId = false) 
+    {
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->getName());
+
+        return $oGroupProfile && ($oConnection = BxDolConnection::getObjectInstance($this->_oConfig->CNF['OBJECT_CONNECTIONS'])) && $oConnection->isConnected($iProfileId ? $iProfileId : bx_get_logged_profile_id(), $oGroupProfile->id(), true);
+    }
+
+    protected function _getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl)
+    {
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aEvent['object_id'], $this->getName());
+                
+        return array(
+		    array('url' => $sUrl, 'src' => $oGroupProfile->getPicture()),
+		);
+    }
+
+    protected function _prepareProfileAndGroupProfile($iGroupProfileId, $iInitiatorId)
+    {
+        if (!($oGroupProfile = BxDolProfile::getInstance($iGroupProfileId)))
+            return array(0, 0, null);
+
+        if ($oGroupProfile->getModule() == $this->getName()) {
+            $iProfileId = $iInitiatorId;
+            $iGroupProfileId = $oGroupProfile->id();
+        } else {
+            $iProfileId = $oGroupProfile->id();
+            $iGroupProfileId = $iInitiatorId;
+        }
+
+        return array($iProfileId, $iGroupProfileId, $oGroupProfile);
+    }
+}
+
+/** @} */

+ 23 - 0
modules/base/groups/classes/BxBaseModGroupsPageBrowse.php

@@ -0,0 +1,23 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/**
+ * Browse entries pages.
+ */
+class BxBaseModGroupsPageBrowse extends BxBaseModProfilePageBrowse
+{
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 45 - 0
modules/base/groups/classes/BxBaseModGroupsPageEntry.php

@@ -0,0 +1,45 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/**
+ * Profile create/edit/delete pages.
+ */
+class BxBaseModGroupsPageEntry extends BxBaseModProfilePageEntry
+{
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+    }
+
+    protected function _processPermissionsCheck ()
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
+        
+        $mixedAllowView = $this->_oModule->checkAllowedView($this->_aContentInfo);
+        if (!$oPrivacy->isPartiallyVisible($this->_aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) && CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $mixedAllowView)) {
+            $this->_oTemplate->displayAccessDenied($sMsg);
+            exit;
+        }
+        elseif ($oPrivacy->isPartiallyVisible($this->_aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) && $CNF['OBJECT_PAGE_VIEW_ENTRY'] == $this->_sObject && CHECK_ACTION_RESULT_ALLOWED !== $mixedAllowView) {
+            // replace current page with different set of blocks
+            $aObject = BxDolPageQuery::getPageObject($CNF['OBJECT_PAGE_VIEW_ENTRY_CLOSED']);
+            $this->_sObject = $aObject['object'];
+            $this->_aObject = $aObject;
+            $this->_oQuery = new BxDolPageQuery($this->_aObject);
+        }
+
+        $this->_oModule->checkAllowedView($this->_aContentInfo, true);
+    }
+}
+
+/** @} */

+ 24 - 0
modules/base/groups/classes/BxBaseModGroupsPageJoinedEntries.php

@@ -0,0 +1,24 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/**
+ * Entries user joined to.
+ */
+class BxBaseModGroupsPageJoinedEntries extends BxBaseModTextPageAuthor
+{
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+    }
+
+}
+
+/** @} */

+ 67 - 0
modules/base/groups/classes/BxBaseModGroupsPrivacy.php

@@ -0,0 +1,67 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxBaseModGroupsPrivacy extends BxBaseModProfilePrivacy
+{
+    public function __construct($aOptions, $oTemplate = false)
+    {
+        parent::__construct($aOptions, $oTemplate);
+    }
+
+	/**
+     * Check whethere viewer is a member of dynamic group.
+     *
+     * @param  mixed   $mixedGroupId   dynamic group ID.
+     * @param  integer $iObjectOwnerId object owner ID.
+     * @param  integer $iViewerId      viewer ID.
+     * @return boolean result of operation.
+     */
+    public function isDynamicGroupMember($mixedGroupId, $iObjectOwnerId, $iViewerId, $iObjectId)
+    {
+        if ('c' == $mixedGroupId)
+            return $this->isClosedGroupAccess($iObjectOwnerId, $iViewerId, $iObjectId);
+
+        if ('s' == $mixedGroupId)
+            return $this->isSecretGroupAccess($iObjectOwnerId, $iViewerId, $iObjectId);
+
+        return false;
+    }
+
+    public function isClosedGroupAccess ($iObjectOwnerId, $iViewerId, $iObjectId)
+    {
+        if (!($oConnection = BxDolConnection::getObjectInstance($this->_oModule->_oConfig->CNF['OBJECT_CONNECTIONS'])))
+            return false;
+
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($iObjectId, $this->MODULE);
+        return $oConnection->isConnected($iViewerId, $oGroupProfile->id(), true);
+    }
+
+    public function isSecretGroupAccess ($iObjectOwnerId, $iViewerId, $iObjectId)
+    {
+        return $this->isClosedGroupAccess($iObjectOwnerId, $iViewerId, $iObjectId);
+    }
+
+    static function getGroupChooser ($sObject, $iOwnerId = 0, $aParams = array())
+    {
+        if (!$iOwnerId)
+    		$iOwnerId = bx_get_logged_profile_id();
+
+		$aParams['dynamic_groups'] = array(
+			array ('key' => '', 'value' => '----'),
+			array ('key' => 'c', 'value' => _t('_bx_groups_privacy_group_closed')),
+			array ('key' => 's', 'value' => _t('_bx_groups_privacy_group_secret')),
+		);
+
+        return parent::getGroupChooser($sObject, $iOwnerId, $aParams);
+    }
+}
+
+/** @} */

+ 31 - 0
modules/base/groups/classes/BxBaseModGroupsPrivacyNotifications.php

@@ -0,0 +1,31 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxBaseModGroupsPrivacyNotifications extends BxBaseModGroupsPrivacy
+{
+    function __construct($aOptions, $oTemplate = false)
+    {
+        parent::__construct($aOptions, $oTemplate);
+    }
+
+    function check($iObjectId, $iViewerId = 0)
+    {
+        if (!parent::check($iObjectId, $iViewerId))
+            return false;
+
+        if (!($aEvent = BxDolService::call('bx_notifications', 'get_event_by_id', array($iObjectId))))
+            return false;
+
+        return $this->_oModule->_oDb->isAdmin($aEvent['object_owner_id'], $iViewerId ? $iViewerId : bx_get_logged_profile_id());
+    }
+}
+
+/** @} */

+ 51 - 0
modules/base/groups/classes/BxBaseModGroupsTemplate.php

@@ -0,0 +1,51 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/*
+ * Groups module representation.
+ */
+class BxBaseModGroupsTemplate extends BxBaseModProfileTemplate
+{
+    function __construct(&$oConfig, &$oDb)
+    {
+        parent::__construct($oConfig, $oDb);
+    }
+
+    function unitVars ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html')
+    {
+        $aVars = parent::unitVars ($aData, $isCheckPrivateContent, $sTemplateName);
+        
+        $CNF = &$this->_oConfig->CNF;
+
+        $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
+
+        $isPublic = CHECK_ACTION_RESULT_ALLOWED === $this->getModule()->checkAllowedView($aData) || $oPrivacy->isPartiallyVisible($aData[$CNF['FIELD_ALLOW_VIEW_TO']]);        
+        $oConn = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS']);
+
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aData[$CNF['FIELD_ID']], $this->MODULE);
+
+        $aVars['title'] = $isPublic ? bx_process_output($aData[$CNF['FIELD_NAME']]) : _t($CNF['T']['txt_private_group']);
+        $aVars['bx_if:info']['condition'] = true;
+        $aVars['bx_if:info']['content']['members'] = $isPublic ? _t($CNF['T']['txt_N_fans'], $oConn ? $oConn->getConnectedInitiatorsCount($oGroupProfile->id(), true) : 0) : '&nbsp;';
+        $aVars['bx_if:info']['content']['bx_if:btn'] = array (
+            'condition' => isLogged() && $isPublic && !$oConn->isConnected(bx_get_logged_profile_id(), $oGroupProfile->id(), true),
+            'content' => array (
+                'id' => $oGroupProfile->id(),
+                'title' => $oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $oGroupProfile->id()) ? _t($CNF['T']['menu_item_title_become_fan_sent']) : _t($CNF['T']['menu_item_title_become_fan']),
+                'object' => $CNF['OBJECT_CONNECTIONS'],
+            ),
+        );
+
+        return $aVars;
+    }
+}
+
+/** @} */

+ 1 - 0
modules/base/groups/template/account_link.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/account_link.html />

+ 1 - 0
modules/base/groups/template/cover.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/cover.html />

+ 19 - 0
modules/base/groups/template/css/main.css

@@ -0,0 +1,19 @@
+@import url(../../../../base/profile/template/css/main.css);
+
+.bx-base-pofile-cover-info .bx-def-ava {
+    border-width:0.0625rem;
+    border-radius:0.1875rem;
+    -moz-border-radius:0.1875rem;
+    -webkit-border-radius:0.1875rem;
+}
+
+.bx-base-groups-unit-cover .bx-base-pofile-unit-cover .bx-def-thumb {
+    border-width:0.0625rem;
+    border-radius:0.1875rem;
+    -moz-border-radius:0.1875rem;
+    -webkit-border-radius:0.1875rem;
+}
+
+.bx-search-result-block {
+    text-align:center;
+}

+ 1 - 0
modules/base/groups/template/entry-share.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/text/template/entry-share.html />

+ 1 - 0
modules/base/groups/template/image_popup.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/image_popup.html />

+ 1 - 0
modules/base/groups/template/name_link.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/name_link.html />

+ 1 - 0
modules/base/groups/template/picture_preview.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/picture_preview.html />

+ 1 - 0
modules/base/groups/template/set_acl_popup.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/set_acl_popup.html />

+ 1 - 0
modules/base/groups/template/unit.html

@@ -0,0 +1 @@
+<span class="bx-base-groups-unit-cover"><bx_include_base:../modules/base/profile/template/unit_with_cover.html /></span>

+ 1 - 0
modules/base/groups/template/unit_live_search.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/general/template/unit_live_search.html />

+ 1 - 90
modules/boonex/groups/classes/BxGroupsAlertsResponse.php

@@ -9,102 +9,13 @@
  * @{
  */
 
-class BxGroupsAlertsResponse extends BxBaseModProfileAlertsResponse
+class BxGroupsAlertsResponse extends BxBaseModGroupsAlertsResponse
 {
     public function __construct()
     {
     	$this->MODULE = 'bx_groups';
         parent::__construct();
     }
-    
-    public function response($oAlert)
-    {
-        parent::response($oAlert);
-
-        $CNF = $this->_oModule->_oConfig->CNF;
-
-        // connection events
-        if ($CNF['OBJECT_CONNECTIONS'] == $oAlert->sUnit && 'connection_added' == $oAlert->sAction) {
-            $this->_oModule->serviceAddMutualConnection($oAlert->aExtras['content'], $oAlert->aExtras['initiator']);
-        }
-        elseif ($CNF['OBJECT_CONNECTIONS'] == $oAlert->sUnit && 'connection_removed' == $oAlert->sAction) {
-            $this->_oModule->serviceOnRemoveConnection($oAlert->aExtras['content'], $oAlert->aExtras['initiator']);
-        }
-
-        // profile delete event
-        if ('profile' == $oAlert->sUnit && 'delete' == $oAlert->sAction) {
-            $this->_oModule->serviceDeleteProfileFromFansAndAdmins($oAlert->iObject);
-            $this->_oModule->serviceReassignEntitiesByAuthor($oAlert->iObject);
-        }
-
-        if ($this->MODULE != $oAlert->sUnit)
-            return;
-
-        // join group events
-        switch ($oAlert->sAction) {
-        case 'join_invitation':
-            $this->sendMailInvitation($oAlert, $oAlert->aExtras['profile'], bx_get_logged_profile_id());
-            break;
-        case 'join_request':
-            $this->sendMailJoinRequest($oAlert, $oAlert->aExtras['profile'], bx_get_logged_profile_id());
-            break;
-        case 'join_request_accepted':
-            $this->sendMailJoinRequestAccepted($oAlert, $oAlert->aExtras['profile'], bx_get_logged_profile_id());
-            break;
-        }
-    }
-
-    protected function sendMailInvitation ($oAlert, $iProfileId, $iSender = 0)
-    {
-        sendMailTemplate($this->_oModule->_oConfig->CNF['EMAIL_INVITATION'], 0, $iProfileId, array(
-            'InviterUrl' => BxDolProfile::getInstance($iSender)->getUrl(),
-            'InviterDisplayName' => BxDolProfile::getInstance($iSender)->getDisplayName(),
-            'EntryUrl' => $oAlert->aExtras['entry_url'],
-            'EntryTitle' => $oAlert->aExtras['entry_title'],
-        ), BX_EMAIL_NOTIFY);
-    }
-
-    protected function sendMailJoinRequest ($oAlert, $iProfileId, $iSender = 0)
-    {
-        $aAdmins = $this->_oModule->_oDb->getAdmins($oAlert->aExtras['group_profile']);
-        foreach ($aAdmins as $iAdminProfileId) {
-            sendMailTemplate($this->_oModule->_oConfig->CNF['EMAIL_JOIN_REQUEST'], 0, $iAdminProfileId, array(
-                'NewMemberUrl' => BxDolProfile::getInstance($iProfileId)->getUrl(),
-                'NewMemberDisplayName' => BxDolProfile::getInstance($iProfileId)->getDisplayName(),
-                'EntryUrl' => $oAlert->aExtras['entry_url'],
-                'EntryTitle' => $oAlert->aExtras['entry_title'],
-            ), BX_EMAIL_NOTIFY);
-        }
-    }
-
-    protected function sendMailJoinRequestAccepted ($oAlert, $iProfileId, $iSender = 0)
-    {
-        sendMailTemplate($this->_oModule->_oConfig->CNF['EMAIL_JOIN_CONFIRM'], 0, $iProfileId, array(
-            'EntryUrl' => $oAlert->aExtras['entry_url'],
-            'EntryTitle' => $oAlert->aExtras['entry_title'],
-        ), BX_EMAIL_NOTIFY);
-    }
-
-    protected function processTimelineShare ($oAlert, $iGroupProfileId)
-    {
-        if ($oAlert->aExtras['check_result'][CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED)
-            return;
-
-        $oGroupProfile = BxDolProfile::getInstance($iGroupProfileId);
-        if (!$oGroupProfile)
-            return;
-
-        $oPrivacy = BxDolPrivacy::getObjectInstance($this->_oModule->_oConfig->CNF['OBJECT_PRIVACY_VIEW']);
-
-        $aContentInfo = $this->_oModule->serviceGetContentInfoById($oGroupProfile->getContentId());
-        if (BX_DOL_PG_ALL == $aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']] || (BX_DOL_PG_MEMBERS == $aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']] && isLogged()) || $oPrivacy->isPartiallyVisible($aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']])) {
-            $oAlert->aExtras['check_result'][CHECK_ACTION_RESULT] = CHECK_ACTION_RESULT_ALLOWED;
-        }
-        else {
-            $oAlert->aExtras['check_result'][CHECK_ACTION_RESULT] = CHECK_ACTION_MESSAGE_NOT_ALLOWED;
-            $oAlert->aExtras['check_result'][CHECK_ACTION_MESSAGE] = _t('_sys_access_denied_to_private_content');
-        }
-    }
 }
 
 /** @} */

+ 2 - 62
modules/boonex/groups/classes/BxGroupsDb.php

@@ -9,75 +9,15 @@
  * @{
  */
 
-/*
+/**
  * Groups module database queries
  */
-class BxGroupsDb extends BxBaseModProfileDb
+class BxGroupsDb extends BxBaseModGroupsDb
 {
     public function __construct(&$oConfig)
     {
         parent::__construct($oConfig);
     }
-
-    public function updateAuthorById ($iContentId, $iProfileId)
-    {
-        $CNF = &$this->_oConfig->CNF;
-
-        $sQuery = "UPDATE `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` SET `" . $CNF['FIELD_AUTHOR'] . "` = :author WHERE `" . $CNF['FIELD_ID'] . "` = :id";
-        return $this->query($sQuery, array(
-    		'id' => $iContentId,
-    		'author' => $iProfileId,
-    	));
-    }
-
-    public function toAdmins ($iGroupProfileId, $mixedFansIds)
-    {
-        if (is_array($mixedFansIds))
-            foreach ($mixedFansIds as $iFanId)
-                $this->toAdmins ($iFanId);
-
-        $iFanId = (int)$mixedFansIds;
-        $sQuery = $this->prepare("INSERT IGNORE INTO `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` SET `group_profile_id` = ?, `fan_id` = ?", $iGroupProfileId, $iFanId);
-        return $this->res($sQuery);
-    }
-
-    public function fromAdmins ($iGroupProfileId, $mixedFansIds)
-    {
-        if (is_array($mixedFansIds))
-            foreach ($mixedFansIds as $iFanId)
-                $this->toAdmins ($iFanId);
-
-        $iFanId = (int)$mixedFansIds;
-        $sQuery = $this->prepare("DELETE FROM `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` WHERE `group_profile_id` = ? AND `fan_id` = ?", $iGroupProfileId, $iFanId);
-        return $this->res($sQuery);
-    }
-
-    public function deleteAdminsByGroupId ($iGroupProfileId)
-    {
-        $sQuery = $this->prepare("DELETE FROM `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` WHERE `group_profile_id` = ?", $iGroupProfileId);
-        return $this->res($sQuery);
-    }
-
-    public function deleteAdminsByProfileId ($iProfileId)
-    {
-        $sQuery = $this->prepare("DELETE FROM `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` WHERE `fan_id` = ?", $iProfileId);
-        return $this->res($sQuery);
-    }
-
-    public function isAdmin ($iGroupProfileId, $iFanId, $aDataEntry = array())
-    {
-        if (isset($aDataEntry[$this->_oConfig->CNF['FIELD_AUTHOR']]) && $iFanId == $aDataEntry[$this->_oConfig->CNF['FIELD_AUTHOR']])
-            return true;
-
-        $sQuery = $this->prepare("SELECT `id` FROM `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` WHERE `group_profile_id` = ? AND `fan_id` = ?", $iGroupProfileId, $iFanId);
-        return $this->getOne($sQuery) ? true : false;
-    }
-
-    public function getAdmins ($iGroupProfileId)
-    {
-        $sQuery = $this->prepare("SELECT `fan_id` FROM `" . $this->_oConfig->CNF['TABLE_ADMINS'] . "` WHERE `group_profile_id` = ?", $iGroupProfileId);
-        return $this->getColumn($sQuery);
-    }
 }
 
 /** @} */

+ 1 - 13
modules/boonex/groups/classes/BxGroupsFormEntry.php

@@ -12,24 +12,12 @@
 /**
  * Create/Edit Group Form.
  */
-class BxGroupsFormEntry extends BxBaseModProfileFormEntry
+class BxGroupsFormEntry extends BxBaseModGroupsFormEntry
 {
     public function __construct($aInfo, $oTemplate = false)
     {
         $this->MODULE = 'bx_groups';
         parent::__construct($aInfo, $oTemplate);
-
-        $CNF = &$this->_oModule->_oConfig->CNF;
-
-        if (isset($this->aInputs['initial_members']) && !isset($this->aInputs['initial_members']['value'])) {
-            $this->aInputs['initial_members']['value'] = array(bx_get_logged_profile_id());
-        }
-    }
-
-    protected function genCustomInputInitialMembers ($aInput)
-    {
-        $aInput['ajax_get_suggestions'] = BX_DOL_URL_ROOT . "modules/?r=" . $this->_oModule->_oConfig->getUri() . "/ajax_get_initial_members";
-        return $this->genCustomInputUsernamesSuggestions($aInput);
     }
 }
 

+ 1 - 45
modules/boonex/groups/classes/BxGroupsFormsEntryHelper.php

@@ -12,56 +12,12 @@
 /**
  * Group profile forms functions
  */
-class BxGroupsFormsEntryHelper extends BxBaseModProfileFormsEntryHelper
+class BxGroupsFormsEntryHelper extends BxBaseModGroupsFormsEntryHelper
 {
     public function __construct($oModule)
     {
         parent::__construct($oModule);
     }
-
-    protected function _processPermissionsCheckForViewDataForm ($aContentInfo, $oProfile)
-    {
-        $sMsg = parent::_processPermissionsCheckForViewDataForm ($aContentInfo, $oProfile);
-
-        $oPrivacy = BxDolPrivacy::getObjectInstance($this->_oModule->_oConfig->CNF['OBJECT_PRIVACY_VIEW']);
-        if ($sMsg && $oPrivacy->isPartiallyVisible($aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']]))
-            return '';
-
-        return $sMsg;
-    }
-
-    public function onDataAddAfter ($iAccountId, $iContentId)
-    {
-        if ($s = parent::onDataAddAfter($iAccountId, $iContentId))
-            return $s;
-
-        if (!($oGroupProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->_oModule->_oConfig->getName())))
-            return '';
-
-        // insert invited members, so they will join without confirmation
-        $aInitialProfiles = bx_get('initial_members');
-        foreach ($aInitialProfiles as $iProfileId) {
-            if (!($oProfile = BxDolProfile::getInstance($iProfileId)))
-                continue;
-            $this->_oModule->serviceAddMutualConnection ($oGroupProfile->id(), $oProfile->id(), true);            
-        }
-        
-        return '';
-    }
-
-    public function onDataDeleteAfter ($iContentId, $aContentInfo, $oProfile)
-    {
-        $CNF = &$this->_oModule->_oConfig->CNF;
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->_oModule->_oConfig->getName());
-
-        if ($oGroupProfile)
-            $this->_oModule->_oDb->deleteAdminsByGroupId($oGroupProfile->id());
-
-        if (isset($CNF['OBJECT_CONNECTIONS']) && $oGroupProfile && ($oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS'])))
-            $oConnection->onDeleteInitiatorAndContent($oGroupProfile->id());
-
-        return '';
-    }
 }
 
 /** @} */

+ 1 - 1
modules/boonex/groups/classes/BxGroupsGridAdministration.php

@@ -9,7 +9,7 @@
  * @{
  */
 
-class BxGroupsGridAdministration extends BxBaseModProfileGridAdministration
+class BxGroupsGridAdministration extends BxBaseModGroupsGridAdministration
 {
     public function __construct ($aOptions, $oTemplate = false)
     {

+ 1 - 1
modules/boonex/groups/classes/BxGroupsGridCommon.php

@@ -9,7 +9,7 @@
  * @{
  */
 
-class BxGroupsGridCommon extends BxBaseModProfileGridCommon
+class BxGroupsGridCommon extends BxBaseModGroupsGridCommon
 {
     public function __construct ($aOptions, $oTemplate = false)
     {

+ 1 - 161
modules/boonex/groups/classes/BxGroupsGridConnections.php

@@ -9,172 +9,12 @@
  * @{
  */
 
-class BxGroupsGridConnections extends BxDolGridConnections
+class BxGroupsGridConnections extends BxBaseModGroupsGridConnections
 {
-    protected $_iGroupProfileId;
-    protected $_oModule;
-    protected $_oConnection;
-    protected $_aContentInfo = array();
-
     public function __construct ($aOptions, $oTemplate = false)
     {
         $this->_sContentModule = 'bx_groups';
-        $this->_oModule = BxDolModule::getInstance($this->_sContentModule);
-        $this->_sObjectConnections = $this->_oModule->_oConfig->CNF['OBJECT_CONNECTIONS'];
-
         parent::__construct ($aOptions, $oTemplate);
-
-        $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
-        if (!$iProfileId)
-            return;
-
-        $oProfile = BxDolProfile::getInstance($iProfileId);
-        if (!$oProfile)
-            return;
-
-        $aProfileInfo = $oProfile->getInfo();
-        $this->_iGroupProfileId = $oProfile->id();
-
-        $this->_aContentInfo = BxDolService::call($aProfileInfo['type'], 'get_content_info_by_id', array($aProfileInfo['content_id']));
-        if (CHECK_ACTION_RESULT_ALLOWED === $this->_oModule->checkAllowedEdit($this->_aContentInfo) || $oProfile->id() == bx_get_logged_profile_id())
-            $this->_bOwner = true;
-
-        $aSQLParts = $this->_oConnection->getConnectedInitiatorsAsSQLParts('p', 'id', $this->_iGroupProfileId, $this->_bOwner ? false : true);
-        $this->addMarkers(array(
-            'profile_id' => $oProfile->id(),
-            'join_connections' => $aSQLParts['join'],
-            'content_module' => $this->_sContentModule,
-        ));
-    }
-
-    protected function _getActionAccept ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
-    {
-        if (isset($aRow[$this->_aOptions['field_id']]))
-            $a['attr']['bx_grid_action_data'] = $aRow[$this->_aOptions['field_id']] . ':' . $this->_iGroupProfileId;
-
-        return parent::_getActionAccept ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
-    }
-
-    protected function _getActionDelete ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
-    {
-        if (isset($aRow[$this->_aOptions['field_id']]))
-            $a['attr']['bx_grid_action_data'] = $aRow[$this->_aOptions['field_id']] . ':' . $this->_iGroupProfileId;
-
-        return parent::_getActionDelete ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
-    }
-
-    protected function _getActionToAdmins ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
-    {
-        if ($this->_oModule->_oDb->isAdmin($this->_iGroupProfileId, $aRow[$this->_aOptions['field_id']]))
-            return '';
-
-        return $this->_getAction_Admins ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
-    }
-
-    protected function _getActionFromAdmins ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
-    {
-        if (!$this->_oModule->_oDb->isAdmin($this->_iGroupProfileId, $aRow[$this->_aOptions['field_id']]))
-            return '';
-
-        return $this->_getAction_Admins ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
-    }
-
-    protected function _getAction_Admins ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
-    {
-        if (!$this->_oConnection->isConnected($aRow[$this->_aOptions['field_id']], $this->_iGroupProfileId, true))
-            return '';
-
-        if (CHECK_ACTION_RESULT_ALLOWED !== $this->_oModule->checkAllowedManageAdmins($this->_iGroupProfileId))
-            return '';
-
-        if (isset($aRow[$this->_aOptions['field_id']]))
-            $a['attr']['bx_grid_action_data'] = $aRow[$this->_aOptions['field_id']] . ':' . $this->_iGroupProfileId;
-
-        return parent::_getActionDefault ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
-    }
-
-    /**
-     * 'To Admins' action handler
-     */
-    public function performActionToAdmins()
-    {
-        $this->_performActionAdmins('toAdmins');
-    }
-
-    /**
-     * 'From Admins' action handler
-     */
-    public function performActionFromAdmins()
-    {
-        $this->_performActionAdmins('fromAdmins');        
-    }
-
-    public function _performActionAdmins($sFunc)
-    {
-        list ($iId, $iGroupProfileId) = $this->_prepareIds();
-
-        if (!$iId) {
-            echoJson(array('msg' => _t('_sys_txt_error_occured')));
-            exit;
-        }
-
-        if (CHECK_ACTION_RESULT_ALLOWED !== $this->_oModule->checkAllowedManageAdmins($iGroupProfileId)) {
-            echoJson(array('msg' => _t('_sys_txt_access_denied')));
-            exit;
-        }
-    
-        if (!$this->_oModule->_oDb->$sFunc($iGroupProfileId, $iId)) {
-            echoJson(array('msg' => _t('_sys_txt_error_occured')));
-        } 
-        else {
-
-            $sEmailTemplate = 'toAdmins' == $sFunc ? $this->_oModule->_oConfig->CNF['EMAIL_FAN_BECOME_ADMIN'] : $this->_oModule->_oConfig->CNF['EMAIL_ADMIN_BECOME_FAN'];
-            list($iGroupProfileId, $iProfileId) = $this->_prepareGroupProfileAndMemberProfile($iGroupProfileId, $iId);
-            if (bx_get_logged_profile_id() != $iProfileId) {
-                // notify about admin status
-                sendMailTemplate($sEmailTemplate, 0, $iProfileId, array(
-                    'EntryUrl' => BxDolProfile::getInstance($iGroupProfileId)->getUrl(),
-                    'EntryTitle' => BxDolProfile::getInstance($iGroupProfileId)->getDisplayName(),
-                ), BX_EMAIL_NOTIFY);
-            }
-
-            // subscribe admins automatically
-            if ('toAdmins' == $sFunc && ($oConn = BxDolConnection::getObjectInstance('sys_profiles_subscriptions')))
-                $oConn->addConnection($iProfileId, $iGroupProfileId);
-
-            echoJson(array('grid' => $this->getCode(false), 'blink' => $iId));
-        }
-    }
-
-    protected function _delete ($mixedId)
-    {
-        list ($iId, $iViewedId) = $this->_prepareIds();
-
-        // send email notification
-        $sEmailTemplate = $this->_oConnection->isConnected($iViewedId, $iId, true) ? $this->_oModule->_oConfig->CNF['EMAIL_FAN_REMOVE'] : $this->_oModule->_oConfig->CNF['EMAIL_JOIN_REJECT'];
-        list($iGroupProfileId, $iProfileId) = $this->_prepareGroupProfileAndMemberProfile($iId, $iViewedId);
-        if (bx_get_logged_profile_id() != $iProfileId) {
-            sendMailTemplate($sEmailTemplate, 0, $iProfileId, array(
-                'EntryUrl' => BxDolProfile::getInstance($iGroupProfileId)->getUrl(),
-                'EntryTitle' => BxDolProfile::getInstance($iGroupProfileId)->getDisplayName(),
-            ), BX_EMAIL_NOTIFY);
-        }
-
-        // delete admin associated with profile
-        $this->_oModule->_oDb->deleteAdminsByProfileId($iProfileId);
-
-        return parent::_delete ($mixedId);
-    }
-
-    /**
-     * @return array where first element is group profile id and second element is some other persons profile id
-     */
-    protected function _prepareGroupProfileAndMemberProfile($iId1, $iId2)
-    {
-        if (BxDolProfile::getInstance($iId1)->getModule() == $this->_sContentModule)
-            return array($iId1, $iId2);
-        else
-            return array($iId2, $iId1);
     }
 }
 

+ 1 - 1
modules/boonex/groups/classes/BxGroupsMenuManageTools.php

@@ -12,7 +12,7 @@
 /**
  * 'Groups manage tools' menu.
  */
-class BxGroupsMenuManageTools extends BxBaseModProfileMenuManageTools
+class BxGroupsMenuManageTools extends BxBaseModGroupsMenuManageTools
 {
 
     public function __construct($aObject, $oTemplate = false)

+ 1 - 23
modules/boonex/groups/classes/BxGroupsMenuView.php

@@ -12,35 +12,13 @@
 /**
  * 'View group' menu.
  */
-class BxGroupsMenuView extends BxBaseModProfileMenuView
+class BxGroupsMenuView extends BxBaseModGroupsMenuView
 {
 
     public function __construct($aObject, $oTemplate = false)
     {
         $this->MODULE = 'bx_groups';
         parent::__construct($aObject, $oTemplate);
-
-        if ($this->_oProfile && isLogged()) {
-            $CNF = &$this->_oModule->_oConfig->CNF;
-            
-            $oConn = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS']);
-            if ($oConn && $oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $this->_oProfile->id())) {
-                $this->addMarkers(array(
-                    'title_add_fan' => _t($CNF['T']['menu_item_title_become_fan_sent']),
-                    'title_remove_fan' => _t($CNF['T']['menu_item_title_leave_group_cancel_request']),
-                ));
-            } else {
-                $this->addMarkers(array(
-                    'title_add_fan' => _t($CNF['T']['menu_item_title_become_fan']),
-                    'title_remove_fan' => _t($CNF['T']['menu_item_title_leave_group']),
-                ));
-            }
-
-            if ($oConn && $this->_oModule->isFan($this->_aContentInfo[$CNF['FIELD_ID']])) {
-                $a = $oConn->getConnectedInitiators($this->_oProfile->id());
-                $this->addMarkers(array('recipients' => implode(',', $a)));
-            }
-        }
     }
 }
 

+ 1 - 425
modules/boonex/groups/classes/BxGroupsModule.php

@@ -12,436 +12,12 @@
 /**
  * Groups profiles module.
  */
-class BxGroupsModule extends BxBaseModProfileModule
+class BxGroupsModule extends BxBaseModGroupsModule
 {
     function __construct(&$aModule)
     {
         parent::__construct($aModule);
     }
-
-    /**
-     * Get possible recipients for start conversation form
-     */
-    public function actionAjaxGetInitialMembers ()
-    {
-        $sTerm = bx_get('term');
-
-        $a = BxDolService::call('system', 'profiles_search', array($sTerm), 'TemplServiceProfiles');
-
-        header('Content-Type:text/javascript; charset=utf-8');
-        echo(json_encode($a));
-    }
-
-    public function serviceActAsProfile ()
-    {
-        return false;
-    }
-
-    /**
-     * Delete profile from fans and admins tables
-     * @param $iProfileId profile id 
-     */
-    public function serviceDeleteProfileFromFansAndAdmins ($iProfileId)
-    {
-        $CNF = &$this->_oConfig->CNF;
-
-        $this->_oDb->deleteAdminsByProfileId($iProfileId);
-
-        if (isset($CNF['OBJECT_CONNECTIONS']) && ($oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS'])))
-            $oConnection->onDeleteInitiatorAndContent($iProfileId);
-    }
-
-    /**
-     * Reset group's author for particular group
-     * @param $iContentId group id 
-     * @return false of error, or number of updated records on success
-     */
-    public function serviceReassignEntityAuthor ($iContentId)
-    {
-        $aContentInfo = $this->_oDb->getContentInfoById((int)$iContentId);
-        if (!$aContentInfo)
-            return false;
-
-        if (!($oGroupProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->getName())))
-            return false;
-
-        $aAdmins = $this->_oDb->getAdmins($oGroupProfile->id());
-
-        return $this->_oDb->updateAuthorById($iContentId, $aAdmins ? array_pop($aAdmins) : 0);
-    }
-
-    /**
-     * Reset group's author when author profile is deleted
-     * @param $iProfileId profile id 
-     * @return number of changed items
-     */
-    public function serviceReassignEntitiesByAuthor ($iProfileId)
-    {
-        $a = $this->_oDb->getEntriesByAuthor((int)$iProfileId);
-        if (!$a)
-            return 0;
-
-        $iCount = 0;
-        foreach ($a as $aContentInfo)
-            $iCount += ('' == $this->serviceReassignEntityAuthor($aContentInfo[$this->_oConfig->CNF['FIELD_ID']]) ? 1 : 0);
-
-        return $iCount;
-    }
-
-    public function servicePrepareFields ($aFieldsProfile)
-    {
-        $CNF = &$this->_oConfig->CNF;
-        
-        $aFieldsProfile[$CNF['FIELD_NAME']] = $aFieldsProfile['name'];
-        $aFieldsProfile[$CNF['FIELD_TEXT']] = isset($aFieldsProfile['description']) ? $aFieldsProfile['description'] : '';
-        unset($aFieldsProfile['name']);
-        unset($aFieldsProfile['description']);
-        return $aFieldsProfile;
-    }
-
-    public function serviceOnRemoveConnection ($iGroupProfileId, $iInitiatorId)
-    {
-        $CNF = &$this->_oConfig->CNF;
-
-        list ($iProfileId, $iGroupProfileId, $oGroupProfile) = $this->_prepareProfileAndGroupProfile($iGroupProfileId, $iInitiatorId);
-        if (!$oGroupProfile)
-            return false;
-
-        $this->_oDb->fromAdmins($iGroupProfileId, $iProfileId);
-
-        if ($oConn = BxDolConnection::getObjectInstance('sys_profiles_subscriptions'))
-            $oConn->removeConnection($iProfileId, $iGroupProfileId);
-    }
-
-    public function serviceAddMutualConnection ($iGroupProfileId, $iInitiatorId, $iIgnoreJoinConfirmation = false)
-    {        
-        $CNF = &$this->_oConfig->CNF;
-
-        list ($iProfileId, $iGroupProfileId, $oGroupProfile) = $this->_prepareProfileAndGroupProfile($iGroupProfileId, $iInitiatorId);
-        if (!$oGroupProfile)
-            return false;
-
-        if (!($aContentInfo = $this->_oDb->getContentInfoById((int)BxDolProfile::getInstance($iGroupProfileId)->getContentId())))
-            return false;
-
-        if (!($oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS'])))
-            return false;
-
-
-
-        $sEntryTitle = $aContentInfo[$CNF['FIELD_NAME']];
-        $sEntryUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]);
-
-        // send invitation to the group 
-        if ($iIgnoreJoinConfirmation && !$oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id()) && !$oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId) && bx_get_logged_profile_id() != $iProfileId) {
-
-            bx_alert($this->getName(), 'join_invitation', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
-
-        }
-        // send notification to group's admins that new connection is pending confirmation 
-        elseif (!$iIgnoreJoinConfirmation && $oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id()) && !$oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId) && $aContentInfo['join_confirmation']) {
-
-            bx_alert($this->getName(), 'join_request', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
-
-        }
-        // send notification that join request was accepted 
-        else if (!$iIgnoreJoinConfirmation && $oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id(), true) && $oGroupProfile->getModule() != $this->getName() && bx_get_logged_profile_id() != $iProfileId) {
-            
-            bx_alert($this->getName(), 'join_request_accepted', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
-
-        }
-
-        // new fan was added
-        if ($oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId, true)) {
-            bx_alert($this->getName(), 'fan_added', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
-            return false;
-        }
-
-        // don't automatically add back connection (mutual) if group requires manual join confirmation
-        if (!$iIgnoreJoinConfirmation && $aContentInfo['join_confirmation'])
-            return false;
-
-        // check if connection already exists
-        if ($oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId, true) || $oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId))
-            return false;
-
-        if (!$oConnection->addConnection($oGroupProfile->id(), (int)$iInitiatorId))
-            return false;
-
-        return true;
-    }
-
-    public function serviceFansTable ()
-    {
-        $oGrid = BxDolGrid::getObjectInstance($this->_oConfig->CNF['OBJECT_GRID_CONNECTIONS']);
-        if (!$oGrid)
-            return false;
-
-        return $oGrid->getCode();
-    }
-
-    public function serviceFans ($iContentId = 0)
-    {
-        if (!$iContentId)
-            $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
-        if (!$iContentId)
-            return false;
-
-        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
-        if (!$aContentInfo)
-            return false;
-
-        if (!($oGroupProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->getName())))
-            return false;
-
-        bx_import('BxDolConnection');
-        $s = $this->serviceBrowseConnectionsQuick ($oGroupProfile->id(), $this->_oConfig->CNF['OBJECT_CONNECTIONS'], BX_CONNECTIONS_CONTENT_TYPE_CONTENT, true);
-        if (!$s)
-            return MsgBox(_t('_sys_txt_empty'));
-        return $s;
-    }
-
-    public function serviceBrowseJoinedEntries ($iProfileId = 0, $bDisplayEmptyMsg = false)
-    {
-        if (!$iProfileId)
-            $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
-        if (!$iProfileId)
-            return '';
-
-        return $this->_serviceBrowse ('joined_entries', array('joined_profile' => $iProfileId), BX_DB_PADDING_DEF, $bDisplayEmptyMsg);
-    }
-
-    /**
-     * Entry social sharing block
-     */
-    public function serviceEntitySocialSharing ($iContentId = 0)
-    {
-        if (!$iContentId)
-            $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
-        if (!$iContentId)
-            return false;
-        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
-        if (!$aContentInfo)
-            return false;
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType((int)$iContentId, $this->getName());
-        if (!$oGroupProfile)
-            return false;
-
-        $CNF = &$this->_oConfig->CNF;
-
-        return $this->_entitySocialSharing ($iContentId, $iContentId, 0, $oGroupProfile->getDisplayName(), false, false, $CNF['OBJECT_VOTES'], $CNF['OBJECT_REPORTS'], $CNF['URI_VIEW_ENTRY']);
-    }
-
-	/**
-     * Data for Notifications module
-     */
-    public function serviceGetNotificationsData()
-    {
-    	$sModule = $this->_aModule['name'];
-
-        return array(
-            'handlers' => array(
-                array('group' => $sModule . '_vote', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'doVote', 'module_name' => $sModule, 'module_method' => 'get_notifications_vote', 'module_class' => 'Module'),
-                array('group' => $sModule . '_vote', 'type' => 'delete', 'alert_unit' => $sModule, 'alert_action' => 'undoVote'),
-
-                array('group' => $sModule . '_fan_added', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'fan_added', 'module_name' => $sModule, 'module_method' => 'get_notifications_fan_added', 'module_class' => 'Module'),
-
-                array('group' => $sModule . '_join_request', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'join_request', 'module_name' => $sModule, 'module_method' => 'get_notifications_join_request', 'module_class' => 'Module', 'module_event_privacy' => $this->_oConfig->CNF['OBJECT_PRIVACY_VIEW_NOTIFICATION_EVENT']),
-                
-                array('group' => $sModule . '_timeline_post_common', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'timeline_post_common', 'module_name' => $sModule, 'module_method' => 'get_notifications_timeline_post_common', 'module_class' => 'Module'),
-            ),
-            'alerts' => array(
-                array('unit' => $sModule, 'action' => 'doVote'),
-                array('unit' => $sModule, 'action' => 'undoVote'),
-                array('unit' => $sModule, 'action' => 'fan_added'),
-                array('unit' => $sModule, 'action' => 'join_request'),
-                array('unit' => $sModule, 'action' => 'timeline_post_common'),
-            )
-        );
-    }
-
-    /**
-     * Notification about new member requst in the group
-     */
-    public function serviceGetNotificationsJoinRequest($aEvent)
-    {
-        return $this->_serviceGetNotification($aEvent, $this->_oConfig->CNF['T']['txt_ntfs_join_request']);
-    }
-    
-	/**
-     * Notification about new member in the group
-     */
-    public function serviceGetNotificationsFanAdded($aEvent)
-    {
-        return $this->_serviceGetNotification($aEvent, $this->_oConfig->CNF['T']['txt_ntfs_fan_added']);
-    }
-
-    /**
-     * Entry post for Timeline module
-     */
-    public function serviceGetTimelinePost($aEvent)
-    {
-        $a = parent::serviceGetTimelinePost($aEvent);
-
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aEvent['object_id'], $this->getName());
-
-        $a['content']['url'] = $oGroupProfile->getUrl();
-        $a['content']['title'] = $oGroupProfile->getDisplayName();
-        
-        return $a;
-    }
-
-    /**
-     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
-     */
-    public function checkAllowedViewCoverImage ($aDataEntry, $isPerformAction = false)
-    {
-        $oPrivacy = BxDolPrivacy::getObjectInstance($this->_oConfig->CNF['OBJECT_PRIVACY_VIEW']);
-        if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = parent::checkAllowedViewCoverImage($aDataEntry)) && $oPrivacy->isPartiallyVisible($aDataEntry[$this->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']]))
-            return CHECK_ACTION_RESULT_ALLOWED;
-        
-        return $sMsg;
-    }
-
-    /**
-     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
-     */
-    public function checkAllowedViewProfileImage ($aDataEntry, $isPerformAction = false)
-    {
-        return $this->checkAllowedViewCoverImage($aDataEntry, $isPerformAction);
-    }
-
-    /**
-     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
-     */
-    public function checkAllowedPost ($aDataEntry, $isPerformAction = false)
-    {
-        if ($this->isFan($aDataEntry[$this->_oConfig->CNF['FIELD_ID']]))
-            return CHECK_ACTION_RESULT_ALLOWED;
-
-        return _t('_sys_txt_access_denied');
-    }
-
-    /**
-     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
-     */
-    public function checkAllowedView ($aDataEntry, $isPerformAction = false)
-    {
-        if ($this->isFan($aDataEntry[$this->_oConfig->CNF['FIELD_ID']]))
-            return CHECK_ACTION_RESULT_ALLOWED;
-
-        return parent::checkAllowedView ($aDataEntry, $isPerformAction);
-    }
-
-    /**
-     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
-     */
-    public function checkAllowedFanAdd (&$aDataEntry, $isPerformAction = false)
-    {
-        if (!$this->isFan($aDataEntry[$this->_oConfig->CNF['FIELD_ID']]) && isLogged())
-            return CHECK_ACTION_RESULT_ALLOWED;
-
-        return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, $this->_oConfig->CNF['OBJECT_CONNECTIONS'], true, false);
-    }
-
-    /**
-     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
-     */
-    public function checkAllowedFanRemove (&$aDataEntry, $isPerformAction = false)
-    {
-        if (CHECK_ACTION_RESULT_ALLOWED === $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, $this->_oConfig->CNF['OBJECT_CONNECTIONS'], false, true, true))
-            return CHECK_ACTION_RESULT_ALLOWED;
-        return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, $this->_oConfig->CNF['OBJECT_CONNECTIONS'], false, true, false);
-    }
-
-    public function checkAllowedManageAdmins ($mixedDataEntry, $isPerformAction = false)
-    {
-        if (is_array($mixedDataEntry)) {
-            $aDataEntry = $mixedDataEntry;
-        }
-        else {
-            $oGroupProfile = BxDolProfile::getInstance((int)$mixedDataEntry);
-            $aDataEntry = $oGroupProfile && $this->getName() == $oGroupProfile->getModule() ? $this->_oDb->getContentInfoById($oGroupProfile->getContentId()) : array();
-        }
-
-        return parent::checkAllowedEdit ($aDataEntry, $isPerformAction);
-    }
-
-    public function checkAllowedEdit ($aDataEntry, $isPerformAction = false)
-    {
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aDataEntry[$this->_oConfig->CNF['FIELD_ID']], $this->getName());
-        if ($this->_oDb->isAdmin($oGroupProfile->id(), bx_get_logged_profile_id(), $aDataEntry))
-            return CHECK_ACTION_RESULT_ALLOWED;
-        return parent::checkAllowedEdit ($aDataEntry, $isPerformAction);
-    }
-
-    public function checkAllowedChangeCover ($aDataEntry, $isPerformAction = false)
-    {
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aDataEntry[$this->_oConfig->CNF['FIELD_ID']], $this->getName());
-        if ($this->_oDb->isAdmin($oGroupProfile->id(), bx_get_logged_profile_id(), $aDataEntry))
-            return CHECK_ACTION_RESULT_ALLOWED;
-        return parent::checkAllowedChangeCover ($aDataEntry, $isPerformAction);
-    }
-
-    public function checkAllowedDelete (&$aDataEntry, $isPerformAction = false)
-    {
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aDataEntry[$this->_oConfig->CNF['FIELD_ID']], $this->getName());
-        if ($oGroupProfile && $this->_oDb->isAdmin($oGroupProfile->id(), bx_get_logged_profile_id(), $aDataEntry))
-            return CHECK_ACTION_RESULT_ALLOWED;
-        return parent::checkAllowedDelete ($aDataEntry, $isPerformAction);
-    }
-
-    public function checkAllowedSubscribeAdd (&$aDataEntry, $isPerformAction = false)
-    {
-        if (!$this->isFan($aDataEntry[$this->_oConfig->CNF['FIELD_ID']]))
-            return _t('_sys_txt_access_denied');
-
-        return parent::checkAllowedSubscribeAdd ($aDataEntry, $isPerformAction);
-    }
-
-    protected function _checkAllowedConnect (&$aDataEntry, $isPerformAction, $sObjConnection, $isMutual, $isInvertResult, $isSwap = false)
-    {
-        $sResult = $this->checkAllowedView($aDataEntry);
-
-        $oPrivacy = BxDolPrivacy::getObjectInstance($this->_oConfig->CNF['OBJECT_PRIVACY_VIEW']);
-
-        if (CHECK_ACTION_RESULT_ALLOWED !== $sResult && !$oPrivacy->isPartiallyVisible($aDataEntry[$this->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']]))
-            return $sResult;
-
-        return parent::_checkAllowedConnect ($aDataEntry, $isPerformAction, $sObjConnection, $isMutual, $isInvertResult, $isSwap);
-    }
-
-    public function isFan ($iContentId, $iProfileId = false) 
-    {
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->getName());
-
-        return $oGroupProfile && ($oConnection = BxDolConnection::getObjectInstance($this->_oConfig->CNF['OBJECT_CONNECTIONS'])) && $oConnection->isConnected($iProfileId ? $iProfileId : bx_get_logged_profile_id(), $oGroupProfile->id(), true);
-    }
-
-    protected function _getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl)
-    {
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aEvent['object_id'], $this->getName());
-                
-        return array(
-		    array('url' => $sUrl, 'src' => $oGroupProfile->getPicture()),
-		);
-    }
-
-    protected function _prepareProfileAndGroupProfile($iGroupProfileId, $iInitiatorId)
-    {
-        if (!($oGroupProfile = BxDolProfile::getInstance($iGroupProfileId)))
-            return array(0, 0, null);
-
-        if ($oGroupProfile->getModule() == $this->getName()) {
-            $iProfileId = $iInitiatorId;
-            $iGroupProfileId = $oGroupProfile->id();
-        } else {
-            $iProfileId = $oGroupProfile->id();
-            $iGroupProfileId = $iInitiatorId;
-        }
-
-        return array($iProfileId, $iGroupProfileId, $oGroupProfile);
-    }
 }
 
 /** @} */

+ 1 - 1
modules/boonex/groups/classes/BxGroupsPageBrowse.php

@@ -12,7 +12,7 @@
 /**
  * Browse entries pages.
  */
-class BxGroupsPageBrowse extends BxBaseModProfilePageBrowse
+class BxGroupsPageBrowse extends BxBaseModGroupsPageBrowse
 {
     public function __construct($aObject, $oTemplate = false)
     {

+ 1 - 23
modules/boonex/groups/classes/BxGroupsPageEntry.php

@@ -12,35 +12,13 @@
 /**
  * Profile create/edit/delete pages.
  */
-class BxGroupsPageEntry extends BxBaseModProfilePageEntry
+class BxGroupsPageEntry extends BxBaseModGroupsPageEntry
 {
     public function __construct($aObject, $oTemplate = false)
     {
         $this->MODULE = 'bx_groups';
         parent::__construct($aObject, $oTemplate);
     }
-
-    protected function _processPermissionsCheck ()
-    {
-        $CNF = &$this->_oModule->_oConfig->CNF;
-
-        $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
-        
-        $mixedAllowView = $this->_oModule->checkAllowedView($this->_aContentInfo);
-        if (!$oPrivacy->isPartiallyVisible($this->_aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) && CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $mixedAllowView)) {
-            $this->_oTemplate->displayAccessDenied($sMsg);
-            exit;
-        }
-        elseif ($oPrivacy->isPartiallyVisible($this->_aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) && $CNF['OBJECT_PAGE_VIEW_ENTRY'] == $this->_sObject && CHECK_ACTION_RESULT_ALLOWED !== $mixedAllowView) {
-            // replace current page with different set of blocks
-            $aObject = BxDolPageQuery::getPageObject($CNF['OBJECT_PAGE_VIEW_ENTRY_CLOSED']);
-            $this->_sObject = $aObject['object'];
-            $this->_aObject = $aObject;
-            $this->_oQuery = new BxDolPageQuery($this->_aObject);
-        }
-
-        $this->_oModule->checkAllowedView($this->_aContentInfo, true);
-    }
 }
 
 /** @} */

+ 1 - 1
modules/boonex/groups/classes/BxGroupsPageJoinedEntries.php

@@ -12,7 +12,7 @@
 /**
  * Entries user joined to.
  */
-class BxGroupsPageJoinedEntries extends BxBaseModTextPageAuthor
+class BxGroupsPageJoinedEntries extends BxBaseModGroupsPageJoinedEntries
 {
     public function __construct($aObject, $oTemplate = false)
     {

+ 1 - 48
modules/boonex/groups/classes/BxGroupsPrivacy.php

@@ -9,7 +9,7 @@
  * @{
  */
 
-class BxGroupsPrivacy extends BxBaseModProfilePrivacy
+class BxGroupsPrivacy extends BxBaseModGroupsPrivacy
 {
     public function __construct($aOptions, $oTemplate = false)
     {
@@ -17,53 +17,6 @@ class BxGroupsPrivacy extends BxBaseModProfilePrivacy
         $this->_aPrivacyParticallyVisible = array ('c', 5);
         parent::__construct($aOptions, $oTemplate);
     }
-
-	/**
-     * Check whethere viewer is a member of dynamic group.
-     *
-     * @param  mixed   $mixedGroupId   dynamic group ID.
-     * @param  integer $iObjectOwnerId object owner ID.
-     * @param  integer $iViewerId      viewer ID.
-     * @return boolean result of operation.
-     */
-    public function isDynamicGroupMember($mixedGroupId, $iObjectOwnerId, $iViewerId, $iObjectId)
-    {
-        if ('c' == $mixedGroupId)
-            return $this->isClosedGroupAccess($iObjectOwnerId, $iViewerId, $iObjectId);
-
-        if ('s' == $mixedGroupId)
-            return $this->isSecretGroupAccess($iObjectOwnerId, $iViewerId, $iObjectId);
-
-        return false;
-    }
-
-    public function isClosedGroupAccess ($iObjectOwnerId, $iViewerId, $iObjectId)
-    {
-        if (!($oConnection = BxDolConnection::getObjectInstance($this->_oModule->_oConfig->CNF['OBJECT_CONNECTIONS'])))
-            return false;
-
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($iObjectId, $this->MODULE);
-        return $oConnection->isConnected($iViewerId, $oGroupProfile->id(), true);
-    }
-
-    public function isSecretGroupAccess ($iObjectOwnerId, $iViewerId, $iObjectId)
-    {
-        return $this->isClosedGroupAccess($iObjectOwnerId, $iViewerId, $iObjectId);
-    }
-
-    static function getGroupChooser ($sObject, $iOwnerId = 0, $aParams = array())
-    {
-        if (!$iOwnerId)
-    		$iOwnerId = bx_get_logged_profile_id();
-
-		$aParams['dynamic_groups'] = array(
-			array ('key' => '', 'value' => '----'),
-			array ('key' => 'c', 'value' => _t('_bx_groups_privacy_group_closed')),
-			array ('key' => 's', 'value' => _t('_bx_groups_privacy_group_secret')),
-		);
-
-        return parent::getGroupChooser($sObject, $iOwnerId, $aParams);
-    }
 }
 
 /** @} */

+ 1 - 14
modules/boonex/groups/classes/BxGroupsPrivacyNotifications.php

@@ -9,25 +9,12 @@
  * @{
  */
 
-bx_import('Privacy', 'bx_groups');
-
-class BxGroupsPrivacyNotifications extends BxGroupsPrivacy
+class BxGroupsPrivacyNotifications extends BxBaseModGroupsPrivacyNotifications
 {
     function __construct($aOptions, $oTemplate = false)
     {
         parent::__construct($aOptions, $oTemplate);
     }
-
-    function check($iObjectId, $iViewerId = 0)
-    {
-        if (!parent::check($iObjectId, $iViewerId))
-            return false;
-
-        if (!($aEvent = BxDolService::call('bx_notifications', 'get_event_by_id', array($iObjectId))))
-            return false;
-
-        return $this->_oModule->_oDb->isAdmin($aEvent['object_owner_id'], $iViewerId ? $iViewerId : bx_get_logged_profile_id());
-    }
 }
 
 /** @} */

+ 1 - 29
modules/boonex/groups/classes/BxGroupsTemplate.php

@@ -12,41 +12,13 @@
 /*
  * Groups module representation.
  */
-class BxGroupsTemplate extends BxBaseModProfileTemplate
+class BxGroupsTemplate extends BxBaseModGroupsTemplate
 {
     function __construct(&$oConfig, &$oDb)
     {
         $this->MODULE = 'bx_groups';
         parent::__construct($oConfig, $oDb);
     }
-
-    function unitVars ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html')
-    {
-        $aVars = parent::unitVars ($aData, $isCheckPrivateContent, $sTemplateName);
-        
-        $CNF = &$this->_oConfig->CNF;
-
-        $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
-
-        $isPublic = CHECK_ACTION_RESULT_ALLOWED === $this->getModule()->checkAllowedView($aData) || $oPrivacy->isPartiallyVisible($aData[$CNF['FIELD_ALLOW_VIEW_TO']]);        
-        $oConn = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS']);
-
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aData[$CNF['FIELD_ID']], $this->MODULE);
-
-        $aVars['title'] = $isPublic ? bx_process_output($aData[$CNF['FIELD_NAME']]) : _t($CNF['T']['txt_private_group']);
-        $aVars['bx_if:info']['condition'] = true;
-        $aVars['bx_if:info']['content']['members'] = $isPublic ? _t($CNF['T']['txt_N_fans'], $oConn ? $oConn->getConnectedInitiatorsCount($oGroupProfile->id(), true) : 0) : '&nbsp;';
-        $aVars['bx_if:info']['content']['bx_if:btn'] = array (
-            'condition' => isLogged() && $isPublic && !$oConn->isConnected(bx_get_logged_profile_id(), $oGroupProfile->id(), true),
-            'content' => array (
-                'id' => $oGroupProfile->id(),
-                'title' => $oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $oGroupProfile->id()) ? _t($CNF['T']['menu_item_title_become_fan_sent']) : _t($CNF['T']['menu_item_title_become_fan']),
-                'object' => $CNF['OBJECT_CONNECTIONS'],
-            ),
-        );
-
-        return $aVars;
-    }
 }
 
 /** @} */

+ 1 - 1
modules/boonex/groups/template/account_link.html

@@ -1 +1 @@
-<bx_include_base:../modules/base/profile/template/account_link.html />
+<bx_include_base:../modules/base/groups/template/account_link.html />

+ 1 - 1
modules/boonex/groups/template/cover.html

@@ -1 +1 @@
-<bx_include_base:../modules/base/profile/template/cover.html />
+<bx_include_base:../modules/base/groups/template/cover.html />

+ 1 - 19
modules/boonex/groups/template/css/main.css

@@ -1,19 +1 @@
-@import url(../../../../base/profile/template/css/main.css);
-
-.bx-base-pofile-cover-info .bx-def-ava {
-    border-width:0.0625rem;
-    border-radius:0.1875rem;
-    -moz-border-radius:0.1875rem;
-    -webkit-border-radius:0.1875rem;
-}
-
-.bx-groups-unit-cover .bx-base-pofile-unit-cover .bx-def-thumb {
-    border-width:0.0625rem;
-    border-radius:0.1875rem;
-    -moz-border-radius:0.1875rem;
-    -webkit-border-radius:0.1875rem;
-}
-
-.bx-search-result-block {
-    text-align:center;
-}
+@import url(../../../../base/groups/template/css/main.css);

+ 1 - 1
modules/boonex/groups/template/entry-share.html

@@ -1,3 +1,3 @@
 
-<bx_include_base:../modules/base/text/template/entry-share.html />
+<bx_include_base:../modules/base/groups/template/entry-share.html />
 

+ 1 - 1
modules/boonex/groups/template/image_popup.html

@@ -1 +1 @@
-<bx_include_base:../modules/base/profile/template/image_popup.html />
+<bx_include_base:../modules/base/groups/template/image_popup.html />

+ 1 - 1
modules/boonex/groups/template/name_link.html

@@ -1 +1 @@
-<bx_include_base:../modules/base/profile/template/name_link.html />
+<bx_include_base:../modules/base/groups/template/name_link.html />

+ 1 - 1
modules/boonex/groups/template/picture_preview.html

@@ -1 +1 @@
-<bx_include_base:../modules/base/profile/template/picture_preview.html />
+<bx_include_base:../modules/base/groups/template/picture_preview.html />

+ 1 - 1
modules/boonex/groups/template/set_acl_popup.html

@@ -1 +1 @@
-<bx_include_base:../modules/base/profile/template/set_acl_popup.html />
+<bx_include_base:../modules/base/groups/template/set_acl_popup.html />

+ 1 - 2
modules/boonex/groups/template/unit.html

@@ -1,2 +1 @@
-<span class="bx-groups-unit-cover"><bx_include_base:../modules/base/profile/template/unit_with_cover.html /></span>
-
+<bx_include_base:../modules/base/groups/template/unit.html />

+ 1 - 3
modules/boonex/groups/template/unit_live_search.html

@@ -1,3 +1 @@
-
-<bx_include_base:../modules/base/general/template/unit_live_search.html />
-
+<bx_include_base:../modules/base/groups/template/unit_live_search.html />