function _sheetnode_phpexcel_export in Sheetnode 7.2
Same name and namespace in other branches
- 5 modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc \_sheetnode_phpexcel_export()
- 6 modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc \_sheetnode_phpexcel_export()
- 7 modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc \_sheetnode_phpexcel_export()
Helper function to export a node using PHPExcel.
1 string reference to '_sheetnode_phpexcel_export'
- sheetnode_phpexcel_menu in modules/
sheetnode_phpexcel/ sheetnode_phpexcel.module - Implements hook_menu().
File
- modules/
sheetnode_phpexcel/ sheetnode_phpexcel.export.inc, line 10 - Export sheetnodes through PHPExcel to xls or xlsx spreadsheets.
Code
function _sheetnode_phpexcel_export($format, $node) {
module_load_include('inc', 'sheetnode', 'socialcalc');
if (empty($node)) {
return drupal_not_found();
}
$sheets = array();
if ($node->type == 'sheetnode') {
$sheets[$node->title] = socialcalc_parse($node->sheetnode['value']);
}
$sheetfields = sheetnode_get_sheetfields($node->type);
if (!empty($sheetfields)) {
foreach ($sheetfields as $sheetfield) {
foreach ($node->{$sheetfield['field_name']}[LANGUAGE_NONE] as $delta => $item) {
$sheets[$sheetfield['instance']['label'] . ' ' . ($delta + 1)] = socialcalc_parse($item['value']);
}
}
}
if (empty($sheets)) {
return drupal_not_found();
}
sheetnode_phpexcel_batch_export($sheets, $node->title, $format);
}