function theme_sheetnode_range in Sheetnode 6
Same name and namespace in other branches
- 5 sheetnode.module \theme_sheetnode_range()
- 7.2 sheetnode.module \theme_sheetnode_range()
- 7 sheetnode.module \theme_sheetnode_range()
Theme function for sheetnode_range.
2 theme calls to theme_sheetnode_range()
File
- ./
sheetnode.module, line 587
Code
function theme_sheetnode_range($range, $labels = SHEETNODE_RANGE_LABELS_ROW_COL) {
if (empty($range)) {
return '';
}
require_once drupal_get_path('module', 'sheetnode') . '/socialcalc.inc';
list($c, $r) = socialcalc_coord_to_cr(key($range));
$row = array();
if ($labels & SHEETNODE_RANGE_LABELS_ROW) {
$row[] = array(
'data' => $r,
'header' => TRUE,
);
}
$header = array();
if ($labels & SHEETNODE_RANGE_LABELS_ROW) {
$header[] = array();
}
$rows = array();
foreach ($range as $coord => $value) {
$pos = socialcalc_coord_to_cr($coord);
if ($pos[1] > $r) {
$rows[] = $row;
$r = $pos[1];
$row = array();
if ($labels & SHEETNODE_RANGE_LABELS_ROW) {
$row[] = array(
'data' => $r,
'header' => TRUE,
);
}
}
$row[] = $value;
if (empty($rows)) {
$coord = socialcalc_cr_to_coord($pos[0], $pos[1], TRUE);
$header[] = $coord[0];
}
}
$rows[] = $row;
return theme('table', $labels & SHEETNODE_RANGE_LABELS_COL ? $header : NULL, $rows);
}