public function getFieldsDataFor($respTrackId)
    {
        if (! $this->_fields) {
            return array();
        }

        // Set the default values to empty as we currently do not store default values for fields
        $output = array_fill_keys(array_keys($this->_fields), null);

        if (! $respTrackId) {
            return $output;
        }

        $model = $this->getDataStorageModel();
        $rows  = $model->load(array('gr2t2f_id_respondent_track' => $respTrackId));

        if ($rows) {
            foreach ($rows as $row) {
                $key   = self::makeKey($row['sub'], $row['gr2t2f_id_field']);

                if (isset($this->_fields[$key]) && ($this->_fields[$key] instanceof FieldInterface)) {
                    $value = $this->_fields[$key]->onFieldDataLoad($row['gr2t2f_value'], $output, $respTrackId);
                } else {
                    $value = $row['gr2t2f_value']; // Should not occur
                }

                $output[$key] = $value;
            }
        }
        // \MUtil_Echo::track($output);

        return $output;
    }
public function getFieldsDataFor($respTrackId)
    {
        if (! $this->_fields) {
            return array();
        }

        // Set the default values to empty as we currently do not store default values for fields
        $output = array_fill_keys(array_keys($this->_fields), null);

        if (! $respTrackId) {
            return $output;
        }

        $model = $this->getDataStorageModel();
        $rows  = $model->load(array('gr2t2f_id_respondent_track' => $respTrackId));

        if ($rows) {
            foreach ($rows as $row) {
                $key   = self::makeKey($row['sub'], $row['gr2t2f_id_field']);

                if (isset($this->_fields[$key]) && ($this->_fields[$key] instanceof FieldInterface)) {
                    $value = $this->_fields[$key]->onFieldDataLoad($row['gr2t2f_value'], $output, $respTrackId);
                } else {
                    $value = $row['gr2t2f_value']; // Should not occur
                }

                $output[$key] = $value;
            }
        }
        // \MUtil_Echo::track($output);

        return $output;
    }
public function getFieldsDataFor ( $ respTrackId ) { if ( ! $ this -> _fields ) { return array ( ) ; } // Set the default values to empty as we currently do not store default values for fields $ output = array_fill_keys ( array_keys ( $ this -> _fields ) , null ) ; if ( ! $ respTrackId ) { return $ output ; } $ model = $ this -> getDataStorageModel ( ) ; $ rows = $ model -> load ( array ( 'gr2t2f_id_respondent_track' => $ respTrackId ) ) ; if ( $ rows ) { foreach ( $ rows as $ row ) { $ key = self :: makeKey ( $ row [ 'sub' ] , $ row [ 'gr2t2f_id_field' ] ) ; if ( isset ( $ this -> _fields [ $ key ] ) && ( $ this -> _fields [ $ key ] instanceof FieldInterface ) ) { $ value = $ this -> _fields [ $ key ] -> onFieldDataLoad ( $ row [ 'gr2t2f_value' ] , $ output , $ respTrackId ) ; } else { $ value = $ row [ 'gr2t2f_value' ] ; // Should not occur } $ output [ $ key ] = $ value ; } } // \MUtil_Echo::track($output); return $ output ; }
Returns the field data for the respondent track id.

@param int $respTrackId Gems respondent track id or null when new
@return array of the existing field values for this respondent track
Returns the field data for the respondent track id .