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

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(
$zipped_collection_textfile == true && $includetext == "true")
        {
        
$qty_sizes count($available_sizes[$size]);
        
$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;    
        }

    return;
    }

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