protected function _addSurveyAnswersToExportModel(\MUtil_Model_ModelAbstract $model, \Gems_Tracker_Survey $survey, array $data, array &$prefixes)
    {
        $prefixes['A'] = [];
        $language = $this->locale->getLanguage();
        $questions = $survey->getQuestionList($language);
        $questionInformation = $survey->getQuestionInformation($language);
        foreach($questions as $questionName => $label) {
            if ($parent = $model->get($questionName, 'parent_question')) {
                if ($model->get($parent, 'type') === \MUtil_Model::TYPE_NOVALUE) {
                    if (isset($data['subquestions']) && $data['subquestions'] == 'prefix_child') {
                        $cleanLabel = strip_tags($label);
                        $model->set($questionName, 'label', $cleanLabel);                        
                    }
                    if (isset($data['subquestions']) && $data['subquestions'] == 'show_parent') {
                        if (!in_array($parent, $prefixes['A'])) {
                            $prefixes['A'][] = $parent;
                            if (isset($questionInformation[$parent], $questionInformation[$parent]['question'])) {
                                $cleanLabel = strip_tags($questionInformation[$parent]['question']);
                                $model->set($parent, 'label', $cleanLabel);
                            }
                        }
                    } else {
                        $model->remove($parent, 'label');
                    }
                }
            }

            if ($question = $model->get($questionName, 'survey_question') && $model->get($questionName, 'label') == null) {
                $model->set($questionName, 'label', $questionName);
                if (isset($questionInformation[$questionName], $questionInformation[$questionName]['question'])) {
                    $cleanLabel = strip_tags($questionInformation[$questionName]['question']);
                    $model->set($questionName, 'label', $cleanLabel);
                }
            }
            $prefixes['A'][] = $questionName;
        }
    }
protected function _addSurveyAnswersToExportModel(\MUtil_Model_ModelAbstract $model, \Gems_Tracker_Survey $survey, array $data, array &$prefixes)
    {
        $prefixes['A'] = [];
        $language = $this->locale->getLanguage();
        $questions = $survey->getQuestionList($language);
        $questionInformation = $survey->getQuestionInformation($language);
        foreach($questions as $questionName => $label) {
            if ($parent = $model->get($questionName, 'parent_question')) {
                if ($model->get($parent, 'type') === \MUtil_Model::TYPE_NOVALUE) {
                    if (isset($data['subquestions']) && $data['subquestions'] == 'prefix_child') {
                        $cleanLabel = strip_tags($label);
                        $model->set($questionName, 'label', $cleanLabel);                        
                    }
                    if (isset($data['subquestions']) && $data['subquestions'] == 'show_parent') {
                        if (!in_array($parent, $prefixes['A'])) {
                            $prefixes['A'][] = $parent;
                            if (isset($questionInformation[$parent], $questionInformation[$parent]['question'])) {
                                $cleanLabel = strip_tags($questionInformation[$parent]['question']);
                                $model->set($parent, 'label', $cleanLabel);
                            }
                        }
                    } else {
                        $model->remove($parent, 'label');
                    }
                }
            }

            if ($question = $model->get($questionName, 'survey_question') && $model->get($questionName, 'label') == null) {
                $model->set($questionName, 'label', $questionName);
                if (isset($questionInformation[$questionName], $questionInformation[$questionName]['question'])) {
                    $cleanLabel = strip_tags($questionInformation[$questionName]['question']);
                    $model->set($questionName, 'label', $cleanLabel);
                }
            }
            $prefixes['A'][] = $questionName;
        }
    }
protected function _addSurveyAnswersToExportModel ( \ MUtil_Model_ModelAbstract $ model , \ Gems_Tracker_Survey $ survey , array $ data , array & $ prefixes ) { $ prefixes [ 'A' ] = [ ] ; $ language = $ this -> locale -> getLanguage ( ) ; $ questions = $ survey -> getQuestionList ( $ language ) ; $ questionInformation = $ survey -> getQuestionInformation ( $ language ) ; foreach ( $ questions as $ questionName => $ label ) { if ( $ parent = $ model -> get ( $ questionName , 'parent_question' ) ) { if ( $ model -> get ( $ parent , 'type' ) === \ MUtil_Model :: TYPE_NOVALUE ) { if ( isset ( $ data [ 'subquestions' ] ) && $ data [ 'subquestions' ] == 'prefix_child' ) { $ cleanLabel = strip_tags ( $ label ) ; $ model -> set ( $ questionName , 'label' , $ cleanLabel ) ; } if ( isset ( $ data [ 'subquestions' ] ) && $ data [ 'subquestions' ] == 'show_parent' ) { if ( ! in_array ( $ parent , $ prefixes [ 'A' ] ) ) { $ prefixes [ 'A' ] [ ] = $ parent ; if ( isset ( $ questionInformation [ $ parent ] , $ questionInformation [ $ parent ] [ 'question' ] ) ) { $ cleanLabel = strip_tags ( $ questionInformation [ $ parent ] [ 'question' ] ) ; $ model -> set ( $ parent , 'label' , $ cleanLabel ) ; } } } else { $ model -> remove ( $ parent , 'label' ) ; } } } if ( $ question = $ model -> get ( $ questionName , 'survey_question' ) && $ model -> get ( $ questionName , 'label' ) == null ) { $ model -> set ( $ questionName , 'label' , $ questionName ) ; if ( isset ( $ questionInformation [ $ questionName ] , $ questionInformation [ $ questionName ] [ 'question' ] ) ) { $ cleanLabel = strip_tags ( $ questionInformation [ $ questionName ] [ 'question' ] ) ; $ model -> set ( $ questionName , 'label' , $ cleanLabel ) ; } } $ prefixes [ 'A' ] [ ] = $ questionName ; } }
Add all survey answers to the export model

@param MUtil_Model_ModelAbstract $model
@param Gems_Tracker_Survey $survey
@param array $data
@param array $prefixes
Add all survey answers to the export model