Elgg  Version 5.1
annotations.php
Go to the documentation of this file.
1 <?php
17  return _elgg_services()->annotationsTable->get($id);
18 }
19 
27 function elgg_delete_annotation_by_id(int $id): bool {
29  if (!$annotation) {
30  return false;
31  }
32 
33  return $annotation->delete();
34 }
35 
52 function elgg_get_annotations(array $options = []) {
53  return _elgg_services()->annotationsTable->find($options);
54 }
55 
65 function elgg_list_annotations(array $options = []): string {
66  $defaults = [
67  'limit' => 25,
68  'offset' => (int) max(get_input('annoff', 0), 0),
69  ];
70 
71  $options = array_merge($defaults, $options);
72 
73  return elgg_list_entities($options, 'elgg_get_annotations', 'elgg_view_annotation_list');
74 }
75 
87 function elgg_delete_annotations(array $options): bool {
88  return _elgg_services()->annotationsTable->deleteAll($options);
89 }
90 
100 function elgg_disable_annotations(array $options): bool {
101  return _elgg_services()->annotationsTable->disableAll($options);
102 }
103 
113 function elgg_enable_annotations(array $options): bool {
114  return _elgg_services()->annotationsTable->enableAll($options);
115 }
116 
127 function elgg_annotation_exists(int $entity_guid, string $name, int $owner_guid = 0): bool {
128  if ($owner_guid < 1) {
130  }
131 
132  return _elgg_services()->annotationsTable->exists($entity_guid, $name, $owner_guid);
133 }
if($id< 1) $annotation
Definition: delete.php:11
$defaults
Generic entity header upload helper.
Definition: header.php:6
elgg_delete_annotations(array $options)
Deletes annotations based on $options.
Definition: annotations.php:87
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
elgg_get_annotations(array $options=[])
Fetch annotations or perform a calculation on them.
Definition: annotations.php:52
Entity Annotation.
$options
Elgg admin footer.
Definition: footer.php:6
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
$entity_guid
Action for adding and editing comments.
Definition: save.php:6
elgg_disable_annotations(array $options)
Disables annotations based on $options.
$owner_guid
elgg_list_annotations(array $options=[])
Returns a rendered list of annotations with pagination.
Definition: annotations.php:65
elgg_enable_annotations(array $options)
Enables annotations based on $options.
elgg_list_entities(array $options=[], callable $getter=null, callable $viewer=null)
Returns a string of rendered entities.
Definition: entities.php:548
elgg_get_annotation_from_id(int $id)
Elgg annotations Functions to manage object annotations.
Definition: annotations.php:16
_elgg_services()
Get the global service provider.
Definition: elgglib.php:346
$id
Generic annotation delete action.
Definition: delete.php:6
elgg_annotation_exists(int $entity_guid, string $name, int $owner_guid=0)
Check to see if a user has already created an annotation on an object.
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:34
elgg_delete_annotation_by_id(int $id)
Deletes an annotation using its ID.
Definition: annotations.php:27