26 $this->CONFIG = $CONFIG;
48 function delete(
$id) {
82 $access_id = (int)$access_id;
101 (entity_guid, name_id, value_id, value_type, owner_guid, time_created, access_id) VALUES 102 ($entity_guid, $name_id, $value_id, '$value_type', $owner_guid, $time, $access_id)");
134 $annotation_id = (int)$annotation_id;
152 $access_id = (int)$access_id;
165 SET name_id = $name_id, value_id = $value_id, value_type = '$value_type', 166 access_id = $access_id, owner_guid = $owner_guid 167 WHERE id = $annotation_id");
214 $options[
'annotation_calculation'] =
'count';
219 $options[
'metastring_type'] =
'annotations';
238 $options[
'metastring_type'] =
'annotations';
259 $options[
'metastring_type'] =
'annotations';
275 if (!$options || !is_array($options)) {
279 $options[
'metastring_type'] =
'annotations';
321 'annotation_name_value_pairs_operator' =>
'AND',
322 'annotation_case_sensitive' =>
true,
323 'order_by_annotation' => array(),
333 $singulars = array(
'annotation_name',
'annotation_value',
334 'annotation_name_value_pair',
'annotation_owner_guid');
345 if (isset(
$options[
'order_by']) && preg_match(
'~\bmaxtime\b~i',
$options[
'order_by'])) {
350 if (!is_array($selects)) {
351 $selects = array($selects);
354 foreach ($selects as $select) {
355 if (preg_match(
'~\bmaxtime\b~i',
$options[
'order_by'])) {
366 .
" by maxtime, you must provide that column via \$options['selects']. See" 367 .
" https://github.com/Elgg/Elgg/issues/6638#issuecomment-41562034",
"1.10");
369 $options[
'selects'][] =
"MAX(n_table.time_created) AS maxtime";
370 $options[
'group_by'] =
'n_table.entity_guid';
375 $options[
'annotation_created_time_lower']);
408 'calculation' =>
'sum',
409 'order_by' =>
'annotation_calculation desc' 418 $options[
'selects'][] =
"$function(CAST(a_msv.string AS signed)) AS annotation_calculation";
422 $options[
'joins'][] =
"JOIN {$db_prefix}metastrings a_msv ON n_table.value_id = a_msv.id";
425 $options[
'group_by'] =
'n_table.entity_guid';
427 $options[
'callback'] =
'entity_row_to_elggstar';
456 $sql =
"SELECT a.id FROM {$this->CONFIG->dbprefix}annotations a" .
457 " JOIN {$this->CONFIG->dbprefix}metastrings m ON a.name_id = m.id" .
458 " WHERE a.owner_guid = $owner_guid AND a.entity_guid = $entity_guid" .
459 " 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_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.
if(!$autoload_available) _elgg_services()
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)
Sends 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.