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

collection_download_process_text_file()

Description

Add resource data/collection_resource data to text file during a collection download.

Parameters

ColumnTypeDefaultDescription
$ref integer
$collection integer
$filename string

Return

void

Location

include/collections_functions.php lines 4799 to 4851

Definition

 
function collection_download_process_text_file($ref$collection$filename)
    {
    global 
$lang$zipped_collection_textfile$includetext$size$subbed_original$k$text$sizetext;

    if ((
$zipped_collection_textfile==true)&&($includetext=="true"))
        {
        if (
$size==""){$sizetext="";}else{$sizetext="-".$size;}
        if (
$subbed_original) { $sizetext '(' $lang['substituted_original'] . ')'; }
        if(
$k === '')
            {
            
$fields get_resource_field_data($ref);
            }
        else
            {
            
// External shares should take into account fields that are not meant to show in that case
            
$fields get_resource_field_data($reffalsetruenulltrue);
            }
        
$commentdata=get_collection_resource_comment($ref,$collection);
        
$fields_count count($fields);
        if(
$fields_count 0)
            {
            
$hook_replace_text hook('replacecollectiontext''', array($text$sizetext$filename$ref$fields$fields_count$commentdata));
            if(
$hook_replace_text == false)
                {
                
$text.= ($sizetext == '' '' $sizetext) . ' '$filename"\r\n-----------------------------------------------------------------\r\n";
                
$text .= $lang['resourceid'] . ': ' $ref "\r\n";

                for(
$i 0$i $fields_count$i++)
                    {
                    
$value=$fields[$i]["value"];
                    
$title=str_replace('Keywords - '''$fields[$i]["title"]);
                    if ((
trim((string) $value)!="") && (trim((string) $value) != ','))
                        {
                        
$text .= wordwrap('* ' $title ': ' i18n_get_translated($value) . "\r\n"65);
                        }
                    }
                if(
trim((string)$commentdata['comment']) != '')
                    {
                    
$text .= wordwrap($lang['comment'] . ': ' $commentdata['comment'] . "\r\n"65);
                    }
                if(
trim((string)$commentdata['rating']) != '')
                    {
                    
$text .= wordwrap($lang['rating'] . ': ' $commentdata['rating'] . "\r\n"65);
                    }
                
$text .= "-----------------------------------------------------------------\r\n\r\n";
                }
            else
                {
                
$text $hook_replace_text;
                }
            }
        }
    }

This article was last updated 4th December 2024 08:35 Europe/London time based on the source file dated 27th November 2024 15:30 Europe/London time.