protected function updateItem(\oat\taoQtiItem\model\qti\Item $item, $itemFile)
    {
        $changed = false;
        $responses = $item->getResponses();

        foreach ($responses as $response) {

            $responseIdentifier = $response->attr('identifier');
            $rules              = $response->getFeedbackRules();

            foreach ($rules as $rule) {
                $modalFeedbacks = array();
                if ($rule->getFeedbackThen()) {
                    $modalFeedbacks[] = $rule->getFeedbackThen();
                }
                if ($rule->getFeedbackElse()) {
                    $modalFeedbacks[] = $rule->getFeedbackElse();
                }
                foreach ($modalFeedbacks as $modalFeedback) {
                    $feedbackXml = simplexml_load_string($modalFeedback->toQti());
                    if ($feedbackXml->div[0] && $feedbackXml->div[0]['class'] && preg_match('/^x-tao-wrapper/',
                            $feedbackXml->div[0]['class'])) {
                        //the item body has not already been wrapped by the new wrapper <div class="x-tao-wrapper w-tao-relatedOutcome-{{response.identifier}}">
                        continue;
                    }
                    $message = $modalFeedback->getBody()->getBody();
                    $modalFeedback->getBody()->edit('<div class="x-tao-wrapper x-tao-relatedOutcome-'.$responseIdentifier.'">'.$message.'</div>',
                        true);
                    $changed = true;
                }
            }
        }

        return $changed;
    }
protected function updateItem(\oat\taoQtiItem\model\qti\Item $item, $itemFile)
    {
        $changed = false;
        $responses = $item->getResponses();

        foreach ($responses as $response) {

            $responseIdentifier = $response->attr('identifier');
            $rules              = $response->getFeedbackRules();

            foreach ($rules as $rule) {
                $modalFeedbacks = array();
                if ($rule->getFeedbackThen()) {
                    $modalFeedbacks[] = $rule->getFeedbackThen();
                }
                if ($rule->getFeedbackElse()) {
                    $modalFeedbacks[] = $rule->getFeedbackElse();
                }
                foreach ($modalFeedbacks as $modalFeedback) {
                    $feedbackXml = simplexml_load_string($modalFeedback->toQti());
                    if ($feedbackXml->div[0] && $feedbackXml->div[0]['class'] && preg_match('/^x-tao-wrapper/',
                            $feedbackXml->div[0]['class'])) {
                        //the item body has not already been wrapped by the new wrapper <div class="x-tao-wrapper w-tao-relatedOutcome-{{response.identifier}}">
                        continue;
                    }
                    $message = $modalFeedback->getBody()->getBody();
                    $modalFeedback->getBody()->edit('<div class="x-tao-wrapper x-tao-relatedOutcome-'.$responseIdentifier.'">'.$message.'</div>',
                        true);
                    $changed = true;
                }
            }
        }

        return $changed;
    }
protected function updateItem ( \ oat \ taoQtiItem \ model \ qti \ Item $ item , $ itemFile ) { $ changed = false ; $ responses = $ item -> getResponses ( ) ; foreach ( $ responses as $ response ) { $ responseIdentifier = $ response -> attr ( 'identifier' ) ; $ rules = $ response -> getFeedbackRules ( ) ; foreach ( $ rules as $ rule ) { $ modalFeedbacks = array ( ) ; if ( $ rule -> getFeedbackThen ( ) ) { $ modalFeedbacks [ ] = $ rule -> getFeedbackThen ( ) ; } if ( $ rule -> getFeedbackElse ( ) ) { $ modalFeedbacks [ ] = $ rule -> getFeedbackElse ( ) ; } foreach ( $ modalFeedbacks as $ modalFeedback ) { $ feedbackXml = simplexml_load_string ( $ modalFeedback -> toQti ( ) ) ; if ( $ feedbackXml -> div [ 0 ] && $ feedbackXml -> div [ 0 ] [ 'class' ] && preg_match ( '/^x-tao-wrapper/' , $ feedbackXml -> div [ 0 ] [ 'class' ] ) ) { //the item body has not already been wrapped by the new wrapper <div class="x-tao-wrapper w-tao-relatedOutcome-{{response.identifier}}"> continue ; } $ message = $ modalFeedback -> getBody ( ) -> getBody ( ) ; $ modalFeedback -> getBody ( ) -> edit ( '<div class="x-tao-wrapper x-tao-relatedOutcome-' . $ responseIdentifier . '">' . $ message . '</div>' , true ) ; $ changed = true ; } } } return $ changed ; }
Update the item content by wrapping the modalfeedback body into a new wrapper

@param oat\taoQtiItem\modal\Item $item
@param string $itemFile
@return boolean
Update the item content by wrapping the modalfeedback body into a new wrapper