コード例 #1
0
 /**
  * This transform function is called before the saving of the data in the source model and allows you to
  * change all data.
  *
  * @param \MUtil_Model_ModelAbstract $model The parent model
  * @param array $row Array containing row
  * @return array Row array containing (optionally) transformed data
  */
 public function transformRowBeforeSave(\MUtil_Model_ModelAbstract $model, array $row)
 {
     $fields = $this->fieldsDefinition->processBeforeSave($row, $row);
     $row['gr2t_track_info'] = $this->fieldsDefinition->calculateFieldsInfo($fields);
     // Also save the calculated fields into the row (actual save is in transformRowAfterSave)
     $row = $fields + $row;
     return $row;
 }
コード例 #2
0
 /**
  * This transform function is called before the saving of the data in the source model and allows you to
  * change all data.
  *
  * @param \MUtil_Model_ModelAbstract $model The parent model
  * @param array $row Array containing row
  * @return array Row array containing (optionally) transformed data
  */
 public function transformRowBeforeSave(\MUtil_Model_ModelAbstract $model, array $row)
 {
     if (!$this->tracker) {
         $this->tracker = $this->loader->getTracker();
     }
     if (isset($row[$this->respTrackIdField]) && $row[$this->respTrackIdField]) {
         $respTrack = $this->tracker->getRespondentTrack($row[$this->respTrackIdField]);
         $fields = $respTrack->processFieldsBeforeSave($row);
         $row['gr2t_track_info'] = $this->fieldsDefinition->calculateFieldsInfo($fields);
         // Also save the calculated fields into the row (actual save is in transformRowAfterSave)
         return $fields + $row;
     }
     return $row;
 }
コード例 #3
0
 /**
  * Calculate the track info from the fields
  *
  * @param array $data The values to save
  * @return string The description to save as track_info
  */
 public function calculateFieldsInfo(array $data)
 {
     return $this->_fieldsDefinition->calculateFieldsInfo($data);
 }