Ad-hoc database queries: Display assignment feedback as HTML

Ad-hoc database queries: Display assignment feedback as HTML

by Riady Santoso -
Number of replies: 1

Hi Moodlers,

I would really appreciate some helps to be able displaying assignment feedback comment as HTML, as the current result display all HTML Tag as the outcomes.

The SQL code used as the following:

SELECT
CONCAT(u.firstname,' ',u.lastname) AS Student,
c.fullname AS Course_Name, 
a.name AS Assignment_Name,
DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(ag.timemodified),'+00:00','+10:00'),'%d-%M-%Y') AS Assignment_Date,
IF (ag.grade=2,'C','NYC') as Assignment_Result,
CONCAT(ug.firstname,' ',ug.lastname) AS Assessor,
afc.commenttext AS Comment,
afc.commentformat AS Comment_Format
FROM prefix_course AS c
JOIN prefix_assign AS a ON a.course = c.id
JOIN prefix_assign_grades AS ag ON ag.assignment = a.id
JOIN prefix_assignfeedback_comments AS afc ON afc.grade= ag.id
JOIN prefix_user AS u ON u.id = ag.userid
JOIN prefix_user AS ug ON ug.id = ag.grader
WHERE ag.grade > 0
AND ag.timemodified  > UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL :how_many_days_back_to_check DAY))
ORDER BY u.firstname, u.lastname, c.fullname, a.name, ag.timemodified DESC


And the outcome is displayed as the following


It will be reader friendly if the Comment can be displayed in the HTML form so all the tags will help to format the comment.

Thank you


Regards,

Riady


Average of ratings: -
In reply to Riady Santoso

Re: Ad-hoc database queries: Display assignment feedback as HTML

by Randy Thornton -
Picture of Documentation writers

As far as I know this is not possible in the Ad-hoc database queries plugin. It treats any html tags as normal text.

You could try to use the Configurable Reports plugin to do this sort of thing. It does allow some basic tags. You will probably have to take that column apart with some SQL to get exactly what you want (eg make the links work).