Adding Watermark to quiz page.

Adding Watermark to quiz page.

by Akosah Dennis -
Number of replies: 19
GOOD EVENING COMRADES
Please can someone help me on how to use student's names as watermarks on the quiz question page?

Average of ratings: -
In reply to Akosah Dennis

Re: Adding Watermark to quiz page.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
I don't know how, but your question makes me wonder "Why?"
In reply to Rick Jerz

Re: Adding Watermark to quiz page.

by Joost Elshoff -
Picture of Particularly helpful Moodlers Picture of Testers
Probably because everything will be printed as part of the assessment process... which would then again prompt a "Why?"

The better question would be, IMHO: "Is it possible to export a student's attempt at a quiz including answers, feedback and marks to a PDF file that clearly states critical attempt information (student name, datetime of attempt, grade and export datetime, ...) at the top of each page?"
Average of ratings: Useful (1)
In reply to Rick Jerz

Re: Adding Watermark to quiz page.

by Akosah Dennis -
It will help me check for students who will decide to write the quiz for their 

colleague. 

In reply to Akosah Dennis

Re: Adding Watermark to quiz page.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
If I understand you correctly, you want to "catch" a student from giving a pdf version of their quiz to another student for "cheating" purposes. You hope to uncover the "pdf" or printed version of the quiz, with the student's name on it.

Well, perhaps. But what if a student, instead of "printing" their quiz, simply strokes through it, and does a copy and paste into a word document? The watermark would not appear, or even if it does, the student could delete it.

For example, if I print this moodle page to a PDF, your profile picture would be in it. But if I swipe through your post, then copy/paste it, your profile photo doesn't show, or I could delete it, like so:


In reply to Rick Jerz
Re: Adding Watermark to quiz page.
by Akosah Dennis - Friday, June 23, 2023, 4:38 PM
It will help me check for students who will decide to write the quiz for their
colleague.
In reply to Rick Jerz

Re: Adding Watermark to quiz page.

by Akosah Dennis -
Thanks for your reply.
Please im not talking of the pdf version of qiuz here. I mean the main quiz page. The student's name will appear as a water mark on the quiz page.
In reply to Akosah Dennis

Re: Adding Watermark to quiz page.

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I'm not sure I understand what you mean by a watermark on the quiz question page. Please could you explain a bit better.

Maybe you want student names to be displayed when they take a quiz and maybe increase the size of student photo as shown below, which you can achieve with the following script. See Where to place the JavaScript code➚ on dynamiccourseware.org for where to put it.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
    var dcnamestudent = $(".logininfo a:eq(0)").text();
    $(".navbar.fixed-top").prepend('<div style="position:fixed; top: -3px; right:290px; color:#ccc; z-index:10; font-size: 40px;"><b>'+dcnamestudent+'</b></div>');
    $(".userpicture").attr("width","120");
    $(".userpicture").attr("height","120");
    $(".userpicture").css({"position":"relative","top":"33px"});
});
</script>

where you might want to adjust the top and right positions.

Here is what it looks like:

MoodleForum_20230624_2359.png

See https://dynamiccourseware.org/course/view.php?id=144&section=3➚ for more details.

Average of ratings: Useful (1)
In reply to Dominique Bauer

Re: Adding Watermark to quiz page.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Perhaps Akosah can provide us with a mockup of what is desired.

Here's an interesting thing, Dominique.  In my Moodle 3.11, I have the student's name showing to the left of the profile photo.  In Moodle 4.2, I cannot figure out how to do this.  I found some comments about the name being removed in Moodle 4.  But I don't know.

So, I take note of your script.

I was going to suggest to Akosah that the student's name already shows (as in your picture).  But again, Moodle 4.2 doesn't show it.

In the past, people wanted to show the name for face-to-face courses, so the instructor could walk around during the quiz (in class) and observe the student's name.  However, It appears that Akosah might be talking about a printed pdf version of the quiz being passed on to other students.  Akosah will have to clarify.

Average of ratings: Useful (1)
In reply to Rick Jerz

Re: Adding Watermark to quiz page.

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Just a comment that, in 4.2 in the Quiz settings > Appearance the option Show user picture allows you to choose a Large or Small image to display.
Average of ratings: Useful (5)
In reply to Mary Cooch

Re: Adding Watermark to quiz page.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
This should do it. Thanks.

Mary, do you recall anything about M3.11 showing both name and picture (see graphic). In M3.11, I have both the name and picture shows, but I can't seem to do this in M4.2. Was this a change in Moodle core?
Attachment M311-Name and Picture.png
In reply to Rick Jerz

Re: Adding Watermark to quiz page.

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
I see it in the Boost theme if you open the Quiz block on the side, Rick. I don't think anything has changed.
Average of ratings: Useful (1)
In reply to Rick Jerz

