You are here

private function FeedsExcelParser::getFixed in Feeds Excel 7

Same name and namespace in other branches
  1. 6 ExcelParser.inc \FeedsExcelParser::getFixed()

Sort out the given fixed cells.

1 call to FeedsExcelParser::getFixed()
FeedsExcelParser::getSheet in ./ExcelParser.inc
Retrieve all relevant sheets from dataset.

File

./ExcelParser.inc, line 194

Class

FeedsExcelParser
Parses a given file as a Excel file.

Code

private function getFixed($sheet) {

  // Store fixed cells in sheet
  $fixed = array();
  if ($this->config['fixed']) {
    $max = array(
      'rows' => $sheet['numRows'],
      'cols' => $sheet['numCols'],
    );
    $fixed_range = new ExcelRange($this->config['fixed'], $max);
    foreach ($sheet['cells'] as $row => $cols) {
      if ($fixed_range
        ->isRowInAnyRange($row)) {
        foreach ($cols as $col => $val) {
          if ($fixed_range
            ->isCellInAnyRange($row, $col)) {
            $cell = array(
              'value' => $val,
              'type' => $sheet['cellsInfo'][$row][$col]['type'],
              'raw' => isset($sheet['cellsInfo'][$row][$col]['raw']) ? $sheet['cellsInfo'][$row][$col]['raw'] : $val,
              'column' => $col,
              'row' => $row,
            );
            $fixed["{$row}-{$col}"] = $cell;
          }
        }
      }
    }
  }
  return $fixed;
}