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

getAnnotations()

Description

General annotations search functionality

Parameters

ColumnTypeDefaultDescription
$resource integer 0
$resource_type_field integer 0
$user integer 0
$page integer 0

Return

array

Location

include/annotation_functions.php lines 39 to 94

Definition

 
function getAnnotations($resource 0$resource_type_field 0$user 0$page 0)
    {
    if(!
is_numeric($resource) || !is_numeric($resource_type_field) || !is_numeric($user) || !is_numeric($page))
        {
        return array();
        }

    
$sql_where_clause    '';
    
$parameters=array();
    
    if(
$resource)
        {
        
$sql_where_clause " resource = ?";
        
$parameters = array("i",$resource);
        }

    if(
$resource_type_field)
        {
        if(
'' != $sql_where_clause)
            {
            
$sql_where_clause .= ' AND';
            }

        
$sql_where_clause .= " resource_type_field = ?";
        
$parameters=array_merge($parameters,array("i",$resource_type_field));
        }

    if(
$user)
        {
        if(
'' != $sql_where_clause)
            {
            
$sql_where_clause .= ' AND';
            }

        
$sql_where_clause .= " user = ?";
        
$parameters=array_merge($parameters,array("i",$user));
        }

    if(
$page)
        {
        if(
'' != $sql_where_clause)
            {
            
$sql_where_clause .= ' AND';
            }

        
$sql_where_clause .= " page = ?";
        
$parameters=array_merge($parameters,array("i",$page));
        }

    if(
'' != $sql_where_clause)
        {
        
$sql_where_clause "WHERE {$sql_where_clause}";
        }

        return 
ps_query("SELECT " columns_in("annotation") . " FROM annotation {$sql_where_clause}",$parameters);
    }

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