public function save(stdClass $grade, stdClass $data) {
        global $DB;

        // Save the files.
        $data = file_postupdate_standard_editor(
            $data,
            'assignfeedbackcomments',
            $this->get_editor_options(),
            $this->assignment->get_context(),
            ASSIGNFEEDBACK_COMMENTS_COMPONENT,
            ASSIGNFEEDBACK_COMMENTS_FILEAREA,
            $grade->id
        );

        $feedbackcomment = $this->get_feedback_comments($grade->id);
        if ($feedbackcomment) {
            $feedbackcomment->commenttext = $data->assignfeedbackcomments;
            $feedbackcomment->commentformat = $data->assignfeedbackcommentsformat;
            return $DB->update_record('assignfeedback_comments', $feedbackcomment);
        } else {
            $feedbackcomment = new stdClass();
            $feedbackcomment->commenttext = $data->assignfeedbackcomments;
            $feedbackcomment->commentformat = $data->assignfeedbackcommentsformat;
            $feedbackcomment->grade = $grade->id;
            $feedbackcomment->assignment = $this->assignment->get_instance()->id;
            return $DB->insert_record('assignfeedback_comments', $feedbackcomment) > 0;
        }
    }
public function save(stdClass $grade, stdClass $data) {
        global $DB;

        // Save the files.
        $data = file_postupdate_standard_editor(
            $data,
            'assignfeedbackcomments',
            $this->get_editor_options(),
            $this->assignment->get_context(),
            ASSIGNFEEDBACK_COMMENTS_COMPONENT,
            ASSIGNFEEDBACK_COMMENTS_FILEAREA,
            $grade->id
        );

        $feedbackcomment = $this->get_feedback_comments($grade->id);
        if ($feedbackcomment) {
            $feedbackcomment->commenttext = $data->assignfeedbackcomments;
            $feedbackcomment->commentformat = $data->assignfeedbackcommentsformat;
            return $DB->update_record('assignfeedback_comments', $feedbackcomment);
        } else {
            $feedbackcomment = new stdClass();
            $feedbackcomment->commenttext = $data->assignfeedbackcomments;
            $feedbackcomment->commentformat = $data->assignfeedbackcommentsformat;
            $feedbackcomment->grade = $grade->id;
            $feedbackcomment->assignment = $this->assignment->get_instance()->id;
            return $DB->insert_record('assignfeedback_comments', $feedbackcomment) > 0;
        }
    }
public function save ( stdClass $ grade , stdClass $ data ) { global $ DB ; // Save the files. $ data = file_postupdate_standard_editor ( $ data , 'assignfeedbackcomments' , $ this -> get_editor_options ( ) , $ this -> assignment -> get_context ( ) , ASSIGNFEEDBACK_COMMENTS_COMPONENT , ASSIGNFEEDBACK_COMMENTS_FILEAREA , $ grade -> id ) ; $ feedbackcomment = $ this -> get_feedback_comments ( $ grade -> id ) ; if ( $ feedbackcomment ) { $ feedbackcomment -> commenttext = $ data -> assignfeedbackcomments ; $ feedbackcomment -> commentformat = $ data -> assignfeedbackcommentsformat ; return $ DB -> update_record ( 'assignfeedback_comments' , $ feedbackcomment ) ; } else { $ feedbackcomment = new stdClass ( ) ; $ feedbackcomment -> commenttext = $ data -> assignfeedbackcomments ; $ feedbackcomment -> commentformat = $ data -> assignfeedbackcommentsformat ; $ feedbackcomment -> grade = $ grade -> id ; $ feedbackcomment -> assignment = $ this -> assignment -> get_instance ( ) -> id ; return $ DB -> insert_record ( 'assignfeedback_comments' , $ feedbackcomment ) > 0 ; } }
Saving the comment content into database.

@param stdClass $grade
@param stdClass $data
@return bool
Saving the comment content into database .