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

get_pdf_template_path()

Parameters

ColumnTypeDefaultDescription
$resource_type
$template_name ''

Location

include/pdf_functions.php lines 10 to 54

Definition

 
function get_pdf_template_path($resource_type$template_name '')
    {
    global 
$storagedir$pdf_resource_type_templates;

    
$template      '';

    if(!
array_key_exists($resource_type$pdf_resource_type_templates))
        {
        
debug('There are no PDF templates set for resource type "' $resource_type '"');
        return 
false;
        }
    
    
$templates     $pdf_resource_type_templates[$resource_type];

    if(
array_key_exists($resource_type$pdf_resource_type_templates) && empty($templates))
        {
        
debug('There are no PDF templates set for resource type "' $resource_type '"');
        return 
false;
        }

    
// Client code wants a specific template name but there isn't one
    
if('' !== $template_name && !in_array($template_name$templates))
        {
        
debug('PDF template "' $template_name '" could not be found in $pdf_resource_type_templates');
        return 
false;
        }

    
// Client code wants a specific template name
    
if('' !== $template_name && in_array($template_name$templates))
        {
        
$template_array_key array_search($template_name$templates);
        if(
false !== $template_array_key)
            {
            
$template $templates[$template_array_key];
            }
        }

    
// Provide a default one if template name is empty
    
if('' === $template && '' === $template_name)
        {
        
$template $templates[0];
        }

    return 
$storagedir '/system/pdf_templates/' $template '.html';
    }

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