Generico Filter - a template maker

Re: Generico Filter - a template maker

by Richard van Iwaarden -
Number of replies: 2
Picture of Particularly helpful Moodlers

Do you have a picture of what you are doing?

All I can think of is get the courseID from the courses you are enrolled in (using SQL). But I'm not really understanding what you are trying to do. I'm an image-thinker, so pictures explain more to me than words smile

In reply to Richard van Iwaarden

Re: Generico Filter - a template maker

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

hi Richard.

I place {GENERICO:type="brandedcoursetitel"} in the Course Full name, and want it to show the course title that is placed in the Metada fields in the Course administration setting when it matches the custom user profile.

To achive it I am using SQL in the template, and I do think that the answer is in it somewhere. 
But I tried several things without success. 

I am using in the DATASET the following SQL: 

Select m.data as titel FROM mdl_local_metadata as m JOIN mdl_local_metadata_field as mf on mf. id = m.fieldid WHERE m.instanceid = ? AND mf.shortname = ?

Dataset variables : @@COURSE:id@@,@@USER:brand@@

This works fine within the course,but when the user is outside the course by example My Dashboard or My Profile page it shows {GENERICO:type="brandedcoursetitel"} instead of the expected course title. 

I have tried a different SQL query, but then it only shows {GENERICO:type="brandedcoursetitel"} even within the course. 

Select m.data as titel FROM mdl_local_metadata as m JOIN mdl_local_metadata_field as mf on mf. id = m.fieldid JOIN mdl_course as c on m.instance = c.id WHERE mf.shortname = ?

Dataset variables : @@USER:brand@@

Gemma

In reply to Gemma Lesterhuis

Re: Generico Filter - a template maker

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Thank you Justin!

It works when I fill in the Course ID in the dataset. 

For those who are looking for a similar solution, enclosed you find the bundle I used. 

Average of ratings: Useful (1)