Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

collection_download_process_summary_notes()

Description

Append summary notes about the completeness of the package, write the text file, add to archive, and schedule for deletion.

Parameters

ColumnTypeDefaultDescription
$result array
$available_sizes array
&$text
$subbed_original_resources array
$used_resources array
$id
$collection
$collectiondata
$collection_download_tar
$usertempdir
$filename
&$path
&$deletion_array array
$size
&$zip

Return

void

Location

include/collections_functions.php lines 4946 to 5025

Definition

 
function collection_download_process_summary_notes(
    array 
$result,
    array 
$available_sizes,
    &
$text,
    array 
$subbed_original_resources,
    array 
$used_resources,
    
$id,
    
$collection,
    
$collectiondata,
    
$collection_download_tar,
    
$usertempdir,
    
$filename,
    &
$path,
    array &
$deletion_array,
    
$size,
    &
$zip)
    {
    global 
$lang$zipped_collection_textfile$includetext$sizetext$use_zip_extension$p;

    if (
        !
hook('zippedcollectiontextfile''', array($text))
        && 
$zipped_collection_textfile == true 
        
&& $includetext == "true"
    
) {
        
$qty_sizes = isset($available_sizes[$size]) ? count($available_sizes[$size]) : 0;
        
$qty_total count($result);
        
$text.= $lang["status-note"] . ": " $qty_sizes " " $lang["of"] . " " $qty_total " ";
        switch (
$qty_total) {
        case 
0:
            
$text.= $lang["resource-0"] . " ";
            break;
        case 
1:
            
$text.= $lang["resource-1"] . " ";
            break;
        default:
            
$text.= $lang["resource-2"] . " ";
            break;
        }

        switch (
$qty_sizes) {
        case 
0:
            
$text.= $lang["were_available-0"] . " ";
            break;
        case 
1:
            
$text.= $lang["were_available-1"] . " ";
            break;
        default:
            
$text.= $lang["were_available-2"] . " ";
            break;
        }
        
$text.= $lang["forthispackage"] . ".\r\n\r\n";

        foreach (
$result as $resource) {
        if (
in_array($resource['ref'],$subbed_original_resources)){
        
$text.= $lang["didnotinclude"] . ": " $resource['ref'];
        
$text.= " (".$lang["substituted_original"] . ")";
        
$text.= "\r\n";
        } elseif (!
in_array($resource['ref'],$used_resources)) {
                
$text.= $lang["didnotinclude"] . ": " $resource['ref'];
        
$text.= "\r\n";
            }
        }

        
$textfile get_temp_dir(false,$id) . "/"$collection "-" safe_file_name(i18n_get_collection_name($collectiondata)) . $sizetext ".txt";
        
$fh fopen($textfile'w') or die("can't open file");
        
fwrite($fh$text);
        
fclose($fh);
        if(
$collection_download_tar)
            {
            
debug("collection_download adding symlink: " $p " - " $usertempdir DIRECTORY_SEPARATOR $filename);
            @
symlink($textfile$usertempdir DIRECTORY_SEPARATOR $collection "-" safe_file_name(i18n_get_collection_name($collectiondata)) . $sizetext '.txt');
            }
        elseif (
$use_zip_extension){
            
$zip->addFile($textfile,$collection "-" safe_file_name(i18n_get_collection_name($collectiondata)) . $sizetext ".txt");
        } else {
            
$path.=$textfile "\r\n";  
        }
        
$deletion_array[]=$textfile;    
    }    
    }

This article was last updated 19th March 2024 03:05 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.