Check isset AMD and $COURSE

Check isset AMD and $COURSE

Szymon Frączyk . -
回帖数: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.

回复Szymon Frączyk .

Re: Check isset AMD and $COURSE

David Mudrák -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像 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.