You are here

function socialcalc_parse_values in Sheetnode 7.2

Same name and namespace in other branches
  1. 5 socialcalc.inc \socialcalc_parse_values()
  2. 6 socialcalc.inc \socialcalc_parse_values()
  3. 7 socialcalc.inc \socialcalc_parse_values()
1 call to socialcalc_parse_values()
sheetnode_handler_field_cell::render in views/sheetnode_handler_field_cell.inc
Render the views field.

File

./socialcalc.inc, line 480
SocialCalc manipulation functions.

Code

function socialcalc_parse_values($data) {
  $line = strtok($data, "\n");
  $sheet = array();
  while ($line !== FALSE) {
    $line = rtrim($line);
    $parts = explode(':', $line);
    if ($parts[0] == 'cell') {
      $coord = $parts[1];
      $cell = isset($sheet['cells'][$coord]) ? $sheet['cells'][$coord] : array();
      $cell += socialcalc_parse_cell_value($parts, 2);
      $sheet['cells'][$coord] = $cell;
    }
    $line = strtok("\n");
  }
  return $sheet;
}