Re: Adding Watermark to quiz page.

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You are right! We can see the photo, small or large, and the name of the student in the quiz Navigation block (you have to set "Appearance / Show the user's picture" of the quiz settings to "Small image" or "Large image"). The student's name is small, providing some privacy, but still visible from a certain distance. However, the block drawer must be open to see the block.

If we set "Extra restrictions on attempts / Browser security" of the quiz settings to "Full screen pop-up with some JavaScript security", the quiz Navigation block is always visible, although it slides to the bottom of the page on small screens.

However, the OP's request was about a watermark. We still don't know for sure what exactly he meant. A watermark is often placed diagonally across the page. Is that what he was talking about?


Quiz navigation block with large image and student's name (standard settings):


Quiz page with watermark(?):

$(".navbar.fixed-top").prepend('<div style="position:fixed; top: 250px; right: 300px; color: rgba(100, 100, 100, 0.2); background-color: transparent; font-size: 120px; transform: rotate(-30deg);"><b>'+dcnamestudent+'</b></div>');
Average of ratings: Useful (2)
In reply to Dominique Bauer

Re: Adding Watermark to quiz page.

by Akosah Dennis -
Thanks Dominique Bauer.
This is what I was talking about.i,e the second picture. (Quiz with water mark?) But can you explain further how it done.
Thanks.
In reply to Dominique Bauer

Re: Adding Watermark to quiz page.

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Rick,

"... people wanted to show the name for face-to-face courses, so the instructor could walk around during the quiz (in class) and observe the student's name."

Exactly, and that's what I had already done in my own course where I teach. I thought that's what Akosah might want.

Although not necessarily displayed, the student's name is available at the bottom of every page, under $("body #page-wrapper #page #page-footer .footer-content-popover .footer-section:eq(1) .logininfo .logininfo a:eq(0)"), with the mention "You are logged in as John Doe".

My script is simple. It retrieves the student's name available under .logininfo, and displays it at the top of the page. You can display it during the quizzes, but also on all the pages of a course if you wish.

I think the option to display the student's name in large letters at the top of the page could be useful to many teachers for the reason you mentioned, and imho maybe Moodle should offer it as a core option.

I also hope that Akosah will clarify what he wanted.

Best smile

In reply to Akosah Dennis

Re: Adding Watermark to quiz page.

by Joost Elshoff -
Picture of Particularly helpful Moodlers Picture of Testers
Another suggestion maybe, now I understand the use case better:

Randomize questions and multiple choice answer options
Randomly pull questions from the question bank to populate a participant's quiz
Use Safe Exam Browser to lock down the workstation while a participant takes a quiz
(Consider proctoring, but I'd rather you opted for not doing that... yikes on privacy and academic ethics issues)

And: even if you'd watermark the pages a participant printed to a PDF, what would you do if they'd just use their phone's camera for screenshots instead?
Average of ratings: Useful (1)
In reply to Joost Elshoff

Re: Adding Watermark to quiz page.

by Akosah Dennis -
Thanks Dominique Bauer.
This is what I was talking about.i,e the second picture. (Quiz with water mark?) But please can you explain further how it done.
Thanks.
In reply to Akosah Dennis

Re: Adding Watermark to quiz page.

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Sure.

For Moodle 4.x:

  • To watermark a single quiz, place the code below in a "Text..." block in the Quiz, and set "Display on page types" to "Attempt quiz page".
  • To watermark all quizzes in a course, place the code below in a "Text..." block on a main Course page, and set "Display on page types" to "Any page".
  • To watermark all quizzes in all courses on a Moodle site, place the code below in "Site administration / Appearance / Additional HTML".

See JavaScript solution➚ and Where to place the JavaScript code➚ on dynamiccourseware.org for more details.


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
    var dcnamestudent = $(".logininfo a:eq(0)").text();
    $(".navbar.fixed-top").prepend('<div style="position:fixed; top: 250px; right: 300px; color: rgba(100, 100, 100, 0.2); background-color: transparent; font-size: 120px; transform: rotate(-30deg);"><b>'+dcnamestudent+'</b></div>');
});
</script>
In reply to Dominique Bauer

Re: Adding Watermark to quiz page.

by Akosah Dennis -
Thanks, Dominic.
please the first two options didn't work for me.
The third worked somehow but I find it difficult to scroll and clicking or selecting a section or option is also difficult. Please help me out
In reply to Akosah Dennis

Re: Adding Watermark to quiz page.

by Eka Kurniadi -
Hi Akosah,

Perhaps you want to give a class name on the element containing student's name, e.g.: "watermark", then add in below in the Raw SCSS (search this on Site Administration):
.watermark {
pointer-events: none;
}
This should fix the scrolling issue. Hope that helps.

- K -