19 if (!(
$row instanceof stdClass)) {
81 $access_id = (int)$access_id;
100 (entity_guid, name_id, value_id, value_type, owner_guid, time_created, access_id) VALUES 101 ($entity_guid, $name_id, $value_id, '$value_type', $owner_guid, $time, $access_id)");
133 $annotation_id = (int)$annotation_id;
151 $access_id = (int)$access_id;
164 SET name_id = $name_id, value_id = $value_id, value_type = '$value_type', 165 access_id = $access_id, owner_guid = $owner_guid 166 WHERE id = $annotation_id");
214 $options[
'annotation_calculation'] =
'count';
219 $options[
'metastring_type'] =
'annotations';
235 'offset' => (
int) max(
get_input(
'annoff', 0), 0),
260 $options[
'metastring_type'] =
'annotations';
282 $options[
'metastring_type'] =
'annotations';
299 if (!$options || !is_array($options)) {
303 $options[
'metastring_type'] =
'annotations';
349 'annotation_name_value_pairs_operator' =>
'AND',
350 'annotation_case_sensitive' =>
true,
351 'order_by_annotation' => array(),
358 'order_by' =>
'maxtime DESC',
359 'group_by' =>
'a.entity_guid' 364 $singulars = array(
'annotation_name',
'annotation_value',
365 'annotation_name_value_pair',
'annotation_owner_guid');
376 $options[
'selects'][] =
"MAX(n_table.time_created) AS maxtime";
377 $options[
'group_by'] =
'n_table.entity_guid';
380 $options[
'annotation_created_time_lower']);
427 'calculation' =>
'sum',
428 'order_by' =>
'annotation_calculation desc' 437 $options[
'selects'][] =
"$function(CAST(a_msv.string AS signed)) AS annotation_calculation";
441 $options[
'joins'][] =
"JOIN {$db_prefix}metastrings a_msv ON n_table.value_id = a_msv.id";
444 $options[
'group_by'] =
'n_table.entity_guid';
446 $options[
'callback'] =
'entity_row_to_elggstar';
466 'calculation' =>
'sum',
467 'order_by' =>
'annotation_calculation desc' 495 $sql =
"SELECT a.id FROM {$CONFIG->dbprefix}annotations a" .
496 " JOIN {$CONFIG->dbprefix}metastrings m ON a.name_id = m.id" .
497 " WHERE a.owner_guid = $owner_guid AND a.entity_guid = $entity_guid" .
498 " AND m.string = '$annotation_type'";
520 if (
$annotation->getSubtype() ==
'generic_comment') {
539 $tests[] = $CONFIG->path .
'engine/tests/ElggCoreAnnotationAPITest.php';
540 $tests[] = $CONFIG->path .
'engine/tests/ElggAnnotationTest.php';
_elgg_annotations_init()
Initialize the annotation library private.
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
get_data_row($query, $callback="")
Retrieve a single row from the database.
_elgg_is_valid_options_for_batch_operation($options, $type)
Checks if there are some constraints on the options array for potentially dangerous operations...
$annotation
Elgg default annotation view.
create_annotation($entity_guid, $name, $value, $value_type= '', $owner_guid=0, $access_id=ACCESS_PRIVATE)
Create a new annotation.
if($guid==elgg_get_logged_in_user_guid()) $name
elgg_delete_annotations(array $options)
Deletes annotations based on $options.
elgg_get_entities_from_annotations(array $options=array())
Returns entities based upon annotations.
_elgg_get_entity_time_where_sql($table, $time_created_upper=null, $time_created_lower=null, $time_updated_upper=null, $time_updated_lower=null)
Returns SQL where clause for entity time limits.
row_to_elggannotation($row)
Convert a database row to a new ElggAnnotation.
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Register a callback as a plugin hook handler.
update_annotation($annotation_id, $name, $value, $value_type, $owner_guid, $access_id)
Update an annotation.
update_data($query)
Update a row in the database.
_elgg_annotations_test($hook, $type, $tests)
Register annotation unit tests.
sanitize_string($string)
Sanitize a string for database use.
_elgg_set_comment_url($hook, $type, $url, $params)
Set the URL for a comment when called from a plugin hook.
insert_data($query)
Insert a row into the database.
detect_extender_valuetype($value, $value_type="")
Detect the value_type for a given value.
elgg_disable_annotations(array $options)
Disables annotations based on $options.
elgg_list_annotations($options)
Returns a rendered list of annotations with pagination.
elgg_get_annotation_from_id($id)
Get a specific annotation by its id.
elgg_delete_annotation_by_id($id)
Deletes an annotation using its ID.
elgg_get_entities_from_annotation_calculation($options)
Get entities ordered by a mathematical calculation on annotation values.
const ELGG_ENTITIES_ANY_VALUE
elgg_enable_annotations(array $options)
Enables annotations based on $options.
elgg global
Pointer to the global context.
access_get_show_hidden_status()
Return current status of showing disabled entities.
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
Register a callback as an Elgg event handler.
elgg_list_entities(array $options=array(), $getter= 'elgg_get_entities', $viewer= 'elgg_view_entity_list')
Returns a string of rendered entities.
elgg_list_entities_from_annotations($options=array())
Returns a viewable list of entities from annotations.
elgg_get_annotations(array $options=array())
Returns annotations.
_elgg_normalize_plural_options_array($options, $singulars)
Normalise the singular keys in an options array to plural keys.
sanitize_int($int, $signed=true)
Sanitizes an integer for database use.
elgg_trigger_event($event, $object_type, $object=null)
Trigger an Elgg Event and attempt to run all handler callbacks registered to that event...
elgg_annotation_exists($entity_guid, $annotation_type, $owner_guid=null)
Check to see if a user has already created an annotation on an object.
if(!$collection_name) $id
elgg_list_entities_from_annotation_calculation($options)
List entities from an annotation calculation.
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
if(!$num_display) $db_prefix
get_entity($guid)
Loads and returns an entity object from a guid.