public function view_summary(stdClass $submission, & $showviewlink) {
        global $CFG;

        $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
        // Always show the view link.
        $showviewlink = true;

        if ($onlinetextsubmission) {
            // This contains the shortened version of the text plus an optional 'Export to portfolio' button.
            $text = $this->assignment->render_editor_content(ASSIGNSUBMISSION_ONLINETEXT_FILEAREA,
                                                             $onlinetextsubmission->submission,
                                                             $this->get_type(),
                                                             'onlinetext',
                                                             'assignsubmission_onlinetext', true);

            // The actual submission text.
            $onlinetext = trim($onlinetextsubmission->onlinetext);
            // The shortened version of the submission text.
            $shorttext = shorten_text($onlinetext, 140);

            $plagiarismlinks = '';

            if (!empty($CFG->enableplagiarism)) {
                require_once($CFG->libdir . '/plagiarismlib.php');

                $plagiarismlinks .= plagiarism_get_links(array('userid' => $submission->userid,
                    'content' => $onlinetext,
                    'cmid' => $this->assignment->get_course_module()->id,
                    'course' => $this->assignment->get_course()->id,
                    'assignment' => $submission->assignment));
            }
            // We compare the actual text submission and the shortened version. If they are not equal, we show the word count.
            if ($onlinetext != $shorttext) {
                $wordcount = get_string('numwords', 'assignsubmission_onlinetext', count_words($onlinetext));

                return $plagiarismlinks . $wordcount . $text;
            } else {
                return $plagiarismlinks . $text;
            }
        }
        return '';
    }
public function view_summary(stdClass $submission, & $showviewlink) {
        global $CFG;

        $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
        // Always show the view link.
        $showviewlink = true;

        if ($onlinetextsubmission) {
            // This contains the shortened version of the text plus an optional 'Export to portfolio' button.
            $text = $this->assignment->render_editor_content(ASSIGNSUBMISSION_ONLINETEXT_FILEAREA,
                                                             $onlinetextsubmission->submission,
                                                             $this->get_type(),
                                                             'onlinetext',
                                                             'assignsubmission_onlinetext', true);

            // The actual submission text.
            $onlinetext = trim($onlinetextsubmission->onlinetext);
            // The shortened version of the submission text.
            $shorttext = shorten_text($onlinetext, 140);

            $plagiarismlinks = '';

            if (!empty($CFG->enableplagiarism)) {
                require_once($CFG->libdir . '/plagiarismlib.php');

                $plagiarismlinks .= plagiarism_get_links(array('userid' => $submission->userid,
                    'content' => $onlinetext,
                    'cmid' => $this->assignment->get_course_module()->id,
                    'course' => $this->assignment->get_course()->id,
                    'assignment' => $submission->assignment));
            }
            // We compare the actual text submission and the shortened version. If they are not equal, we show the word count.
            if ($onlinetext != $shorttext) {
                $wordcount = get_string('numwords', 'assignsubmission_onlinetext', count_words($onlinetext));

                return $plagiarismlinks . $wordcount . $text;
            } else {
                return $plagiarismlinks . $text;
            }
        }
        return '';
    }
public function view_summary ( stdClass $ submission , & $ showviewlink ) { global $ CFG ; $ onlinetextsubmission = $ this -> get_onlinetext_submission ( $ submission -> id ) ; // Always show the view link. $ showviewlink = true ; if ( $ onlinetextsubmission ) { // This contains the shortened version of the text plus an optional 'Export to portfolio' button. $ text = $ this -> assignment -> render_editor_content ( ASSIGNSUBMISSION_ONLINETEXT_FILEAREA , $ onlinetextsubmission -> submission , $ this -> get_type ( ) , 'onlinetext' , 'assignsubmission_onlinetext' , true ) ; // The actual submission text. $ onlinetext = trim ( $ onlinetextsubmission -> onlinetext ) ; // The shortened version of the submission text. $ shorttext = shorten_text ( $ onlinetext , 140 ) ; $ plagiarismlinks = '' ; if ( ! empty ( $ CFG -> enableplagiarism ) ) { require_once ( $ CFG -> libdir . '/plagiarismlib.php' ) ; $ plagiarismlinks .= plagiarism_get_links ( array ( 'userid' => $ submission -> userid , 'content' => $ onlinetext , 'cmid' => $ this -> assignment -> get_course_module ( ) -> id , 'course' => $ this -> assignment -> get_course ( ) -> id , 'assignment' => $ submission -> assignment ) ) ; } // We compare the actual text submission and the shortened version. If they are not equal, we show the word count. if ( $ onlinetext != $ shorttext ) { $ wordcount = get_string ( 'numwords' , 'assignsubmission_onlinetext' , count_words ( $ onlinetext ) ) ; return $ plagiarismlinks . $ wordcount . $ text ; } else { return $ plagiarismlinks . $ text ; } } return '' ; }
Display onlinetext word count in the submission status table

@param stdClass $submission
@param bool $showviewlink - If the summary has been truncated set this to true
@return string
Display onlinetext word count in the submission status table