function _sheetnode_phpexcel_settings_validate in Sheetnode 6
Same name and namespace in other branches
- 5 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \_sheetnode_phpexcel_settings_validate()
- 7.2 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \_sheetnode_phpexcel_settings_validate()
- 7 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \_sheetnode_phpexcel_settings_validate()
Validate function for _sheetnode_phpexcel_settings form.
1 string reference to '_sheetnode_phpexcel_settings_validate'
- _sheetnode_phpexcel_settings in modules/sheetnode_phpexcel/ sheetnode_phpexcel.module 
- Form function for admin/settings/sheetnode/phpexcel.
File
- modules/sheetnode_phpexcel/ sheetnode_phpexcel.module, line 258 
Code
function _sheetnode_phpexcel_settings_validate($form, $form_state) {
  $path = rtrim($form_state['values']['sheetnode_phpexcel_library_path'], '/');
  if (!is_dir($path) || !is_file($path . '/Classes/PHPExcel.php')) {
    form_set_error('sheetnode_phpexcel_library_path', t('The PHPExcel library path you entered does not point to a valid location. Please enter the location of the extracted PHPExcel package.'));
    return;
  }
  require_once $path . '/Classes/PHPExcel.php';
  $pdf = PHPExcel_Settings::PDF_RENDERER_TCPDF;
  $path = rtrim($form_state['values']['sheetnode_phpexcel_pdf_renderer_path'], '/');
  if (!PHPExcel_Settings::setPdfRenderer($pdf, $path)) {
    form_set_error('sheetnode_phpexcel_pdf_renderer_path', t('The PDF renderer library path you entered does not point to a valid location. Please enter the location of the extracted !pdf package.', array(
      '!pdf' => $pdf,
    )));
  }
}