| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?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 DolphinCore Dolphin Core
- * @{
- */
- /**
- * System services for connections.
- */
- class BxBaseServiceConnections extends BxDol
- {
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * get grid with friends connections
- */
- public function serviceConnectionsTable ()
- {
- bx_import('BxDolGrid');
- $oGrid = BxDolGrid::getObjectInstance('sys_grid_connections');
- if (!$oGrid)
- return false;
- return $oGrid->getCode();
- }
- /**
- * get number of received unconfirmed connections (friend requests)
- * @param $sConnectionsObject connections object to get unconfirmed connections from
- * @param $mixedId id to get connections for, if omitted then logged-in profile id is used
- * @return number
- */
- public function serviceGetUnconfirmedConnectionsNum ($sConnectionsObject, $mixedId = 0)
- {
- bx_import('BxDolConnection');
- $oConnection = BxDolConnection::getObjectInstance($sConnectionsObject);
- if (!$oConnection)
- return 0;
- if (!$mixedId)
- $mixedId = bx_get_logged_profile_id();
- $i = 0;
- $a = $oConnection->getConnectedInitiators($mixedId, 0); // get received friend requests
- foreach ($a as $iId)
- if (BxDolProfile::getInstance($iId))
- ++$i;
- return $i;
- }
- }
- /** @} */
|