UNA
|
Public Member Functions | |
init () | |
getType () | |
getTable () | |
isProfileInitiator () | |
isProfileContent () | |
checkAllowedConnect ($iInitiator, $iContent, $isPerformAction=false, $isMutual=false, $isInvertResult=false, $isSwap=false, $isCheckExists=true) | |
checkAllowedAddConnection ($iInitiator, $iContent, $isPerformAction=false, $isMutual=false, $isInvertResult=false, $isSwap=false, $isCheckExists=true) | |
checkAllowedRemoveConnection ($iInitiator, $iContent, $isPerformAction=false, $isMutual=false, $isInvertResult=false, $isSwap=false, $isCheckExists=true) | |
actionAdd ($iContent=0, $iInitiator=false) | |
actionRemove ($iContent=0, $iInitiator=false) | |
actionReject ($iContent=0, $iInitiator=false) | |
outputActionResult ($mixed, $sFormat='json') | |
addConnection ($iInitiator, $iContent, $aParams=array()) | |
onAdded ($iInitiator, $iContent, $iMutual) | |
removeConnection ($iInitiator, $iContent) | |
onRemoved ($iInitiator, $iContent) | |
getConnectionsAsArray ($sContentType, $iId1, $iId2, $isMutual=false, $iStart=0, $iLimit=BX_CONNECTIONS_LIST_LIMIT, $iOrder=BX_CONNECTIONS_ORDER_NONE) | |
getCommonContent ($iInitiator1, $iInitiator2, $isMutual=false, $iStart=0, $iLimit=BX_CONNECTIONS_LIST_LIMIT, $iOrder=BX_CONNECTIONS_ORDER_NONE) | |
getCommonContentCount ($iInitiator1, $iInitiator2, $isMutual=false) | |
getConnectedContentCount ($iInitiator, $isMutual=false, $iFromDate=0) | |
getConnectedContentCountExt ($iInitiator, $isMutual=false, $aParams=[]) | |
getConnectedInitiatorsCount ($iContent, $isMutual=false) | |
getConnectedContent ($iInitiator, $isMutual=false, $iStart=0, $iLimit=BX_CONNECTIONS_LIST_LIMIT, $iOrder=BX_CONNECTIONS_ORDER_NONE) | |
getConnectedContentByType ($iInitiator, $mixedType, $isMutual=false, $iStart=0, $iLimit=BX_CONNECTIONS_LIST_LIMIT, $iOrder=BX_CONNECTIONS_ORDER_NONE) | |
getConnectedInitiators ($iContent, $isMutual=false, $iStart=0, $iLimit=BX_CONNECTIONS_LIST_LIMIT, $iOrder=BX_CONNECTIONS_ORDER_NONE) | |
getConnectedInitiatorsByType ($iContent, $mixedType, $isMutual=false, $iStart=0, $iLimit=BX_CONNECTIONS_LIST_LIMIT, $iOrder=BX_CONNECTIONS_ORDER_NONE) | |
getConnectionsAsSQLParts ($sContentType, $sContentTable, $sContentField, $iId1, $iId2, $isMutual=false) | |
getCommonContentAsSQLParts ($sContentTable, $sContentField, $iInitiator1, $iInitiator2, $isMutual=false) | |
getConnectedContentAsSQLParts ($sContentTable, $sContentField, $iInitiator, $isMutual=false) | |
getConnectedContentAsSQLPartsExt ($sContentTable, $sContentField, $iInitiator, $isMutual=false) | |
getConnectedContentAsSQLPartsMultiple ($sContentTable, $sContentField, $sInitiatorTable, $sInitiatorField, $isMutual=false) | |
getConnectedInitiatorsAsSQLParts ($sInitiatorTable, $sInitiatorField, $iContent, $isMutual=false) | |
getConnectedInitiatorsAsSQLPartsMultiple ($sInitiatorTable, $sInitiatorField, $sContentTable, $sContentField, $isMutual=false) | |
getConnectionsAsCondition ($sContentType, $sContentField, $iId1, $iId2, $isMutual=false) | |
getCommonContentAsCondition ($sContentField, $iInitiator1, $iInitiator2, $iMutual=false) | |
getConnectedContentAsCondition ($sContentField, $iInitiator, $iMutual=false) | |
getConnectedInitiatorsAsCondition ($sContentField, $iContent, $iMutual=false) | |
isConnected ($iInitiator, $iContent, $isMutual=false) | |
isConnectedNotMutual ($iInitiator, $iContent) | |
getConnection ($iInitiator, $iContent) | |
getConnectionById ($iId) | |
onDeleteInitiatorAndContent ($iId) | |
onDeleteInitiator ($iIdInitiator) | |
onDeleteContent ($iIdContent) | |
onModuleDeleteInitiatorAndContent ($sTable, $sFieldId) | |
onModuleDeleteInitiator ($sTable, $sFieldId) | |
onModuleDeleteContent ($sTable, $sFieldId) | |
onModuleProfileDeleteInitiatorAndContent ($sModuleName) | |
onModuleProfileDeleteInitiator ($sModuleName) | |
onModuleProfileDeleteContent ($sModuleName) | |
Static Public Member Functions | |
static | getObjectInstance ($sObject) |
Protected Member Functions | |
__construct ($aObject) | |
_action ($iInitiator, $iContent, $sMethod, $sErrorKey, $isMutual=false, $isInvert=false) | |
_checkAllowedConnect ($iInitiator, $iContent, $isPerformAction=false, $isMutual=false, $isInvertResult=false, $isSwap=false, $isCheckExists=true) | |
_checkAllowedConnectInitiator ($oInitiator, $isPerformAction=false) | |
_checkAllowedConnectContent ($oContent) | |
Protected Attributes | |
$_sObject | |
$_aObject | |
$_oQuery | |
$_sType | |
Connection is usefull when you need to organize some sorts of connections between different content, for example: friends, contacts, favorites, block lists, subscriptions, etc.
Two types of connections are supported one way connections (block list, favourites) and mutual (friends).
For automatic handling of connections (like, add/remove connection in frontend) refer to JS function:
Step 1: Add record to 'sys_objects_connection' table:
Step 2: Create table for connections:
Check if two profiles are friends:
Get mutual content IDs (friends IDs)
|
protected |
Constructor
$aObject | array of connection options |
Reimplemented in BxBaseConnection, BxBaseModGroupsConnectionFans, BxCoursesConnectionFans, BxDolBan, BxDolRelation, BxEventsConnectionFans, BxGroupsConnectionFans, BxJobsConnectionFans, BxOrgsConnectionFans, BxSpacesConnectionFans, and BxTemplConnection.
BxDolConnection::actionAdd | ( | $iContent = 0, | |
$iInitiator = false ) |
Add new connection.
$iContent | content to make connection to, in most cases some content id, or other profile id in case of friends |
Reimplemented in BxDolRelation.
BxDolConnection::actionReject | ( | $iContent = 0, | |
$iInitiator = false ) |
Reject connection request. This method is wrapper for
$iContent | content to make connection to, in most cases some content id, or other profile id in case of friends |
Reimplemented in BxBaseModGroupsConnectionFans.
BxDolConnection::actionRemove | ( | $iContent = 0, | |
$iInitiator = false ) |
Remove connection. This method is wrapper for
$iContent | content to make connection to, in most cases some content id, or other profile id in case of friends |
Reimplemented in BxBaseModGroupsConnectionFans, and BxDolRelation.
BxDolConnection::addConnection | ( | $iInitiator, | |
$iContent, | |||
$aParams = array() ) |
Add new connection.
$iInitiator | initiator of the connection, in most cases some profile id |
$iContent | content to make connection to, in most cases some content id, or other profile id in case of friends |
connection_before_add
initiator
- [int] by ref, profile id who created the connection, can be overridden in hook processingcontent
- [int] by ref, profile id with whom the connection was created, can be overridden in hook processingmutual
- [int] by ref, if the relation is mutual or not, can be overridden in hook processingobject
- [object] an instance of relation, It's equivalent to '{object_name}', 'connection_before_add' - hook before connection was added. Connection params can be overridden
Reimplemented in BxDolBan, and BxDolRelation.
BxDolConnection::checkAllowedConnect | ( | $iInitiator, | |
$iContent, | |||
$isPerformAction = false, | |||
$isMutual = false, | |||
$isInvertResult = false, | |||
$isSwap = false, | |||
$isCheckExists = true ) |
Check whether connection between Initiator and Content can be established.
Reimplemented in BxDolRelation.
BxDolConnection::getCommonContent | ( | $iInitiator1, | |
$iInitiator2, | |||
$isMutual = false, | |||
$iStart = 0, | |||
$iLimit = BX_CONNECTIONS_LIST_LIMIT, | |||
$iOrder = BX_CONNECTIONS_ORDER_NONE ) |
Get common content IDs between two initiators
$iInitiator1 | one initiator |
$iInitiator2 | second initiator |
$isMutual | get mutual connections only |
BxDolConnection::getCommonContentAsCondition | ( | $sContentField, | |
$iInitiator1, | |||
$iInitiator2, | |||
$iMutual = false ) |
Get necessary condition array to use connections in search classes
$sContentField | content table field name |
$iInitiator | initiator of the connection |
$iMutual | get mutual connections only |
BxDolConnection::getCommonContentAsSQLParts | ( | $sContentTable, | |
$sContentField, | |||
$iInitiator1, | |||
$iInitiator2, | |||
$isMutual = false ) |
Get necessary parts of SQL query to use connections in other queries
$sContentTable | content table or alias |
$sContentField | content table field or field alias |
$iInitiator | initiator of the connection |
$isMutual | get mutual connections only |
BxDolConnection::getCommonContentCount | ( | $iInitiator1, | |
$iInitiator2, | |||
$isMutual = false ) |
Get common content count between two initiators
$iInitiator1 | one initiator |
$iInitiator2 | second initiator |
$isMutual | get mutual connections only |
BxDolConnection::getConnectedContent | ( | $iInitiator, | |
$isMutual = false, | |||
$iStart = 0, | |||
$iLimit = BX_CONNECTIONS_LIST_LIMIT, | |||
$iOrder = BX_CONNECTIONS_ORDER_NONE ) |
Get connected content IDs
$iInitiator | initiator of the connection |
$isMutual | get mutual connections only |
BxDolConnection::getConnectedContentAsCondition | ( | $sContentField, | |
$iInitiator, | |||
$iMutual = false ) |
Get necessary condition array to use connections in search classes
$sContentField | content table field name |
$iInitiator | initiator of the connection |
$iMutual | get mutual connections only |
BxDolConnection::getConnectedContentAsSQLParts | ( | $sContentTable, | |
$sContentField, | |||
$iInitiator, | |||
$isMutual = false ) |
Get necessary parts of SQL query to use connections in other queries
$sContentTable | content table or alias |
$sContentField | content table field or field alias |
$iInitiator | initiator of the connection |
$isMutual | get mutual connections only |
BxDolConnection::getConnectedContentAsSQLPartsMultiple | ( | $sContentTable, | |
$sContentField, | |||
$sInitiatorTable, | |||
$sInitiatorField, | |||
$isMutual = false ) |
Get necessary parts of SQL query to use connections in other queries
$sContentTable | content table or alias |
$sContentField | content table field or field alias |
$sInitiatorTable | initiator table or alias |
$sInitiatorField | initiator table field or field alias |
$iInitiator | initiator of the connection |
$isMutual | get mutual connections only |
BxDolConnection::getConnectedContentByType | ( | $iInitiator, | |
$mixedType, | |||
$isMutual = false, | |||
$iStart = 0, | |||
$iLimit = BX_CONNECTIONS_LIST_LIMIT, | |||
$iOrder = BX_CONNECTIONS_ORDER_NONE ) |
Get connected content IDs for specified type
$iInitiator | initiator of the connection |
$mixedType | type of content or an array of types |
$isMutual | get mutual connections only |
BxDolConnection::getConnectedContentCount | ( | $iInitiator, | |
$isMutual = false, | |||
$iFromDate = 0 ) |
Get connected content count
$iInitiator | initiator of the connection |
$isMutual | get mutual connections only |
BxDolConnection::getConnectedContentCountExt | ( | $iInitiator, | |
$isMutual = false, | |||
$aParams = [] ) |
Get connected content count
$iInitiator | initiator of the connection |
$isMutual | get mutual connections only |
$aParams | additional params |
BxDolConnection::getConnectedInitiators | ( | $iContent, | |
$isMutual = false, | |||
$iStart = 0, | |||
$iLimit = BX_CONNECTIONS_LIST_LIMIT, | |||
$iOrder = BX_CONNECTIONS_ORDER_NONE ) |
Get connected initiators IDs
$iContent | content of the connection |
$isMutual | get mutual connections only |
BxDolConnection::getConnectedInitiatorsAsCondition | ( | $sContentField, | |
$iContent, | |||
$iMutual = false ) |
Get necessary condition array to use connections in search classes
$sContentField | content table field name |
$iInitiator | initiator of the connection |
$iMutual | get mutual connections only |
BxDolConnection::getConnectedInitiatorsAsSQLParts | ( | $sInitiatorTable, | |
$sInitiatorField, | |||
$iContent, | |||
$isMutual = false ) |
Get necessary parts of SQL query to use connections in other queries
$sInitiatorTable | initiator table or alias |
$sInitiatorField | initiator table field or field alias |
$iContent | content of the connection |
$isMutual | get mutual connections only |
BxDolConnection::getConnectedInitiatorsAsSQLPartsMultiple | ( | $sInitiatorTable, | |
$sInitiatorField, | |||
$sContentTable, | |||
$sContentField, | |||
$isMutual = false ) |
Get necessary parts of SQL query to use connections in other queries
$sInitiatorTable | initiator table or alias |
$sInitiatorField | initiator table field or field alias |
$sContentTable | content table or alias |
$sContentField | content table field or field alias |
$isMutual | get mutual connections only |
BxDolConnection::getConnectedInitiatorsByType | ( | $iContent, | |
$mixedType, | |||
$isMutual = false, | |||
$iStart = 0, | |||
$iLimit = BX_CONNECTIONS_LIST_LIMIT, | |||
$iOrder = BX_CONNECTIONS_ORDER_NONE ) |
Get connected initiators IDs
$iContent | content of the connection |
$mixedType | type of content or an array of types |
$isMutual | get mutual connections only |
BxDolConnection::getConnectedInitiatorsCount | ( | $iContent, | |
$isMutual = false ) |
Get connected initiators count
$iContent | content of the connection |
$isMutual | get mutual connections only |
BxDolConnection::getConnectionsAsArray | ( | $sContentType, | |
$iId1, | |||
$iId2, | |||
$isMutual = false, | |||
$iStart = 0, | |||
$iLimit = BX_CONNECTIONS_LIST_LIMIT, | |||
$iOrder = BX_CONNECTIONS_ORDER_NONE ) |
Compound function, which calls getCommonContent, getConnectedContent or getConnectedInitiators depending on $sContentType
$sContentType | content type to get BX_CONNECTIONS_CONTENT_TYPE_CONTENT, BX_CONNECTIONS_CONTENT_TYPE_INITIATORS or BX_CONNECTIONS_CONTENT_TYPE_COMMON |
$iId1 | one content or initiator |
$iId2 | second content or initiator only in case of BX_CONNECTIONS_CONTENT_TYPE_COMMON content type |
$isMutual | get mutual connections only |
BxDolConnection::getConnectionsAsCondition | ( | $sContentType, | |
$sContentField, | |||
$iId1, | |||
$iId2, | |||
$isMutual = false ) |
Similar to getConnectionsAsArray, but for getCommonContentAsCondition, getConnectedContentAsCondition or getConnectedInitiatorsAsCondition methods
BxDolConnection::getConnectionsAsSQLParts | ( | $sContentType, | |
$sContentTable, | |||
$sContentField, | |||
$iId1, | |||
$iId2, | |||
$isMutual = false ) |
Similar to getConnectionsAsArray, but for getCommonContentAsSQLParts, getConnectedContentAsSQLParts or getConnectedInitiatorsAsSQLParts methods
|
static |
Get connection object instance by object name
$sObject | object name |
Implements iBxDolFactoryObject.
BxDolConnection::getTable | ( | ) |
Get connection table. return string with table name.
BxDolConnection::getType | ( | ) |
Get connection type. return BX_CONNECTIONS_TYPE_ONE_WAY or BX_CONNECTIONS_TYPE_MUTUAL
BxDolConnection::init | ( | ) |
Init something here if it's needed.
Reimplemented in BxBaseModGroupsConnectionFans.
BxDolConnection::isConnected | ( | $iInitiator, | |
$iContent, | |||
$isMutual = false ) |
Check if initiator and content are connected. In case if friends this function in conjunction with isMutual parameter can be used to check pending friend requests.
$iInitiator | initiator of the connection |
$iContent | connected content or other profile id in case of friends |
BxDolConnection::isConnectedNotMutual | ( | $iInitiator, | |
$iContent ) |
Check if initiator and content are connected but connetion is not mutual, for checking pending connection requests. This method makes sense only when type of connection is mutual.
$iInitiator | initiator of the connection |
$iContent | connected content or other profile id in case of friends |
BxDolConnection::isProfileContent | ( | ) |
Checks whether connection's Content is profile or not. return boolean.
BxDolConnection::isProfileInitiator | ( | ) |
Checks whether connection's Initiator is profile or not. return boolean.
BxDolConnection::onAdded | ( | $iInitiator, | |
$iContent, | |||
$iMutual ) |
Update recommendations.
BxDolConnection::onDeleteContent | ( | $iIdContent | ) |
Must be called when some content is deleted which can have connections as 'content', to delete any associated data
$iIdInitiator | initiator id |
connection_removed_all
content
- [int] profile id with whom the connection was createdobject
- [object] an instance of relation, BxDolConnection::onDeleteInitiator | ( | $iIdInitiator | ) |
Must be called when some content is deleted which can have connections as 'initiator', to delete any associated data
$iIdInitiator | initiator id |
connection_removed_all
initiator
- [int] profile id who created the connectionobject
- [object] an instance of relation, BxDolConnection::onDeleteInitiatorAndContent | ( | $iId | ) |
Must be called when some content is deleted which can have connections as 'content' or as 'initiator', to delete any associated data
$iId | which can be as conetnt ot initiator |
BxDolConnection::onModuleDeleteContent | ( | $sTable, | |
$sFieldId ) |
Must be called when module (which can have connections as 'content') is deleted, to delete any associated data. This method call may be automated via
$sTable | table name with data which have assiciations with the connection |
$sFieldId | id field name which is associated with the connection |
BxDolConnection::onModuleDeleteInitiator | ( | $sTable, | |
$sFieldId ) |
Must be called when module (which can have connections as 'initiator') is deleted, to delete any associated data. This method call may be automated via
$sTable | table name with data which have assiciations with the connection |
$sFieldId | id field name which is associated with the connection |
BxDolConnection::onModuleDeleteInitiatorAndContent | ( | $sTable, | |
$sFieldId ) |
Must be called when module (which can have connections as 'content' or as 'initiator') is deleted, to delete any associated data. This method call may be automated via
$sTable | table name with data which have assiciations with the connection |
$sFieldId | id field name which is associated with the connection |
BxDolConnection::onModuleProfileDeleteContent | ( | $sModuleName | ) |
Must be called when module (which can have connections as 'content' with 'sys_profiles' table) is deleted, to delete any associated data. This method call may be automated via
$sModuleName | module name to delete connections for |
BxDolConnection::onModuleProfileDeleteInitiator | ( | $sModuleName | ) |
Must be called when module (which can have connections as 'initiator' with 'sys_profiles' table) is deleted, to delete any associated data. This method call may be automated via
$sModuleName | module name to delete connections for |
BxDolConnection::onModuleProfileDeleteInitiatorAndContent | ( | $sModuleName | ) |
Must be called when module (which can have connections as 'content' or as 'initiator' with 'sys_profiles' table) is deleted, to delete any associated data. This method call may be automated via
$sModuleName | module name to delete connections for |
BxDolConnection::removeConnection | ( | $iInitiator, | |
$iContent ) |
Remove connection.
$iInitiator | initiator of the connection |
$iContent | connected content or other profile id in case of friends |
connection_removed
initiator
- [int] profile id who created the connectioncontent
- [int] profile id with whom the connection was createdmutual
- [int] if the relation is mutual or notobject
- [object] an instance of relation,