Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

deleteAnnotation()

Description

Delete annotation

@see getAnnotation()

Parameters

ColumnTypeDefaultDescription
$annotation array Annotation array as returned by getAnnotation()

Return

boolean

Location

include/annotation_functions.php lines 276 to 305

Definition

 
function deleteAnnotation(array $annotation)
    {
    if(!
annotationEditable($annotation))
        {
        return 
false;
        }

    
$annotation_ref $annotation['ref'];
    
$parameters=array("i",$annotation_ref);

    
$nodes_to_remove = array();
    foreach(
getAnnotationTags($annotation) as $tag)
        {
        
$nodes_to_remove[] = $tag['ref'];
        }

    
db_begin_transaction("deleteAnnotation");

    if(
count($nodes_to_remove))
        {
        
delete_resource_nodes($annotation['resource'], $nodes_to_remove);
        }

    
ps_query("DELETE FROM annotation_node WHERE annotation = ?"$parameters);
    
ps_query("DELETE FROM annotation WHERE ref = ?"$parameters);
        
    
db_end_transaction("deleteAnnotation");

    return 
true;
    }

This article was last updated 15th December 2024 07:35 Europe/London time based on the source file dated 6th March 2024 14:45 Europe/London time.