26 $this->CONFIG = $CONFIG;
48 function delete(
$id) {
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");
209 $options[
'annotation_calculation'] =
'count';
213 $options[
'metastring_type'] =
'annotations';
232 $options[
'metastring_type'] =
'annotations';
253 $options[
'metastring_type'] =
'annotations';
269 if (!$options || !is_array($options)) {
273 $options[
'metastring_type'] =
'annotations';
315 'annotation_name_value_pairs_operator' =>
'AND',
316 'annotation_case_sensitive' =>
true,
317 'order_by_annotation' => array(),
327 $singulars = array(
'annotation_name',
'annotation_value',
328 'annotation_name_value_pair',
'annotation_owner_guid');
339 if (isset(
$options[
'order_by']) && preg_match(
'~\bmaxtime\b~i',
$options[
'order_by'])) {
344 if (!is_array($selects)) {
345 $selects = array($selects);
348 foreach ($selects as $select) {
349 if (preg_match(
'~\bmaxtime\b~i',
$options[
'order_by'])) {
360 .
" by maxtime, you must provide that column via \$options['selects']. See" 361 .
" https://github.com/Elgg/Elgg/issues/6638#issuecomment-41562034",
"1.10");
363 $options[
'selects'][] =
"MAX(n_table.time_created) AS maxtime";
364 $options[
'group_by'] =
'n_table.entity_guid';
369 $options[
'annotation_created_time_lower']);
418 'calculation' =>
'sum',
419 'order_by' =>
'annotation_calculation desc' 428 $options[
'selects'][] =
"$function(CAST(a_msv.string AS signed)) AS annotation_calculation";
432 $options[
'joins'][] =
"JOIN {$db_prefix}metastrings a_msv ON n_table.value_id = a_msv.id";
435 $options[
'group_by'] =
'n_table.entity_guid';
439 $options[
'callback'] =
'entity_row_to_elggstar';
465 $sql =
"SELECT a.id FROM {$this->CONFIG->dbprefix}annotations a" .
466 " JOIN {$this->CONFIG->dbprefix}metastrings m ON a.name_id = m.id" .
467 " WHERE a.owner_guid = $owner_guid AND a.entity_guid = $entity_guid" .
468 " AND m.string = '$annotation_type'";
getEntities(array $options=array())
Returns entities based upon annotations.
_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.
deleteAll(array $options)
Deletes annotations based on $options.
__construct()
Constructor.
if($guid==elgg_get_logged_in_user_guid()) $name
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.
create($entity_guid, $name, $value, $value_type= '', $owner_guid=0, $access_id=ACCESS_PRIVATE)
Create a new annotation.
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
events($event="", $object_type="", $function="", $priority=500, $call=false, $object=null)
Deprecated events core function.
disableAll(array $options)
Disables annotations based on $options.
sanitize_string($string)
Sanitize a string for database use.
detect_extender_valuetype($value, $value_type="")
Detect the value_type for a given value.
elgg_get_annotation_from_id($id)
Get a specific annotation by its id.
exists($entity_guid, $annotation_type, $owner_guid=null)
Check to see if a user has already created an annotation on an object.
getEntitiesFromCalculation($options)
Get entities ordered by a mathematical calculation on annotation values.
elgg_delete_annotation_by_id($id)
Deletes an annotation using its ID.
const ELGG_ENTITIES_ANY_VALUE
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
elgg global
Pointer to the global context.
find(array $options=array())
Returns annotations.
access_get_show_hidden_status()
Return current status of showing disabled entities.
elgg_get_annotations(array $options=array())
Returns annotations.
update($annotation_id, $name, $value, $value_type, $owner_guid, $access_id)
Update an annotation.
_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.
if(!$collection_name) $id
if(!$num_display) $db_prefix
get_entity($guid)
Loads and returns an entity object from a guid.
enableAll(array $options)
Enables annotations based on $options.