Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

do_collections_search()

Description

Search within available collections

Parameters

ColumnTypeDefaultDescription
$search string
$restypes string
$archive integer 0
$order_by string ''
$sort string "DESC"
$fetchrows integer -1

Return

array

Location

include/collections_functions.php lines 833 to 887

Definition

 
function do_collections_search($search,$restypes,$archive=0,$order_by='',$sort="DESC"$fetchrows = -1)
    {
    global 
$search_includes_themes$search_includes_public_collections$search_includes_user_collections$userref$collection_search_includes_resource_metadata$default_collection_sort;
    
    if(
$order_by=='')
        {
        
$order_by=$default_collection_sort;
        }
    
$result=array();
    
    
# Recognise a quoted search, which is a search for an exact string
    
$quoted_string=false;
    if (
substr($search,0,1)=="\"" && substr($search,-1,1)=="\""
        {
        
$quoted_string=true;
        
$search=substr($search,1,-1);
        } 
    
$search_includes_themes_now=$search_includes_themes;
    
$search_includes_public_collections_now=$search_includes_public_collections;
    
$search_includes_user_collections_now=$search_includes_user_collections;
    if (
$restypes!=""
        {
        
$restypes_x=explode(",",$restypes);
        
$search_includes_themes_now=in_array("themes",$restypes_x);
        
$search_includes_public_collections_now=in_array("pubcol",$restypes_x);
        
$search_includes_user_collections_now=in_array("mycol",$restypes_x);
        } 

    if (
$search_includes_themes_now || $search_includes_public_collections_now || $search_includes_user_collections_now)
        {
        if (
$collection_search_includes_resource_metadata)
            {
            
# Include metadata from resources when searching - using a special search
                
$collections=do_search("!contentscollection"
                    
. ($search_includes_user_collections_now?'U':'')
                    . (
$search_includes_public_collections_now?'P':'')
                    . (
$search_includes_themes_now?'T':'')
                    . 
" " $search,"",$order_by,0,-1,$sort);
            }
        else
            {
            
# The old way - same search as when searching within publich collections.
            
$collections=search_public_collections($search,"theme","ASC",!$search_includes_themes_now,!$search_includes_public_collections_now,true,false$search_includes_user_collections_now$fetchrows);
            }
        
        
            
$condensedcollectionsresults=array();
            
$result=$collections;

        }
       
    
    
    return 
$result;
    }

This article was last updated 25th November 2020 04:35 Europe/London time based on the source file dated 23rd November 2020 16:00 Europe/London time.