michael-milette / moodle-filter_filtercodes

FilterCodes filter for Moodle enables content creators to easily customize and personalize course and site content using plain text tags (no HTML). For premium support, contact us at https://www.tngconsulting.ca/contact
https://moodle.org/plugins/filter_filtercodes
GNU General Public License v3.0
32 stars 44 forks source link

Suggestion for ifdate new feature #167

Open mohamedmohamedatia opened 2 years ago

mohamedmohamedatia commented 2 years ago

Hi, I have a suggestion for a new condition for the filter codes, that might be useful in some cases, I wanted to add some labels in my template that highlights this course as Past, In Progress, always open, or future based on the course date. examples

{ifendlessthancurrent}Finshed (Past Course) {/ifendlessthancurrent} or {ifgreaterthanenddate} {ifstartgreaterthancurrent}Future Course{/ifstartgreaterthancurrent} or {iflessthanstartdate} {ifnoenddate}Always Open{/ifnoenddate} {ifbetweenstartenddates}In Progress{/ifbetweenstartenddates}

michael-milette commented 2 years ago

Hi @mohamedmohamedatia

Thank you for taking the time to submit your suggestion. Could you please give me an example of where you would use this?

Best regards,

Michael

mohamedmohamedatia commented 2 years ago

Hi @michael-milette The course page is an example (/course/view.php), as in the attached screenshot, I added a block where I put course custom fields and dates as information about the course, I want to add a label at the top of the block to highlight if this course is in progress or in past or will be in the future. I hope the screenshot clarifies more I added a yellow highlight to where I want to add, Sorry our courses are not in English but I guess you will get it.

image

michael-milette commented 2 years ago

Hi @mohamedmohamedatia

Thank you for the screenshot. I think I get it. I can't tell if you are planning on using this in the course summary or in custom course fields? If so, this is not going to work for you. The course information is only available within the context of the course. It will not work in course listings such as on the home page, dashboard, or course category listings. However, it would work within a course such as a block or label on the course outline page or in a page within the course for example.

Please confirm your intended use. I just don't want to invest the time in developing the functionality if it isn't going to work for you in the end.

Michael

mohamedmohamedatia commented 2 years ago

HI @michael-milette, I confirm that I am planing to use it in a block inside the course main page. Thank you

michael-milette commented 2 years ago

That you for your suggestions @mohamedmohamedatia I will let you know if I have any other questions.

michael-milette commented 2 years ago

I was womdering what you might think of:

{ifnotcoursestarted} {ifcoursestarted} {ifcourseended} {ifcourseperpetual}

... just to keep the syntax of the tags a little simpler and intuitive. However, I am still not sure about the name of the end tag. I am considering {ifcoursenoend}. Feel free to share your thoughts.

Best regards,

Michael

mohamedmohamedatia commented 2 years ago

Hi @michael-milette Sorry, I didn't notice your last reply, yes I liked your suggestion more than what I suggested, it is easier for understanding, I added to the list if "the course is in progress" {ifnotcoursestarted} {ifcoursestarted} {ifcourseended} {ifcourseinprogress} {ifcourseperpetual}

I guess {ifcourseperpetual} and {ifcoursenoend} are the same, am I correct?

michael-milette commented 2 years ago

ifcourseperpetual} and {ifcoursenoend} are the same,

Yes.

What would be the difference between ifcoursestarted and ifcourseinprogress?

mohamedmohamedatia commented 2 years ago

Hi @michael-milette ifcoursestarted this means the start date in past which means two cases

  1. the end date in the future (the course is in progress) equals ifcourseinprogress
  2. the end date in the past (The course is ended) this is NOT equals ifcourseinprogress
michael-milette commented 2 years ago

Hi @mohamedmohamedatia

I am confused. Could you please provide me with an example of how you would use these tags? Preferably in English.

Best regards,

Michael

akramelsaadony1 commented 2 years ago

I guess it is simpler if you have one tag {coursestatus}

This will displays Past, Future, In Progress or Always Open. Based on checking the current date with (course start date, course end date).

mohamedmohamedatia commented 2 years ago

@michael-milette I will create test english course and will share screenshots. Once I reach my laptop

@akramelsaadony1 Thanks for your suggestion, I agree it is easier to be understood and can achieve what I am planning to put in course page, I guess conditions maybe more flexible but your suggestion is easier to use.

michael-milette commented 2 years ago

@akramelsaadony1

A {coursestatus} tag is an interesting idea but it depends on what you are trying to achieve and how you want to achieve it.

A requirement to display the current course status is different than a need to display various content depending on the status.

This is one of the reasons that I prefer to get clear on how a tag is going to be used before I invest my time in developing it. The other is that I am concious that the plugin is growing in size, so I prefer to only include tags that people will actually find useful and use.

Best regards,

Michael