function _sheetnode_update_index in Sheetnode 6
Same name and namespace in other branches
- 7.2 sheetnode.module \_sheetnode_update_index()
- 7 sheetnode.module \_sheetnode_update_index()
Helper function to return an indexable version of the spreadsheet.
1 call to _sheetnode_update_index()
- sheetnode_nodeapi in ./
sheetnode.module - Implementation of hook_nodeapi().
File
- ./
sheetnode.module, line 335
Code
function _sheetnode_update_index($value) {
require_once drupal_get_path('module', 'sheetnode') . '/socialcalc.inc';
$output = '<table>';
$socialcalc = socialcalc_parse($value);
$sc = $socialcalc['sheet'];
$row = -1;
if (!empty($sc['cells'])) {
foreach ($sc['cells'] as $c) {
if ($c['pos'][1] > $row) {
// new row? - this assumes cells are ordered by col/row
if ($row != -1) {
$output .= '</tr>';
}
$row = $c['pos'][1];
$output .= '<tr>';
}
$output .= '<td>' . (isset($c['datavalue']) ? $c['datavalue'] : ' ') . (isset($c['comment']) ? ' (' . check_plain($c['comment']) . ')' : '') . '</td>';
}
}
if ($row != -1) {
$output .= '</tr>';
}
$output .= '</table>';
return $output;
}