RomanL 8 years ago
parent
commit
4e6aa33601

+ 23 - 23
modules/boonex/invites/classes/BxInvConfig.php

@@ -28,26 +28,26 @@ class BxInvConfig extends BxBaseModGeneralConfig
         parent::__construct($aModule);
 
         $this->CNF = array (
-        	'URL_INVITE' => 'page.php?i=invites-invite',
-        	'URL_REQUEST' => 'page.php?i=invites-request',
-        	'URL_REQUESTS' => 'page.php?i=invites-requests',
+            'URL_INVITE' => 'page.php?i=invites-invite',
+            'URL_REQUEST' => 'page.php?i=invites-request',
+            'URL_REQUESTS' => 'page.php?i=invites-requests',
             
             'TABLE_REQUESTS' => $aModule['db_prefix'] . 'requests',
             'TABLE_INVITES' => $aModule['db_prefix'] . 'invites',
         );
 
-		$this->_aObjects = array(
-			'alert' => $this->_sName,
-			'grid_requests' => $this->_sName . '_requests',
-			'form_invite' => $this->_sName . '_invite',
-			'form_request' => $this->_sName . '_request',
-			'form_display_invite_send' => $this->_sName . '_invite_send',
-			'form_display_request_send' => $this->_sName . '_request_send',
-		);
-
-		$this->_aPrefixes = array(
-        	'style' => 'bx-inv',
-        	'option' => 'bx_invites_',
+        $this->_aObjects = array(
+            'alert' => $this->_sName,
+            'grid_requests' => $this->_sName . '_requests',
+            'form_invite' => $this->_sName . '_invite',
+            'form_request' => $this->_sName . '_request',
+            'form_display_invite_send' => $this->_sName . '_invite_send',
+            'form_display_request_send' => $this->_sName . '_request_send',
+        );
+
+        $this->_aPrefixes = array(
+            'style' => 'bx-inv',
+            'option' => 'bx_invites_',
         );
 
         $this->_iCountPerUser = 0;
@@ -58,7 +58,7 @@ class BxInvConfig extends BxBaseModGeneralConfig
         $this->_bRegistrationByInvitation = true;
 
         $this->_aJsClasses = array(
-        	'main' => 'BxInvMain',
+            'main' => 'BxInvMain',
         );
         $this->_aJsObjects = array(
             'main' => 'oInvMain',
@@ -66,8 +66,8 @@ class BxInvConfig extends BxBaseModGeneralConfig
 
         $sHtmlPrefix = str_replace('_', '-', $this->_sName);
         $this->_aHtmlIds = array(
-        	'link_popup' => $sHtmlPrefix . '-link-popup',
-        	'link_input' => $sHtmlPrefix . '-link-input',
+            'link_popup' => $sHtmlPrefix . '-link-popup',
+            'link_input' => $sHtmlPrefix . '-link-input',
         );
     }
 
@@ -84,17 +84,17 @@ class BxInvConfig extends BxBaseModGeneralConfig
         $this->_bRegistrationByInvitation = getParam($sOptionPrefix . 'enable_reg_by_inv') == 'on';
     }
 
-	public function getCountPerUser()
+    public function getCountPerUser()
     {
         return $this->_iCountPerUser;
     }
 
-	public function getKeyCode()
+    public function getKeyCode()
     {
         return $this->_sKeyCode;
     }
 
-	public function getKeyLifetime()
+    public function getKeyLifetime()
     {
         return $this->_iKeyLifetime;
     }
@@ -109,12 +109,12 @@ class BxInvConfig extends BxBaseModGeneralConfig
         return $this->_sRequestsEmail;
     }
 
-	public function isRegistrationByInvitation()
+    public function isRegistrationByInvitation()
     {
         return $this->_bRegistrationByInvitation;
     }
 
-	public function getHtmlIds($sKey = '')
+    public function getHtmlIds($sKey = '')
     {
         if(empty($sKey))
             return $this->_aHtmlIds;

+ 102 - 37
modules/boonex/invites/classes/BxInvDb.php

@@ -29,24 +29,71 @@ class BxInvDb extends BxDolModuleDb
         $this->_sTableRequests = $CNF['TABLE_REQUESTS'];
     }
 
-	public function getInvites($aParams, $bReturnCount = false)
+    public function getInvites($aParams, $bReturnCount = false)
     {
-    	$aMethod = array('name' => 'getAll', 'params' => array(0 => 'query'));
+        $aMethod = array('name' => 'getAll', 'params' => array(0 => 'query'));
         $sSelectClause = $sJoinClause = $sWhereClause = $sOrderClause = $sLimitClause = "";
 
         $sSelectClause = "`{$this->_sTableInvites}`.*";
 
         switch($aParams['type']) {
             case 'count_by_account':
-            	$aMethod['name'] = 'getOne';
+                $aMethod['name'] = 'getOne';
                 $aMethod['params'][1] = array(
-                	'account_id' => $aParams['value']
+                    'account_id' => $aParams['value']
                 );
 
                 $sSelectClause = "COUNT(`{$this->_sTableInvites}`.`id`) AS `count`";
                 $sWhereClause = "AND `{$this->_sTableInvites}`.`account_id`=:account_id ";
                 $sLimitClause = "LIMIT 1";
                 break;
+            case 'count_by_request':
+                $aMethod['name'] = 'getOne';
+                $aMethod['params'][1] = array(
+                    'request_id' => $aParams['value']
+                );
+
+                $sSelectClause = "COUNT(`{$this->_sTableInvites}`.`id`) AS `count`";
+                $sWhereClause = "AND `{$this->_sTableInvites}`.`request_id`=:request_id ";
+                $sLimitClause = "LIMIT 1";
+                break;
+            case 'account_by_request':
+                $aMethod['name'] = 'getOne';
+                $aMethod['params'][1] = array(
+                    'request_id' => $aParams['value']
+                );
+
+                $sSelectClause = "MAX(`{$this->_sTableInvites}`.`joined_account_id`)";
+                $sWhereClause = "AND joined_account_id IS NOT NULL AND `{$this->_sTableInvites}`.`request_id`=:request_id ";
+                $sLimitClause = "LIMIT 1";
+                break;
+            case 'date_joined_by_request':
+                $aMethod['name'] = 'getOne';
+                $aMethod['params'][1] = array(
+                    'request_id' => $aParams['value']
+                );
+
+                $sSelectClause = "MAX(`{$this->_sTableInvites}`.`date_joined`)";
+                $sWhereClause = "AND joined_account_id IS NOT NULL AND `{$this->_sTableInvites}`.`request_id`=:request_id ";
+                $sLimitClause = "LIMIT 1";
+                break;
+            case 'invites_code_by_single':
+                $aMethod['name'] = 'getOne';
+                $aMethod['params'][1] = array(
+                    'keyvalue' => $aParams['value']
+                );
+
+                $sSelectClause = "GROUP_CONCAT(`{$this->_sTableInvites}`.`key` SEPARATOR ',')";
+                $sWhereClause = "AND `{$this->_sTableInvites}`.`request_id` IN (SELECT `request_id` FROM `{$this->_sTableInvites}` WHERE `key`=:keyvalue ) ";
+                $sLimitClause = "";
+                break;
+            case 'all':
+                $aMethod['name'] = 'getAll';
+                $aMethod['params'][1] = array(
+                    'request_id' => $aParams['value']
+                );
+                $sWhereClause = "AND `{$this->_sTableInvites}`.`request_id`=:request_id ";
+                break;
         }
 
         $sSql = "SELECT {select} FROM `{$this->_sTableInvites}` " . $sJoinClause . " WHERE 1 " . $sWhereClause . " {order} {limit}";
@@ -55,15 +102,15 @@ class BxInvDb extends BxDolModuleDb
         $aEntries = call_user_func_array(array($this, $aMethod['name']), $aMethod['params']);
 
         if(!$bReturnCount)
-        	return $aEntries;
+            return $aEntries;
 
         $aMethod['name'] = 'getOne';
-		$aMethod['params'][0] = str_replace(array('{select}', '{order}', '{limit}'), array("COUNT(*)", "", ""), $sSql);
+        $aMethod['params'][0] = str_replace(array('{select}', '{order}', '{limit}'), array("COUNT(*)", "", ""), $sSql);
 
-		return array($aEntries, (int)call_user_func_array(array($this, $aMethod['name']), $aMethod['params']));
+        return array($aEntries, (int)call_user_func_array(array($this, $aMethod['name']), $aMethod['params']));
     }
 
-	public function deleteInvites($aParams)
+    public function deleteInvites($aParams)
     {
         $sSql = "DELETE FROM `{$this->_sTableInvites}` WHERE " . $this->arrayToSQL($aParams, " AND ");
         return $this->query($sSql);
@@ -72,12 +119,13 @@ class BxInvDb extends BxDolModuleDb
     public function attachInviteToRequest($iReqestId, $iInviteId)
     {
         $aBindings = array(
-            'id' => $iReqestId,
-            'invite_id' => $iInviteId
+            'request_id' => $iReqestId,
+            'id' => $iInviteId
         );
-        $this->query("UPDATE `{$this->_sTableRequests}` SET invite_id=:invite_id WHERE id=:id", $aBindings);
+        $this->query("UPDATE `{$this->_sTableInvites}` SET request_id=:request_id WHERE `id`=:id", $aBindings);
+        $this->updateRequestStatusByRequestId(1, $iReqestId);
     }
-    
+     
     public function attachAccountIdToInvite($iAccountId, $sKey)
     {
         $aBindings = array(
@@ -86,6 +134,7 @@ class BxInvDb extends BxDolModuleDb
             'date_joined' => time(),
         );
         $this->query("UPDATE `{$this->_sTableInvites}` SET `joined_account_id`=:joined_account_id, `date_joined`=:date_joined WHERE `key`=:keyvalue", $aBindings);
+        $this->updateRequestStatusByInviteCode(3, $sKey);
     }
     
     public function updateDateSeenForInvite($sKey)
@@ -95,41 +144,41 @@ class BxInvDb extends BxDolModuleDb
             'keyvalue' => $sKey
         );
         $this->query("UPDATE `{$this->_sTableInvites}` SET `date_seen`=:date_seen WHERE `key`=:keyvalue", $aBindings);
