Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video 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 42 to 96

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();
        }

    
$resource            escape_check($resource);
    
$resource_type_field escape_check($resource_type_field);
    
$user                escape_check($user);
    
$page                escape_check($page);
    
$sql_where_clause    '';

    if(
$resource)
        {
        
$sql_where_clause " resource = '{$resource}'";
        }

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

        
$sql_where_clause .= " resource_type_field = '{$resource_type_field}'";
        }

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

        
$sql_where_clause .= " user = '{$user}'";
        }

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

        
$sql_where_clause .= " page = '{$page}'";
        }

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

    return 
sql_query("SELECT * FROM annotation {$sql_where_clause}");
    }

This article was last updated 30th November 2020 20:35 Europe/London time based on the source file dated 17th January 2020 16:11 Europe/London time.