Go to the source code of this file.
Namespaces | |
| namespace | Elgg::Core |
Activate a plugin or plugins. | |
Functions | |
| row_to_elggrelationship ($row) | |
| Convert a database row to a new ElggRelationship. | |
| get_relationship ($id) | |
| Return a relationship. | |
| delete_relationship ($id) | |
| Delete a specific relationship. | |
| add_entity_relationship ($guid_one, $relationship, $guid_two) | |
| Define an arbitrary relationship between two entities. | |
| check_entity_relationship ($guid_one, $relationship, $guid_two) | |
| Determine if a relationship between two entities exists and returns the relationship object if it does. | |
| remove_entity_relationship ($guid_one, $relationship, $guid_two) | |
| Remove an arbitrary relationship between two entities. | |
| remove_entity_relationships ($guid_one, $relationship="", $inverse=false, $type= '') | |
| Removes all arbitrary relationships originating from a particular entity. | |
| get_entity_relationships ($guid, $inverse_relationship=FALSE) | |
| Get all the relationships for a given guid. | |
| elgg_get_entities_from_relationship ($options) | |
| Return entities matching a given query joining against a relationship. | |
| elgg_get_entity_relationship_where_sql ($column, $relationship=NULL, $relationship_guid=NULL, $inverse_relationship=FALSE) | |
| Returns sql appropriate for relationship joins and wheres. | |
| elgg_list_entities_from_relationship (array $options=array()) | |
| Returns a viewable list of entities by relationship. | |
| elgg_get_entities_from_relationship_count (array $options=array()) | |
| Gets the number of entities by a the number of entities related to them in a particular way. | |
| elgg_list_entities_from_relationship_count ($options) | |
| Returns a list of entities by relationship count. | |
| elgg_register_relationship_url_handler ($relationship_type, $function_name) | |
| Sets the URL handler for a particular relationship type. | |
| get_relationship_url ($id) | |
| Get the url for a given relationship. | |
| already_attached ($guid_one, $guid_two) | |
| Function to determine if the object trying to attach to other, has already done so. | |
| get_attachments ($guid, $type="") | |
| Function to get all objects attached to a particular object. | |
| remove_attachment ($guid_one, $guid_two) | |
| Function to remove a particular attachment between two objects. | |
| make_attachment ($guid_one, $guid_two) | |
| Function to start the process of attaching one object to another. | |
| import_relationship_plugin_hook ($hook, $entity_type, $returnvalue, $params) | |
| Handler called by trigger_plugin_hook on the "import" event. | |
| export_relationship_plugin_hook ($hook, $entity_type, $returnvalue, $params) | |
| Handler called by trigger_plugin_hook on the "export" event. | |
| relationship_notification_hook ($event, $type, $object) | |
| Notify user that someone has friended them. | |
| add_entity_relationship | ( | $ | guid_one, | |
| $ | relationship, | |||
| $ | guid_two | |||
| ) |
Define an arbitrary relationship between two entities.
This relationship could be a friendship, a group membership or a site membership.
This function lets you make the statement "$guid_one is a $relationship of $guid_two".
| int | $guid_one First GUID | |
| string | $relationship Relationship name | |
| int | $guid_two Second GUID |
Definition at line 75 of file relationships.php.
| already_attached | ( | $ | guid_one, | |
| $ | guid_two | |||
| ) |
Function to determine if the object trying to attach to other, has already done so.
| int | $guid_one This is the target object | |
| int | $guid_two This is the object trying to attach to $guid_one |
Definition at line 488 of file relationships.php.
| check_entity_relationship | ( | $ | guid_one, | |
| $ | relationship, | |||
| $ | guid_two | |||
| ) |
Determine if a relationship between two entities exists and returns the relationship object if it does.
| int | $guid_one The GUID of the entity "owning" the relationship | |
| string | $relationship The type of relationship | |
| int | $guid_two The GUID of the entity the relationship is with |
Definition at line 114 of file relationships.php.
| delete_relationship | ( | $ | id | ) |
Delete a specific relationship.
| int | $id The relationship ID |
Definition at line 49 of file relationships.php.
| elgg_get_entities_from_relationship | ( | $ | options | ) |
Return entities matching a given query joining against a relationship.
Also accepts all options available to elgg_get_entities() and elgg_get_entities_from_metadata().
To ask for entities that do not have a particulat relationship to an entity, use a custom where clause like the following:
$options['wheres'][] = "NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = '$relationship' )";
| array | $options Array in format: |
relationship => NULL|STR relationship
relationship_guid => NULL|INT Guid of relationship to test
inverse_relationship => BOOL Inverse the relationship
Definition at line 265 of file relationships.php.
| elgg_get_entities_from_relationship_count | ( | array $ | options = array() |
) |
Gets the number of entities by a the number of entities related to them in a particular way.
This is a good way to get out the users with the most friends, or the groups with the most members.
| array | $options An options array compatible with elgg_get_entities_from_relationship() |
Definition at line 387 of file relationships.php.
| elgg_get_entity_relationship_where_sql | ( | $ | column, | |
| $ | relationship = NULL, |
|||
| $ | relationship_guid = NULL, |
|||
| $ | inverse_relationship = FALSE | |||
| ) |
Returns sql appropriate for relationship joins and wheres.
| string | $column Column name the guid should be checked against. Provide in table.column format. | |
| string | $relationship Relationship string | |
| int | $relationship_guid Entity guid to check | |
| bool | $inverse_relationship Inverse relationship check? |
Definition at line 325 of file relationships.php.
| elgg_list_entities_from_relationship | ( | array $ | options = array() |
) |
Returns a viewable list of entities by relationship.
| array | $options Options array for retrieval of entities |
Definition at line 373 of file relationships.php.
| elgg_list_entities_from_relationship_count | ( | $ | options | ) |
Returns a list of entities by relationship count.
| array | $options Options array |
Definition at line 404 of file relationships.php.
| elgg_register_relationship_url_handler | ( | $ | relationship_type, | |
| $ | function_name | |||
| ) |
Sets the URL handler for a particular relationship type.
| string | $relationship_type The relationship type. | |
| string | $function_name The function to register |
Definition at line 416 of file relationships.php.
| export_relationship_plugin_hook | ( | $ | hook, | |
| $ | entity_type, | |||
| $ | returnvalue, | |||
| $ | params | |||
| ) |
Handler called by trigger_plugin_hook on the "export" event.
| string | $hook export | |
| string | $entity_type all | |
| mixed | $returnvalue Previous hook return value | |
| array | $params Parameters |
export all
| InvalidParameterException | private |
Definition at line 591 of file relationships.php.
| get_attachments | ( | $ | guid, | |
| $ | type = "" | |||
| ) |
Function to get all objects attached to a particular object.
| int | $guid Entity GUID | |
| string | $type The type of object to return e.g. 'file', 'friend_of' etc |
Definition at line 505 of file relationships.php.
| get_entity_relationships | ( | $ | guid, | |
| $ | inverse_relationship = FALSE | |||
| ) |
Get all the relationships for a given guid.
| int | $guid The GUID of the relationship owner | |
| bool | $inverse_relationship Inverse relationship owners? |
Definition at line 225 of file relationships.php.
| get_relationship | ( | $ | id | ) |
Return a relationship.
| int | $id The ID of a relationship |
Definition at line 33 of file relationships.php.
| get_relationship_url | ( | $ | id | ) |
Get the url for a given relationship.
| int | $id Relationship ID |
Definition at line 439 of file relationships.php.
| import_relationship_plugin_hook | ( | $ | hook, | |
| $ | entity_type, | |||
| $ | returnvalue, | |||
| $ | params | |||
| ) |
Handler called by trigger_plugin_hook on the "import" event.
| string | $hook import | |
| string | $entity_type all | |
| mixed | $returnvalue Value from previous hook | |
| mixed | $params Array of params |
Definition at line 566 of file relationships.php.
| make_attachment | ( | $ | guid_one, | |
| $ | guid_two | |||
| ) |
Function to start the process of attaching one object to another.
| int | $guid_one This is the target object | |
| int | $guid_two This is the object trying to attach to $guid_one |
Definition at line 547 of file relationships.php.
| relationship_notification_hook | ( | $ | event, | |
| $ | type, | |||
| $ | object | |||
| ) |
Notify user that someone has friended them.
| string | $event Event name | |
| string | $type Object type | |
| mixed | $object Object |
Definition at line 624 of file relationships.php.
| remove_attachment | ( | $ | guid_one, | |
| $ | guid_two | |||
| ) |
Function to remove a particular attachment between two objects.
| int | $guid_one This is the target object | |
| int | $guid_two This is the object to remove from $guid_one |
Definition at line 532 of file relationships.php.
| remove_entity_relationship | ( | $ | guid_one, | |
| $ | relationship, | |||
| $ | guid_two | |||
| ) |
Remove an arbitrary relationship between two entities.
| int | $guid_one First GUID | |
| string | $relationship Relationship name | |
| int | $guid_two Second GUID |
Definition at line 143 of file relationships.php.
| remove_entity_relationships | ( | $ | guid_one, | |
| $ | relationship = "", |
|||
| $ | inverse = false, |
|||
| $ | type = '' | |||
| ) |
Removes all arbitrary relationships originating from a particular entity.
| int | $guid_one The GUID of the entity | |
| string | $relationship The name of the relationship (optional) | |
| bool | $inverse Whether we're deleting inverse relationships (default false) | |
| string | $type The type of entity to the delete to (defaults to all) |
Definition at line 177 of file relationships.php.
| row_to_elggrelationship | ( | $ | row | ) |
Convert a database row to a new ElggRelationship.
| stdClass | $row Database row from the relationship table |
Definition at line 18 of file relationships.php.
1.6.3