+        $this->updateRequestStatusByInviteCode(2, $sKey);
     }
     
-    public function insertInvite($iAccountId, $iProfileId, $sKey, $sEmail, $iDate) 
+    public function insertInvite($iAccountId, $iProfileId, $sKey, $sEmail, $iDate)
     {
         $aBindings = array(
-			'account_id' => $iAccountId,
-			'profile_id' => $iProfileId,
-			'keyvalue' => $sKey,
-			'email' => $sEmail,
-			'date' => $iDate
-		);
-        $this->query("INSERT `{$this->_sTableInvites}` (account_id, profile_id, `key`, email, date) VALUES (:account_id, :profile_id, :keyvalue, :email, :date)", $aBindings);  
+            'account_id' => $iAccountId,
+            'profile_id' => $iProfileId,
+            'keyvalue' => $sKey,
+            'email' => $sEmail,
+            'date' => $iDate
+        );
+        $this->query("INSERT `{$this->_sTableInvites}` (account_id, profile_id, `key`, email, date) VALUES (:account_id, :profile_id, :keyvalue, :email, :date)", $aBindings);
         return (int)$this->lastId();
     }
 
-	public function getRequests($aParams, $bReturnCount = false)
+    public function getRequests($aParams, $bReturnCount = false)
     {
-    	$aMethod = array('name' => 'getAll', 'params' => array(0 => 'query'));
-        $sSelectClause = $sWhereClause = $sOrderClause = $sLimitClause = "";
-        $sJoinClause = " LEFT JOIN `{$this->_sTableInvites}` ON `bx_inv_invites`.`id` = `bx_inv_requests`.`invite_id` ";
-        $sSelectClause = "`{$this->_sTableRequests}`.*, `{$this->_sTableInvites}`.`date_seen`, `{$this->_sTableInvites}`.`date_joined`, `{$this->_sTableInvites}`.`joined_account_id` AS joined_account, `{$this->_sTableInvites}`.`date` AS `date_invite` ";
+        $aMethod = array('name' => 'getAll', 'params' => array(0 => 'query'));
+        $sSelectClause = $sWhereClause = $sJoinClause = $sOrderClause = $sLimitClause = "";
+        $sSelectClause = "`{$this->_sTableRequests}`.* ";
 
         switch($aParams['type']) {
-        	case 'by_id':
-        		$aMethod['name'] = 'getRow';
+            case 'by_id':
+                $aMethod['name'] = 'getRow';
                 $aMethod['params'][1] = array(
-                	'id' => $aParams['value']
+                    'id' => $aParams['value']
                 );
 
-        		$sWhereClause = "AND `{$this->_sTableRequests}`.`id`=:id ";
-        		$sLimitClause = "LIMIT 1";
-        		break;
+                $sWhereClause = "AND `{$this->_sTableRequests}`.`id`=:id ";
+                $sLimitClause = "LIMIT 1";
+                break;
 
             case 'count_all':
-            	$aMethod['name'] = 'getOne';
+                $aMethod['name'] = 'getOne';
 
                 $sSelectClause = "COUNT(`{$this->_sTableRequests}`.`id`) AS `count`";
                 $sLimitClause = "LIMIT 1";
@@ -137,17 +186,33 @@ class BxInvDb extends BxDolModuleDb
         }
 
         $sSql = "SELECT {select} FROM `{$this->_sTableRequests}` " . $sJoinClause . " WHERE 1 " . $sWhereClause . " {order} {limit}";
-
+       
         $aMethod['params'][0] = str_replace(array('{select}', '{order}', '{limit}'), array($sSelectClause, $sOrderClause, $sLimitClause), $sSql);
         $aEntries = call_user_func_array(array($this, $aMethod['name']), $aMethod['params']);
 
         if(!$bReturnCount)
-        	return $aEntries;
+            return $aEntries;
 
-		$aMethod['name'] = 'getOne';
-		$aMethod['params'][0] = str_replace(array('{select}', '{order}', '{limit}'), array("COUNT(*)", "", ""), $sSql);
+        $aMethod['name'] = 'getOne';
+        $aMethod['params'][0] = str_replace(array('{select}', '{order}', '{limit}'), array("COUNT(*)", "", ""), $sSql);
 
-		return array($aEntries, (int)call_user_func_array(array($this, $aMethod['name']), $aMethod['params']));
+        return array($aEntries, (int)call_user_func_array(array($this, $aMethod['name']), $aMethod['params']));
+    }
+    
+    private function updateRequestStatusByRequestId($iStatus, $iReqestId)
+    {
+        $aBindings = array(
+            'request_id' => $iReqestId,
+            'status' => $iStatus
+        );
+        $this->query("UPDATE `{$this->_sTableRequests}` SET `status`=:status WHERE `id`=:request_id", $aBindings);
+    }
+    
+    private function updateRequestStatusByInviteCode($iStatus, $sKey)
+    {
+        $iReqestId = $this->getOne("SELECT request_id FROM `{$this->_sTableInvites}` WHERE `key`=:keyvalue", array('keyvalue' => $sKey));
+        if ($iReqestId != "")
+            $this->updateRequestStatusByRequestId($iStatus, $iReqestId);
     }
 }
 

+ 5 - 5
modules/boonex/invites/classes/BxInvFormCheckerHelper.php

