Elgg  Version master
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 
50 function elgg_get_annotations(array $options = []) {
51  return _elgg_services()->annotationsTable->find($options);
52 }
53 
63 function elgg_list_annotations(array $options = []): string {
64  $defaults = [
65  'limit' => 25,
66  'offset' => (int) max(get_input('annoff', 0), 0),
67  ];
68 
69  $options = array_merge($defaults, $options);
70 
71  return elgg_list_entities($options, 'elgg_get_annotations', 'elgg_view_annotation_list');
72 }
73 
85 function elgg_delete_annotations(array $options): bool {
86  return _elgg_services()->annotationsTable->deleteAll($options);
87 }
88 
99 function elgg_annotation_exists(int $entity_guid, string $name, int $owner_guid = 0): bool {
100  if ($owner_guid < 1) {
102  }
103 
104  return _elgg_services()->annotationsTable->exists($entity_guid, $name, $owner_guid);
105 }
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:85
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:50
Entity Annotation.
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
if($who_can_change_language=== 'nobody') elseif($who_can_change_language=== 'admin_only'&&!elgg_is_admin_logged_in()) $options
Definition: language.php:20
$owner_guid
elgg_list_annotations(array $options=[])
Returns a rendered list of annotations with pagination.
Definition: annotations.php:63
elgg_list_entities(array $options=[], callable $getter=null, callable $viewer=null)
Returns a string of rendered entities.
Definition: entities.php:551
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:351
$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.
Definition: annotations.php:99
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