Просмотр исходного кода

Ticket #4688 - Group based: Updates in 'Invite' action.

AntonLV 2 лет назад
Родитель
Сommit
32a3d7c10d

+ 17 - 2
modules/base/groups/classes/BxBaseModGroupsFormEntry.php

@@ -14,6 +14,8 @@
  */
 class BxBaseModGroupsFormEntry extends BxBaseModProfileFormEntry
 {
+    protected $_bDisplayInvite;
+
     public function __construct($aInfo, $oTemplate = false)
     {
         if (!isset($this->_bAllowChangeUserForAdmins))
@@ -23,8 +25,21 @@ class BxBaseModGroupsFormEntry extends BxBaseModProfileFormEntry
 
         $CNF = &$this->_oModule->_oConfig->CNF;
 
-        if (isset($this->aInputs['initial_members']) && !isset($this->aInputs['initial_members']['value'])) {
-            $this->aInputs['initial_members']['value'] = isset($CNF['OBJECT_FORM_ENTRY_DISPLAY_INVITE']) && $CNF['OBJECT_FORM_ENTRY_DISPLAY_INVITE'] == $this->aParams['display'] ? array() : array(bx_get_logged_profile_id());
+        $this->_bDisplayInvite = isset($CNF['OBJECT_FORM_ENTRY_DISPLAY_INVITE']) && $CNF['OBJECT_FORM_ENTRY_DISPLAY_INVITE'] == $this->aParams['display'];
+
+        if (isset($this->aInputs['initial_members'])) {
+            if(!isset($this->aInputs['initial_members']['value']))
+                $this->aInputs['initial_members']['value'] = $this->_bDisplayInvite ? [] : [bx_get_logged_profile_id()];
+
+            if($this->_bDisplayInvite)
+                $this->aInputs['initial_members'] = array_merge($this->aInputs['initial_members'], [
+                    'required' => 1,
+                    'checker' => [
+                        'func' => 'Avail',
+                        'params' => [],
+                        'error' => _t('_Enter_value_here'),
+                    ]                    
+                ]);
         }
     }
 

+ 13 - 8
modules/base/groups/classes/BxBaseModGroupsFormsEntryHelper.php

@@ -160,22 +160,27 @@ class BxBaseModGroupsFormsEntryHelper extends BxBaseModProfileFormsEntryHelper
     protected function redirectAfterEdit($aContentInfo, $sUrl = '')
     {
         $CNF = &$this->_oModule->_oConfig->CNF;
+
         $sUrl = '';
-        if (bx_get('initial_members') && isset($CNF['URL_ENTRY_FANS'])){
-            $sUrl = $CNF['URL_ENTRY_FANS'] . '&profile_id=' . $aContentInfo['profile_id'];
+        if(bx_get('initial_members')) {
+            if(isset($CNF['URL_ENTRY_MANAGE']))
+                $sUrl = $CNF['URL_ENTRY_MANAGE'];
+            else if(isset($CNF['URL_ENTRY_FANS']))
+                $sUrl = $CNF['URL_ENTRY_FANS'];
+
+            $sUrl = bx_append_url_params($sUrl, ['profile_id' => $aContentInfo['profile_id']]);
         }
-        else{
+        else
             $sUrl = 'page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']];
-        }
-        
-        if (bx_is_api())
+
+        if(bx_is_api())
             return bx_api_get_block('redirect', ['uri' => '/' . BxDolPermalinks::getInstance()->permalink($sUrl), 'timeout' => 1000]);
-        
+
         bx_alert($this->_oModule->getName(), 'redirect_after_edit', 0, false, array(
             'content' => $aContentInfo,
             'override_result' => &$sUrl,
         ));
-        
+
         $this->_redirectAndExit($sUrl);
     }
     

+ 3 - 2
modules/base/groups/classes/BxBaseModGroupsModule.php

@@ -1447,8 +1447,9 @@ class BxBaseModGroupsModule extends BxBaseModProfileModule
         $oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS']);
         if($oConnection)
             $a['content']['members'] = $oConnection->getConnectedInitiatorsCount($oGroupProfile->id(), true);
-        
-        $a['content']['visibility'] = $aEvent['object_privacy_view'];
+
+        if(isset($aEvent['object_privacy_view']))
+            $a['content']['visibility'] = $aEvent['object_privacy_view'];
 
         if(isset($CNF['FIELD_PUBLISHED'])) {
             $aContentInfo = $this->_oDb->getContentInfoById($aEvent['object_id']);

+ 1 - 0
modules/boonex/events/classes/BxEventsConfig.php

@@ -92,6 +92,7 @@ class BxEventsConfig extends BxBaseModGroupsConfig
 
             'URL_HOME' => 'page.php?i=events-home',
             'URL_ENTRY_FANS' => 'page.php?i=event-fans',
+            'URL_ENTRY_MANAGE' => 'page.php?i=event-manage',
             'URL_MANAGE_COMMON' => 'page.php?i=events-manage',
             'URL_MANAGE_ADMINISTRATION' => 'page.php?i=events-administration',
 

+ 1 - 0
modules/boonex/groups/classes/BxGroupsConfig.php

@@ -79,6 +79,7 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
 
             'URL_HOME' => 'page.php?i=groups-home',
             'URL_ENTRY_FANS' => 'page.php?i=group-fans',
+            'URL_ENTRY_MANAGE' => 'page.php?i=group-manage',
             'URL_MANAGE_COMMON' => 'page.php?i=groups-manage',
             'URL_MANAGE_ADMINISTRATION' => 'page.php?i=groups-administration',