@@ -13,12 +13,12 @@ bx_import('BxDolForm');
 
 class BxInvFormCheckerHelper extends BxDolFormCheckerHelper
 {
-	static public function checkEmails($s)
+    static public function checkEmails($s)
     {
-    	$aEmails = preg_split("/[\s\n,;]+/", $s);
-    	foreach($aEmails as $sEmail)
-    		if(!empty($sEmail) && !self::checkEmail($sEmail))
-    			return false;
+        $aEmails = preg_split("/[\s\n,;]+/", $s);
+        foreach($aEmails as $sEmail)
+            if(!empty($sEmail) && !self::checkEmail($sEmail))
+                return false;
 
         return true;
     }

+ 92 - 101
modules/boonex/invites/classes/BxInvGridRequests.php

@@ -9,36 +9,36 @@
  * @{
  */
 
-define('BX_INV_FILTER_STATUS_NEW', 'new');
-define('BX_INV_FILTER_STATUS_INVITED', 'invited');
-define('BX_INV_FILTER_STATUS_SEEN', 'seen');
-define('BX_INV_FILTER_STATUS_JOINED', 'joined');
+define('BX_INV_FILTER_STATUS_NEW', 0);
+define('BX_INV_FILTER_STATUS_INVITED', 1);
+define('BX_INV_FILTER_STATUS_SEEN', 2);
+define('BX_INV_FILTER_STATUS_JOINED', 3);
 
 class BxInvGridRequests extends BxTemplGrid
 {
-	protected $_sModule;
-	protected $_oModule;
+    protected $_sModule;
+    protected $_oModule;
 
     protected $_sFilter1Name;
-	protected $_sFilter1Value;
-	protected $_aFilter1Values;
+    protected $_sFilter1Value;
+    protected $_aFilter1Values;
     protected $_sParamsDivider;
     
     public function __construct ($aOptions, $oTemplate = false)
     {
         parent::__construct ($aOptions, $oTemplate);
 
-		$this->_sModule = 'bx_invites';
-		$this->_oModule = BxDolModule::getInstance($this->_sModule);
+        $this->_sModule = 'bx_invites';
+        $this->_oModule = BxDolModule::getInstance($this->_sModule);
         
         $this->_sFilter1Name = 'filter1';
         $this->_aFilter1Values = array(
             '' => _t('_bx_invites_request_status_for_filter_all'),
-        	BX_INV_FILTER_STATUS_NEW => _t('_bx_invites_request_status_for_filter_new'),
+            BX_INV_FILTER_STATUS_NEW => _t('_bx_invites_request_status_for_filter_new'),
             BX_INV_FILTER_STATUS_INVITED => _t('_bx_invites_request_status_for_filter_invited'),
             BX_INV_FILTER_STATUS_SEEN => _t('_bx_invites_request_status_for_filter_seen'),
             BX_INV_FILTER_STATUS_JOINED => _t('_bx_invites_request_status_for_filter_joined')
-		);
+        );
         
         $sFilter1 = bx_get($this->_sFilter1Name);
         if(!empty($sFilter1)) {
@@ -52,30 +52,20 @@ class BxInvGridRequests extends BxTemplGrid
     {
         $CNF = $this->_oModule->_oConfig->CNF;
         $sTableRequests = $CNF['TABLE_REQUESTS'];
-        $sTableInvites = $CNF['TABLE_INVITES'];
         
-		if(strpos($sFilter, $this->_sParamsDivider) !== false)
+        if(strpos($sFilter, $this->_sParamsDivider) !== false)
             list($this->_sFilter1Value, $sFilter) = explode($this->_sParamsDivider, $sFilter);
        
         $sFilterSql = "";
-    	if(!empty($this->_sFilter1Value)){
-            switch ($this->_sFilter1Value) {
-                case BX_INV_FILTER_STATUS_NEW:
-                    $sFilterSql = " AND " . $sTableRequests . ".invite_id IS NULL ";
-                    break;
-                case BX_INV_FILTER_STATUS_INVITED:
-                    $sFilterSql = " AND " . $sTableRequests . ".invite_id IS NOT NULL AND " . $sTableInvites . ".date_seen IS  NULL AND " . $sTableInvites . ".joined_account_id IS NULL ";
-                    break;
-                case BX_INV_FILTER_STATUS_SEEN:
-                    $sFilterSql = " AND " . $sTableInvites . ".date_seen IS NOT NULL AND " . $sTableInvites . ".joined_account_id IS NULL";
-                    break;
-                case BX_INV_FILTER_STATUS_JOINED:
-                    $sFilterSql = " AND " . $sTableInvites . ".joined_account_id IS NOT NULL ";
-                    break;
+        if(isset($this->_sFilter1Value) && $this->_sFilter1Value != ''){
+            if ($this->_sFilter1Value == BX_INV_FILTER_STATUS_INVITED){
+                $sFilterSql = " AND " . $sTableRequests . ".`status` IN (" . BX_INV_FILTER_STATUS_INVITED . ', ' . BX_INV_FILTER_STATUS_SEEN . ', ' . BX_INV_FILTER_STATUS_JOINED . ')';
+            }
+            else{
+                $sFilterSql = " AND " . $sTableRequests . ".`status` = " . $this->_sFilter1Value;
             }
         }
         $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString($sFilterSql);
-
         return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
     }
     
@@ -107,32 +97,51 @@ class BxInvGridRequests extends BxTemplGrid
     
     public function performActionInfo()
     {
-    	$aIds = bx_get('ids');
+        $aIds = bx_get('ids');
         if(!$aIds || !is_array($aIds)) {
             echoJson(array());
             exit;
         }
 
         $aRequest = $this->_oModule->_oDb->getRequests(array('type' => 'by_id', 'value' => (int)array_shift($aIds)));
-		if(empty($aRequest) || !is_array($aRequest)){
+        if(empty($aRequest) || !is_array($aRequest)){
+            echoJson(array());
+            exit;
+        }
+
+        $sContent = BxTemplFunctions::getInstance()->transBox('bx-invites-info-popup', $this->_oModule->_oTemplate->getBlockRequestText($aRequest));
+
+        echoJson(array('popup' => array('html' => $sContent)));
+    }
+    
+    public function performActionInviteInfo()
+    {
+        $aIds = bx_get('ids');
+        if(!$aIds || !is_array($aIds)) {
+            echoJson(array());
+            exit;
+        }
+
+        $aRequest = $this->_oModule->_oDb->getInvites(array('type' => 'all', 'value' => (int)array_shift($aIds)));
+        if(empty($aRequest) || !is_array($aRequest)){
             echoJson(array());
             exit;
         }
 
-		$sContent = BxTemplFunctions::getInstance()->transBox('bx-invites-info-popup', $this->_oModule->_oTemplate->getBlockRequestText($aRequest));
+        $sContent = BxTemplFunctions::getInstance()->transBox('bx-invites-info-popup', $this->_oModule->_oTemplate->getBlockInviteInfo($aRequest));
 
-		echoJson(array('popup' => array('html' => $sContent)));
+        echoJson(array('popup' => array('html' => $sContent)));
     }
     
-	public function performActionInvite($aParams = array())
+    public function performActionInvite($aParams = array())
     {
-    	$iProfileId = $this->_oModule->getProfileId();
+        $iProfileId = $this->_oModule->getProfileId();
 
-    	$mixedAllowed = $this->_oModule->isAllowedInvite($iProfileId);
-    	if($mixedAllowed !== true) {
-	    	echoJson(array('msg' => $mixedAllowed));
-			exit;
-    	}
+        $mixedAllowed = $this->_oModule->isAllowedInvite($iProfileId);
+        if($mixedAllowed !== true) {
+            echoJson(array('msg' => $mixedAllowed));
+            exit;
+        }
 
         $iAffected = 0;
         $aIds = bx_get('ids');
@@ -145,18 +154,18 @@ class BxInvGridRequests extends BxTemplGrid
 
         $aIdsAffected = array ();
         foreach($aIds as $iId) {
-			$aRequest = $this->_oModule->_oDb->getRequests(array('type' => 'by_id', 'value' => $iId));
-			if(empty($aRequest) || !is_array($aRequest))
-				continue;
+            $aRequest = $this->_oModule->_oDb->getRequests(array('type' => 'by_id', 'value' => $iId));
+            if(empty($aRequest) || !is_array($aRequest))
+                continue;
             
             $iInviteId = -1;
-        	$mixedResult = $this->_oModule->invite(BX_INV_TYPE_FROM_SYSTEM, $aRequest['email'], $sText);
-        	if($mixedResult === false)
-        		continue;
+            $mixedResult = $this->_oModule->invite(BX_INV_TYPE_FROM_SYSTEM, $aRequest['email'], $sText);
+            if($mixedResult === false)
+                continue;
             else
                 $iInviteId = (int)$mixedResult[0];
-			$this->_oModule->isAllowedInvite($iProfileId, true);
-			$this->_oModule->_oDb->attachInviteToRequest($iId, $iInviteId);
+            $this->_oModule->isAllowedInvite($iProfileId, true);
+            $this->_oModule->_oDb->attachInviteToRequest($iId, $iInviteId);
             $aIdsAffected[] = $iId;
             $iAffected++;
         }
@@ -164,15 +173,15 @@ class BxInvGridRequests extends BxTemplGrid
         echoJson($iAffected ? array('grid' => $this->getCode(false), 'blink' => $aIdsAffected, 'msg' => _t('_bx_invites_msg_invitation_sent', $iAffected)) : array('msg' => _t('_bx_invites_err_invite')));
     }
     
-	public function performActionDelete($aParams = array())
+    public function performActionDelete($aParams = array())
     {
-    	$iProfileId = $this->_oModule->getProfileId();
+        $iProfileId = $this->_oModule->getProfileId();
 
-    	$mixedAllowed = $this->_oModule->isAllowedDeleteRequest($iProfileId);
-    	if($mixedAllowed !== true) {
-	    	echoJson(array('msg' => $mixedAllowed));
-			exit;
-    	}
+        $mixedAllowed = $this->_oModule->isAllowedDeleteRequest($iProfileId);
+        if($mixedAllowed !== true) {
+            echoJson(array('msg' => $mixedAllowed));
+            exit;
+        }
 
         $iAffected = 0;
         $aIds = bx_get('ids');
@@ -185,10 +194,10 @@ class BxInvGridRequests extends BxTemplGrid
 
         $aIdsAffected = array ();
         foreach($aIds as $iId) {
-        	if(!$oForm->delete($iId))
+            if(!$oForm->delete($iId))
                 continue;
 
-			$this->_oModule->isAllowedDeleteRequest($iProfileId, true);
+            $this->_oModule->isAllowedDeleteRequest($iProfileId, true);
 
             $aIdsAffected[] = $iId;
             $iAffected++;
@@ -219,18 +228,17 @@ class BxInvGridRequests extends BxTemplGrid
         $oForm = new BxTemplFormView(array());
         return $oForm->genRow($aInputSearch);
     }
-
     
     protected function _getFilterSelectOne($sFilterName, $sFilterValue, $aFilterValues)
     {
         if(empty($sFilterName) || empty($aFilterValues))
             return '';
 
-		$CNF = &$this->_oModule->_oConfig->CNF;
-		$sJsObject = $this->_oModule->_oConfig->getJsObject('main');
+        $CNF = &$this->_oModule->_oConfig->CNF;
+        $sJsObject = $this->_oModule->_oConfig->getJsObject('main');
 
-		foreach($aFilterValues as $sKey => $sValue)
-			$aFilterValues[$sKey] = _t($sValue);
+        foreach($aFilterValues as $sKey => $sValue)
+            $aFilterValues[$sKey] = _t($sValue);
 
         $aInputModules = array(
             'type' => 'select',
@@ -247,12 +255,12 @@ class BxInvGridRequests extends BxTemplGrid
         return $oForm->genRow($aInputModules);
     }
 
-	protected function _getCellNip($mixedValue, $sKey, $aField, $aRow)
+    protected function _getCellNip($mixedValue, $sKey, $aField, $aRow)
     {
         return parent::_getCellDefault(long2ip($mixedValue), $sKey, $aField, $aRow);
     }
 
-	protected function _getCellDate($mixedValue, $sKey, $aField, $aRow)
+    protected function _getCellDate($mixedValue, $sKey, $aField, $aRow)
     {
         return parent::_getCellDefault(bx_time_js($mixedValue), $sKey, $aField, $aRow);
     }
@@ -260,61 +268,44 @@ class BxInvGridRequests extends BxTemplGrid
     protected function _getCellStatus($mixedValue, $sKey, $aField, $aRow)
     {
         $sStatus = _t('_bx_invites_request_status_new');
-        if($aRow["invite_id"] != "")
-            $sStatus = _t('_bx_invites_request_status_invited');
-        if($aRow["date_seen"] != "")
-            $sStatus = _t('_bx_invites_request_status_seen');
-        if($aRow["joined_account"] != "")
-            $sStatus = _t('_bx_invites_request_status_joined');
+        switch ($mixedValue) {
+            case 1:
+            case 2:
+                $sLinkHtml = $this->_oTemplate->parseLink('javascript:void(0)', $this->_oModule->_oDb->getInvites(array('type' => 'count_by_request', 'value' => $aRow['id'])), array(
+                    'title' => _t('_bx_invites_grid_action_title_adm_invite_info'),
+                    'bx_grid_action_single' => 'invite_info',
+                    'bx_grid_action_data' => $aRow['id']
+                ));
+                $sStatus = ($mixedValue == 1 ? _t('_bx_invites_request_status_invited') : _t('_bx_invites_request_status_seen')) . ' (' . $sLinkHtml . ')';
+                break;
+            case 3:
+                $sStatus = _t('_bx_invites_request_status_joined') . ' (' . bx_time_js($this->_oModule->_oDb->getInvites(array('type' => 'date_joined_by_request', 'value' => $aRow['id']))) . ')';
+                break;
+        }
         return parent::_getCellDefault($sStatus, $sKey, $aField, $aRow);
     }
     
-    protected function _getCellDateSeen($mixedValue, $sKey, $aField, $aRow)
-    {
-        return parent::_getCellDefault($this->getDateValueOrEmpty($mixedValue), $sKey, $aField, $aRow);
-    }
-    
-    protected function _getCellDateJoined($mixedValue, $sKey, $aField, $aRow)
-    {
-        return parent::_getCellDefault($this->getDateValueOrEmpty($mixedValue), $sKey, $aField, $aRow);
-    }
-    
     protected function _getCellJoinedAccount($mixedValue, $sKey, $aField, $aRow)
     {
         $sAccountInfo = "";
-        if ($mixedValue != 'undefined') {
-            $iAccountId = (int)$mixedValue;
-            $oJoinedProfile = BxDolProfile::getInstanceByAccount($iAccountId);
-            if ($oJoinedProfile->getModule() != 'system') {
-                $sAccountInfo = $this->_oModule->_oTemplate->parseHtmlByName('member_link.html', array(
-                    'href' => $oJoinedProfile->getUrl(),
-                    'content' => $oJoinedProfile->getDisplayName()
-        	        )
-                );
-            }
-            else {
-                $sAccountInfo = BxDolAccount::getInstance($iAccountId)->getDisplayName();
-            }
+        if(isset($aRow["status"]) && $aRow["status"] == 3){
+            $sAccountInfo = $this->_oModule->_oTemplate->getProfilesByAccount($this->_oModule->_oDb->getInvites(array('type' => 'account_by_request', 'value' => $aRow['id'])));
         }
         return parent::_getCellDefault($sAccountInfo, $sKey, $aField, $aRow);
     }
     
-    protected function _getCellDateInvite($mixedValue, $sKey, $aField, $aRow)
-    {
-        return parent::_getCellDefault($this->getDateValueOrEmpty($mixedValue), $sKey, $aField, $aRow);
-    }
-    
     protected function _getActionInvite($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
     {
-        if(isset($aRow["invite_id"]) && $aRow["invite_id"] != "")
+        if(isset($aRow["status"]) && $aRow["status"] == 3)
             return '';
         return parent::_getActionDefault ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
     }
     
-    private function getDateValueOrEmpty($sValue)
+    protected function _getActionInviteInfo ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
     {
-        return $sValue != 'undefined' ? bx_time_js($sValue) : '';
+        return '';
     }
+    
 }
 
 /** @} */

+ 140 - 140
modules/boonex/invites/classes/BxInvModule.php

@@ -26,41 +26,41 @@ class BxInvModule extends BxDolModule
         $this->_oConfig->init($this->_oDb);
     }
 
-	/**
+    /**
      * ACTION METHODS
      */
-	function actionGetLink()
+    function actionGetLink()
     {
-    	$iProfileId = $this->getProfileId();
-		$iAccountId = $this->getAccountId($iProfileId);
+        $iProfileId = $this->getProfileId();
+        $iAccountId = $this->getAccountId($iProfileId);
 
         $mixedAllowed = $this->isAllowedInvite($iProfileId);
         if($mixedAllowed !== true)
-        	return echoJson(array('message' => $mixedAllowed));
+            return echoJson(array('message' => $mixedAllowed));
 
-	    if(!isAdmin($iAccountId)) {
-			$iInvited = (int)$this->_oDb->getInvites(array('type' => 'count_by_account', 'value' => $iAccountId));
-			if(($this->_oConfig->getCountPerUser() - $iInvited) <= 0)
-				return echoJson(array('message' => _t('_bx_invites_err_limit_reached')));
-		}
+        if(!isAdmin($iAccountId)) {
+            $iInvited = (int)$this->_oDb->getInvites(array('type' => 'count_by_account', 'value' => $iAccountId));
+            if(($this->_oConfig->getCountPerUser() - $iInvited) <= 0)
+                return echoJson(array('message' => _t('_bx_invites_err_limit_reached')));
+        }
 
-    	$oKeys = BxDolKey::getInstance();
-    	if(!$oKeys)
-    		return  echoJson(array('message' => _t('_bx_invites_err_not_available')));  		
+        $oKeys = BxDolKey::getInstance();
+        if(!$oKeys)
+            return  echoJson(array('message' => _t('_bx_invites_err_not_available')));
 
-    	$sKey = $oKeys->getNewKey(false, $this->_oConfig->getKeyLifetime());
+        $sKey = $oKeys->getNewKey(false, $this->_oConfig->getKeyLifetime());
 
-    	$oForm = $this->getFormObjectInvite();
-    	$oForm->insert(array(
-			'account_id' => $iAccountId,
-			'profile_id' => $iProfileId,
-			'key' => $sKey,
-			'email' => '',
-			'date' => time()
-		));
+        $oForm = $this->getFormObjectInvite();
+        $oForm->insert(array(
+            'account_id' => $iAccountId,
+            'profile_id' => $iProfileId,
+            'key' => $sKey,
+            'email' => '',
+            'date' => time()
+        ));
 
         echoJson(array('popup' => $this->_oTemplate->getLinkPopup(
-        	$this->getJoinLink($sKey)
+            $this->getJoinLink($sKey)
         )));
     }
     
@@ -116,20 +116,20 @@ class BxInvModule extends BxDolModule
      */
     public function serviceGetBlockInvite()
     {
-		$iProfileId = $this->getProfileId();
-		$iAccountId = $this->getAccountId($iProfileId);
+        $iProfileId = $this->getProfileId();
+        $iAccountId = $this->getAccountId($iProfileId);
 
-		$mixedAllowed = $this->isAllowedInvite($iProfileId);
+        $mixedAllowed = $this->isAllowedInvite($iProfileId);
         if($mixedAllowed !== true)
             return '';
 
-		$iInvited = (int)$this->_oDb->getInvites(array('type' => 'count_by_account', 'value' => $iAccountId));
-		if(!isAdmin($iAccountId) && $iInvited >= $this->_oConfig->getCountPerUser())
-			return '';
+        $iInvited = (int)$this->_oDb->getInvites(array('type' => 'count_by_account', 'value' => $iAccountId));
+        if(!isAdmin($iAccountId) && $iInvited >= $this->_oConfig->getCountPerUser())
+            return '';
 
-    	return array(
-    		'content' => $this->_oTemplate->getBlockInvite($iAccountId, $iProfileId)
-    	);
+        return array(
+            'content' => $this->_oTemplate->getBlockInvite($iAccountId, $iProfileId)
+        );
     }
 
     /**
@@ -157,9 +157,9 @@ class BxInvModule extends BxDolModule
         $sResult = '';
         $oForm->initChecker();
         if($oForm->isSubmittedAndValid()) {
-        	
+            
             $sResult = $this->processFormObjectInvite($oForm);
-        	$sResult = MsgBox($sResult);
+            $sResult = MsgBox($sResult);
         }
 
         return array(
@@ -192,7 +192,7 @@ class BxInvModule extends BxDolModule
             exit;
         }
 
-    	return array(
+        return array(
             'content' => $mixedResult
         );
     }
@@ -222,9 +222,9 @@ class BxInvModule extends BxDolModule
         if(!$oGrid)
             return '';
 
-		$this->_oTemplate->addCss(array('main.css'));
+        $this->_oTemplate->addCss(array('main.css'));
         $this->_oTemplate->addJsTranslation(array('_sys_grid_search'));
-		return  $this->_oTemplate->getJsCode('main') . $oGrid->getCode();
+        return  $this->_oTemplate->getJsCode('main') . $oGrid->getCode();
     }
 
     /**
@@ -244,12 +244,12 @@ class BxInvModule extends BxDolModule
     /** 
      * @ref bx_invites-get_menu_addon_requests "get_menu_addon_requests"
      */
-	public function serviceGetMenuAddonRequests()
-	{
+    public function serviceGetMenuAddonRequests()
+    {
         return $this->_oDb->getRequests(array('type' => 'count_all'));
-	}
+    }
 
-	/**
+    /**
      * @page service Service Calls
      * @section bx_invites Invitations
      * @subsection bx_invites-other Other
@@ -266,95 +266,95 @@ class BxInvModule extends BxDolModule
     /** 
      * @ref bx_invites-account_add_form_check "account_add_form_check"
      */
-	public function serviceAccountAddFormCheck()
-	{
-	    $sReturn = '';
-    	if (!$this->_oConfig->isRegistrationByInvitation())
-    		return $sReturn;
+    public function serviceAccountAddFormCheck()
+    {
+        $sReturn = '';
+        if (!$this->_oConfig->isRegistrationByInvitation())
+            return $sReturn;
 
-    	$oSession = BxDolSession::getInstance();
-		$sKeyCode = $this->_oConfig->getKeyCode();
+        $oSession = BxDolSession::getInstance();
+        $sKeyCode = $this->_oConfig->getKeyCode();
 
-		$bKey = bx_get($sKeyCode) !== false;
-		if($bKey) {
-			$sKey = bx_process_input(bx_get($sKeyCode));
+        $bKey = bx_get($sKeyCode) !== false;
+        if($bKey) {
+            $sKey = bx_process_input(bx_get($sKeyCode));
 
-        	$oKeys = BxDolKey::getInstance();
-        	if($oKeys && $oKeys->isKeyExists($sKey))
-		    	$oSession->setValue($sKeyCode, $sKey);
-		}
+            $oKeys = BxDolKey::getInstance();
+            if($oKeys && $oKeys->isKeyExists($sKey))
+                $oSession->setValue($sKeyCode, $sKey);
+        }
 
-		$sKey = $oSession->getValue($sKeyCode);
-		if($sKey !== false)
-		    return $sReturn;
+        $sKey = $oSession->getValue($sKeyCode);
+        if($sKey !== false)
+            return $sReturn;
 
         if($bKey)
             $sReturn .= MsgBox(_t('_bx_invites_err_used'));
         $sReturn .= $this->_oTemplate->getBlockRequest();
 
         return $sReturn;
-	}
-
-	public function invite($sType, $sEmails, $sText, $mixedLimit = false, $oForm = null)
-	{
-		$iProfileId = $this->getProfileId();
-		$iAccountId = $this->getAccountId($iProfileId);
-
-		$oKeys = BxDolKey::getInstance();
-		if(!$oKeys || !in_array($sType, array(BX_INV_TYPE_FROM_MEMBER, BX_INV_TYPE_FROM_SYSTEM)))
-			return false;
-
-		$iKeyLifetime = $this->_oConfig->getKeyLifetime();
-
-		$sEmailTemplate = '';
-		switch($sType) {
-			case BX_INV_TYPE_FROM_MEMBER:
-				$sEmailTemplate = 'bx_invites_invite_form_message';
-				break;
-
-			case BX_INV_TYPE_FROM_SYSTEM:
-				$sEmailTemplate = 'bx_invites_invite_by_request_message';
-				break;
-		}
-
-		if(empty($oForm))
-			$oForm = $this->getFormObjectInvite();
-
-		$aMessage = BxDolEmailTemplates::getInstance()->parseTemplate($sEmailTemplate, array(
-			'text' => $sText
-		), $iAccountId, $iProfileId);
-
-		$aAccountIds = array();
-		$iDate = time();
-		$aEmails = preg_split("/[\s\n,;]+/", $sEmails);
-		if(is_array($aEmails) && !empty($aEmails)){
-			foreach($aEmails as $sEmail) {
-				if($mixedLimit !== false && (int)$mixedLimit <= 0)
-					break;
-
-				$sEmail = trim($sEmail);
-				if(empty($sEmail))
-					continue;
-
-				$sKey = $oKeys->getNewKey(false, $iKeyLifetime);
-				if(sendMail($sEmail, $aMessage['Subject'], $aMessage['Body'], 0, array('join_url' => $this->getJoinLink($sKey), 'seen_image_url' => $this->getSeenImageUrl($sKey)), BX_EMAIL_SYSTEM)) {
-					$iInviteId = (int)$this->_oDb->insertInvite($iAccountId, $iProfileId, $sKey, $sEmail, $iDate);
+    }
+
+    public function invite($sType, $sEmails, $sText, $mixedLimit = false, $oForm = null)
+    {
+        $iProfileId = $this->getProfileId();
+        $iAccountId = $this->getAccountId($iProfileId);
+
+        $oKeys = BxDolKey::getInstance();
+        if(!$oKeys || !in_array($sType, array(BX_INV_TYPE_FROM_MEMBER, BX_INV_TYPE_FROM_SYSTEM)))
+            return false;
+
+        $iKeyLifetime = $this->_oConfig->getKeyLifetime();
+
+        $sEmailTemplate = '';
+        switch($sType) {
+            case BX_INV_TYPE_FROM_MEMBER:
+                $sEmailTemplate = 'bx_invites_invite_form_message';
+                break;
+
+            case BX_INV_TYPE_FROM_SYSTEM:
+                $sEmailTemplate = 'bx_invites_invite_by_request_message';
+                break;
+        }
+
+        if(empty($oForm))
+            $oForm = $this->getFormObjectInvite();
+
+        $aMessage = BxDolEmailTemplates::getInstance()->parseTemplate($sEmailTemplate, array(
+            'text' => $sText
+        ), $iAccountId, $iProfileId);
+
+        $aAccountIds = array();
+        $iDate = time();
+        $aEmails = preg_split("/[\s\n,;]+/", $sEmails);
+        if(is_array($aEmails) && !empty($aEmails)){
+            foreach($aEmails as $sEmail) {
+                if($mixedLimit !== false && (int)$mixedLimit <= 0)
+                    break;
+
+                $sEmail = trim($sEmail);
+                if(empty($sEmail))
+                    continue;
+
+                $sKey = $oKeys->getNewKey(false, $iKeyLifetime);
+                if(sendMail($sEmail, $aMessage['Subject'], $aMessage['Body'], 0, array('join_url' => $this->getJoinLink($sKey), 'seen_image_url' => $this->getSeenImageUrl($sKey)), BX_EMAIL_SYSTEM)) {
+                    $iInviteId = (int)$this->_oDb->insertInvite($iAccountId, $iProfileId, $sKey, $sEmail, $iDate);
                     array_push($aAccountIds, $iInviteId);
-					
+                    
                     $this->onInvite($iAccountId, $iProfileId);
-					
-                    if($mixedLimit !== false) 
-						$mixedLimit -= 1;					
-				}
-			}
+                    
+                    if($mixedLimit !== false)
+                        $mixedLimit -= 1;
+                }
+            }
         }
-		return $aAccountIds;
-	}
+        return $aAccountIds;
+    }
     
     public function processFormObjectInvite($oForm)
     {
         $iProfileId = $this->getProfileId();
-		$iAccountId = $this->getAccountId($iProfileId);
+        $iAccountId = $this->getAccountId($iProfileId);
 
         $mixedAllowed = $this->isAllowedInvite($iProfileId);
         if($mixedAllowed !== true)
@@ -362,15 +362,15 @@ class BxInvModule extends BxDolModule
                 'content' => MsgBox($mixedAllowed)
             );
 
-		$mixedInvites = false;
-		if(!isAdmin($iAccountId)) {
-			$iInvited = (int)$this->_oDb->getInvites(array('type' => 'count_by_account', 'value' => $iAccountId));
-			$mixedInvites = $this->_oConfig->getCountPerUser() - $iInvited;
-			if($mixedInvites <= 0)
-				return array(
-					'content' => MsgBox(_t('_bx_invites_err_limit_reached'))
-				);
-		}
+        $mixedInvites = false;
+        if(!isAdmin($iAccountId)) {
+            $iInvited = (int)$this->_oDb->getInvites(array('type' => 'count_by_account', 'value' => $iAccountId));
+            $mixedInvites = $this->_oConfig->getCountPerUser() - $iInvited;
+            if($mixedInvites <= 0)
+                return array(
+                    'content' => MsgBox(_t('_bx_invites_err_limit_reached'))
+                );
+        }
         
         $sEmails = bx_process_input($oForm->getCleanValue('emails'));
         $sText = bx_process_pass($oForm->getCleanValue('text'));
@@ -383,19 +383,19 @@ class BxInvModule extends BxDolModule
         return  $sResult;
     }
 
-	public function isAllowedInvite($iProfileId, $bPerform = false)
+    public function isAllowedInvite($iProfileId, $bPerform = false)
     {
         $aCheckResult = checkActionModule($iProfileId, 'invite', $this->getName(), $bPerform);
         return $aCheckResult[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED ? $aCheckResult[CHECK_ACTION_MESSAGE] : true;
     }
 
-	public function isAllowedRequest($iProfileId, $bPerform = false)
+    public function isAllowedRequest($iProfileId, $bPerform = false)
     {
         $aCheckResult = checkActionModule($iProfileId, 'request', $this->getName(), $bPerform);
         return $aCheckResult[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED ? $aCheckResult[CHECK_ACTION_MESSAGE] : true;
     }
 
-	public function isAllowedDeleteRequest($iProfileId, $bPerform = false)
+    public function isAllowedDeleteRequest($iProfileId, $bPerform = false)
     {
         $aCheckResult = checkActionModule($iProfileId, 'delete request', $this->getName(), $bPerform);
         return $aCheckResult[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED ? $aCheckResult[CHECK_ACTION_MESSAGE] : true;
@@ -415,11 +415,11 @@ class BxInvModule extends BxDolModule
         return $oProfile;
     }
 
-	public function getAccountId($iProfileId)
+    public function getAccountId($iProfileId)
     {
-    	$oProfile = $this->getProfileObject($iProfileId);
-    	if($oProfile->id() == 0)
-    		return 0;
+        $oProfile = $this->getProfileObject($iProfileId);
+        if($oProfile->id() == 0)
+            return 0;
 
         return $oProfile->getAccountId();
     }
@@ -434,7 +434,7 @@ class BxInvModule extends BxDolModule
         //--- Event -> Invite for Alerts Engine ---//
     }
 
-	protected function onRequest()
+    protected function onRequest()
     {
         //--- Event -> Request for Alerts Engine ---//
         $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'request');
@@ -444,25 +444,25 @@ class BxInvModule extends BxDolModule
 
     public function getFormObjectInvite($sDisplay = '')
     {
-    	if(empty($sDisplay))
-    		$sDisplay = $this->_oConfig->getObject('form_display_invite_send');
+        if(empty($sDisplay))
+            $sDisplay = $this->_oConfig->getObject('form_display_invite_send');
 
         bx_import('FormCheckerHelper', $this->_aModule);
         return BxDolForm::getObjectInstance($this->_oConfig->getObject('form_invite'), $sDisplay);
     }
 
-	protected function getJoinLink($sKey)
-	{
-		$sKeyCode = $this->_oConfig->getKeyCode();
+    protected function getJoinLink($sKey)
+    {
+        $sKeyCode = $this->_oConfig->getKeyCode();
 
-		$sJoinUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account');
-		return bx_append_url_params($sJoinUrl, array($sKeyCode => $sKey));
-	}
+        $sJoinUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account');
+        return bx_append_url_params($sJoinUrl, array($sKeyCode => $sKey));
+    }
     
     protected function getSeenImageUrl($sKey)
-	{
+    {
         return  BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'SetSeenMark/' . $sKey . "/";
-	}
+    }
     
     public function attachAccountIdToInvite($iAccountId, $sKey)
     {

+ 25 - 19
modules/boonex/invites/classes/BxInvResponse.php

@@ -11,8 +11,8 @@
 
 class BxInvResponse extends BxDolAlertsResponse
 {
-	protected $_sModule;
-	protected $_oModule;
+    protected $_sModule;
+    protected $_oModule;
 
     public function __construct()
     {
@@ -29,11 +29,11 @@ class BxInvResponse extends BxDolAlertsResponse
      */
     public function response($oAlert)
     {
-		$sMethod = '_process' . bx_gen_method_name($oAlert->sUnit . '_' . $oAlert->sAction);
-		if(!method_exists($this, $sMethod))
-			return;
+        $sMethod = '_process' . bx_gen_method_name($oAlert->sUnit . '_' . $oAlert->sAction);
+        if(!method_exists($this, $sMethod))
+            return;
 
-		return $this->$sMethod($oAlert);
+        return $this->$sMethod($oAlert);
     }
 
     protected function _processAccountAddForm($oAlert)
@@ -45,25 +45,31 @@ class BxInvResponse extends BxDolAlertsResponse
 
     protected function _processAccountAdded($oAlert)
     {
-    	if(!$this->_oModule->_oConfig->isRegistrationByInvitation())
-    		return;
+        if(!$this->_oModule->_oConfig->isRegistrationByInvitation())
+            return;
 
-    	$sKeyCode = $this->_oModule->_oConfig->getKeyCode();
-    	$sKey = BxDolSession::getInstance()->getUnsetValue($sKeyCode);
-    	if($sKey === false)
-    		return;
+        $sKeyCode = $this->_oModule->_oConfig->getKeyCode();
+        $sKey = BxDolSession::getInstance()->getUnsetValue($sKeyCode);
+        if($sKey === false)
+            return;
         $this->_oModule->attachAccountIdToInvite($oAlert->iObject, $sKey);
-
-		$oKeys = BxDolKey::getInstance();
-    	if($oKeys && $oKeys->isKeyExists($sKey))
-    		$oKeys->removeKey($sKey);
-
-    	return;
+        
+        $sKeysToRemove = $this->_oModule->_oDb->getInvites(array('type' => 'invites_code_by_single', 'value' => $sKey));
+        $aKeysToRemove = explode(',', $sKeysToRemove);
+        $oKeys = BxDolKey::getInstance();
+        if($oKeys){
+            foreach($aKeysToRemove as $sKeyToRemove) {
+                if($oKeys->isKeyExists($sKeyToRemove))
+                    $oKeys->removeKey($sKeyToRemove);
+            }
+        }
+        
+        return;
     }
 
     protected function _processProfileDelete($oAlert)
     {
-    	$this->_oModule->_oDb->deleteInvites(array('profile_id' => $oAlert->iObject));
+        $this->_oModule->_oDb->deleteInvites(array('profile_id' => $oAlert->iObject));
     }
 }
 

+ 138 - 85
modules/boonex/invites/classes/BxInvTemplate.php

@@ -16,16 +16,16 @@ class BxInvTemplate extends BxBaseModGeneralTemplate
         parent::__construct($oConfig, $oDb);
     }
 
-	public function getCssJs()
+    public function getCssJs()
     {
         $this->addCss(array(
             'main.css',
         ));
 
         $this->addJs(array(
-        	'clipboard.min.js',
-        	'jquery.form.min.js', 
-        	'jquery.anim.js',
+            'clipboard.min.js',
+            'jquery.form.min.js',
+            'jquery.anim.js',
             'main.js'
         ));
     }
@@ -38,86 +38,81 @@ class BxInvTemplate extends BxBaseModGeneralTemplate
 
     public function getBlockRequestText($aRequest)
     {
-    	return $this->parseHtmlByName('request_text.html', array(
-			'style_prefix' => $this->_oConfig->getPrefix('style'),
-			'text' => bx_process_output(nl2br($aRequest['text']), BX_DATA_TEXT_MULTILINE),
-            'bx_if:show_date_invite' => array(
-    			'condition' => $aRequest['date_invite'] != '',
-    			'content' => array(
-    				'title' => _t('_bx_invites_grid_column_title_date_invite'),
-                    'value' => bx_time_js($aRequest['date_invite'], BX_FORMAT_DATE_TIME, true)
-    			)
-    		),
-            'bx_if:show_date_seen' => array(
-    			'condition' => $aRequest['date_seen'] != '',
-    			'content' => array(
-    				'title' => _t('_bx_invites_grid_column_title_date_seen'),
-                    'value' => bx_time_js($aRequest['date_seen'], BX_FORMAT_DATE_TIME, true)
-    			)
-    		),
-            'bx_if:show_date_joined' => array(
-    			'condition' => $aRequest['date_joined'] != '',
-    			'content' => array(
-    				'title' => _t('_bx_invites_grid_column_title_date_joined'),
-                    'value' => bx_time_js($aRequest['date_joined'], BX_FORMAT_DATE_TIME, true)
-    			)
-    		)
-		));
+        return $this->parseHtmlByName('request_text.html', array(
+            'style_prefix' => $this->_oConfig->getPrefix('style'),
+            'text' => bx_process_output(nl2br($aRequest['text']), BX_DATA_TEXT_MULTILINE),
+        ));
     }
-
+    
+    public function getBlockInviteInfo($aRequest)
+    {
+        $aVars = array(
+            'date_sent_title' => _t('_bx_invites_title_date_invite_sent'),
+            'date_seen_title' => _t('_bx_invites_title_date_invite_seen'),
+            'bx_repeat:items' => array()
+        );
+        foreach ($aRequest as $r) {
+            $aVars['bx_repeat:items'][] = array (
+                 'date_sent' => bx_time_js($r['date'], BX_FORMAT_DATE_TIME, true),
+                 'date_seen' => ($r['date_seen'] != '' ? bx_time_js($r['date_seen'], BX_FORMAT_DATE_TIME, true) : ' - ')
+            );
+        }
+        return $this->parseHtmlByName('invite_info.html', $aVars);
+    }
+    
     public function getBlockInvite($iAccountId, $iProfileId)
     {
-    	$sInvitesRemain = '';
-    	if(!isAdmin($iAccountId)) {
-	    	$iInvites = $this->_oConfig->getCountPerUser();
-	        $iInvited = $this->_oDb->getInvites(array('type' => 'count_by_account', 'value' => $iAccountId));
+        $sInvitesRemain = '';
+        if(!isAdmin($iAccountId)) {
+            $iInvites = $this->_oConfig->getCountPerUser();
+            $iInvited = $this->_oDb->getInvites(array('type' => 'count_by_account', 'value' => $iAccountId));
 
-	        $sInvitesRemain = $iInvites - $iInvited;
-    	}
-    	else 
-    		$sInvitesRemain = _t('_bx_invites_txt_unlimited');
+            $sInvitesRemain = $iInvites - $iInvited;
+        }
+        else
+            $sInvitesRemain = _t('_bx_invites_txt_unlimited');
 
         $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($this->_oConfig->CNF['URL_INVITE']);
 
         $this->getCssJs();
-    	return $this->parseHtmlByName('block_invite.html', array(
-    		'style_prefix' => $this->_oConfig->getPrefix('style'),
-    		'js_object' => $this->_oConfig->getJsObject('main'),
-    		'text' => _t('_bx_invites_txt_invite_block_text', $sInvitesRemain),
-    		'url' => $sUrl,
-    		'js_code' => $this->getJsCode('main')
-    	));
+        return $this->parseHtmlByName('block_invite.html', array(
+            'style_prefix' => $this->_oConfig->getPrefix('style'),
+            'js_object' => $this->_oConfig->getJsObject('main'),
+            'text' => _t('_bx_invites_txt_invite_block_text', $sInvitesRemain),
+            'url' => $sUrl,
+            'js_code' => $this->getJsCode('main')
+        ));
     }
 
     public function getBlockRequest()
     {
         $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($this->_oConfig->CNF['URL_REQUEST']);
 
-    	$this->getCssJs();
-    	return $this->parseHtmlByName('block_request.html', array(
-    		'style_prefix' => $this->_oConfig->getPrefix('style'),
-    		'text' => _t('_bx_invites_txt_request_block_text'),
-    		'bx_if:show_button_request' => array(
-    			'condition' => $this->_oConfig->isRequestInvite(),
-    			'content' => array(
-    				'url' => $sUrl
-    			)
-    		)
-    	));
+        $this->getCssJs();
+        return $this->parseHtmlByName('block_request.html', array(
+            'style_prefix' => $this->_oConfig->getPrefix('style'),
+            'text' => _t('_bx_invites_txt_request_block_text'),
+            'bx_if:show_button_request' => array(
+                'condition' => $this->_oConfig->isRequestInvite(),
+                'content' => array(
+                    'url' => $sUrl
+                )
+            )
+        ));
     }
     public function getBlockFormRequest()
     {
-    	if(!$this->_oConfig->isRequestInvite())
-    		return MsgBox(_t('_bx_invites_err_not_available'));
+        if(!$this->_oConfig->isRequestInvite())
+            return MsgBox(_t('_bx_invites_err_not_available'));
 
-    	$mixedAllowed = $this->getModule()->isAllowedRequest(0);
+        $mixedAllowed = $this->getModule()->isAllowedRequest(0);
         if($mixedAllowed !== true)
             return MsgBox($mixedAllowed);
 
         $CNF = &$this->_oConfig->CNF;
 
-    	$sJsObject = $this->_oConfig->getJsObject('main');
-    	$oPermalink = BxDolPermalinks::getInstance();
+        $sJsObject = $this->_oConfig->getJsObject('main');
+        $oPermalink = BxDolPermalinks::getInstance();
 
         $oForm = BxDolForm::getObjectInstance($this->_oConfig->getObject('form_request'), $this->_oConfig->getObject('form_display_request_send'));
         $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . $oPermalink->permalink($CNF['URL_REQUEST']);
@@ -133,8 +128,8 @@ class BxInvTemplate extends BxBaseModGeneralTemplate
                 return $this->parseHtmlByName('block_request_form.html', array(
                     'style_prefix' => $this->_oConfig->getPrefix('style'),
                     'js_object' => $sJsObject,
-                	'js_code' => $this->getJsCode('main'),
-                	'form' => $sForm,
+                    'js_code' => $this->getJsCode('main'),
+                    'form' => $sForm,
                     'form_id' => $sFormId,
                 ));
             }
@@ -143,43 +138,43 @@ class BxInvTemplate extends BxBaseModGeneralTemplate
                 return array('content' => $sForm, 'content_id' => $sFormId, 'eval' => $sEval);
         }
 
-    	$sIp = getVisitorIP();
+        $sIp = getVisitorIP();
 
-    	$iId = (int)$oForm->insert(array('nip' => ip2long($sIp),'date' => time()));
-		if(!$iId)
-		    return array('content' => MsgBox(_t('_bx_invites_err_cannot_perform')), 'content_id' => $sFormId, 'eval' => $sEval);
+        $iId = (int)$oForm->insert(array('nip' => ip2long($sIp),'date' => time()));
+        if(!$iId)
+            return array('content' => MsgBox(_t('_bx_invites_err_cannot_perform')), 'content_id' => $sFormId, 'eval' => $sEval);
 
-		$sRequestsEmail = $this->_oConfig->getRequestsEmail();
-		if(!empty($sRequestsEmail)) {
-			$sManageUrl = BX_DOL_URL_ROOT . $oPermalink->permalink($CNF['URL_REQUESTS']);
+        $sRequestsEmail = $this->_oConfig->getRequestsEmail();
+        if(!empty($sRequestsEmail)) {
+            $sManageUrl = BX_DOL_URL_ROOT . $oPermalink->permalink($CNF['URL_REQUESTS']);
 
-			$aMessage = BxDolEmailTemplates::getInstance()->parseTemplate('bx_invites_request_form_message', array(
-				'sender_name' => bx_process_output($oForm->getCleanValue('name')),
-				'sender_email' => bx_process_output($oForm->getCleanValue('email')),
-				'sender_ip' => $sIp,
-				'manage_url' => $sManageUrl
-			));
+            $aMessage = BxDolEmailTemplates::getInstance()->parseTemplate('bx_invites_request_form_message', array(
+                'sender_name' => bx_process_output($oForm->getCleanValue('name')),
+                'sender_email' => bx_process_output($oForm->getCleanValue('email')),
+                'sender_ip' => $sIp,
+                'manage_url' => $sManageUrl
+            ));
 
-			sendMail($sRequestsEmail, $aMessage['Subject'], $aMessage['Body'], 0, array(), BX_EMAIL_SYSTEM);
-		}
+            sendMail($sRequestsEmail, $aMessage['Subject'], $aMessage['Body'], 0, array(), BX_EMAIL_SYSTEM);
+        }
 
-		return array('content' => MsgBox(_t('_bx_invites_msg_request_sent')), 'content_id' => $sFormId, 'eval' => $sEval);
+        return array('content' => MsgBox(_t('_bx_invites_msg_request_sent')), 'content_id' => $sFormId, 'eval' => $sEval);
     }
 
-	public function getLinkPopup($sLink)
+    public function getLinkPopup($sLink)
     {
         $sId = $this->_oConfig->getHtmlIds('link_popup');
         $sTitle = _t('_bx_invites_txt_link_popup_title');
         $sContent = $this->parseHtmlByName('popup_link.html', array(
-			'style_prefix' => $this->_oConfig->getPrefix('style'),
-        	'html_id_link' => $this->_oConfig->getHtmlIds('link_input'),
-        	'link' => $sLink
+            'style_prefix' => $this->_oConfig->getPrefix('style'),
+            'html_id_link' => $this->_oConfig->getHtmlIds('link_input'),
+            'link' => $sLink
         ));
 
-    	return BxTemplFunctions::getInstance()->popupBox($sId, $sTitle, $sContent, true);
+        return BxTemplFunctions::getInstance()->popupBox($sId, $sTitle, $sContent, true);
     }
 
-	public function getJsCode($sType, $aParams = array(), $bWrap = true)
+    public function getJsCode($sType, $aParams = array(), $bWrap = true)
     {
         $aParams = array_merge(array(
             'aHtmlIds' => $this->_oConfig->getHtmlIds(),
@@ -188,6 +183,64 @@ class BxInvTemplate extends BxBaseModGeneralTemplate
 
         return parent::getJsCode($sType, $aParams, $bWrap);
     }
+    
+    public function getProfilesByAccount($iAccountId, $iMaxVisible = 2)
+    {
+        $aProfiles = BxDolAccount::getInstance($iAccountId)->getProfiles();
+        $iProfiles = count($aProfiles);
+
+        $aTmplVars = array (
+            'class_cnt' => '',
+            'bx_repeat:profiles' => array(),
+            'bx_if:profiles_more' => array(
+                'condition' => $iProfiles > $iMaxVisible,
+                'content' => array(
+                    'html_id' => $this->_oConfig->getHtmlIds('profile_more_popup') . $iAccountId,
+                    'more' => _t('_bx_accnt_txt_more', $iProfiles - $iMaxVisible),
+                    'more_attr' => bx_html_attribute(_t('_bx_accnt_txt_see_more')),
+                    'popup' => '',
+                ),
+            ),
+        );
+
+        $aTmplVarsPopup = array (
+            'class_cnt' => ' bx-def-padding',
+            'bx_repeat:profiles' => array(),
+            'bx_if:profiles_more' => array(
+                'condition' => false,
+                'content' => array(),
+            ),
+        );
+
+        $i = 0;
+        foreach ($aProfiles as $iProfileId => $aProfile) {
+            $oProfile = BxDolProfile::getInstance($iProfileId);
+            if(!$oProfile)
+                continue;
+
+            $sName = $oProfile->getDisplayName();
+            $aTmplVarsProfile = array (
+                'html_id' => $this->_oConfig->getHtmlIds('profile') . $aProfile['id'],
+                'id' => $oProfile->id(),
+                'url' => $oProfile->getUrl(),
+                'name' => $sName,
+                'name_attr' => bx_html_attribute($sName)
+            );
+
+            if($i < $iMaxVisible)
+                $aTmplVars['bx_repeat:profiles'][] = $aTmplVarsProfile;
+            if($i >= $iMaxVisible)
+                $aTmplVarsPopup['bx_repeat:profiles'][] = $aTmplVarsProfile;
+
+            ++$i;
+        }
+
+        if($aTmplVarsPopup['bx_repeat:profiles']) {
+            $aTmplVars['bx_if:profiles_more']['content']['popup'] = BxTemplFunctions::getInstance()->transBox('', $this->parseHtmlByName('profiles.html', $aTmplVarsPopup));
+        }
+
+        return $this->parseHtmlByName('profiles.html', $aTmplVars);
+    }
 }
 
 /** @} */

+ 1 - 1
modules/boonex/invites/install/config.php

@@ -19,7 +19,7 @@ $aConfig = array(
     'note' => 'Invitations module.',
     'version' => '9.0.7.DEV',
     'vendor' => 'BoonEx',
-	'help_url' => 'http://feed.una.io/?section={module_name}',
+    'help_url' => 'http://feed.una.io/?section={module_name}',
 
     'compatible_with' => array(
         '9.0.x'

+ 5 - 2
modules/boonex/invites/install/langs/en.xml

@@ -44,7 +44,8 @@
   <string name="_bx_invites_grid_column_title_status"><![CDATA[Status]]></string>
 
 	<string name="_bx_invites_grid_action_title_adm_info"><![CDATA[Info]]></string>
-	<string name="_bx_invites_grid_action_title_adm_invite"><![CDATA[Invite]]></string>
+  <string name="_bx_invites_grid_action_title_adm_invite_info"><![CDATA[Invitation info]]></string>
+  <string name="_bx_invites_grid_action_title_adm_invite"><![CDATA[Invite]]></string>
 	<string name="_bx_invites_grid_action_title_adm_delete"><![CDATA[Delete]]></string>
   <string name="_bx_invites_grid_action_title_adm_add"><![CDATA[Send invitations]]></string>
 
@@ -137,11 +138,13 @@
 	<string name="_bx_invites_err_used"><![CDATA[The invitation link isn't available or already used.]]></string>
   <string name="_bx_invites_request_status_new"><![CDATA[New]]></string>
   <string name="_bx_invites_request_status_invited"><![CDATA[Invited]]></string>
-  <string name="_bx_invites_request_status_seen"><![CDATA[Joined]]></string>
+  <string name="_bx_invites_request_status_seen"><![CDATA[Seen]]></string>
   <string name="_bx_invites_request_status_joined"><![CDATA[Joined]]></string>
   <string name="_bx_invites_request_status_for_filter_all"><![CDATA[All requests]]></string>
   <string name="_bx_invites_request_status_for_filter_new"><![CDATA[New requests]]></string>
   <string name="_bx_invites_request_status_for_filter_invited"><![CDATA[Requests with invites]]></string>
   <string name="_bx_invites_request_status_for_filter_seen"><![CDATA[Invite seen]]></string>
   <string name="_bx_invites_request_status_for_filter_joined"><![CDATA[Joined]]></string>
+  <string name="_bx_invites_title_date_invite_sent"><![CDATA[Date sent]]></string>
+  <string name="_bx_invites_title_date_invite_seen"><![CDATA[Date seen]]></string>
 </resources>

+ 11 - 14
modules/boonex/invites/install/sql/install.sql

@@ -9,11 +9,12 @@ CREATE TABLE IF NOT EXISTS `bx_inv_invites` (
   `key` varchar(128) NOT NULL,
   `email` varchar(128) NOT NULL,
   `date` int(11) NOT NULL default '0',
-   `date_seen` int(11) DEFAULT NULL,
-   `date_joined` int(11) DEFAULT NULL,
-   `joined_account_id` int(11) DEFAULT NULL,
-  PRIMARY KEY  (`id`)
-
+  `date_seen` int(11) DEFAULT NULL,
+  `date_joined` int(11) DEFAULT NULL,
+  `joined_account_id` int(11) DEFAULT NULL,
+  `request_id` int(11) DEFAULT NULL,
+  PRIMARY KEY  (`id`),
+  INDEX `bx_inv_invites_request_id` (`request_id`)
 );
 
 CREATE TABLE IF NOT EXISTS `bx_inv_requests` (
@@ -23,12 +24,10 @@ CREATE TABLE IF NOT EXISTS `bx_inv_requests` (
   `text` text NOT NULL,
   `nip` int(11) unsigned NOT NULL default '0',
   `date` int(11) NOT NULL default '0',
-  `invite_id` int(11) DEFAULT NULL,
-  PRIMARY KEY  (`id`),
-  INDEX `bx_inv_requests_invite_id` (`invite_id`)
+  `status` TINYINT(4) DEFAULT '0',
+  PRIMARY KEY  (`id`)
 );
 
-
 -- FORMS
 INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
 ('bx_invites_invite', @sName, '_bx_invites_form_invite', '', '', 'do_submit', 'bx_inv_invites', 'id', '', '', 'a:1:{s:14:"checker_helper";s:22:"BxInvFormCheckerHelper";}', 0, 1, '', '');
@@ -68,7 +67,7 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 
 -- GRIDS
 INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `field_id`, `field_order`, `field_active`, `paginate_url`, `paginate_per_page`, `paginate_simple`, `paginate_get_start`, `paginate_get_per_page`, `filter_fields`, `filter_fields_translatable`, `filter_mode`, `sorting_fields`, `sorting_fields_translatable`, `visible_for_levels`, `override_class_name`, `override_class_file`) VALUES
-('bx_invites_requests', 'Sql', 'SELECT `bx_inv_requests`.*, `bx_inv_invites`.`date_seen`, `bx_inv_invites`.`date_joined`, `bx_inv_invites`.`joined_account_id` AS joined_account, `bx_inv_invites`.`date` AS `date_invite` FROM `bx_inv_requests` LEFT JOIN `bx_inv_invites` ON `bx_inv_invites`.`id` = `bx_inv_requests`.`invite_id` WHERE 1', 'bx_inv_requests', 'id', 'invite_id', '', '', 20, NULL, 'start', '', 'bx_inv_requests`.`name, bx_inv_requests`.`email', '', 'like', '', '', 192, 'BxInvGridRequests', 'modules/boonex/invites/classes/BxInvGridRequests.php');
+('bx_invites_requests', 'Sql', 'SELECT `bx_inv_requests`.* FROM `bx_inv_requests` WHERE 1', 'bx_inv_requests', 'id', 'status, date', '', '', 20, NULL, 'start', '', 'bx_inv_requests`.`name, bx_inv_requests`.`email', '', 'like', '', '', 192, 'BxInvGridRequests', 'modules/boonex/invites/classes/BxInvGridRequests.php');
 
 INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
 ('bx_invites_requests', 'checkbox', '_sys_select', '2%', 0, '', '', 1),
@@ -76,9 +75,6 @@ INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable
 ('bx_invites_requests', 'email', '_bx_invites_grid_column_title_email', '14%', 1, '25', '', 3),
 ('bx_invites_requests', 'nip', '_bx_invites_grid_column_title_nip', '10%', 0, '15', '', 4),
 ('bx_invites_requests', 'date', '_bx_invites_grid_column_title_date', '10%', 0, '20', '', 5),
-/*('bx_invites_requests', 'date_invite', '_bx_invites_grid_column_title_date_invite', '8%', 0, '20', '', 6),
-('bx_invites_requests', 'date_seen', '_bx_invites_grid_column_title_date_seen', '8%', 0, '20', '', 7),
-('bx_invites_requests', 'date_joined', '_bx_invites_grid_column_title_date_joined', '8%', 0, '20', '', 8),*/
 ('bx_invites_requests', 'joined_account', '_bx_invites_grid_column_title_joined_account', '20%', 0, '20', '', 6),
 ('bx_invites_requests', 'status', '_bx_invites_grid_column_title_status', '10%', 0, '15', '', 7),
 ('bx_invites_requests', 'actions', '', '20%', 0, '', '', 8);
@@ -89,7 +85,8 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_invites_requests', 'single', 'info', '_bx_invites_grid_action_title_adm_info', 'exclamation-circle', 1, 0, 1),
 ('bx_invites_requests', 'single', 'invite', '_bx_invites_grid_action_title_adm_invite', 'envelope', 1, 0, 2),
 ('bx_invites_requests', 'single', 'delete', '_bx_invites_grid_action_title_adm_delete', 'remove', 1, 1, 3),
-('bx_invites_requests', 'independent', 'add', '_bx_invites_grid_action_title_adm_add', '', 0, 0, 4);
+('bx_invites_requests', 'single', 'invite_info', '_bx_invites_grid_action_title_adm_invite_info', 'exclamation-circle', 1, 0, 4),
+('bx_invites_requests', 'independent', 'add', '_bx_invites_grid_action_title_adm_add', '', 0, 0, 5);
 
 
 -- STUDIO PAGE & WIDGET

+ 0 - 2
modules/boonex/invites/install/sql/uninstall.sql

@@ -1,11 +1,9 @@
 SET @sName = 'bx_invites';
 
-
 -- TABLES
 DROP TABLE IF EXISTS `bx_inv_invites`;
 DROP TABLE IF EXISTS `bx_inv_requests`;
 
-
 -- FORMS ALL
 DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN  (SELECT `display_name` FROM `sys_form_displays` WHERE `module` = @sName);
 DELETE FROM `sys_form_inputs` WHERE `module` = @sName;

+ 12 - 0
modules/boonex/invites/template/invite_info.html

@@ -0,0 +1,12 @@
+<table style="width:100%;" class="bx-def-padding">
+    <tr>
+        <td>__date_sent_title__</td>
+        <td>__date_seen_title__</td>
+    </tr>
+    <bx_repeat:items>
+        <tr>
+            <td>__date_sent__</td>
+            <td>__date_seen__</td>
+        </tr>
+    </bx_repeat:items>
+</table>

+ 0 - 1
modules/boonex/invites/template/member_link.html

@@ -1 +0,0 @@
-<a href="__href__">__content__</a>

+ 16 - 0
modules/boonex/invites/template/profiles.html

@@ -0,0 +1,16 @@
+<div class="bx-accnt-profiles bx-clearfix">
+	<div class="bx-accnt-profiles-cnt__class_cnt__">
+	    <bx_repeat:profiles>
+	        <div id="__html_id____id__" class="bx-accnt-profile">
+	            <a href="__url__" target="_blank" title="__name_attr__">__name__</a>
+	        </div>
+	    </bx_repeat:profiles>
+	   
+	    <bx_if:profiles_more>
+	        <div class="bx-accnt-profile">
+	            <a href="javascript:void(0);" onclick="$('#__html_id__').dolPopup({pointer:{el:$(this)}})" title="__more_attr__">__more__</a>            
+	        </div>
+	        <div id="__html_id__" style="display:none;">__popup__</div>
+	    </bx_if:profiles_more>
+	</div>
+</div>

+ 0 - 12
modules/boonex/invites/template/request_text.html

@@ -1,15 +1,3 @@
 <div class="__style_prefix__-request-text bx-def-padding">
     __text__
-    <bx_if:show_date_invite>
-        <br>
-        __title__: __value__
-    </bx_if:show_date_invite>
-    <bx_if:show_date_seen>
-        <br>
-        __title__: __value__
-    </bx_if:show_date_seen>
-    <bx_if:show_date_joined>
-        <br>
-        __title__: __value__
-    </bx_if:show_date_joined>  
 </div>