<?php defined('BASEPATH') or exit('No direct script access allowed');

function staff_declaration_upload_path($declaration_id)
{
    // Use Perfex uploads folder
    return FCPATH . 'uploads/staff_declaration/' . (int)$declaration_id . '/';
}

function staff_declaration_ensure_dir($path)
{
    if (!is_dir($path)) {
        @mkdir($path, 0755, true);
    }
}

function staff_declaration_allowed_types()
{
    // adjust as needed
    return 'pdf|jpg|jpeg|png|doc|docx';
}
function staff_declaration_pdf($decl, $items = [], $files = [])
{
    $CI = &get_instance();

    // IMPORTANT: filename must be lowercase for app_pdf() basename logic
    // because it does: ucfirst(basename(...)) -> Staff_declaration_pdf
    $path = module_dir_path('staff_declaration', 'libraries/pdf/staff_declaration_pdf');

    return app_pdf('staff_declaration', $path, $decl, $items, $files);


    
}
