Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource 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 4756 to 4808

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($value)!="")&&(trim($value) != ','))
                        {
                        
$text .= wordwrap('* ' $title ': ' i18n_get_translated($value) . "\r\n"65);
                        }
                    }
                if(
trim($commentdata['comment']) != '')
                    {
                    
$text .= wordwrap($lang['comment'] . ': ' $commentdata['comment'] . "\r\n"65);
                    }
                if(
trim($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 19th March 2024 09:05 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.