/** * Process a result row. * @param array $row * @param int $row_num The current row number when processing results. If there was a result limit, it starts the count from the beginning of the * result offset. Othwerwise, it starts counting form zero. * @param DOMNode $contentNode. Default to null. A node to append the result onto */ protected function processResultRow($row, $row_num, $contentNode = null) { $mapped_row = $this->mapResults($row); try { $this->odf_row->setVars('++row_num', $row_num + 1, $this->encoding, $this->charset); } catch (SegmentException $e) { //It's ok if it's not there so don't do anything. } foreach ($this->header_vars as $key => $val) { try { $this->odf_row->setVars($key, $val, $this->encoding, $this->charset); } catch (SegmentException $e) { //It's ok if it's not there so don't do anything. } } $ff = I2CE_FormFactory::instance(); foreach ($mapped_row as $key => $val) { if (array_key_exists($key, $this->image_objs) && ($fieldObj = $this->image_objs[$key])) { //need to get $reportform+id and get the formObj. list($form, $field) = explode('+', $key, 2); $formid = $form . '+id'; if (!array_key_exists($formid, $mapped_row) || !($formObj = $ff->createContainer($mapped_row[$formid])) instanceof I2CE_Form || !($fieldObj = $formObj->getField($field)) instanceof I2CE_FormField) { I2CE::raiseError("Can't get form/field associated to {$key}" . print_r($mapped_row, true)); try { $this->odf_row->setVars($key, ''); } catch (SegementException $e) { //It's ok if it's not there so don't do anything. } continue; } $formObj->populate(); try { $this->odf_row->setImageFromField($this->full_keys[$key], $fieldObj, $this->extra[$key]); } catch (SegmentException $e) { //It's ok if it's not there so don't do anything. } } else { if ($row_num == 0) { try { $this->odf->setVars($key, $val, $this->encoding, $this->charset); } catch (OdfException $e) { //It's ok if it's not there so don't do anything. } try { $this->odf->setStyleVars($key, $val, $this->encoding, $this->charset); } catch (OdfException $e) { //It's ok if it's not there so don't do anything. } } try { $this->odf_row->setVars($key, $val, $this->encoding, $this->charset); } catch (SegmentException $e) { //It's ok if it's not there so don't do anything. } } } $this->odf_row->merge(); return true; }