Elgg  Version 4.3
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
elgg_delete_annotations(array $options)
Deletes annotations based on $options.
Definition: annotations.php:87
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
$defaults
elgg_get_annotations(array $options=[])
Fetch annotations or perform a calculation on them.
Definition: annotations.php:52
elgg_list_entities(array $options=[], $getter= 'elgg_get_entities', $viewer= 'elgg_view_entity_list')
Returns a string of rendered entities.
Definition: entities.php:589
$options
Elgg admin footer.
Definition: footer.php:6
$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
get_input($variable, $default=null, $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_enable_annotations(array $options)
Enables annotations based on $options.
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:638
$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