Collections functions
General functions
Render functions
Theme permission functions
Resource 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 * FROM annotation {$sql_where_clause}",$parameters);
    }

This article was last updated 26th June 2022 03:35 Europe/London time based on the source file dated 1st February 2022 16:00 Europe/London time.