Check isset AMD and $COURSE

Check isset AMD and $COURSE

by Szymon Frączyk . -
Number of replies: 1

Welcome,

I have two question .

1 : Is this possible to check if js code amd is included? When i have availability plugin i include AMD block but when  i create 
topics format and set my restriction my code is include many times.


2: When i log in moodle as admin when i type in code $COURSE->id i see a correct value but when i am student i always see id 1 (which is moodle course). 

Is this possible to fix it ? I know i can use global $cm but it isnt't working as i want.


Thanks for any answers.

Average of ratings: -
In reply to Szymon Frączyk .

Re: Check isset AMD and $COURSE

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

my code is include many times

I don't fully understand what you are trying to achieve here but it seems that you are just loading your JS module in a wrong way, such as via inline embedded code.

$COURSE->id is the identifier of the current course you are in, including so called "site course" which is kind of course that implements the front page interface.