Elgg
Version 1.11
|
Public Member Functions | |
__construct () | |
Constructor. More... | |
get ($id) | |
Get a specific annotation by its id. More... | |
delete ($id) | |
Deletes an annotation using its ID. More... | |
create ($entity_guid, $name, $value, $value_type= '', $owner_guid=0, $access_id=ACCESS_PRIVATE) | |
Create a new annotation. More... | |
update ($annotation_id, $name, $value, $value_type, $owner_guid, $access_id) | |
Update an annotation. More... | |
find (array $options=array()) | |
Returns annotations. More... | |
deleteAll (array $options) | |
Deletes annotations based on $options. More... | |
disableAll (array $options) | |
Disables annotations based on $options. More... | |
enableAll (array $options) | |
Enables annotations based on $options. More... | |
getEntities (array $options=array()) | |
Returns entities based upon annotations. More... | |
getEntitiesFromCalculation ($options) | |
Get entities ordered by a mathematical calculation on annotation values. More... | |
exists ($entity_guid, $annotation_type, $owner_guid=null) | |
Check to see if a user has already created an annotation on an object. More... | |
Definition at line 13 of file Annotations.php.
Elgg\Database\Annotations::__construct | ( | ) |
Constructor.
Definition at line 24 of file Annotations.php.
Elgg\Database\Annotations::create | ( | $entity_guid, | |
$name, | |||
$value, | |||
$value_type = '' , |
|||
$owner_guid = 0 , |
|||
$access_id = ACCESS_PRIVATE |
|||
) |
Create a new annotation.
int | $entity_guid | GUID of entity to be annotated |
string | $name | Name of annotation |
string | $value | Value of annotation |
string | $value_type | Type of value (default is auto detection) |
int | $owner_guid | Owner of annotation (default is logged in user) |
int | $access_id | Access level of annotation |
Definition at line 68 of file Annotations.php.
Elgg\Database\Annotations::delete | ( | $id | ) |
Deletes an annotation using its ID.
int | $id | The annotation ID to delete. |
Definition at line 48 of file Annotations.php.
Elgg\Database\Annotations::deleteAll | ( | array | $options | ) |
Deletes annotations based on $options.
array | $options | An options array. elgg_get_annotations() |
Definition at line 227 of file Annotations.php.
Elgg\Database\Annotations::disableAll | ( | array | $options | ) |
Disables annotations based on $options.
array | $options | An options array. elgg_get_annotations() |
Definition at line 244 of file Annotations.php.
Elgg\Database\Annotations::enableAll | ( | array | $options | ) |
Enables annotations based on $options.
array | $options | An options array. elgg_get_annotations() |
Definition at line 268 of file Annotations.php.
Elgg\Database\Annotations::exists | ( | $entity_guid, | |
$annotation_type, | |||
$owner_guid = null |
|||
) |
Check to see if a user has already created an annotation on an object.
int | $entity_guid | Entity guid |
string | $annotation_type | Type of annotation |
int | $owner_guid | Defaults to logged in user. |
Definition at line 454 of file Annotations.php.
Elgg\Database\Annotations::find | ( | array | $options = array() | ) |
Returns annotations.
Accepts all elgg_get_entities() options for entity restraints.
array | $options | Array in format: |
annotation_names => null|ARR Annotation names annotation_values => null|ARR Annotation values annotation_ids => null|ARR annotation ids annotation_case_sensitive => BOOL Overall Case sensitive annotation_owner_guids => null|ARR guids for annotation owners annotation_created_time_lower => INT Lower limit for created time. annotation_created_time_upper => INT Upper limit for created time. annotation_calculation => STR Perform the MySQL function on the annotation values returned. Do not confuse this "annotation_calculation" option with the "calculation" option to elgg_get_entities_from_annotation_calculation(). The "annotation_calculation" option causes this function to return the result of performing a mathematical calculation on all annotations that match the query instead of objects. See the docs for elgg_get_entities_from_annotation_calculation() for the proper use of the "calculation" option.
Definition at line 205 of file Annotations.php.
Elgg\Database\Annotations::get | ( | $id | ) |
Get a specific annotation by its id.
If you want multiple annotation objects, use elgg_get_annotations().
int | $id | The id of the annotation object being retrieved. |
Definition at line 38 of file Annotations.php.
Elgg\Database\Annotations::getEntities | ( | array | $options = array() | ) |
Returns entities based upon annotations.
Also accepts all options available to elgg_get_entities() and elgg_get_entities_from_metadata().
array | $options | Array in format: annotation_names => null|ARR annotations names annotation_values => null|ARR annotations values annotation_name_value_pairs => null|ARR (name = 'name', value => 'value', 'operator' => '=', 'case_sensitive' => true) entries. Currently if multiple values are sent via an array (value => array('value1', 'value2') the pair's operator will be forced to "IN". annotation_name_value_pairs_operator => null|STR The operator to use for combining(name = value) OPERATOR (name = value); default AND |
annotation_case_sensitive => BOOL Overall Case sensitive
order_by_annotation => null|ARR (array('name' => 'annotation_text1', 'direction' => ASC|DESC, 'as' => text|integer),
Also supports array('name' => 'annotation_text1')
annotation_owner_guids => null|ARR guids for annotaiton owners
Definition at line 309 of file Annotations.php.
Elgg\Database\Annotations::getEntitiesFromCalculation | ( | $options | ) |
Get entities ordered by a mathematical calculation on annotation values.
Note that this function uses elgg_get_annotations() to return a list of entities ordered by a mathematical calculation on annotation values, and elgg_get_entities_from_annotations() to return a count of entities if $options['count'] is set to a truthy value
array | $options | An options array: 'calculation' => The calculation to use. Must be a valid MySQL function. Defaults to sum. Result selected as 'annotation_calculation'. Don't confuse this "calculation" option with the "annotation_calculation" option to elgg_get_annotations(). This "calculation" option is applied to each entity's set of annotations and is selected as annotation_calculation for that row. See the docs for elgg_get_annotations() for proper use of the "annotation_calculation" option. 'order_by' => The order for the sorting. Defaults to 'annotation_calculation desc'. 'annotation_names' => The names of annotations on the entity. 'annotation_values' => The values of annotations on the entity. |
'metadata_names' => The name of metadata on the entity. 'metadata_values' => The value of metadata on the entitiy. 'callback' => Callback function to pass each row through. This function is different from other ege* functions, as it uses a metastring-based getter function elgg_get_annotations(), therefore the callback function should be a derivative of entity_row_to_elggstar() and not of row_to_annotation()
Definition at line 410 of file Annotations.php.
Elgg\Database\Annotations::update | ( | $annotation_id, | |
$name, | |||
$value, | |||
$value_type, | |||
$owner_guid, | |||
$access_id | |||
) |
Update an annotation.
int | $annotation_id | Annotation ID |
string | $name | Name of annotation |
string | $value | Value of annotation |
string | $value_type | Type of value |
int | $owner_guid | Owner of annotation |
int | $access_id | Access level of annotation |
Definition at line 130 of file Annotations.php.