moodle

How to include external JavaScript on my Moodle page?

匆匆过客 提交于 2019-12-05 10:59:19
In Moodle, while we use $PAGE->requires->js_init_call() to include a JS function defined in our plugin's module.js file, how can I include external Javascript resources , which we normally include in the <head> tags like: <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>mypage</title> <script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> <script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/element/element-beta-min.js"></script> <script type="text/javascript" src="http://yui

Create user using Moodle webservice

China☆狼群 提交于 2019-12-05 02:20:22
问题 I have tried to create a new user on the Moodle by web service api. I tried with a example that i found on the github and with another php code In the both i receive the same response: "Missing required key in single structure: users" the response: { "exception":"invalid_parameter_exception", "errorcode":"invalidparameter", "message":"Invalid parameter value detected", "debuginfo":"Missing required key in single structure: users" } I try to change the object by a array, but the error

cURL works from Terminal, but not from PHP

限于喜欢 提交于 2019-12-04 23:32:44
I'm running into a rather strange issue. I'm trying to log into a remote moodle install using curl from PHP. I have a curl command, which works perfectly in the Terminal. When I translate the same thing into PHP, it works, but it just doesn't login. The exact same value which successfully login via terminal, somehow trips up the login system via PHP and it doesn't login. Instead, it returns the login page again. My cURL command (data section ommitted as it has my username and password): curl 'http://moodle.tsrs.org/login/index.php' -H 'Pragma: no-cache' -H 'Origin: http://moodle.tsrs.org' -H

How to add a block to the center of a page in Moodle?

▼魔方 西西 提交于 2019-12-04 19:44:45
I wanted to display a comment block below the activity rather than on the left or right side bars. It was a lot easier than I thought. I've added code for center-post which will add a block at the bottom of the main content. It could easily be modified to have a centre-pre for displaying at the top of the main content. In /theme/yourthemename/config.php Add 'centre-post' to the regions() array for each page layout where it is required. Eg for modules only added it to 'incourse' layout // Part of course, typical for modules - default page layout if $cm specifi 'incourse' => array( 'file' =>

Create XML file with python by iterating over lists

北城以北 提交于 2019-12-04 15:26:44
I am trying to get an xml file that looks like this so that I can import it into a moodle gradebook: <results> <result> <student>1</student> <assignment>100</assignment> <score>0</score> </result> <result> <student>1</student> <assignment>101</assignment> <score>4</score> </result> <result> <student>1</student> <assignment>102</assignment> <score>10</score> </result> <result> <student>2</student> <assignment>100</assignment> <score>0</score> </result> <result> <student>2</student> <assignment>101</assignment> <score>4</score> </result> <result> <student>2</student> <assignment>102</assignment>

How to create a custom form in moodle? [closed]

风流意气都作罢 提交于 2019-12-04 14:53:44
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I want to create a custom form in moodle and store the form data in database table. I've been studying moodle form library but it's too complex for me. Any help or guidance or tutorial or reference guide or ebook on how to create custom forms in moodle and store the forms data in the database will be much

How to resolve moodle fresh installation issue mysql_full_unicode_support#File_format and mysql_full_unicode_support#Large_prefix

巧了我就是萌 提交于 2019-12-04 14:29:17
问题 I am very new to Moodle. When i am trying to install this i got this issue(Please ref screenshot). Can any one help me regarding this? Thank you in advance. Omkar 回答1: This is very common problem, people often face, even i did face too. When installing moodle latest 3.2+ it checks for enabled support for utf8mb4 charset in MySQL database. This doesn't come by default in MySQL. You need to set few parameters in mysql conf. On Linux based systems you will want to alter my.cnf. This may be

Use window.print content to download a web page as pdf

别说谁变了你拦得住时间么 提交于 2019-12-04 13:11:20
I would like to have a link that when is clicked, automatically starts the download of the printable version of the web page. I'm using Moodle. The content I want it's exactly the same If I download the page using ctrl + p and saving as pdf or using <a href=\"whatever.htm\" onClick=\"window.print();return false\">Download web page</a> I want exactly that content because using this way, the header, sidebar and footer is removed. I don't want css. I'm not using this because this doesn't work in some browsers. I'd rather not using pdf libraries like tcpdf because Moodle loads the content in a

Getting JSON Object by calling a URL with parameters in PHP

不打扰是莪最后的温柔 提交于 2019-12-04 09:43:39
问题 I'm trying to get json data by calling moodle url: https://<moodledomain>/login/token.php?username=test1&password=Test1&service=moodle_mobile_app the response format of moodle system is like this: {"token":"a2063623aa3244a19101e28644ad3004"} The result I tried to process with PHP: if ( isset($_POST['username']) && isset($_POST['password']) ){ // test1 Test1 // request for a 'token' via moodle url $json_url = "https://<moodledomain>/login/token.php?username=".$_POST['username']."&password=".$

Email using cron and including attachment to email from moodle

时光毁灭记忆、已成空白 提交于 2019-12-04 05:44:06
问题 I would like to send emails only to users that have completed a specific course and add a pdf file (a certificate for completing the course) as attachment to the email, and do so at a specific time using moodle cron. I have looked at some plugins to find out how it's done, but I'm still not sure how exactly I should do this. I need: 1. to know how I would add an attachment to an email (and which API to use), 2. how I would use cron to send the emails to the desired group at a certain time, 3.