function sheetnode_nodeapi in Sheetnode 5
Same name and namespace in other branches
- 6 sheetnode.module \sheetnode_nodeapi()
Implementation of hook_nodeapi().
File
- ./
sheetnode.module, line 200
Code
function sheetnode_nodeapi($node, $op) {
if ($node->type != 'sheetnode') {
return;
}
switch ($op) {
case 'update index':
require_once drupal_get_path('module', 'sheetnode') . '/socialcalc.inc';
$output = '<table>';
$socialcalc = socialcalc_parse(_sheetnode_load($node->nid, $node->vid));
$sc = $socialcalc['sheet'];
$row = -1;
if (!empty($sc['cells'])) {
foreach ($sc['cells'] as $c) {
if ($c['pos'][1] > $row) {
// new 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;
}
}