Greetings all,
I am wondering if one can enter php code in the HTML choice of Resources?
I have tried, but it seems to not parse at all.
Thanks in advance.
Bill
Martin,
Thanks for your reply.
I asked the question because I am writing material in html and php format. Right now I am using resource to link to the 'web page' option. The problem is that when displayed, anyone can open the nested frame in a new window which allows anyone to see the material and/or bookmark to the same. This could allow anyone outside of the course to view the material.
I thought that if I can include the php code within the resource module, the material would only be viewed within the platform.
Any ideas on how to protect the material within the Moodle platform and use php.... and keep it safe?
Thanks in advance.
Bill
Thanks for your reply.
I asked the question because I am writing material in html and php format. Right now I am using resource to link to the 'web page' option. The problem is that when displayed, anyone can open the nested frame in a new window which allows anyone to see the material and/or bookmark to the same. This could allow anyone outside of the course to view the material.
I thought that if I can include the php code within the resource module, the material would only be viewed within the platform.
Any ideas on how to protect the material within the Moodle platform and use php.... and keep it safe?
Thanks in advance.
Bill
in your php, include the moodle config file. use moodle functions such as isadmin, isguest, etc to validate users.
I do variations on the above for lots of pages. I find that using my makeclass utility (found in contrib, which you can get from moodle cvs) makes integrating moodle code with existing code much easier.
I do variations on the above for lots of pages. I find that using my makeclass utility (found in contrib, which you can get from moodle cvs) makes integrating moodle code with existing code much easier.
Yep, what Greg said.
To be more specific, add:
Another way is to use the "Program" resource type. This passes url, username, password etc to the external resource (as part of the URL, ie GET). You can get more details on the format by looking in mod/resource/view.php (must document it some day). The Program type probably needs some work to pass information in a less convoluted way, but it should be usable enough.
To be more specific, add:
require("location/moodle/config.php");at the top of each of your PHP scripts, and then:
require_login();followed by your code. All this does is check that the person is logged in to the server - it does not do a check for enrolment in a course (sadly this isn't currently possible in normal resources).
Another way is to use the "Program" resource type. This passes url, username, password etc to the external resource (as part of the URL, ie GET). You can get more details on the format by looking in mod/resource/view.php (must document it some day). The Program type probably needs some work to pass information in a less convoluted way, but it should be usable enough.
For a complete sample of something I put together that ties in to moodle:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/moodle/moodle/contrib/crown_college/userDirectory/
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/moodle/moodle/contrib/crown_college/userDirectory/
Hello All!
Greg's resource appears to have been moved to,
http://cvs.sourceforge.net/viewcvs.py/moodle/contrib/crown_college/
WP1
Greg's resource appears to have been moved to,
http://cvs.sourceforge.net/viewcvs.py/moodle/contrib/crown_college/
WP1