Closed bfriesenvcc closed 2 years ago
Interesting! Can you give me an example of how you would use this?
Using FilterCodes, we've created a "sticky block" called, "Need Help?" This block expands to show useful links, but some of the most important things (in our opinion) are visible at the top. If there were a visibility tag, we would add the line "Course Visibility: HIDE" or "Course Visibility: SHOW." Something like that, anyway. :-)
Hmm... now that I've written that out, I'm thinking it may be better to have conditional filters like {ifhidden}{/ifhidden} instead.
Collapsed view:
Expanded view:
Hi @bfriesenvcc ,
Why would you want to show the course visibility status to students? If the course visibility is set to hidden, students would not be able to access the course.
On a side note, if you don't mind, I am very curious on how you created the expandable sticky block using FilterCodes. Would you mind sharing?
Best regards,
Michael
Sorry, Michael. I neglected to mention that we use your filtercodes to show the students something else in the same block:
The previous images are what course editors only will see.
So, I created an HTML block on the front page of Moodle and set the page contexts settings to "Display throughout the entire site."
I then went to edit the HTML within a random course, immediately changing Display on Page types setting to "Any type of course main page."
I then added the content of the block which contained all of the code and made great use of your filtercodes.
Previously, I used permissions to show a sticky block only to editors and NOTHING to students. However, somewhere around Moodle 3.2 (I think) the permissions trick stopped working for sticky blocks and only worked for regular blocks. Then I got the idea of using your filtercodes and it saved us.
Hi @bfriesenvcc ,
Nice! Thank you.
I am still not clear on why you would you want to show the course visibility status to students. It sounds to me like all you are really looking for is a set of {ifnotvisible}{/ifnotvisible} tags or something like that which would enable you to display a warning when the course is not set to "show".
Michael
No, the student view doesn't show the course visibility. They only see the suggestion to report issues to the instructors. Only the course editors see the view that would include the visibility. And, yes, I think the if/ifnot tags would do the job nicely because I could word it any way that I chose.
Thanks for your feedback. Last thing before I do this. Do you understand that this tag will only work in a course? It will not work outside of the course or in course listings.
Yes, that makes sense to me and that's how I plan to use it. :-)
ok, give me a few minutes. I am testing it now.
Hi @bfriesenvcc ,
Just pulled it out of the oven! Looks ready to me. If you have a few minutes, I would really appreciate it if you could test the new tag for me and let me know if it meets your needs. Here is an example of how it could be used:
{ifnotvisible}Warning: Course visibility is set to Hide.{/ifnotvisible}
Please note that this new tag is only available here on GitHub at the moment. It will be released on Moodle.org around the same time as Moodle 4.0.
Best regards,
Michael Milette
Michael, you are truly amazing! I will try to test before I leave today. I'm pretty sure I can get that done.
It seems that I cannot use nested conditionals.
The screenshot shows my block on the right and, on the same page, a label resource in the content area. The ifnotvisible is working as expected in the label, but not in my block. I suspect it's because I'm trying to put the {ifnotvisible} inside the {ifminassistant} code:
{ifminassistant}This is for course editors only. {ifnotvisible}Warning: Course is set to Hide!{/ifnotvisible}{/ifminassistant}
Hi @bfriesenvcc ,
It works fine for me exactly as you typed it. Here is the code that I put into an HTML block:
{details}{summary}More information{/summary}
Contact us for help.
{ifminassistant}This is for course editors only. {ifnotvisible}Warning: Course is set to Hide!{/ifnotvisible}{/ifminassistant}
{/details}
Some people have mentioned that extra codes get pasted into the editor when they copy from GitHub and paste in Moodle's Atto editor. Take a look at the HTML view to see if some unexpected characters might have accidentally been added to your text.
Best regards,
Michael
OK, I've done quite a bit of playing around, and pulling out of hair, but I've solved the issue IN MY CASE.
Basically, long story short, I believe it was related to the use of {courseenddate} when the end date was disabled for that particular course.
Any of the following methods solved the problem:
tag.
To reproduce the first two methods, mentioned above:
<p>Your Course ID is <strong>{courseid}</strong><br> Start date: {coursestartdate}<br>End date: {courseenddate}<br>{ifnotvisible}<strong>Warning: Course visibility is set to Hide</strong>.{/ifnotvisible}<br>{ifeditmode}editing is turned on.{/ifeditmode}
</p>
Image1:
Image2:
Image3:
Image4:
A couple of questions:
We're using Moodle 3.9.11, but I had to Google NGINX, so I'm going to say "no."
This is a really nice filtercode! Just sharing an example for others to see if interested:
{ifnotvisible}
<div class="samsc-warning">
<h5 class="card-title">This course is not visible to participants!</h5>
<a href="/course/edit.php?id={courseid}"><i class="fas fa-cog" aria-hidden="true"></i> Edit settings</a>
</div>
{/ifnotvisible}
<h5 class="card-title">Quick Links</h5>
{ifincourse}
<ul class="fa-ul" style="margin-left: 0;">
<li><span class="fa-li"><i class="fas fa-users" aria-hidden="true"></i></span><a href="/user/index.php?id={courseid}">Course Participants</a></li>
<li><span class="fa-li"><i class="fas fa-chart-line" aria-hidden="true"></i></span><a href="/report/completion/index.php?course={courseid}">Completion Report</a></li>
<li><span class="fa-li"><i class="fas fa-bullhorn" aria-hidden="true"></i></span><a href="/mod/feedback/index.php?id={courseid}">Evaluation Form</a></li>
<li><span class="fa-li"><i class="far fa-file" aria-hidden="true"></i></span><a href="/mod/customcert/index.php?id={courseid}">Certificates</a></li>
</ul>
{/ifincourse}
<ul class="fa-ul" style="margin-left: 0;">
<li><span class="fa-li"><i class="fas fa-graduation-cap" aria-hidden="true"></i></span><a href="/course">All courses</a>
</li>
</ul>
Great example, jb-fol!
It would be awesome if there were a tag for course visibility. :-) Love this plugin!