Exemplo n.º 1
0
 public function serviceBrowseConnectionsQuick($iProfileId, $sObjectConnections = 'sys_profiles_friends', $sConnectionsType = 'content', $iMutual = false, $iProfileId2 = 0)
 {
     // get connections object
     $oConnection = BxDolConnection::getObjectInstance($sObjectConnections);
     if (!$oConnection) {
         return '';
     }
     // set some vars
     $iLimit = empty($this->_oConfig->CNF['PARAM_NUM_CONNECTIONS_QUICK']) ? 4 : getParam($this->_oConfig->CNF['PARAM_NUM_CONNECTIONS_QUICK']);
     if (!$iLimit) {
         $iLimit = 4;
     }
     $iStart = (int) bx_get('start');
     // get connections array
     bx_import('BxDolConnection');
     $a = $oConnection->getConnectionsAsArray($sConnectionsType, $iProfileId, $iProfileId2, $iMutual, (int) bx_get('start'), $iLimit + 1, BX_CONNECTIONS_ORDER_ADDED_DESC);
     if (!$a) {
         return '';
     }
     // get paginate object
     $oPaginate = new BxTemplPaginate(array('on_change_page' => "return !loadDynamicBlockAutoPaginate(this, '{start}', '{per_page}');", 'num' => count($a), 'per_page' => $iLimit, 'start' => $iStart));
     // remove last item from connection array, because we've got one more item for pagination calculations only
     if (count($a) > $iLimit) {
         array_pop($a);
     }
     // get profiles HTML
     $s = '';
     foreach ($a as $iProfileId) {
         if (!($o = BxDolProfile::getInstance($iProfileId))) {
             continue;
         }
         $s .= $o->getUnit();
     }
     // return profiles + paginate
     return $s . (!$iStart && $oPaginate->getNum() <= $iLimit ? '' : $oPaginate->getSimplePaginate());
 }