Property | Type | Description | |
---|---|---|---|
$db | |||
$events | |||
$session | ElggSession |
Method | Description | |
---|---|---|
__construct ( |
Constructor | |
create ( integer $entity_guid, string $name, string $value, string $value_type = '', integer $owner_guid, integer $access_id = ACCESS_PRIVATE ) : integer | boolean | Create a new annotation. | |
delete ( integer $id ) : boolean | Deletes an annotation using its ID. | |
deleteAll ( array $options ) : boolean | null | Deletes annotations based on $options. | |
disableAll ( array $options ) : boolean | null | Disables annotations based on $options. | |
enableAll ( array $options ) : boolean | null | Enables annotations based on $options. | |
exists ( integer $entity_guid, string $annotation_type, integer $owner_guid = null ) : boolean | Check to see if a user has already created an annotation on an object | |
find ( array $options = [] ) : ElggAnnotation[] | mixed | Returns annotations. Accepts all elgg_get_entities() options for entity restraints. | |
get ( integer $id ) : ElggAnnotation | false | Get a specific annotation by its id. | |
getEntities ( array $options = [] ) : mixed | Returns entities based upon annotations. Also accepts all options available to elgg_get_entities() and elgg_get_entities_from_metadata(). | |
getEntitiesFromCalculation ( array $options ) : ElggEntity[] | integer | Get entities ordered by a mathematical calculation on annotation values | |
update ( integer $annotation_id, string $name, string $value, string $value_type, integer $owner_guid, integer $access_id ) : boolean | Update an annotation. |
public __construct ( |
||
$db | Database | |
$session | ElggSession | Session |
$events | Events |
public create ( integer $entity_guid, string $name, string $value, string $value_type = '', integer $owner_guid, integer $access_id = ACCESS_PRIVATE ) : integer | boolean | ||
$entity_guid | integer | GUID of entity to be annotated |
$name | string | Name of annotation |
$value | string | Value of annotation |
$value_type | string | Type of value (default is auto detection) |
$owner_guid | integer | Owner of annotation (default is logged in user) |
$access_id | integer | Access level of annotation |
return | integer | boolean | id on success or false on failure |
public find ( array $options = [] ) : ElggAnnotation[] | mixed | ||
$options | array | 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 \ElggAnnotation objects. See the docs for elgg_get_entities_from_annotation_calculation() for the proper use of the "calculation" option. |
return | ElggAnnotation[] | mixed |
public getEntities ( array $options = [] ) : mixed | ||
$options | array | 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 |
return | mixed | If count, int. If not count, array. false on errors. |
public getEntitiesFromCalculation ( array $options ) : ElggEntity[] | integer | ||
$options | array | 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. @tip This function is different from other ege* functions, as it uses a metastring-based getter function { @link elgg_get_annotations() }, therefore the callback function should be a derivative of { @link entity_row_to_elggstar() } and not of { @link row_to_annotation() } |
return | ElggEntity[] | integer | An array or a count of entities |
public update ( integer $annotation_id, string $name, string $value, string $value_type, integer $owner_guid, integer $access_id ) : boolean | ||
$annotation_id | integer | Annotation ID |
$name | string | Name of annotation |
$value | string | Value of annotation |
$value_type | string | Type of value |
$owner_guid | integer | Owner of annotation |
$access_id | integer | Access level of annotation |
return | boolean |