|
|
@@ -130,24 +130,22 @@ class BxDolGridConnections extends BxTemplGrid
|
|
|
$s = '';
|
|
|
|
|
|
// for friend requests display mutual friends
|
|
|
- if ($this->_bOwner && !$aRow['mutual']) {
|
|
|
- $a = $this->_oConnection->getCommonContent($aRow['id'], bx_get_logged_profile_id(), true);
|
|
|
- $i = count($a);
|
|
|
- if (1 == $i) {
|
|
|
- $iProfileId = array_pop($a);
|
|
|
- $oProfile = BxDolProfile::getInstance($iProfileId);
|
|
|
+ if($this->_bOwner && !$aRow['mutual']) {
|
|
|
+ $iLogged = bx_get_logged_profile_id();
|
|
|
+ $iConnections = $this->_oConnection->getCommonContentCount($aRow['id'], $iLogged, true);
|
|
|
+ if($iConnections == 1) {
|
|
|
+ $aConnections = $this->_oConnection->getCommonContent($aRow['id'], $iLogged, true);
|
|
|
+
|
|
|
+ $oProfile = BxDolProfile::getInstance(array_pop($aConnections));
|
|
|
$s = _t('_sys_txt_one_mutual_friend', $oProfile->getUrl(), $oProfile->getDisplayName());
|
|
|
- } elseif ($i) {
|
|
|
- $s = _t('_sys_txt_n_mutual_friends', $i);
|
|
|
- }
|
|
|
+ }
|
|
|
+ else if($iConnections)
|
|
|
+ $s = _t('_sys_txt_n_mutual_friends', $iConnections);
|
|
|
}
|
|
|
|
|
|
// display friends number if no other info is available
|
|
|
- if (!$s) {
|
|
|
- $a = $this->_oConnection->getConnectedContent($aRow['id'], true);
|
|
|
- $i = count($a);
|
|
|
- $s = _t('_sys_txt_n_friends', $i);
|
|
|
- }
|
|
|
+ if(!$s)
|
|
|
+ $s = _t('_sys_txt_n_friends', $this->_oConnection->getConnectedContentCount($aRow['id'], true));
|
|
|
|
|
|
return parent::_getCellDefault ($s, $sKey, $aField, $aRow);
|
|
|
}
|