50 public function get(
$id) {
56 $qb->addClause($where);
58 $row = $this->db->getDataRow($qb);
78 if (!$this->events->trigger(
'delete',
'annotation',
$annotation)) {
84 $deleted = $this->db->deleteData($qb);
105 if ($annotation->id) {
106 return $this->
update($annotation);
109 $annotation->entity_guid = $entity->guid;
118 if (!$this->events->trigger(
'annotate', $entity->
getType(),
$entity)) {
122 if (!$this->events->triggerBefore(
'create',
'annotation', $annotation)) {
133 'value_type' => $qb->param($annotation->value_type, ELGG_VALUE_STRING),
139 $result = $this->db->insertData($qb);
147 if (!$this->events->trigger(
'create',
'annotation', $annotation)) {
153 $this->events->triggerAfter(
'create',
'annotation', $annotation);
172 if (!$this->events->triggerBefore(
'update',
'annotation', $annotation)) {
179 ->
set(
'value_type', $qb->param($annotation->value_type, ELGG_VALUE_STRING))
184 $result = $this->db->updateData($qb);
190 $this->events->trigger(
'update',
'annotation', $annotation);
191 $this->events->triggerAfter(
'update',
'annotation', $annotation);
205 if ($annotation->enabled ==
'no') {
217 if ($annotation->id) {
222 if (!$this->db->updateData($qb)) {
227 $annotation->enabled =
'no';
241 if ($annotation->enabled ==
'yes') {
253 if ($annotation->id) {
258 if (!$this->db->updateData($qb)) {
263 $annotation->enabled =
'yes';
278 $options[
'metastring_type'] =
'annotations';
303 $options[
'batch'] =
true;
304 $options[
'batch_size'] = 50;
305 $options[
'batch_inc_offset'] =
false;
308 $count = $annotations->count();
316 if ($annotation->delete()) {
321 return $success ==
$count;
339 $inc_offset =
_elgg_services()->session->getDisabledEntityVisibility();
341 $options[
'batch'] =
true;
342 $options[
'batch_size'] = 50;
343 $options[
'batch_inc_offset'] = $inc_offset;
346 $count = $annotations->count();
354 if ($annotation->disable()) {
359 return $success ==
$count;
378 $options[
'batch'] =
true;
379 $options[
'batch_size'] = 50;
382 $count = $annotations->count();
390 if ($annotation->enable()) {
395 return $success ==
$count;
418 $result = $this->db->getDataRow($qb);
getType()
Return a type of extension.
disable(ElggAnnotation $annotation)
Disable the annotation.
disableAll(array $options)
Disables annotations based on $options.
if(!$user||!$user->canDelete()) $name
exists($entity_guid, $name, $owner_guid)
Check to see if a user has already created an annotation on an object.
_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.
static find(array $options=[])
Build and execute a new query from an array of legacy options.
static table($table, $alias=null)
{}
const ELGG_VALUE_INTEGER
Value types.
enable(ElggAnnotation $annotation)
Enable the annotation.
elgg_delete_river(array $options=[])
Delete river items based on $options.
__construct(Database $db, EventsService $events)
Constructor.
getCurrentTime($modifier= '')
Get the (cloned) time.
Builds queries for matching annotations against their properties.
create(ElggAnnotation $annotation, ElggEntity $entity)
Create a new annotation and return its ID.
update(ElggAnnotation $annotation)
Store updated annotation in the database.
canEdit($user_guid=0)
Determines whether or not the user can edit this annotation.
static intoTable($table)
{}
$id
River item delete action.
elgg_delete_annotation_by_id($id)
Deletes an annotation using its ID.
deleteAll(array $options)
Deletes annotations based on $options.
find(array $options=[])
Returns annotations.
static fromTable($table, $alias=null)
{}
getType()
Returns the entity type.
_elgg_services()
Get the global service provider.
Interfaces with the database to perform CRUD operations on annotations.
enableAll(array $options)
Enables annotations based on $options.
trait TimeUsing
Adds methods for setting the current time (for testing)
static fromTable($table, $alias=null)
{}