You are here

function fillpdf_file_usage_add in FillPDF 7

Adds a generated FillPDF file to {file_usage} table, along with its context.

Use this function when tracking usage of a new FillPDF file. If you simply want to increase the count of an existing one, look up the existing {file_usage} record to get the /id/ and use file_usage_add() directly.

Parameters

object $file: A saved FillPDF file on which to track usage.

object $fillpdf_object: The FillPDF Object that was used to generate the file.

See also

file_usage_add()

1 call to fillpdf_file_usage_add()
fillpdf_action_save_to_file in ./fillpdf.module
Save a PDF to a file.

File

./fillpdf.module, line 2184

Code

function fillpdf_file_usage_add($file, $fillpdf_object) {
  $fcid = db_insert('fillpdf_file_context')
    ->fields(array(
    'context' => fillpdf_context_to_link($fillpdf_object->info->fid, $fillpdf_object->context, $fillpdf_object->options['sample']),
    'fid' => $fillpdf_object->info->fid,
  ))
    ->execute();
  file_usage_add($file, 'fillpdf', 'fillpdf_file', $fcid);
}