You are here

function regcode_import_file in Registration codes 5.3

Import codes from a file (plain list or CSV)

Parameters

$filepath: File system path of the file to import from

$action: Import action: overwrite - overwrite any existing codes with same code identifiers as the imported ones skip - skip any import of a codes, if any code with same code identifier exists clean - completely wipe the code database befor importing all codes

$code_template: Optional code data template to use as default data setting for each imported code (key/value pairs for any applicable code field, see regcode_save_code)

Return value

Whether the import operation has been successful (TRUE) or not (FALSE)

1 call to regcode_import_file()
regcode_admin_import_submit in ./regcode_admin.inc.php
Handle the processing of a submitted import form
1 string reference to 'regcode_import_file'
regcode_admin_import_submit in ./regcode_admin.inc.php
Handle the processing of a submitted import form

File

./regcode_api.inc.php, line 348
regcode_api.inc.php contains general low-level functions for the registration-code module, for tasks like

Code

function regcode_import_file($filepath, $action = NULL, $code_template = NULL) {

  // open file as stream and delegate to regcode_import_stream
  $handle = fopen($filepath, "r");
  $result = regcode_import_stream($handle, $action, $code_template);
  fclose($handle);
  return $result;
}