public function addSurveyCompareForm($tableBody, $post) {
        if ($this->sourceSurveyId && $this->targetSurveyId) {
            $sourceSurveyData = $this->getSurveyData($this->sourceSurveyId);
            $targetSurveyData = $this->getSurveyData($this->targetSurveyId);
            $surveyCompare    = $this->getSurveyCompare($sourceSurveyData, $targetSurveyData, $post);

            $icon = \MUtil_Html::create()->i(['class' => 'fa fa-exclamation-triangle', 'style' => 'color: #d43f3a; margin: 1em;', 'renderClosingTag' => true]);

            foreach ($surveyCompare as $question) {
                if ($question['status'] == 'missing') {
                    continue;
                }
                $rowMessage  = false;
                $statusClass = '';

                if (isset($this->questionStatusClasses[$question['status']])) {
                    $statusClass = $this->questionStatusClasses[$question['status']];
                }

                if ($question['status'] == 'type-difference') {
                    $rowMessage = $this->_('Question type is not the same. Check compatibility!');
                } elseif ($question['status'] == 'new') {
                    $rowMessage = $this->_('Question could not be found in source. Is this a new question?');
                } /*elseif ($question['status'] == 'missing') {
                    $rowMessage = $this->_('Warning! Question not found in target survey. Data will be lost on transfer');
                }*/

                $row = $tableBody->tr(['class' => $statusClass]);
                $row->td($question['target']);

                // Source column
                $row->td($this->getSurveyQuestionSelect($sourceSurveyData, $question['source'], $question['target']));

                // Target column
                if (isset($targetSurveyData[$question['target']])) {
                    $row->td($targetSurveyData[$question['target']]['question']);
                } else {
                    $row->td();
                }

                if ($rowMessage) {
                    $tableBody->tr(['class' => $statusClass])->td(['colspan' => 3])->append($icon, $rowMessage);
                }
            }
        }
    }
public function addSurveyCompareForm($tableBody, $post) {
        if ($this->sourceSurveyId && $this->targetSurveyId) {
            $sourceSurveyData = $this->getSurveyData($this->sourceSurveyId);
            $targetSurveyData = $this->getSurveyData($this->targetSurveyId);
            $surveyCompare    = $this->getSurveyCompare($sourceSurveyData, $targetSurveyData, $post);

            $icon = \MUtil_Html::create()->i(['class' => 'fa fa-exclamation-triangle', 'style' => 'color: #d43f3a; margin: 1em;', 'renderClosingTag' => true]);

            foreach ($surveyCompare as $question) {
                if ($question['status'] == 'missing') {
                    continue;
                }
                $rowMessage  = false;
                $statusClass = '';

                if (isset($this->questionStatusClasses[$question['status']])) {
                    $statusClass = $this->questionStatusClasses[$question['status']];
                }

                if ($question['status'] == 'type-difference') {
                    $rowMessage = $this->_('Question type is not the same. Check compatibility!');
                } elseif ($question['status'] == 'new') {
                    $rowMessage = $this->_('Question could not be found in source. Is this a new question?');
                } /*elseif ($question['status'] == 'missing') {
                    $rowMessage = $this->_('Warning! Question not found in target survey. Data will be lost on transfer');
                }*/

                $row = $tableBody->tr(['class' => $statusClass]);
                $row->td($question['target']);

                // Source column
                $row->td($this->getSurveyQuestionSelect($sourceSurveyData, $question['source'], $question['target']));

                // Target column
                if (isset($targetSurveyData[$question['target']])) {
                    $row->td($targetSurveyData[$question['target']]['question']);
                } else {
                    $row->td();
                }

                if ($rowMessage) {
                    $tableBody->tr(['class' => $statusClass])->td(['colspan' => 3])->append($icon, $rowMessage);
                }
            }
        }
    }
public function addSurveyCompareForm ( $ tableBody , $ post ) { if ( $ this -> sourceSurveyId && $ this -> targetSurveyId ) { $ sourceSurveyData = $ this -> getSurveyData ( $ this -> sourceSurveyId ) ; $ targetSurveyData = $ this -> getSurveyData ( $ this -> targetSurveyId ) ; $ surveyCompare = $ this -> getSurveyCompare ( $ sourceSurveyData , $ targetSurveyData , $ post ) ; $ icon = \ MUtil_Html :: create ( ) -> i ( [ 'class' => 'fa fa-exclamation-triangle' , 'style' => 'color: #d43f3a; margin: 1em;' , 'renderClosingTag' => true ] ) ; foreach ( $ surveyCompare as $ question ) { if ( $ question [ 'status' ] == 'missing' ) { continue ; } $ rowMessage = false ; $ statusClass = '' ; if ( isset ( $ this -> questionStatusClasses [ $ question [ 'status' ] ] ) ) { $ statusClass = $ this -> questionStatusClasses [ $ question [ 'status' ] ] ; } if ( $ question [ 'status' ] == 'type-difference' ) { $ rowMessage = $ this -> _ ( 'Question type is not the same. Check compatibility!' ) ; } elseif ( $ question [ 'status' ] == 'new' ) { $ rowMessage = $ this -> _ ( 'Question could not be found in source. Is this a new question?' ) ; } /*elseif ($question['status'] == 'missing') {
                    $rowMessage = $this->_('Warning! Question not found in target survey. Data will be lost on transfer');
                }*/ $ row = $ tableBody -> tr ( [ 'class' => $ statusClass ] ) ; $ row -> td ( $ question [ 'target' ] ) ; // Source column $ row -> td ( $ this -> getSurveyQuestionSelect ( $ sourceSurveyData , $ question [ 'source' ] , $ question [ 'target' ] ) ) ; // Target column if ( isset ( $ targetSurveyData [ $ question [ 'target' ] ] ) ) { $ row -> td ( $ targetSurveyData [ $ question [ 'target' ] ] [ 'question' ] ) ; } else { $ row -> td ( ) ; } if ( $ rowMessage ) { $ tableBody -> tr ( [ 'class' => $ statusClass ] ) -> td ( [ 'colspan' => 3 ] ) -> append ( $ icon , $ rowMessage ) ; } } } }
Adds the survey compare form to the current table, showing the matches between different surveys

@param $tableBody \MUtil_Html Table object
@param $post array List of Post data
Adds the survey compare form to the current table showing the matches between different surveys