_oDb->getContentInfoById((int)$iContentId); if (!$aContentInfo || (!$iIgnoreJoinConfirmation && $aContentInfo['join_confirmation'])) return false; if (!($oConnection = BxDolConnection::getObjectInstance($this->_oConfig->CNF['OBJECT_CONNECTIONS']))) return false; return $oConnection->addConnection((int)$iContentId, (int)$iInitiatorId); } public function serviceFansTable () { $oGrid = BxDolGrid::getObjectInstance($this->_oConfig->CNF['OBJECT_GRID_CONNECTIONS']); if (!$oGrid) return false; return $oGrid->getCode(); } public function serviceFans ($iContentId = 0) { if (!$iContentId) $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT); if (!$iContentId) return false; $aContentInfo = $this->_oDb->getContentInfoById($iContentId); if (!$aContentInfo) return false; bx_import('BxDolConnection'); $s = $this->serviceBrowseConnectionsQuick ($iContentId, $this->_oConfig->CNF['OBJECT_CONNECTIONS'], BX_CONNECTIONS_CONTENT_TYPE_CONTENT, true); if (!$s) return MsgBox(_t('_sys_txt_empty')); return $s; } public function serviceBrowseJoinedEntries ($iProfileId = 0, $bDisplayEmptyMsg = false) { if (!$iProfileId) $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT); if (!$iProfileId) return ''; return $this->_serviceBrowse ('joined_entries', array('joined_profile' => $iProfileId), BX_DB_PADDING_DEF, $bDisplayEmptyMsg); } /** * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. */ public function checkAllowedView ($aDataEntry, $isPerformAction = false) { if (($oConnection = BxDolConnection::getObjectInstance($this->_oConfig->CNF['OBJECT_CONNECTIONS'])) && $oConnection->isConnected(bx_get_logged_profile_id(), $aDataEntry[$this->_oConfig->CNF['FIELD_ID']], true)) return CHECK_ACTION_RESULT_ALLOWED; return parent::checkAllowedView ($aDataEntry, $isPerformAction); } /** * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. */ public function checkAllowedFanAdd (&$aDataEntry, $isPerformAction = false) { return $this->_checkAllowedConnectContent ($aDataEntry, $isPerformAction, $this->_oConfig->CNF['OBJECT_CONNECTIONS'], true, false); } /** * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. */ public function checkAllowedFanRemove (&$aDataEntry, $isPerformAction = false) { if (CHECK_ACTION_RESULT_ALLOWED === $this->_checkAllowedConnectContent ($aDataEntry, $isPerformAction, 'sys_profiles_friends', false, true, true)) return CHECK_ACTION_RESULT_ALLOWED; return $this->_checkAllowedConnectContent ($aDataEntry, $isPerformAction, $this->_oConfig->CNF['OBJECT_CONNECTIONS'], false, true, false); } public function checkAllowedManageAdmins ($mixedDataEntry, $isPerformAction = false) { $aDataEntry = is_array($mixedDataEntry) ? $mixedDataEntry : $this->_oDb->getContentInfoById((int)$mixedDataEntry); return parent::checkAllowedEdit ($aDataEntry, $isPerformAction); } public function checkAllowedEdit ($aDataEntry, $isPerformAction = false) { if ($this->_oDb->isAdmin($aDataEntry[$this->_oConfig->CNF['FIELD_ID']], bx_get_logged_profile_id())) return CHECK_ACTION_RESULT_ALLOWED; return parent::checkAllowedEdit ($aDataEntry, $isPerformAction); } public function checkAllowedChangeCover ($aDataEntry, $isPerformAction = false) { if ($this->_oDb->isAdmin($aDataEntry[$this->_oConfig->CNF['FIELD_ID']], bx_get_logged_profile_id())) return CHECK_ACTION_RESULT_ALLOWED; return parent::checkAllowedChangeCover ($aDataEntry, $isPerformAction); } public function checkAllowedDelete (&$aDataEntry, $isPerformAction = false) { if ($this->_oDb->isAdmin($aDataEntry[$this->_oConfig->CNF['FIELD_ID']], bx_get_logged_profile_id())) return CHECK_ACTION_RESULT_ALLOWED; return parent::checkAllowedDelete ($aDataEntry, $isPerformAction); } protected function _checkAllowedConnect (&$aDataEntry, $isPerformAction, $sObjConnection, $isMutual, $isInvertResult, $isSwap = false) { $sResult = $this->checkAllowedView($aDataEntry); if (CHECK_ACTION_RESULT_ALLOWED !== $sResult) return $sResult; return parent::_checkAllowedConnect ($aDataEntry, $isPerformAction, $sObjConnection, $isMutual, $isInvertResult, $isSwap); } } /** @} */