https://docs.moodle.org/19/en/api.php?action=feedcontributions&user=Jamiesensei&feedformat=atom
MoodleDocs - User contributions [en]
2024-03-29T07:22:44Z
User contributions
MediaWiki 1.39.6
https://docs.moodle.org/19/en/index.php?title=Installation_Guide_for_Installing_on_Amazon_EC2&diff=79234
Installation Guide for Installing on Amazon EC2
2010-12-15T10:25:07Z
<p>Jamiesensei: /* Rent a ec2 instance */</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent an ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
You may want to map a domain name to point to your elastic IP address. You will need a dns provider to do this. Amazon does not provide this service at the time of writing.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
sudo mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
sudo mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* Install the version of Moodle required. I recommend using CVS to install Moodle. See [[CVS for Administrators]].<br />
* [[Create Moodle site database]]<br />
* [[Creating Moodle site data directory]]<br />
* [[Cron#Using_the_crontab_program_on_Unix|Set up cron using crontab command]]<br />
<br />
Install Moodle by going to http://youelasticipaddress/roottoyourmoodleserver/ (if you have set up a domain name to point to your elasticip address then you should use that of course)<br />
<br />
Copy the config.php that the installer creates and then go to the root of your moodleserver and do :<br />
<br />
sudo vi config.php<br />
<br />
Then type i to put vi in insert mode and on putty you can use the right mouse key to paste the contents of the clipboard, then delete the former contents.<br />
<br />
Then go again to the root of your Moodle installation http://youelasticipaddress/roottoyourmoodleserver/ and complete the automatic installation of your Moodle db.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Installation_Guide_for_Installing_on_Amazon_EC2&diff=79223
Installation Guide for Installing on Amazon EC2
2010-12-15T07:07:26Z
<p>Jamiesensei: /* Install Moodle */</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent a ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
You may want to map a domain name to point to your elastic IP address. You will need a dns provider to do this. Amazon does not provide this service at the time of writing.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
sudo mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
sudo mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* Install the version of Moodle required. I recommend using CVS to install Moodle. See [[CVS for Administrators]].<br />
* [[Create Moodle site database]]<br />
* [[Creating Moodle site data directory]]<br />
* [[Cron#Using_the_crontab_program_on_Unix|Set up cron using crontab command]]<br />
<br />
Install Moodle by going to http://youelasticipaddress/roottoyourmoodleserver/ (if you have set up a domain name to point to your elasticip address then you should use that of course)<br />
<br />
Copy the config.php that the installer creates and then go to the root of your moodleserver and do :<br />
<br />
sudo vi config.php<br />
<br />
Then type i to put vi in insert mode and on putty you can use the right mouse key to paste the contents of the clipboard, then delete the former contents.<br />
<br />
Then go again to the root of your Moodle installation http://youelasticipaddress/roottoyourmoodleserver/ and complete the automatic installation of your Moodle db.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Installation_Guide_for_Installing_on_Amazon_EC2&diff=79219
Installation Guide for Installing on Amazon EC2
2010-12-15T07:05:30Z
<p>Jamiesensei: /* Set up MYSQL */</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent a ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
You may want to map a domain name to point to your elastic IP address. You will need a dns provider to do this. Amazon does not provide this service at the time of writing.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
sudo mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
sudo mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* Install the version of Moodle required. I recommend using CVS to install Moodle. See [[CVS for Administrators]].<br />
* [[Create Moodle site database]]<br />
* [[Creating Moodle site data directory]]<br />
* [[Cron#Using_the_crontab_program_on_Unix|Set up cron using crontab command]]<br />
<br />
Install Moodle by going to http://youelasticipaddress/roottoyourmoodleserver/ (if you have set up a domain name to point to your elasticip address then you should use that of course)<br />
<br />
Copy and paste the config.php that the installer creates and then go to the root of your moodleserver and do :<br />
<br />
sudo vi config.php<br />
<br />
<br />
Then go again to the root of your Moodle installation http://youelasticipaddress/roottoyourmoodleserver/ and complete the automatic installation of your Moodle db.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Installation_Guide_for_Installing_on_Amazon_EC2&diff=79218
Installation Guide for Installing on Amazon EC2
2010-12-15T07:04:26Z
<p>Jamiesensei: /* Install Moodle */</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent a ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
You may want to map a domain name to point to your elastic IP address. You will need a dns provider to do this. Amazon does not provide this service at the time of writing.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* Install the version of Moodle required. I recommend using CVS to install Moodle. See [[CVS for Administrators]].<br />
* [[Create Moodle site database]]<br />
* [[Creating Moodle site data directory]]<br />
* [[Cron#Using_the_crontab_program_on_Unix|Set up cron using crontab command]]<br />
<br />
Install Moodle by going to http://youelasticipaddress/roottoyourmoodleserver/ (if you have set up a domain name to point to your elasticip address then you should use that of course)<br />
<br />
Copy and paste the config.php that the installer creates and then go to the root of your moodleserver and do :<br />
<br />
sudo vi config.php<br />
<br />
<br />
Then go again to the root of your Moodle installation http://youelasticipaddress/roottoyourmoodleserver/ and complete the automatic installation of your Moodle db.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Installation_Guide_for_Installing_on_Amazon_EC2&diff=79217
Installation Guide for Installing on Amazon EC2
2010-12-15T07:00:30Z
<p>Jamiesensei: /* Install Moodle */ fixing some link syntax</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent a ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
You may want to map a domain name to point to your elastic IP address. You will need a dns provider to do this. Amazon does not provide this service at the time of writing.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* Install the version of Moodle required. I recommend using CVS to install Moodle. See [[CVS for Administrators]].<br />
* [[Create Moodle site database]]<br />
* [[Creating Moodle site data directory]]<br />
<br />
Install Moodle by going to http://youelasticipaddress/roottoyourmoodleserver/ (if you have set up a domain name to point to your elasticip address then you should use that of course)<br />
<br />
Copy and paste the config.php that the installer creates and then go to the root of your moodleserver and do :<br />
<br />
sudo vi config.php<br />
<br />
<br />
Then go again to the root of your Moodle installation http://youelasticipaddress/roottoyourmoodleserver/ and complete the automatic installation of your Moodle db.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Installation_Guide_for_Installing_on_Amazon_EC2&diff=79215
Installation Guide for Installing on Amazon EC2
2010-12-15T06:58:43Z
<p>Jamiesensei: /* Install Moodle */</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent a ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
You may want to map a domain name to point to your elastic IP address. You will need a dns provider to do this. Amazon does not provide this service at the time of writing.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* Install the version of Moodle required. I recommend using CVS to install Moodle. See [CVS for Administrators]<br />
* [Create Moodle site database]<br />
* [Creating Moodle site data directory]<br />
<br />
Install Moodle by going to http://youelasticipaddress/roottoyourmoodleserver/ (if you have set up a domain name to point to your elasticip address then you should use that of course)<br />
<br />
Copy and paste the config.php that the installer creates and then go to the root of your moodleserver and do :<br />
<br />
sudo vi config.php<br />
<br />
<br />
Then go again to the root of your Moodle installation http://youelasticipaddress/roottoyourmoodleserver/ and complete the automatic installation of your Moodle db.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Installation_Guide_for_Installing_on_Amazon_EC2&diff=79214
Installation Guide for Installing on Amazon EC2
2010-12-15T06:57:49Z
<p>Jamiesensei: /* Attach an 'elastic ip' and open necessary ports on firewall */</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent a ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
You may want to map a domain name to point to your elastic IP address. You will need a dns provider to do this. Amazon does not provide this service at the time of writing.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* Install the version of Moodle required. I recommend using CVS to install Moodle. See [CVS for Administrators]<br />
* [Create Moodle site database]<br />
* [Creating Moodle site data directory]<br />
<br />
Install Moodle by going to http://youelasticipaddress/roottoyourmoodleserver/<br />
<br />
Copy and paste the config.php that the installer creates and then go to the root of your moodleserver and do :<br />
<br />
sudo vi config.php<br />
<br />
<br />
Then go again to the root of your Moodle installation http://youelasticipaddress/roottoyourmoodleserver/ and complete the automatic installation of your Moodle db.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Installation_Guide_for_Installing_on_Amazon_EC2&diff=79212
Installation Guide for Installing on Amazon EC2
2010-12-15T06:54:54Z
<p>Jamiesensei: /* Install Moodle */</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent a ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* Install the version of Moodle required. I recommend using CVS to install Moodle. See [CVS for Administrators]<br />
* [Create Moodle site database]<br />
* [Creating Moodle site data directory]<br />
<br />
Install Moodle by going to http://youelasticipaddress/roottoyourmoodleserver/<br />
<br />
Copy and paste the config.php that the installer creates and then go to the root of your moodleserver and do :<br />
<br />
sudo vi config.php<br />
<br />
<br />
Then go again to the root of your Moodle installation http://youelasticipaddress/roottoyourmoodleserver/ and complete the automatic installation of your Moodle db.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Installation_Guide_for_Installing_on_Amazon_EC2&diff=79211
Installation Guide for Installing on Amazon EC2
2010-12-15T06:44:07Z
<p>Jamiesensei: /* Setting up a web server on Amazon Linux AMI */ - code formatting</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent a ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* create a db user<br />
* create a</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Install_Guide_for_Installing_Amazon_EC2&diff=79210
Install Guide for Installing Amazon EC2
2010-12-15T06:41:57Z
<p>Jamiesensei: moving page - creating redirect to new page</p>
<hr />
<div>#REDIRECT [[Installation Guide for Installing on Amazon EC2]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Installation_Guide_for_Installing_on_Amazon_EC2&diff=79208
Installation Guide for Installing on Amazon EC2
2010-12-15T06:39:09Z
<p>Jamiesensei: moving page</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent a ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* create a db user<br />
* create a</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Administrator_documentation&diff=79207
Administrator documentation
2010-12-15T06:38:30Z
<p>Jamiesensei: /* Unix/Linux-based */ fixing link name</p>
<hr />
<div>The purpose of this page is to list useful links by general topics for administrators of a Moodle site.<br />
__TOC__<br />
<br />
== Installation & Upgrading ==<br />
<br />
*[[Installation Quickstart]] for an overview of the installation steps<br />
*[[Installing Moodle]] for detailed installation instructions<br />
*[[Installation FAQ]]<br />
*[[Installing AMP|Options for installing Apache, MySQL and PHP]]<br />
*[[Upgrading|Upgrading Moodle]]<br />
*[[Installing contributed modules or plugins]]<br />
<br />
== System-specific Instructions & Packages ==<br />
<br />
===Unix/Linux-based===<br />
* [[SUSE Linux Server 10|Automated Installation Guide for SUSE Linux Enterprise Server 10]] operating system<br />
* [[RedHat Linux installation|Step-by-step Installation Guide for RedHat]] operating system<br />
* [[Debian GNU/Linux installation|Step-by-step Installation Guide for Debian GNU/Linux]] operating system<br />
* [[Step-by-step Installation Guide for Ubuntu]]<br />
* [[Manual_installation_on_Ubuntu|Manual Installation on Ubuntu]]<br />
* [[Step-by-step Install Guide for Zenwalk-5.0|Step-by-step Installation Guide for Zenwalk-5.0]]<br />
* [[OLPC XS installation|Step-by-step Installation Guide for the One Laptop per Child XS Server (Beta)]]<br />
* [[Step-by-step Install Guide for Solaris 10 with Oracle 10|Step-by-step Installation Guide for Solaris 10 with Oracle 10]]<br />
* [[Installation Guide for Installing on Amazon EC2]]<br />
<br />
===Windows===<br />
* [[Windows installation|Windows installations with instructions for Windows NT/2000/2003 servers]]<br />
* [[Windows installation using XAMPP|Windows installation using XAMPP: Apache, MySQL and PHP]]<br />
* [[Development:Windows_Installer_anywhere|MoodleAnywhere]] another Windows installation package<br />
* [[Installing Moodle on Windows Vista]] - how to<br />
* [http://www.bfcnetworks.com/whitepapers/installing-moodle-on-windows-server-iis-sql/ Installing Moodle on Windows Server 2008 x86]<br />
* [http://www.bfcnetworks.com/whitepapers/installing-moodle-on-windows-server-2008-r2-x64-sql-iis/ Installing Moodle on Windows Server 2008 R2]<br />
<br />
===Mac===<br />
* [[Step by Step Installation on a Mac OS X Server|Step by step Installation on a Mac OS X Server 10.5/10.6]]<br />
* [[Complete Install Packages for Mac OS X | Complete Install Packages for Mac OS X Clients 10.4/10.5/10.6]]<br />
* [[Step-by-step Guide for Installing Moodle on Mac OS X 10.4 Client|Step by Step Installation on a Mac OS X 10.4 Client using the internal web server]]<br />
<br />
===Web Hosts===<br />
* [[1and1_MySQL_installation | Installation on '''1and1''' web hosting]]<br />
* [[powweb_MySQL_installation | Step-by-step Installation on '''Powweb''' web hosting]]<br />
* [[Step-by-step Installation using the old version of CPanel]]<br />
* [[Step-by-step Installation using the new version of CPanel]]<br />
<br />
===Appliances===<br />
Some users may prefer to skip manual installation by using a pre-integrated [[Moodle appliance]].<br />
<br />
===Database===<br />
* [[Installing Oracle for PHP]]<br />
* [[Installing MSSQL for PHP]]<br />
* [[Installing Postgres for PHP]]<br />
<br />
===Plugins===<br />
* [[Installing contributed modules or plugins]]<br />
<br />
==Security, Performance and Roles==<br />
<br />
*[[Security]] contains important security procedures for a production site<br />
*[[Performance]] for ideas on improving the speed of your installation<br />
*[[Manage roles]] For Moodle 1.7 and later.<br />
*[[Reducing spam in Moodle]]<br />
*[[suhosin]] is an advanced protection system for PHP installation. It was designed to protect servers and users from known and unknown flaws in PHP applications and the PHP core.<br />
*[[nagios]] Open source software to monitor servers<br />
<br />
== FAQs ==<br />
<br />
*[[Installation FAQ]]<br />
*[[Beginning Administration FAQ]]<br />
*[[Administration FAQ]]<br />
*[[Performance FAQ]]<br />
*[[Backup and restore FAQ]]<br />
*[[Errors FAQ]]<br />
*[[:Category:FAQ|List of FAQs]]<br />
<br />
== Configuration Settings ==<br />
=== Site administration setting===<br />
[[Site administration block]] contains most site configuration settings including:<br />
*[[Front Page settings]]- initial or home page of a Moodle site<br />
*[[Themes]] - user interface packages of XHTML and CSS controls<br />
*[[Language]] - default and additional language packs<br />
*[[Activity modules administration]]<br />
*[[Blocks administration]]<br />
*[[Filters]] - Text and Multimedea plugins <br />
*[[Backup settings]]<br />
*[[HTML editor settings]]<br />
*[[Calendar settings]]<br />
*[[Maintenance mode]]<br />
*[[Notification page]] used to update versions<br />
*[[Settings block]] Moodle 2.0 site settings location<br />
<br />
===Other settings===<br />
*[[Course settings]] for course home page configuration<br />
**Each type of [[Activities|activity]], [[resource]] and [[:Category:Block|block]] has their own settings<br />
*Older versions settings<br />
**[[Site settings]] pre 1.7<br />
**[[Variables]] pre 1.6 <br />
**[[Location of admin settings in 1.7|Comparison between configuration settings in Moodle 1.6 & 1.7]]<br />
<br />
==User Management==<br />
<br />
*[[Authentication]] of user on a site<br />
*[[Add new user|Add a new user]] - on a site<br />
*[[Upload users]] - from a file to a site, and into existing course and group, some existing user global updates<br />
*[[User_profile_fields]]<br />
*[[Enrolment plugins]]<br />
**[[Flat file]] - enrol existing users in a course<br />
*[[Roles and capabilities|Assigning user a role]] - typical assignments include:<br />
**[[Students|Enrol students in a course]]<br />
**[[Unenrolment]] Student<br />
**[[Courses (administrator)|Assign teachers]] - to a course<br />
**[[Assign creators|Assign course creators]] - in a site<br />
**[[Assign administrators]] - in a site<br />
<br />
==Other==<br />
<br />
*[[Courses (administrator)|Courses]] and [[Course formats|course formats]]<br />
*[[Reports (administrator)]] and [[Logs]]<br />
*[[Site files]]<br />
*[[Moodle database|Moodle site database]] <br />
*[[Environment]]<br />
*[[MNet|Moodle Network]] and Moodle [[Community hub]]<br />
*[[Streaming Media]]<br />
*[[Case studies (administrator)]]<br />
*[[Anti-virus]]<br />
*[[System Monitoring and Server Statistic Software]]<br />
*[[Integrate Moodle, LDAP and SIMS.net]]<br />
*[[How to rebuild context paths]]<br />
*[[Hacking the Moodle 2.0 database transfer script to convert a Moodle 1.9 site]]<br />
*[[Category:ProxyProblems]]<br />
<br />
==See also==<br />
<br />
*[[:Category:Administrator | Index of all Administrator-related pages]]<br />
*[[Integrations]]<br />
*[[CVS for Administrators]]<br />
*[[Email processing]]<br />
*[[Search engine optimization]]<br />
*[[Messaging]]<br />
*[[Migration]]<br />
*[[Metacourses]]<br />
*[[Block layout]]<br />
*[[Customizing Moodle]]<br />
*[[Administrator do's and don'ts]]<br />
*[[Using Moodle book]] Chapter 16: Moodle Administration<br />
*[[Administration hacks]]<br />
*[[Git]] Version control, upgrading <br />
<br />
[[Category: Administrator]]<br />
[[cs:Rukověť správce]]<br />
[[es:Documentación para Administradores]]<br />
[[eu:Kudeatzaileentzako dokumentazioa]]<br />
[[fr:Documentation administrateur]]<br />
[[ja:管理者ドキュメント]]<br />
[[ko:관리자 문서]]<br />
[[nl:Documentatie voor beheerders]]<br />
[[pt:Documentação para administradores]]<br />
[[ru:Администраторам]]<br />
[[sk:Dokumentácia pre správcov]]<br />
[[zh:管理员文档]]<br />
[[pl:Administrator documentation]]<br />
[[fi:Ylläpitäjän opas]]<br />
[[de:Dokumentation für Administratoren]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Install_Guide_for_Installing_Amazon_EC2&diff=79204
Install Guide for Installing Amazon EC2
2010-12-15T06:32:10Z
<p>Jamiesensei: first draft - not finished</p>
<hr />
<div>An ec2 instance is a virtual web server that can be rented out by the hour from Amazon. Prices vary depending on the power of the instance you rent out.<br />
<br />
I recommend the following book for background reading on Amazon EC2 "Host Your Web Site in the Cloud: Amazon Web Services Made Easy<br />
by Jeff Barr Copyright ©2010 Amazon Web Services" This is the official Amazon book on their web services and tells you how to set up a web server on an ec2 instance.<br />
<br />
The instructions below are one way in which to set up Moodle on an EC2 instance.<br />
<br />
==Rent a ec2 instance==<br />
<br />
You can set up an account with Amazon Web Services and rent out a ec2 instance here [http://aws.amazon.com/console/ The Amazon Web Service Console]<br />
<br />
I used an instance of the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI] based on Elastic Block Store. Using an instance based on an Elastic Block Store gives you more options for backing up your disks later. The "[http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI]" is based on CentOS and is a pared down version of linux with only the bare essentials included, that should be more secure. You can use the yum command to install anything extra necessary on your server.<br />
<br />
===Attach an 'elastic ip' and open necessary ports on firewall===<br />
<br />
Again through the [http://aws.amazon.com/console/ The Amazon Web Service Console] :<br />
<br />
* I created and attached an elastic ip address to the ec2 instance I had launched with the [http://aws.amazon.com/amazon-linux-ami/ Amazon Linux AMI].<br />
* I opened ports 22 and 80. For my purposes I did not intend to make the server accessible through https so these were sufficient.<br />
<br />
==Connect to your ec2 instance with putty or another ssh client==<br />
<br />
Through the [http://aws.amazon.com/console/ The Amazon Web Service Console] you can set up an ssh key and attach it to the ec2 instance you have running.<br />
<br />
Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.<br />
<br />
===Accessing ec2 instance using putty ssh client===<br />
<br />
In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'<br />
<br />
==Setting up a web server on Amazon Linux AMI==<br />
<br />
Make sure all your currently installed packages are up to date.<br />
<br />
sudo yum -y update<br />
<br />
You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :<br />
<br />
sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell<br />
<br />
You can list all your installed packages (including dependencies) with this command :<br />
<br />
sudo yum list installed<br />
<br />
===Start server services and have them start up automatically on a reboot===<br />
<br />
Configure the new services to start automatically.<br />
<br />
sudo /sbin/chkconfig httpd on<br />
sudo /sbin/chkconfig mysqld on<br />
<br />
sudo /sbin/service httpd start<br />
sudo /sbin/service mysqld start<br />
<br />
===Edit httpd.conf===<br />
<br />
If you need to edit httpd.conf it is in /etc/httpd/conf<br />
<br />
But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.<br />
<br />
If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :<br />
<br />
sudo /sbin/service httpd restart<br />
<br />
==Set up MYSQL==<br />
<br />
mysqladmin -u root password 'new-password'<br />
<br />
Make additional security-related changes to mysql.<br />
<br />
mysql -u root -p<br />
<br />
mysql> DROP DATABASE test; [removes the test database]<br />
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]<br />
mysql> FLUSH PRIVILEGES;<br />
<br />
==Install Moodle==<br />
<br />
Now you need to :<br />
<br />
* create a db user<br />
* create a</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Administrator_documentation&diff=79200
Administrator documentation
2010-12-15T05:03:06Z
<p>Jamiesensei: /* Unix/Linux-based */ - New Page Amazon EC2</p>
<hr />
<div>The purpose of this page is to list useful links by general topics for administrators of a Moodle site.<br />
__TOC__<br />
<br />
== Installation & Upgrading ==<br />
<br />
*[[Installation Quickstart]] for an overview of the installation steps<br />
*[[Installing Moodle]] for detailed installation instructions<br />
*[[Installation FAQ]]<br />
*[[Installing AMP|Options for installing Apache, MySQL and PHP]]<br />
*[[Upgrading|Upgrading Moodle]]<br />
*[[Installing contributed modules or plugins]]<br />
<br />
== System-specific Instructions & Packages ==<br />
<br />
===Unix/Linux-based===<br />
* [[SUSE Linux Server 10|Automated Installation Guide for SUSE Linux Enterprise Server 10]] operating system<br />
* [[RedHat Linux installation|Step-by-step Installation Guide for RedHat]] operating system<br />
* [[Debian GNU/Linux installation|Step-by-step Installation Guide for Debian GNU/Linux]] operating system<br />
* [[Step-by-step Installation Guide for Ubuntu]]<br />
* [[Manual_installation_on_Ubuntu|Manual Installation on Ubuntu]]<br />
* [[Step-by-step Install Guide for Zenwalk-5.0|Step-by-step Installation Guide for Zenwalk-5.0]]<br />
* [[OLPC XS installation|Step-by-step Installation Guide for the One Laptop per Child XS Server (Beta)]]<br />
* [[Step-by-step Install Guide for Solaris 10 with Oracle 10|Step-by-step Installation Guide for Solaris 10 with Oracle 10]]<br />
* [[Install Guide for Installing Amazon EC2]]<br />
<br />
===Windows===<br />
* [[Windows installation|Windows installations with instructions for Windows NT/2000/2003 servers]]<br />
* [[Windows installation using XAMPP|Windows installation using XAMPP: Apache, MySQL and PHP]]<br />
* [[Development:Windows_Installer_anywhere|MoodleAnywhere]] another Windows installation package<br />
* [[Installing Moodle on Windows Vista]] - how to<br />
* [http://www.bfcnetworks.com/whitepapers/installing-moodle-on-windows-server-iis-sql/ Installing Moodle on Windows Server 2008 x86]<br />
* [http://www.bfcnetworks.com/whitepapers/installing-moodle-on-windows-server-2008-r2-x64-sql-iis/ Installing Moodle on Windows Server 2008 R2]<br />
<br />
===Mac===<br />
* [[Step by Step Installation on a Mac OS X Server|Step by step Installation on a Mac OS X Server 10.5/10.6]]<br />
* [[Complete Install Packages for Mac OS X | Complete Install Packages for Mac OS X Clients 10.4/10.5/10.6]]<br />
* [[Step-by-step Guide for Installing Moodle on Mac OS X 10.4 Client|Step by Step Installation on a Mac OS X 10.4 Client using the internal web server]]<br />
<br />
===Web Hosts===<br />
* [[1and1_MySQL_installation | Installation on '''1and1''' web hosting]]<br />
* [[powweb_MySQL_installation | Step-by-step Installation on '''Powweb''' web hosting]]<br />
* [[Step-by-step Installation using the old version of CPanel]]<br />
* [[Step-by-step Installation using the new version of CPanel]]<br />
<br />
===Appliances===<br />
Some users may prefer to skip manual installation by using a pre-integrated [[Moodle appliance]].<br />
<br />
===Database===<br />
* [[Installing Oracle for PHP]]<br />
* [[Installing MSSQL for PHP]]<br />
* [[Installing Postgres for PHP]]<br />
<br />
===Plugins===<br />
* [[Installing contributed modules or plugins]]<br />
<br />
==Security, Performance and Roles==<br />
<br />
*[[Security]] contains important security procedures for a production site<br />
*[[Performance]] for ideas on improving the speed of your installation<br />
*[[Manage roles]] For Moodle 1.7 and later.<br />
*[[Reducing spam in Moodle]]<br />
*[[suhosin]] is an advanced protection system for PHP installation. It was designed to protect servers and users from known and unknown flaws in PHP applications and the PHP core.<br />
*[[nagios]] Open source software to monitor servers<br />
<br />
== FAQs ==<br />
<br />
*[[Installation FAQ]]<br />
*[[Beginning Administration FAQ]]<br />
*[[Administration FAQ]]<br />
*[[Performance FAQ]]<br />
*[[Backup and restore FAQ]]<br />
*[[Errors FAQ]]<br />
*[[:Category:FAQ|List of FAQs]]<br />
<br />
== Configuration Settings ==<br />
=== Site administration setting===<br />
[[Site administration block]] contains most site configuration settings including:<br />
*[[Front Page settings]]- initial or home page of a Moodle site<br />
*[[Themes]] - user interface packages of XHTML and CSS controls<br />
*[[Language]] - default and additional language packs<br />
*[[Activity modules administration]]<br />
*[[Blocks administration]]<br />
*[[Filters]] - Text and Multimedea plugins <br />
*[[Backup settings]]<br />
*[[HTML editor settings]]<br />
*[[Calendar settings]]<br />
*[[Maintenance mode]]<br />
*[[Notification page]] used to update versions<br />
*[[Settings block]] Moodle 2.0 site settings location<br />
<br />
===Other settings===<br />
*[[Course settings]] for course home page configuration<br />
**Each type of [[Activities|activity]], [[resource]] and [[:Category:Block|block]] has their own settings<br />
*Older versions settings<br />
**[[Site settings]] pre 1.7<br />
**[[Variables]] pre 1.6 <br />
**[[Location of admin settings in 1.7|Comparison between configuration settings in Moodle 1.6 & 1.7]]<br />
<br />
==User Management==<br />
<br />
*[[Authentication]] of user on a site<br />
*[[Add new user|Add a new user]] - on a site<br />
*[[Upload users]] - from a file to a site, and into existing course and group, some existing user global updates<br />
*[[User_profile_fields]]<br />
*[[Enrolment plugins]]<br />
**[[Flat file]] - enrol existing users in a course<br />
*[[Roles and capabilities|Assigning user a role]] - typical assignments include:<br />
**[[Students|Enrol students in a course]]<br />
**[[Unenrolment]] Student<br />
**[[Courses (administrator)|Assign teachers]] - to a course<br />
**[[Assign creators|Assign course creators]] - in a site<br />
**[[Assign administrators]] - in a site<br />
<br />
==Other==<br />
<br />
*[[Courses (administrator)|Courses]] and [[Course formats|course formats]]<br />
*[[Reports (administrator)]] and [[Logs]]<br />
*[[Site files]]<br />
*[[Moodle database|Moodle site database]] <br />
*[[Environment]]<br />
*[[MNet|Moodle Network]] and Moodle [[Community hub]]<br />
*[[Streaming Media]]<br />
*[[Case studies (administrator)]]<br />
*[[Anti-virus]]<br />
*[[System Monitoring and Server Statistic Software]]<br />
*[[Integrate Moodle, LDAP and SIMS.net]]<br />
*[[How to rebuild context paths]]<br />
*[[Hacking the Moodle 2.0 database transfer script to convert a Moodle 1.9 site]]<br />
*[[Category:ProxyProblems]]<br />
<br />
==See also==<br />
<br />
*[[:Category:Administrator | Index of all Administrator-related pages]]<br />
*[[Integrations]]<br />
*[[CVS for Administrators]]<br />
*[[Email processing]]<br />
*[[Search engine optimization]]<br />
*[[Messaging]]<br />
*[[Migration]]<br />
*[[Metacourses]]<br />
*[[Block layout]]<br />
*[[Customizing Moodle]]<br />
*[[Administrator do's and don'ts]]<br />
*[[Using Moodle book]] Chapter 16: Moodle Administration<br />
*[[Administration hacks]]<br />
*[[Git]] Version control, upgrading <br />
<br />
[[Category: Administrator]]<br />
[[cs:Rukověť správce]]<br />
[[es:Documentación para Administradores]]<br />
[[eu:Kudeatzaileentzako dokumentazioa]]<br />
[[fr:Documentation administrateur]]<br />
[[ja:管理者ドキュメント]]<br />
[[ko:관리자 문서]]<br />
[[nl:Documentatie voor beheerders]]<br />
[[pt:Documentação para administradores]]<br />
[[ru:Администраторам]]<br />
[[sk:Dokumentácia pre správcov]]<br />
[[zh:管理员文档]]<br />
[[pl:Administrator documentation]]<br />
[[fi:Ylläpitäjän opas]]<br />
[[de:Dokumentation für Administratoren]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Talk:Moodle_for_Mobiles_installation&diff=71210
Talk:Moodle for Mobiles installation
2010-04-19T05:32:49Z
<p>Jamiesensei: /* re: Instructions */ new section</p>
<hr />
<div>== Instructions ==<br />
<br />
Maybe I have Asperger's or something, but I need hyper-specific instructions for some things; the instructions read, "1. Add the following line to yourmoodledirroot/course/lib.php line 2 :"<br />
<br />
Now what exactly does that mean? Does it mean append to line 2, make it the new line 2, or ...?<br />
<br />
If someone could be so kind, could they show me exactly what the first few lines of that file should look like?<br />
<br />
Also, the instructions say to go login on your phone and go the admin section to set up the database. What database?<br />
<br />
== re: Instructions ==<br />
<br />
Have tried to clarify those instructions for you. Hope this helps. Thanks for the feedback.<br />
<br />
<br />
---------------<br />
<br />
Thanks for those changes! But I still have the same problem. That is, what precisely do you mean by saying, "Add the following line to line 2"? Where exactly does this new line go? It would be so helpful if you could use the same method that you used to show where the make_mobile_buttons statement goes. Thanks in advance.<br />
<br />
== re: Instructions ==<br />
<br />
OK. I updated the installation instructions again.<br />
<br />
Please continue to provide feedback here about how you get on and I will try to help.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Moodle_for_Mobiles_installation&diff=71209
Moodle for Mobiles installation
2010-04-19T05:30:52Z
<p>Jamiesensei: /* Then make some small additions to Moodle code */</p>
<hr />
<div>{{Moodle For Mobiles}}<br />
===Install Moodle 1.9===<br />
<br />
The latest version of Moodle for Mobiles works with Moodle 1.9.<br />
<br />
====Moodle for Mobiles for Moodle 1.6 is still available====<br />
<br />
You can still get the old version of Moodle for Mobiles from this url http://download.moodle.org/patches16/mobile.zip This older version works with Moodle 1.6. Instructions for installation of the older version are included in the downloadable package in a file called README.txt<br />
<br />
====Optionally install the Japanese language pack.====<br />
<br />
You will need to check out the Japanese language pack (or download it with the new lang pack<br />
download admin facility) as well - only the english language pack is now included in the main moodle distribution.<br />
<br />
====Optionally install the feedback module.====<br />
<br />
Also if you want to use Andreas Grabs' feedback module the latest version is available from this url :<br />
<br />
http://download.moodle.org/plugins/mod/feedback.zip<br />
<br />
====Moodle Settings.====<br />
<br />
Set the site theme to standardwhite or standard. Or to use another theme see instructions below (4).<br />
<br />
===Download Moodle for Mobiles Code===<br />
<br />
Download the Moodle for Mobiles code from here : http://download.moodle.org/patches/mobile.zip<br />
<br />
Install the contents of the package in yourmoodledirroot/mobile/<br />
<br />
===Then make some small additions to Moodle code===<br />
<br />
1. Add the following line marked with a plus to yourmoodledirroot/course/lib.php at line 2, immediately after the line starting '<?php // $Id:'. The exact contents of this line starting '<?php // $Id:' will depend on when you updated your copy of Moodle 1.9. Delete the + sign it is just used to mark what you need to add :<br />
<br />
<pre><br />
<?php // $Id: lib.php,v 1.538.2.80 2010/02/25 10:16:15 stronk7 Exp $<br />
+ include_once($CFG->mfm_dirroot.'/course/mfmbuttons.php');<br />
// Library of useful functions<br />
</pre><br />
<br />
<br />
2. Add the following line marked with a plus to the same file (yourmoodledirroot/course/lib.php) around line 1389 (immediately after the line starting 'echo make_editing_buttons'). Delete the + sign it is just used to mark what you need to add :<br />
<br />
<pre><br />
}<br />
echo '&nbsp;&nbsp;';<br />
echo make_editing_buttons($mod, $absolute, true, $mod->indent, $section->section);<br />
+ echo make_mobile_enable_button($mod, $absolute, $section->section);<br />
}<br />
echo "</td>";<br />
echo "</tr>";<br />
</pre><br />
<br />
3. If you are using a theme other than standard or standardwhite then you need to make a copy of customscripts/theme/standard or customscripts/theme/standardwhite and rename it to the same name as the theme you want to use.<br />
<br />
4. In yourmoodlewwwroot/config.php replace :<br />
<br />
require_once("$CFG->dirroot/lib/setup.php");<br />
<br />
with<br />
<br />
require_once($CFG->dirroot.'/mobile/customscripts/lib/setup.php');<br />
5. Finally go to yourmoodleroot.com/admin/ on your mobile phone to have the code automatically set up the extra required storage in your moodle database (you will need to log in as an admin to access this page).<br />
[[Category:Contributed code]]<br />
[[Category:Moodle For Mobiles]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Talk:Moodle_for_Mobiles_installation&diff=71193
Talk:Moodle for Mobiles installation
2010-04-19T02:55:34Z
<p>Jamiesensei: /* re: Instructions */ new section</p>
<hr />
<div>== Instructions ==<br />
<br />
Maybe I have Asperger's or something, but I need hyper-specific instructions for some things; the instructions read, "1. Add the following line to yourmoodledirroot/course/lib.php line 2 :"<br />
<br />
Now what exactly does that mean? Does it mean append to line 2, make it the new line 2, or ...?<br />
<br />
If someone could be so kind, could they show me exactly what the first few lines of that file should look like?<br />
<br />
Also, the instructions say to go login on your phone and go the admin section to set up the database. What database?<br />
<br />
== re: Instructions ==<br />
<br />
Have tried to clarify those instructions for you. Hope this helps. Thanks for the feedback.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Talk:Moodle_for_Mobiles_installation&diff=71191
Talk:Moodle for Mobiles installation
2010-04-19T02:54:31Z
<p>Jamiesensei: /* Instructions */</p>
<hr />
<div>== Instructions ==<br />
<br />
Maybe I have Asperger's or something, but I need hyper-specific instructions for some things; the instructions read, "1. Add the following line to yourmoodledirroot/course/lib.php line 2 :"<br />
<br />
Now what exactly does that mean? Does it mean append to line 2, make it the new line 2, or ...?<br />
<br />
If someone could be so kind, could they show me exactly what the first few lines of that file should look like?<br />
<br />
Also, the instructions say to go login on your phone and go the admin section to set up the database. What database?</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Moodle_for_Mobiles_installation&diff=71190
Moodle for Mobiles installation
2010-04-19T02:52:20Z
<p>Jamiesensei: /* Then make some small additions to Moodle code */</p>
<hr />
<div>{{Moodle For Mobiles}}<br />
===Install Moodle 1.9===<br />
<br />
The latest version of Moodle for Mobiles works with Moodle 1.9.<br />
<br />
====Moodle for Mobiles for Moodle 1.6 is still available====<br />
<br />
You can still get the old version of Moodle for Mobiles from this url http://download.moodle.org/patches16/mobile.zip This older version works with Moodle 1.6. Instructions for installation of the older version are included in the downloadable package in a file called README.txt<br />
<br />
====Optionally install the Japanese language pack.====<br />
<br />
You will need to check out the Japanese language pack (or download it with the new lang pack<br />
download admin facility) as well - only the english language pack is now included in the main moodle distribution.<br />
<br />
====Optionally install the feedback module.====<br />
<br />
Also if you want to use Andreas Grabs' feedback module the latest version is available from this url :<br />
<br />
http://download.moodle.org/plugins/mod/feedback.zip<br />
<br />
====Moodle Settings.====<br />
<br />
Set the site theme to standardwhite or standard. Or to use another theme see instructions below (4).<br />
<br />
===Download Moodle for Mobiles Code===<br />
<br />
Download the Moodle for Mobiles code from here : http://download.moodle.org/patches/mobile.zip<br />
<br />
Install the contents of the package in yourmoodledirroot/mobile/<br />
<br />
===Then make some small additions to Moodle code===<br />
<br />
1. Add the following extra line of code to yourmoodledirroot/course/lib.php at line 2 :<br />
<br />
include_once($CFG->mfm_dirroot.'/course/mfmbuttons.php');<br />
<br />
2. Add the following line marked with a plus to the same file (yourmoodledirroot/course/lib.php) around line 1389 (immediately after the line starting 'echo make_editing_buttons'). Delete the + sign it is just used to mark what you need to add :<br />
<br />
<pre><br />
}<br />
echo '&nbsp;&nbsp;';<br />
echo make_editing_buttons($mod, $absolute, true, $mod->indent, $section->section);<br />
+ echo make_mobile_enable_button($mod, $absolute, $section->section);<br />
}<br />
echo "</td>";<br />
echo "</tr>";<br />
</pre><br />
<br />
3. If you are using a theme other than standard or standardwhite then you need to make a copy of customscripts/theme/standard or customscripts/theme/standardwhite and rename it to the same name as the theme you want to use.<br />
<br />
4. In yourmoodlewwwroot/config.php replace :<br />
<br />
require_once("$CFG->dirroot/lib/setup.php");<br />
<br />
with<br />
<br />
require_once($CFG->dirroot.'/mobile/customscripts/lib/setup.php');<br />
5. Finally go to yourmoodleroot.com/admin/ on your mobile phone to have the code automatically set up the extra required storage in your moodle database (you will need to log in as an admin to access this page).<br />
[[Category:Contributed code]]<br />
[[Category:Moodle For Mobiles]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Cookieless_Sessions&diff=68721
Cookieless Sessions
2010-02-18T13:27:56Z
<p>Jamiesensei: </p>
<hr />
<div>{{Moodle 1.6}}<br />
In Moodle 1.6 we've added support for cookieless sessions to Moodle. The code will need testing in the different modules to check that it works in all areas of a site. You can test it by turning cookies off in your browser or disallowing cookies just for your Moodle site. Post any bugs you find here : http://tracker.moodle.org/browse/MDL-4504<br />
<br />
Cookieless sessions work by appending a session id to every url or to hidden form fields in forms in html pages so that php can track sessions. When cookieless sessions are turned on then code in lib/cookieless.php will automatically add session ids in the absence of cookies. ''The code will fail when javascript is used to jump from page to page.'' So when using javascript to jump to a new page then you can call a function in lib/cookieless.php to add session ids to the URL, as follows :<br />
<br />
if (!empty($CFG->usesid) && !isset($_COOKIE[session_name()])) {<br />
$attempturl=sid_process_url("attempt.php?id=$cm->id");<br />
} else {<br />
$attempturl="attempt.php?id=$cm->id";<br />
};<br />
<br />
You don't need to include cookieless.php it will have been included already if needed.<br />
<br />
<br />
Enable cookieless sessions by including $CFG->usesid=true; in config.php.<br />
Based on code from php manual by Richard at postamble.co.uk<br />
<br />
Attempts to use cookies if cookies not present then uses session ids attached to all urls and forms to pass session id from page to page.<br />
If site is open to google, google is given guest access as usual and there are no sessions. No session ids will be attached to urls for googlebot.<br />
This doesn't require trans_sid to be turned on but this is recommended for better performance you should put '''session.use_trans_sid = 1''' in your php.ini file and make sure that you don't have a line like this in your php.ini: '''session.use_only_cookies = 1'''<br />
<br />
author Richard at postamble.co.uk and Jamie Pratt<br />
license http://www.gnu.org/copyleft/gpl.html GNU Public License<br />
<br />
===Turning off cookies completely===<br />
<br />
By default this code tries to use cookies still and falls back to using url parameters to pass the session id if cookies are not present.<br />
<br />
You can turn off cookies completely for your Moodle server by adding the editing the setting in php.ini file for "use_cookies", so it says :<br />
<br />
session.use_cookies = 0<br />
<br />
== Security ==<br />
<br />
Especially if your users are using shared computers this can reduce the security of Moodle.<br />
<br />
Following warning is from php.ini file :<br />
<br />
; trans sid support is disabled by default.<br />
; Use of trans sid may risk your users security.<br />
; Use this option with caution.<br />
; - User may send URL contains active session ID<br />
; to other person via. email/irc/etc.<br />
; - URL that contains active session ID may be stored<br />
; in publically accessible computer.<br />
; - User may access your site with the same session ID<br />
; always using URL stored in browser's history or bookmarks.<br />
<br />
It is probably best to time out the sessions fairly quickly to reduce the risk of people using shared computers having access to others sessions and being able to log in as them. Use the sessiontimeout setting in the admin menu and set it to as low a number as possible (but remember it can be frustrating for your users to spend a long time on a forum post and then find they lose the post when they try to save it because the session has timed out).<br />
<br />
Importantly '''users should be informed it is important to log out when they have finished their session''' and not to send urls with their session id in it to others. Closing the browser window instead of logging out will not be sufficient to stop someone else trying to log in to that users account using urls in the browser history.<br />
<br />
[[Category:Developer]]<br />
[[Category:Administrator]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Sessions_FAQ&diff=68479
Sessions FAQ
2010-02-11T13:45:57Z
<p>Jamiesensei: </p>
<hr />
<div>== What is the purpose of Sessions? ==<br />
Web applications are "stateless". That is, by nature, any information stored in program variables is lost each time a script completes. That happens on every page. So for anything other than completely trivial scripts you need to have a way of storing information for that user for the current login. There's various ways to do this but the simplest is an implementation of PHP's native $_SESSION[] array that will keep information for a particular user on the same PC for a short period of time.<br />
<br />
== What information do they hold?==<br />
Sessions hold a range of information. The fact that you are logged on, your user profile, etc. Anything that needs to be available on all Moodle pages quickly.<br />
<br />
== How are they constructed? ==<br />
It's a PHP thing. It's very simple. Moodle issues the session_start() 'command' and then access PHP's $_SESSION variable. The contents of that automagically persist in a written file.<br />
<br />
== How long should they be retained for? ==<br />
There is no reason to keep them beyond the current, well, session. <br />
<br />
== Do I need to include them in my site backups? == <br />
No, not at all. The information required is for the immediate purposes of Moodle and is not required beyond that. <br />
<br />
== Do I need to delete them? ==<br />
<br />
Session files should automatically be deleted when they are no longer needed. If files are building up you should look into why.<br />
<br />
=== How do I delete them? ===<br />
It's not very elegant, but at quiet times you can simply delete the sessions directory in moodledata. The worst that will happen is that anyone logged in gets thrown off. A slightly more elegant solution would delete any files in that directory more than a few hours old.<br />
<br />
[[Session handling]]<br />
<br />
[[Category:FAQ]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Cookieless_Sessions&diff=68476
Cookieless Sessions
2010-02-11T13:11:19Z
<p>Jamiesensei: </p>
<hr />
<div>{{Moodle 1.6}}<br />
In Moodle 1.6 we've added support for cookieless sessions to Moodle. The code will need testing in the different modules to check that it works in all areas of a site. You can test it by turning cookies off in your browser or disallowing cookies just for your Moodle site. Post any bugs you find here : http://tracker.moodle.org/browse/MDL-4504<br />
<br />
Cookieless sessions work by appending a session id to every url or to hidden form fields in forms in html pages so that php can track sessions. When cookieless sessions are turned on then code in lib/cookieless.php will automatically add session ids in the absence of cookies. ''The code will fail when javascript is used to jump from page to page.'' So when using javascript to jump to a new page then you can call a function in lib/cookieless.php to add session ids to the URL, as follows :<br />
<br />
if (!empty($CFG->usesid) && !isset($_COOKIE[session_name()])) {<br />
$attempturl=sid_process_url("attempt.php?id=$cm->id");<br />
} else {<br />
$attempturl="attempt.php?id=$cm->id";<br />
};<br />
<br />
You don't need to include cookieless.php it will have been included already if needed.<br />
<br />
<br />
Enable cookieless sessions by including $CFG->usesid=true; in config.php.<br />
Based on code from php manual by Richard at postamble.co.uk<br />
<br />
Attempts to use cookies if cookies not present then uses session ids attached to all urls and forms to pass session id from page to page.<br />
If site is open to google, google is given guest access as usual and there are no sessions. No session ids will be attached to urls for googlebot.<br />
This doesn't require trans_sid to be turned on but this is recommended for better performance you should put '''session.use_trans_sid = 1''' in your php.ini file and make sure that you don't have a line like this in your php.ini: '''session.use_only_cookies = 1'''<br />
<br />
author Richard at postamble.co.uk and Jamie Pratt<br />
license http://www.gnu.org/copyleft/gpl.html GNU Public License<br />
<br />
<br />
== Security ==<br />
<br />
Especially if your users are using shared computers this can reduce the security of Moodle.<br />
<br />
Following warning is from php.ini file :<br />
<br />
; trans sid support is disabled by default.<br />
; Use of trans sid may risk your users security.<br />
; Use this option with caution.<br />
; - User may send URL contains active session ID<br />
; to other person via. email/irc/etc.<br />
; - URL that contains active session ID may be stored<br />
; in publically accessible computer.<br />
; - User may access your site with the same session ID<br />
; always using URL stored in browser's history or bookmarks.<br />
<br />
It is probably best to time out the sessions fairly quickly to reduce the risk of people using shared computers having access to others sessions and being able to log in as them. Use the sessiontimeout setting in the admin menu and set it to as low a number as possible (but remember it can be frustrating for your users to spend a long time on a forum post and then find they lose the post when they try to save it because the session has timed out).<br />
<br />
Importantly '''users should be informed it is important to log out when they have finished their session''' and not to send urls with their session id in it to others. Closing the browser window instead of logging out will not be sufficient to stop someone else trying to log in to that users account using urls in the browser history.<br />
<br />
[[Category:Developer]]<br />
[[Category:Administrator]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Cookieless_Sessions&diff=68474
Cookieless Sessions
2010-02-11T13:06:14Z
<p>Jamiesensei: added security information to cookieless sessions page</p>
<hr />
<div>{{Moodle 1.6}}<br />
In Moodle 1.6 we've added support for cookieless sessions to Moodle. The code will need testing in the different modules to check that it works in all areas of a site. You can test it by turning cookies off in your browser or disallowing cookies just for your Moodle site. Post any bugs you find here : http://tracker.moodle.org/browse/MDL-4504<br />
<br />
Cookieless sessions work by appending a session id to every url or to hidden form fields in forms in html pages so that php can track sessions. When cookieless sessions are turned on then code in lib/cookieless.php will automatically add session ids in the absence of cookies. ''The code will fail when javascript is used to jump from page to page.'' So when using javascript to jump to a new page then you can call a function in lib/cookieless.php to add session ids to the URL, as follows :<br />
<br />
if (!empty($CFG->usesid) && !isset($_COOKIE[session_name()])) {<br />
$attempturl=sid_process_url("attempt.php?id=$cm->id");<br />
} else {<br />
$attempturl="attempt.php?id=$cm->id";<br />
};<br />
<br />
You don't need to include cookieless.php it will have been included already if needed.<br />
<br />
<br />
Enable cookieless sessions by including $CFG->usesid=true; in config.php.<br />
Based on code from php manual by Richard at postamble.co.uk<br />
<br />
Attempts to use cookies if cookies not present then uses session ids attached to all urls and forms to pass session id from page to page.<br />
If site is open to google, google is given guest access as usual and there are no sessions. No session ids will be attached to urls for googlebot.<br />
This doesn't require trans_sid to be turned on but this is recommended for better performance you should put '''session.use_trans_sid = 1''' in your php.ini file and make sure that you don't have a line like this in your php.ini: '''session.use_only_cookies = 1'''<br />
<br />
author Richard at postamble.co.uk and Jamie Pratt<br />
license http://www.gnu.org/copyleft/gpl.html GNU Public License<br />
<br />
<br />
== Security ==<br />
<br />
Especially if your users are using shared computers this can reduce the security of Moodle.<br />
<br />
Following warning is from php.ini file :<br />
<br />
; trans sid support is disabled by default.<br />
; Use of trans sid may risk your users security.<br />
; Use this option with caution.<br />
; - User may send URL contains active session ID<br />
; to other person via. email/irc/etc.<br />
; - URL that contains active session ID may be stored<br />
; in publically accessible computer.<br />
; - User may access your site with the same session ID<br />
; always using URL stored in browser's history or bookmarks.<br />
<br />
It is probably best to time out the sessions fairly quickly to reduce the risk of people using shared computers having access to others sessions and being able to log in as them. Use the sessiontimeout setting in the admin menu and set it to as low a number as possible (but remember it can be frustrating for your users to spend a long time on a forum post and then find they lose the post when they try to save it because the session has timed out).<br />
<br />
Importantly '''users should be informed it is important to log out when they have finished their session''' and not to send urls with their session id in it to others. Closing the browser window instead of logging out will not be sufficient to stop someone else trying to log in to that users account using urls in the browser history.<br />
<br />
* [[Cookieless Sessions FAQ]]<br />
[[Category:Developer]]<br />
[[Category:Administrator]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development_talk:lib/formslib.php&diff=48088
Development talk:lib/formslib.php
2008-12-12T01:22:43Z
<p>Jamiesensei: </p>
<hr />
<div>what do the numbers refer to:<br />
<br />
auth\cas\index_form.html (18) <br />
<br />
the (18) ?<br />
<br />
:Just guessing, but I think the list may have originally been generated from some CVS command, and that the numbers are CVS file revision numbers.--[[User:Tim Hunt|Tim Hunt]] 19:17, 11 December 2008 (CST)<br />
:: Actually they are line nos. I used a search for the <form tag I think and these are the line nos where it was found. [[User:Jamie Pratt|Jamie Pratt]] 19:22, 11 December 2008 (CST)</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:lib/formslib.php_Form_Definition&diff=46688
Development:lib/formslib.php Form Definition
2008-11-13T11:58:34Z
<p>Jamiesensei: Undo revision 46678 by Mike1989 (Talk) this is wrong, the sesskey hidden fields and form name fields are automatically added to the form</p>
<hr />
<div>{{Formslib}}<br />
==definition()==<br />
<br />
The definition of the elements to be included in the form, their 'types' (PARAM_*), helpbuttons included, etc is all included in a function you must define in your class 'definition();'<br />
<br />
definition() is used to define the elements in the form and '''this definition will be used for validating data submitted as well as for printing the form.''' For select and checkbox type elements only data that could have been selected will be allowed. And only data that corresponds to a form element in the defintion will be accepted as submitted data.<br />
<br />
The definition() should include all elements that are going to be used on form, some elements may be removed or tweaked later in definition_after_data(). Please do not create conditional elements in definition(), the definition() should not directly depend on the submitted data.<br />
<br />
==Use Fieldsets to group Form Elements==<br />
<br />
You use code like this to open a fieldset with a legend.<br />
<br />
<pre><br />
//-------------------------------------------------------------------------------<br />
$mform->addElement('header', 'nameforyourheaderelement', get_string('titleforlegened', 'modulename'));<br />
</pre><br />
<br />
You can't yet nest these visible fieldsets unfortunately. But in fact groups of elements are wrapped in invisible fieldsets.<br />
<br />
You close a fieldset with moodle_form's closeHeaderBefore method. You tell closeHeaderBefore the element before you wish to end the fieldset. A fieldset is automatically closed if you open a new one. You need to use this code only if you want to close a fieldset and the subsequent form elements are not to be enclosed by a visible fieldset (they are still enclosed with an invisibe one with no legend) :<br />
<br />
<pre><br />
$mform->closeHeaderBefore('buttonar');<br />
</pre><br />
<br />
==addElement==<br />
<br />
Use the addElement method to add an element to a form. The first few arguments are always the same. The first param is the type of the element to add. The second is the elementname to use which is normally the html name of the element in the form. The third is often the text for the label for the element.<br />
<br />
Some examples are below :<br />
===button===<br />
<br />
<pre><br />
$mform->addElement('button', 'intro', get_string("buttonlabel"));<br />
</pre><br />
<br />
A button element. If you want a submit or cancel button see 'submit' element. <br />
<br />
===checkbox===<br />
<pre><br />
$mform->addElement('checkbox', 'ratingtime', get_string('ratingtime', 'forum'));<br />
</pre><br />
This is a simple checkbox. The third param for this element is the label to display on the left side of the form. You can also supply a string as a fourth param to specify a label that will appear on the right of the element. Checkboxes and radio buttons can be grouped and have individual labels on their right.<br />
<br />
====advcheckbox====<br />
<pre><br />
$mform->addElement('advcheckbox', 'ratingtime', get_string('ratingtime', 'forum'), 'Label displayed after checkbox', array('group' => 1), array(0, 1));<br />
</pre><br />
Similar to the checkbox above, but with a couple of important improvements:<br />
<br />
#The 5th parameter is a normal $attributes array, normally used to set HTML attributes for the <input> element. However, a special value of 'group' can be given, which will add a class name to the element, and enable its grouping for a [[Development:lib/formslib.php_add_checkbox_controller|checkbox controller]]<br />
#The 6th parameter is an array of values that will be associated with the checked/unchecked state of the checkbox. With a normal checkbox you cannot choose that value, and in fact an unchecked checkbox will not even be sent with the form data.<br />
<br />
===choosecoursefile===<br />
<pre><br />
$mform->addElement('choosecoursefile', 'mediafile', get_string('mediafile', 'lesson'), array('courseid'=>$COURSE->id));<br />
<br />
</pre><br />
<br />
Choose a file from the course files area. The fourth option is a list of options for the element. <br />
<br />
<pre><br />
array('courseid'=>null,//if it is null (default then use global $COURSE<br />
'height'=>500,// height of the popup window<br />
'width'=>750, // width of the popup window<br />
'options'=>'none');//options string for the pop up window <br />
//eg. 'menubar=0,location=0,scrollbars,resizable'<br />
<br />
</pre><br />
<br />
===date_selector===<br />
<pre><br />
$mform->addElement('date_selector', 'assesstimefinish', get_string('to'));<br />
</pre><br />
<br />
This is a date selector. You can select a Day, Month and Year using a group of select boxes. The fourth param here is an array of options. The defaults for the options are :<br />
<br />
<pre>array('startyear'=>1970, 'stopyear'=>2020,<br />
'timezone'=>99, 'applydst'=>true, 'optional'=>false);<br />
</pre><br />
<br />
You can override these defaults by supplying an array as fourth param with one or more keys with a value to override the default. You can supply a fifth param of attributes here as well.<br />
<br />
===date_time_selector===<br />
<pre><br />
$mform->addElement('date_time_selector', 'assesstimestart', get_string('from'));<br />
</pre><br />
This is a group of select boxes to select a date (Day Month and Year) and time (Hour and Minute). When submitted, submitted data is processed and a timestamp is passed to $form->get_data(); the fourth param here is an array of options. The defaults for the options are:<br />
<br />
<pre>array('startyear'=>1970, 'stopyear'=>2020,<br />
'timezone'=>99, 'applydst'=>true, 'step'=>5);<br />
</pre><br />
<br />
You can override these defaults by supplying an array as fourth param with one or more keys with a value to override the default. You can supply a fifth param of attributes here as well.<br />
<br />
===file===<br />
<br />
File upload input box with browse button. In the form definition type<br />
<pre><br />
$mform->addElement('file', 'attachment', get_string('attachment', 'forum'));<br />
</pre><br />
<br />
after form submission and validation use<br />
<pre><br />
if ($data = $mform->get_data()) {<br />
...<br />
$mform->save_files($destination_directory);<br />
...<br />
}<br />
</pre><br />
<br />
If you need advanced settings such as required file, different max upload size or name of uploaded file<br />
<pre><br />
<br />
$this->set_upload_manager(new upload_manager('attachment', true, false, $COURSE, false, 0, true, true, false));<br />
$mform->addElement('file', 'attachment', get_string('attachment', 'forum'));<br />
$mform->addRule('attachment', null, 'required');<br />
<br />
</pre><br />
<br />
<pre><br />
if ($data = $mform->get_data()) {<br />
...<br />
$mform->save_files($destination_directory);<br />
$newfilename = $mform->get_new_filename();<br />
...<br />
}<br />
</pre><br />
<br />
When porting old code it is also possible to use the upload manager directly for processing of uploaded files.<br />
<br />
Please note that if using set_upload_manager() it must be before addElement('file',..).<br />
<br />
{{Moodle 2.0}}<br />
File uploading was rewritten in 2.0. Please see inline docs for now. This page will be updated when the new API stabilises.<br />
<br />
===filepicker===<br />
{{Moodle 2.0}}<br />
General replacement of ''file'' element.<br />
<br />
===hidden===<br />
<pre><br />
$mform->addElement('hidden', 'reply', 'yes');<br />
</pre><br />
<br />
A hidden element. Set the element name (in this case '''reply''') to the stated value (in this case '''yes''').<br />
<br />
===htmleditor & format===<br />
<pre><br />
<br />
$mform->addElement('htmleditor', 'text', get_string('choicetext', 'choice'));<br />
$mform->setType('text', PARAM_RAW);<br />
$mform->addRule('text', null, 'required', null, 'client');<br />
<br />
$mform->addElement('format', 'format', get_string('format'));<br />
</pre><br />
You can supply a fourth param to htmleditor of an array of options :<br />
<br />
<pre><br />
array('canUseHtmlEditor'=>'detect','rows'=>10, 'cols'=>65, <br />
'width'=>0,'height'=>0, 'course'=>0);<br />
//options same as print_textarea params<br />
//use rows and cols options to control htmleditor size.<br />
</pre><br />
<br />
===modgrade===<br />
<pre><br />
$mform->addElement('modgrade', 'scale', get_string('grade'), false);<br />
</pre><br />
This is a custom element for selecting a grade for any activity module. The fourth argument is whether to include an option for no grade which has a value 0. This select box does include scales. The default is true, include no grade option.<br />
<br />
A helpbutton is automatically added.<br />
<br />
<br />
===password===<br />
<pre><br />
$mform->addElement('password', 'password', get_string('label'), $attributes);<br />
</pre><br />
<br />
A password element. Fourth param is an array or string of attributes.<br />
<br />
===passwordunmask===<br />
{{Moodle 1.9}}<br />
<pre><br />
$mform->addElement('passwordunmask', 'password', get_string('label'), $attributes);<br />
</pre><br />
<br />
A password element with option to show the password in plaintext. Fourth param is an array or string of attributes.<br />
<br />
===radio===<br />
<pre><br />
$radioarray=array();<br />
$radioarray[] = &MoodleQuickForm::createElement('radio', 'yesno', '', get_string('yes'), 1, $attributes);<br />
$radioarray[] = &MoodleQuickForm::createElement('radio', 'yesno', '', get_string('no'), 0, $attributes);<br />
$mform->addGroup($radioarray, 'radioar', '', array(' '), false);<br />
</pre><br />
<br />
Second param names the radio button and should be the same for each button in the group in order to toggle correctly. Third param would be the label for the form element but is generally ignored as this element will always be in a group which has it's own label. Fourth param is a string, a label to be displayed on the right of the element. The fifth is the value for this radio button. $attributes can be a string or an array of attributes.<br />
<br />
It is possible to add help to individual radio buttons but this requires a custom template to be defined for the group elements. See MDL-15571.<br />
<br />
====setDefault====<br />
<br />
To set the default for a radio button group as above use the following :<br />
<br />
<pre><br />
$mform->setDefault('yesno', 0);<br />
</pre><br />
<br />
This would make the default 'no'.<br />
<br />
===select===<br />
<pre><br />
$mform->addElement('select', 'type', get_string('forumtype', 'forum'), $FORUM_TYPES, $attributes);<br />
</pre><br />
<br />
The fourth param for this element is an array of options for the select box. The keys are the values for the option and the value of the array is the text for the option. The fifth param $attributes is optional, see text element for description of attributes param.<br />
<br />
====multi-select====<br />
<pre><br />
$select = &$mform->addElement('select', 'colors', get_string('colors'), array('red', 'blue', 'green'), $attributes);<br />
$select->setMultiple(true);<br />
</pre><br />
<br />
===selectyesno===<br />
<pre><br />
$mform->addElement('selectyesno', 'maxbytes', get_string('maxattachmentsize', 'forum'));<br />
</pre><br />
<br />
If you want a yes / no select box this one automatically translates itself and has value 1 for yes and 0 for no.<br />
<br />
===static===<br />
<pre><br />
$mform->addElement('static', 'description', get_string('description', 'exercise'),<br />
get_string('descriptionofexercise', 'exercise', $COURSE->students));<br />
<br />
</pre><br />
<br />
This is a static element. It should be used with care it is used to display a static piece of text with a label. The third param is the label and the fourth is the static text itself.<br />
<br />
===submit, reset and cancel===<br />
<br />
<pre><br />
//normally you use add_action_buttons instead of this code<br />
$buttonarray=array();<br />
$buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('savechanges'));<br />
$buttonarray[] = &$mform->createElement('reset', 'resetbutton', get_string('revert'));<br />
$buttonarray[] = &$mform->createElement('cancel');<br />
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);<br />
$mform->closeHeaderBefore('buttonar');<br />
</pre><br />
<br />
A 'Submit' type element is a submit type form element which will submit the form. A 'Reset' will not submit the form but will reset any changes the user has made to form contents. A 'Cancel' element cancels form submission. You need to have a branch in your code before you check for get_data() to check if submission has been cancelled with is_cancelled(); See the example on the usage page.<br />
<br />
You should name your submit and reset buttons 'submitbutton' and 'resetbutton' or something similar (not 'submit' and 'reset'). This avoids problems in JavaScript of collisions between form element names and names of JavaScript methods of the form object.<br />
<br />
====add_action_buttons($cancel = true, $submitlabel=null);====<br />
<br />
You will normally use this helper function which is a method of moodleform to add all the 'action' buttons to the end of your form. A boolean parameter allow you to specify whether to include a cancel button and specify the label for your submit button (pass the result of get_string). Default for the submit button label is get_string('savechanges').<br />
<br />
===text===<br />
<br />
<pre><br />
$mform->addElement('text', 'name', get_string('forumname', 'forum'), $attributes);<br />
</pre><br />
For a simple text element. Your fourth parameter here can be a string or array of attributes for the text element. The following are equivalent :<br />
<pre><br />
$attributes='size="20"';<br />
$attributes=array('size'=>'20');<br />
</pre><br />
<br />
Generally you are encouraged to use CSS instead of using attributes for styling.<br />
<br />
<br />
A format element can be used as a format select box. It will be non-selectable if you're using an html editor.<br />
<br />
The third param for this element is $useHtmlEditor and it defaults to null in which case an html editor is used if the browser and user profile support it.<br />
<br />
===textarea===<br />
<br />
<pre><br />
$mform->addElement('textarea', 'introduction', get_string("introtext", "survey"), 'wrap="virtual" rows="20" cols="50"');<br />
</pre><br />
<br />
A textarea element. If you want an htmleditor use htmleditor element. Fourth element here is a string or array of attributes.<br />
<br />
==addGroup==<br />
<br />
A 'group' in formslib is just a group of elements that will have a label and will be included on one line. <br />
<br />
For example typical code to include a submit and cancel button on the same line : <br />
<br />
<pre><br />
$buttonarray=array();<br />
$buttonarray[] =& $mform->createElement('submit', 'submitbutton', get_string('savechanges'));<br />
$buttonarray[] =& $mform->createElement('submit', 'cancel', get_string('cancel'));<br />
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);<br />
</pre><br />
<br />
You use the same arguments for createElement as you do for addElement. Any label for the element in the third argument is normally ignored (but not in the case of the submit buttons above where the third argument is not for a label but is the text for the button).<br />
<br />
Here's an example of putting a date_selector (which is itself a group of elements) and a checkbox on the same line, note that you can disable every element in the group using the group name 'availablefromgroup' but it doesn't disable the controlling element the 'availablefromenabled' checkbox:<br />
<br />
<pre><br />
$availablefromgroup=array();<br />
$availablefromgroup[] =& $mform->createElement('date_selector', 'availablefrom', '');<br />
$availablefromgroup[] =& $mform->createElement('checkbox', 'availablefromenabled', '', get_string('enable'));<br />
$mform->addGroup($availablefromgroup, 'availablefromgroup', get_string('availablefromdate', 'data'), '&nbsp;', false);<br />
$mform->disabledIf('availablefromgroup', 'availablefromenabled');<br />
<br />
</pre><br />
<br />
==setHelpButton==<br />
<pre><br />
$mform->setHelpButton('lessondefault', array('lessondefault', get_string('lessondefault', 'lesson'), 'lesson'));<br />
</pre><br />
First param is an elementname and the second param is an array of params that are passed to helpbutton in weblib.php. Params are :<br />
<br />
<pre><br />
* @param string $page The keyword that defines a help page<br />
* @param string $title The title of links, rollover tips, alt tags etc<br />
* 'Help with' (or the language equivalent) will be prefixed and '...' will be stripped.<br />
* @param string $module Which module is the page defined in<br />
* @param mixed $image Use a help image for the link? (true/false/"both")<br />
* @param boolean $linktext If true, display the title next to the help icon.<br />
* @param string $text If defined then this text is used in the page, and<br />
* the $page variable is ignored.<br />
* @param boolean $return If true then the output is returned as a string, if false it is printed to the current page.<br />
* @param string $imagetext The full text for the helpbutton icon. If empty use default help.gif<br />
</pre><br />
Make sure you don't set boolean $return to false. <br />
<br />
You need to do use this method after addElement();<br />
<br />
==setDefault==<br />
<br />
<pre><br />
$mform->addElement('select', 'grade', get_string('gradeforsubmission', 'exercise'), $grades);<br />
$mform->setHelpButton('grade', array('grade', get_string('gradeforsubmission', 'exercise'), 'exercise'));<br />
$mform->setDefault('grade', 100);<br />
</pre><br />
<br />
Set the default of the form value with setDefault($elementname, $value); where elementname is the elementname whose default you want to set and $value is the default to set. We set the defaults for the form in definition(). This default is what is used if no data is loaded into the form with set_data(); eg. on display of the form for an 'add' rather than 'update' function.<br />
<br />
==disabledIf==<br />
<br />
For any element or groups of element in a form you can conditionally disable the group or individual element depending on conditions.<br />
<br />
You can use $mform->disabledIf($elementName, $dependentOn, $condition = 'notchecked', $value=null)<br />
<br />
* elementname can be a group. If you specify a group all elements in the group will be disabled (if dependentOn is in elementname group that is ignored and not disabled). These are the element names you've used as the first argument in addElement or addGroup.<br />
* dependentOn is the actual name of the element as it will appear in html. This can be different to the name used in addGroup particularly but also addElement where you're adding a complex element like a date_selector. Check the html of your page. You typically make the depedentOn a checkbox or select box.<br />
* $condition will be notchecked, checked, selected, eq or if it is anything else then we test for neq.<br />
* If $condition is eq or neq then we check the value of the dependentOn field and check for equality (==) or nonequality (!=) in js<br />
* If $condition is checked or notchecked then we check to see if a checkbox is checked or not.<br />
* If $condition is selected then we check to see if a particular option is selected from a dropdown list.<br />
<br />
''Note: I am not sure this section is complete. I just found and added one missing case, but there may be others--[[User:Tim Hunt|Tim Hunt]] 06:04, 15 October 2007 (CDT)''<br />
<br />
==setType==<br />
<br />
PARAM_* types are used to specify how a submitted variable should be cleaned. These should be used for get parameters such as id, course etc. which are used to load a page and also with setType(); method. Every form element should have a type specified except select, radio box and checkbox elements, these elements do a good job of cleaning themselves (only specified options are allowed as user input).<br />
<br />
<br />
<br />
===Most Commonly Used PARAM_* Types===<br />
<br />
These are the most commonly used PARAM_* types and their proper uses. More types can be seen in moodlelib.php starting around line 100.<br />
<br />
* PARAM_CLEAN is deprecated and you should try to use a more specific type.<br />
* PARAM_TEXT should be used for cleaning data that is expected to be plain text. It will strip all html tags. But will still let tags for multilang support through.<br />
* PARAM_NOTAGS should be used for cleaning data that is expected to be plain text. It will strip *all* html type tags. It will still *not* let tags for multilang support through. This should be used for instance for email addresses where no multilang support is appropriate.<br />
* PARAM_RAW means no cleaning whatsoever, it is used mostly for data from the html editor. Data from the editor is later cleaned before display using format_text() function. PARAM_RAW can also be used for data that is validated by some other way or printed by p() or s().<br />
* PARAM_INT should be used for integers.<br />
* PARAM_ACTION is an alias of PARAM_ALPHA and is used for hidden fields specifying form actions.<br />
<br />
==References==<br />
<br />
* [http://web.archive.org/web/20080214041550/http://www.midnighthax.com/quickform.php PEAR HTML QuickForm Getting Started Guide by Keith Edmunds of Midnighthax.com (via archive.org as original now dead)]<br />
<br />
[[Category:Formslib]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development_talk:Web_services&diff=46577
Development talk:Web services
2008-11-11T12:51:19Z
<p>Jamiesensei: New section: Using web services to allow client side code such as js, Flash/Flex or java to communicate with Moodle</p>
<hr />
<div>==general remarks about OUTPUT of operations:==<br />
Is true of false informative enough ?<br />
Should the API have some sort of "last_error" function giving back more details such as "non existing course, non existing user, duplicate entry ...)<br />
Shall we consider that affecting a role that already exist or removing role that do not exist as an error (output=false) or not (output=true)<br />
:yep, agree, I'd result always one well defined $result object, with his status, error code and error msg (and perhaps, the whole original WS request encapsulated for easier debugging).<br />
:[[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] 19:55, 21 December 2007 (CST)<br />
I agree but throught the WS we need to be be carefull with the feedback we give to errors, due to security issues. --[[User:Ludo (Marc Alier)|Ludo (Marc Alier)]] 14:14, 22 December 2007 (CST)<br />
<br />
==some WS to be able to... build courses ?==<br />
Perhpas it would be a great idea to start thinking about some WS functionalities like this:<br />
<br />
* add_course, delete_course, reset_course<br />
* add_section, delete_section, show_section, hide_section<br />
* add_activity, delete_activity, show_activity, hide_activity<br />
<br />
Apart from the WS utility itself: automated creation of courses... it would help (or force, as we prefer), to better encapsulate course/section/modules internals, 100% isolating the creation and configuration from the frontend (forms, WS...). It implies some decisions, like upwards compatibility of old modules (although I think it can be maintained)... and so on, you know.<br />
<br />
Just one idea to analyse. But with benefits in the end, IMO.<br />
[[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] 20:02, 21 December 2007 (CST)<br />
<br />
I do agree with this ; this would also allow creation of specific courses, customized for some users, depending of their "performances" in external evaluations methods ; when the ePortfolio API will be finalized in Moodle core's, accessing the portfolio of any user would be needed.<br />
[[User:Patrick Pollet|Patrick Pollet]] 04:21, 30 December 2007 (CST)<br />
<br />
==the problem of ID of entity to fetch:==<br />
In the list of API calls defined in this page, Moodle entity to process (user,course,grade,event ...) is identified by an ID, that is implicitly the Moodle's internal id field used in the database. This raises a problem since it is very likely that in the "external SIS" talking to Moodle across the Web Service, the entity will be identified by another attribute such as an idNumber (user,course), a short name (course) or even an username (login of user). <br />
<br />
So either we must provide :<br />
<br />
* extra API calls to convert external identifiers to Moodle's internal id, such as user_id_from_idnumber, user_id_from_username, course_id_from_shortname ..., at the cost of extra calls before the real one ; three calls would be needed to enrol student "CS2121212", to course "JAVA_101". <br />
<br />
* extra API functions such as delete_user_byusername, get_course_by_idnumber , enrol_student_byidnumber_tocourse_byshortname ....<br />
<br />
* or add parameters to the current API calls specifiying what identifier we are using such as delete_user(id,idField) with idField being a string that could be "id","idnumber","username","email" ... or enrol_student(sid,"idnumber",cid,"shortname") . This is the approach in the current SOAP implementation (with some calls of the previous type (get_user_byusername()...) <br />
<br />
[[User:Patrick Pollet|Patrick Pollet]] 04:21, 30 December 2007 (CST)<br />
<br />
== output of operations: adding URLs?==<br />
In addition, I suggest to return the full URL towards every Moodle entity, either added or got.<br />
* user added with id 12345 --> http://moodle.xxx.edu/user/view.php?id=12345&course=1<br />
* got user 12345 --> http://moodle.xxx.edu/user/view.php?id=12345&course=1<br />
* course added with id 67 --> http://moodle.xxx.edu/course/view.php?id=67<br />
* got course 67 --> http://moodle.xxx.edu/course/view.php?id=67<br />
* etc.<br />
<br />
Today, in my uPortal installation, I request for Moodle database and display a list of courses in which the connected user is enrolled. Of course I provide links to these courses so that he can directly access. In addition I display a list of the last changes in these courses, again with links to the resources/activities.<br />
<br />
If the URLs are returned by the WS then the calling service has nothing to know about Moodle URLs. Else it has to build every URL by aggregating Moodle alias + adequate PHP script + entity ID<br />
<br />
== Implementation feedback ==<br />
<br />
[Feedback]<br />
Speaking as someone who will be using this API to integrate with another line of business application I would recommend the following changes.<br />
<br />
The add_user method should really be a 'SetUser' ie it will create the record if it does not exist or update it it if it does. The ID that is passed into the method would be *our* primary key which Moodle would use to recognise the user record within Moodle. We would not normally need to know anything about the Moodle primary key.<br />
<br />
One option to make the web services maintainable is to accept XML as a parameter and not a structure or custom object. That way you can define an XSD which will define required\optional parameters. Equally if you include a version number you can change the XML to add new features without having to redefine the web service signature itself (and hence clients will not have to recompile their code). So you may receive a SetUser call with XML V1.0 and another with XML V2.0 on the same webservice but from two different clients supporting different versions of the API.<br />
<br />
The method *must* accept an array of users - it's a little trickier to set this up in the client code but is much more scalable (if there's some good sample code then this is easier anyway). The latency (round trip time) with web service calls is high so you want to do as much as you can in a single call. We have a customer who wants us to deploy Moodle to 40,000 users - we're not going to do that using individual calls.<br />
<br />
Would it be possible to expand on the existing web service work rather than produce something completely new? We're investing a lot of effort with these services and we wouldn't like to have to re-do that work.<br />
[/Feedback]<br />
<br />
== Using web services to allow client side code such as js, Flash/Flex or java to communicate with Moodle ==<br />
<br />
I understand these web services should also allow client side code to communicate with Moodle.<br />
<br />
I imagined that web services used by client side code should be authenticated with a 'session key'. When the server outputs a page with such an object in it then a random session key string should be created and passed into the client side code through the html that embeds/outputs the object in a page. I think the session key should be associated with a user and probably a Moodle context. Then the context can be used within block related code or activity module related code to know when for example the client side code passes a log message back to Moodle or when it passes a grade back to Moodle that the grade is for such and such an activity. For web services for Flash I thought an appropriate way to do this would be to have an array of objects of session keys and there associated context/other data in the $SESSION object.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_statistics_calculations&diff=45585
Development:Quiz statistics calculations
2008-10-21T09:19:56Z
<p>Jamiesensei: kurtosis equation is wrong</p>
<hr />
<div>{{Moodle 2.0}}<br />
{{Quiz item analysis calculations}}<br />
<br />
==General issues==<br />
<br />
===Quizzes that allow multiple attempts===<br />
<br />
For quizzes that allow multiple attempts, by default the report should only include data from the first attempt by each student. (The data for subsequent attempts probably does not satisfy the assumptions that underlie item analysis statistics.) However, there should be an option 'Include data from all attempts', which should have a disclaimer that this may be statistically invalid either near it on screen, or possibly in the help file. (For small data sets, it may be better to include all data.)<br />
<br />
Using the first attempt also avoids problems caused by each attempt builds on last.<br />
<br />
Within the analysis, when multiple attempts per student are included, each attempt is treated as an independent attempt. (That is, we pretend each attempt was by a different student.)<br />
<br />
===Adaptive mode===<br />
<br />
Adaptive mode does not pose a problem. Item Analysis just supposes that each item in the test returns a score, and these scores are added up to get the test score. Therefore Item Analysis does not care about adaptive/non-adaptive mode. However, just to be clear, for an adaptive question, the score used in the calculation is the final score for the item, including penalties.<br />
<br />
===Certainty based marking===<br />
<br />
Similarly, should CBM, and/or negative scoring for multiple choice questions be implemented, we just use the final item score in the calculations, making sure that the formulae are not assuming that the minimum item score is zero.<br />
<br />
===Incomplete attempts===<br />
<br />
There is an issue about what you do when not all students have answered all questions. Depending on how you handle these missing items, you distort the statistics in different ways.<br />
<br />
There are basically two reasons why a student may not have answered a particular question:<br />
* they may have chosen to omit it, or<br />
* they may have run out of time, if the test is timed. In this case, omitted questions tend to be towards the end of the test.<br />
<br />
Available approaches for handling this are:<br />
<br />
# treat omitted items as having a score of 0.<br />
# exclude any attempt with missing scores from the analysis.<br />
# Analyse each question separately - and when analysing a particular question, just include students who answered that question in the analysis.<br />
<br />
I think we should implement 1 for now. This is how Moodle currently works - a blank answer is marked and receives a score of zero, and so is indistinguishable from a wrong answer. Item analysis is most important for summative tests, and the result of that question being in the test is that it gave that student a contribution of 0 marks towards their final score.<br />
<br />
===Random questions===<br />
<br />
In a quiz with random questions not all students will have attempted the same set of questions. To account for this, the analysis below distinguishes between positions in the test, and test items.<br />
<br />
==Notation used in the calculations==<br />
<br />
''Note: The only way I can think of to write this document with all the maths is to type TeX notation like $$x_i$$ even though MoodleDocs does not currently render it nicely. Maybe one day it will. In the mean time, if you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
We have a lot of students $$s \in S$$, who have completed at least one attempt on the quiz.<br />
<br />
The test has a number of positions $$p \in P$$.<br />
<br />
The test is assembled from a number of items $$i \in I$$.<br />
<br />
Because of random questions, different students may have recieved different items in different positions, so $$i(p, s)$$ is the item student $$s$$ received in position $$p$$.<br />
<br />
Let $$I_s$$ be the set of items that student $$s$$ saw. Let $$S_i$$ be the set of students who attempted item $$i$$.<br />
<br />
Each position has a maximum and minimum possible contribution to the test score, $$x_p(min)$$ and $$x_p(max)$$. At the moment in Moodle, $$x_p(min)$$ is always zero, but we cannot assume that will continue to be the case. $$x_p(max)$$ is database column quiz_question_instances.grade.<br />
<br />
Then, each student achieved an actual score $$x_p(s)$$ on the item in position $$p$$. So $$x_p(min) \le x_p(s) \le x_p(max)$$.<br />
<br />
$$x_p(s)$$ should be measured on the same scale as the final score for the quiz. That is, scaled by quiz_question_instances.grade, but that is already how grades are stored in mdl_question_states.<br />
<br />
We can also think of the student's score on a particular item $$x_i(s)$$. However, in this case, the score should be measured out of the Default question grade for this question. Also, there is a $$x_i(max)$$ ( = Default question grade) and $$x_i(min)$$ (currently, zero, but if we allow negative marking, that will change).<br />
<br />
$$x_{i(p, s)}(s) = x_p(s)\frac{x_i(max)}{x_p(max)}$$.<br />
<br />
Each student has a total score <br />
<br />
$$\displaystyle T_s = \sum_{p \in P} x_p(s)$$<br />
<br />
Similarly, there are the maximum and minimum possible test scores<br />
<br />
$$\displaystyle T_{max} = \sum_{p \in P} x_p(max)$$<br />
<br />
and <br />
<br />
$$\displaystyle T_{min} = \sum_{p \in P} x_p(min)$$<br />
<br />
===Intermediate calculations===<br />
<br />
To simplify the form of the formulas below, we need some intermediate calculated quantities, derived from the ones above.<br />
<br />
Student's rest of test score for a position: $$X_p(s) = T_s - x_p(s)$$.<br />
<br />
For any quantity that depends on position (for example $$x_p$$ or $$X_p$$), it's average is denoted with an overbar, and is an average over all students, so <br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
When a quantity is a property of an item, a bar denotes an average over all students who attempted that item, so<br />
<br />
$$\displaystyle \bar{x}_i = \frac{1}{S_i} \sum_{s \in S_i} x_i(s)$$.<br />
<br />
Similarly we have the variance of a quantity depending on position:<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
and for a quantity depending on items:<br />
<br />
$$\displaystyle V(x_i) = \frac{1}{S_i - 1} \sum_{s \in S_i} (x_i(s) - \bar{x}_i)^2$$.<br />
<br />
Finally, we need co-variances of two quantites, for example:<br />
<br />
$$\displaystyle C(x_p, X_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)(X_p(s) - \bar{X}_p)$$<br />
<br />
$$\displaystyle C(x_i, X_i) = \frac{1}{S_i - 1} \sum_{s \in S_i} (x_i(s) - \bar{x}_i)(X_i(s) - \bar{X}_i)$$.<br />
<br />
==Position statistics==<br />
<br />
===Facility index===<br />
<br />
This is the average score on the item, expressed as a percentage:<br />
<br />
$$\displaystyle F_p = 100\frac{\bar{x}_p - x_p(min)}{x_p(max) - x_p(min)}$$.<br />
<br />
The higher the facility index, the easier the question is (for this cohort of students).<br />
<br />
===Standard deviation===<br />
<br />
Again expressed on a percentage scale:<br />
<br />
$$\displaystyle SD_p = 100\frac{\sqrt{V(x_p)}}{x_p(max) - x_p(min)}$$.<br />
<br />
===Discrimination index===<br />
<br />
This is the product moment correlation coefficient between $$x_p$$ and $$X_p$$, expressed on a percentage scale. That is,<br />
<br />
$$\displaystyle D_p = 100r(x_p, X_p) = 100\frac{C(x_p, X_p)}{\sqrt{V(x_P) V(X_p)}}$$.<br />
<br />
The idea is that for a good question (or at least a question that fits in with the other questions in the test), students who have scored highly on the other parts of the test should also have scored highly on this question, so the score for the question and the score for the test as a whole should be well correlated.<br />
<br />
The weakness of this statistic is that, unless the facility index is 50%, it is impossible for the discrimination index to be 100%, or, to put it another way, if $$F_p$$ is close to 0% or 100%, $$D_p$$ will always be very small. That makes interpreting this statistic difficult.<br />
<br />
===Discriminative efficiency===<br />
<br />
This gets around that weakness in the discrimination index by expressing $$C(x_p, X_p)$$ as a percentage of the maximum value it could have taken given the scores the students got on this question, and the test as a whole. That is:<br />
<br />
$$\displaystyle DE_p = 100\frac{C(x_p, X_p)}{C_{max}(x_p, X_p)}$$<br />
<br />
where $$C_{max}(x_p, X_p)$$ is defined as follows:<br />
<br />
When you compute $$C(x_p, X_p)$$, you do the sum <br />
<br />
$$\displaystyle C(x_p, X_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)(X_p(s) - \bar{X}_p)$$<br />
<br />
which involves a term for each student combining their question score and rest of test score. That is, you start with an array of $$x_p(s)$$ with an array of corresponding $$X_p(s)$$, one for each $$s$$. To compute $$C_{max}(x_p, X_p)$$, you just sort these two arrays before applying the above formula. That is, for the purpose of computing $$C_{max}$$, you pretend that the first student scored the lowest $$x_p$$ and the lowest $$X_p$$, the second student scored the second lowest $$x_p$$ and the second lowest $$X_p$$, and so on to the last student, who scored the highest $$x_p$$ and $$X_p$$.<br />
<br />
===Intended question weight===<br />
<br />
How much this question was supposed to contribute to determining the overall test score.<br />
<br />
$$\displaystyle IQW_p = 100\frac{x_p(max) - x_p(min)}{T_{max} - T_{min}}$$.<br />
<br />
===Effective question weight===<br />
<br />
This is an estimate of what proportion of the variance in the students' test scores is due this question.<br />
<br />
$$\displaystyle EQW_p = 100\frac{\sqrt{C(x_p, T)}}{\sum_{p \in P}\sqrt{C(x_p, T)}}$$.<br />
<br />
==Item statistics==<br />
<br />
===Number of attempts===<br />
<br />
The number of students who got this question as part of a quiz attempt. This is just $$S_i$$.<br />
<br />
===Random guess score===<br />
<br />
This is the score that the student would have got by guessing randomly. It depends on the question type. For types like shortanswer, it is 0 - or the score associated with answer '*', if there is one.<br />
<br />
For multiple choice questions (including matching, truefalse, etc.) it is the average score over all the possible choices.<br />
<br />
(There should probably be a method in the question type class to compute this.)<br />
<br />
===Facility index===<br />
<br />
$$\displaystyle F_i = 100\frac{\bar{x}_i - x_i(min)}{x_i(max) - x_i(min)}$$.<br />
<br />
===Standard deviation===<br />
<br />
$$\displaystyle SD_i = 100\frac{\sqrt{V(x_i)}}{x_i(max) - x_i(min)}$$.<br />
<br />
===Discrimination index===<br />
<br />
$$\displaystyle D_i = 100r(x_i, T) = 100\frac{C(x_i, T)}{\sqrt{V(x_i) V(T)}}$$.<br />
<br />
(It is not possible to define $$X_i$$ because it is conceivable that the same item may have been chosen in different positions with different weights, so we substitute $$T$$ instead.)<br />
<br />
===Discriminative efficiency===<br />
<br />
$$\displaystyle DE_i = 100\frac{C(x_i, T)}{C_{max}(x_i, T)}$$.<br />
<br />
==Test statistics==<br />
<br />
===Number of Attempts===<br />
<br />
This is $$S$$.<br />
<br />
Note that depending on the options, we may be counting one or all attempts per student.<br />
<br />
===Mean Score===<br />
<br />
Test mean $$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
===Median Score===<br />
<br />
Sort all the $$T_s$$, and take the middle one if S is odd, or the average of the two middle ones if S is even.<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
Probably of limited interest, but included for completeness. Skewness is a measure of the asymmetry in a distribution. Kurtosis - imagine a normal distribution. Kurtosis tells you if your distribution has more of a bulge, but thinner tails, or vice-versa.<br />
<br />
First calculate:<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
Then compute<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = V(T)$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3$$<br />
<br />
$$\displaystyle k_4 = \frac{S^2}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then<br />
<br />
Skewness $$\displaystyle = \frac{k_3}{k_2^{3/2}}$$<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
===Coefficient of Internal Consistency===<br />
<br />
This is on a percentage scale<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
===Error Ratio===<br />
<br />
Also a percentage.<br />
<br />
$$\displaystyle ER = 100 \sqrt{1 - \frac{CIC}{100}}$$<br />
<br />
===Standard Error===<br />
<br />
$$\displaystyle SE = \frac{ER}{100}SD$$<br />
<br />
These last three are to do with estimating how reliable the test scores are. If you take the view that the score the student got on the test on the day is a combination of their actual ability and a random error (how lucky they were on the day of the test), the the standard error is an estimate of the luck factor. So if SE ~= 10, and the student scored 60, then you can be quite confident that their actual ability is between 50 and 70.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_statistics_calculations&diff=45584
Development:Quiz statistics calculations
2008-10-21T08:34:26Z
<p>Jamiesensei: /* Skewness and Kurtosis */ corrected skewness equation</p>
<hr />
<div>{{Moodle 2.0}}<br />
{{Quiz item analysis calculations}}<br />
<br />
==General issues==<br />
<br />
===Quizzes that allow multiple attempts===<br />
<br />
For quizzes that allow multiple attempts, by default the report should only include data from the first attempt by each student. (The data for subsequent attempts probably does not satisfy the assumptions that underlie item analysis statistics.) However, there should be an option 'Include data from all attempts', which should have a disclaimer that this may be statistically invalid either near it on screen, or possibly in the help file. (For small data sets, it may be better to include all data.)<br />
<br />
Using the first attempt also avoids problems caused by each attempt builds on last.<br />
<br />
Within the analysis, when multiple attempts per student are included, each attempt is treated as an independent attempt. (That is, we pretend each attempt was by a different student.)<br />
<br />
===Adaptive mode===<br />
<br />
Adaptive mode does not pose a problem. Item Analysis just supposes that each item in the test returns a score, and these scores are added up to get the test score. Therefore Item Analysis does not care about adaptive/non-adaptive mode. However, just to be clear, for an adaptive question, the score used in the calculation is the final score for the item, including penalties.<br />
<br />
===Certainty based marking===<br />
<br />
Similarly, should CBM, and/or negative scoring for multiple choice questions be implemented, we just use the final item score in the calculations, making sure that the formulae are not assuming that the minimum item score is zero.<br />
<br />
===Incomplete attempts===<br />
<br />
There is an issue about what you do when not all students have answered all questions. Depending on how you handle these missing items, you distort the statistics in different ways.<br />
<br />
There are basically two reasons why a student may not have answered a particular question:<br />
* they may have chosen to omit it, or<br />
* they may have run out of time, if the test is timed. In this case, omitted questions tend to be towards the end of the test.<br />
<br />
Available approaches for handling this are:<br />
<br />
# treat omitted items as having a score of 0.<br />
# exclude any attempt with missing scores from the analysis.<br />
# Analyse each question separately - and when analysing a particular question, just include students who answered that question in the analysis.<br />
<br />
I think we should implement 1 for now. This is how Moodle currently works - a blank answer is marked and receives a score of zero, and so is indistinguishable from a wrong answer. Item analysis is most important for summative tests, and the result of that question being in the test is that it gave that student a contribution of 0 marks towards their final score.<br />
<br />
===Random questions===<br />
<br />
In a quiz with random questions not all students will have attempted the same set of questions. To account for this, the analysis below distinguishes between positions in the test, and test items.<br />
<br />
==Notation used in the calculations==<br />
<br />
''Note: The only way I can think of to write this document with all the maths is to type TeX notation like $$x_i$$ even though MoodleDocs does not currently render it nicely. Maybe one day it will. In the mean time, if you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
We have a lot of students $$s \in S$$, who have completed at least one attempt on the quiz.<br />
<br />
The test has a number of positions $$p \in P$$.<br />
<br />
The test is assembled from a number of items $$i \in I$$.<br />
<br />
Because of random questions, different students may have recieved different items in different positions, so $$i(p, s)$$ is the item student $$s$$ received in position $$p$$.<br />
<br />
Let $$I_s$$ be the set of items that student $$s$$ saw. Let $$S_i$$ be the set of students who attempted item $$i$$.<br />
<br />
Each position has a maximum and minimum possible contribution to the test score, $$x_p(min)$$ and $$x_p(max)$$. At the moment in Moodle, $$x_p(min)$$ is always zero, but we cannot assume that will continue to be the case. $$x_p(max)$$ is database column quiz_question_instances.grade.<br />
<br />
Then, each student achieved an actual score $$x_p(s)$$ on the item in position $$p$$. So $$x_p(min) \le x_p(s) \le x_p(max)$$.<br />
<br />
$$x_p(s)$$ should be measured on the same scale as the final score for the quiz. That is, scaled by quiz_question_instances.grade, but that is already how grades are stored in mdl_question_states.<br />
<br />
We can also think of the student's score on a particular item $$x_i(s)$$. However, in this case, the score should be measured out of the Default question grade for this question. Also, there is a $$x_i(max)$$ ( = Default question grade) and $$x_i(min)$$ (currently, zero, but if we allow negative marking, that will change).<br />
<br />
$$x_{i(p, s)}(s) = x_p(s)\frac{x_i(max)}{x_p(max)}$$.<br />
<br />
Each student has a total score <br />
<br />
$$\displaystyle T_s = \sum_{p \in P} x_p(s)$$<br />
<br />
Similarly, there are the maximum and minimum possible test scores<br />
<br />
$$\displaystyle T_{max} = \sum_{p \in P} x_p(max)$$<br />
<br />
and <br />
<br />
$$\displaystyle T_{min} = \sum_{p \in P} x_p(min)$$<br />
<br />
===Intermediate calculations===<br />
<br />
To simplify the form of the formulas below, we need some intermediate calculated quantities, derived from the ones above.<br />
<br />
Student's rest of test score for a position: $$X_p(s) = T_s - x_p(s)$$.<br />
<br />
For any quantity that depends on position (for example $$x_p$$ or $$X_p$$), it's average is denoted with an overbar, and is an average over all students, so <br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
When a quantity is a property of an item, a bar denotes an average over all students who attempted that item, so<br />
<br />
$$\displaystyle \bar{x}_i = \frac{1}{S_i} \sum_{s \in S_i} x_i(s)$$.<br />
<br />
Similarly we have the variance of a quantity depending on position:<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
and for a quantity depending on items:<br />
<br />
$$\displaystyle V(x_i) = \frac{1}{S_i - 1} \sum_{s \in S_i} (x_i(s) - \bar{x}_i)^2$$.<br />
<br />
Finally, we need co-variances of two quantites, for example:<br />
<br />
$$\displaystyle C(x_p, X_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)(X_p(s) - \bar{X}_p)$$<br />
<br />
$$\displaystyle C(x_i, X_i) = \frac{1}{S_i - 1} \sum_{s \in S_i} (x_i(s) - \bar{x}_i)(X_i(s) - \bar{X}_i)$$.<br />
<br />
==Position statistics==<br />
<br />
===Facility index===<br />
<br />
This is the average score on the item, expressed as a percentage:<br />
<br />
$$\displaystyle F_p = 100\frac{\bar{x}_p - x_p(min)}{x_p(max) - x_p(min)}$$.<br />
<br />
The higher the facility index, the easier the question is (for this cohort of students).<br />
<br />
===Standard deviation===<br />
<br />
Again expressed on a percentage scale:<br />
<br />
$$\displaystyle SD_p = 100\frac{\sqrt{V(x_p)}}{x_p(max) - x_p(min)}$$.<br />
<br />
===Discrimination index===<br />
<br />
This is the product moment correlation coefficient between $$x_p$$ and $$X_p$$, expressed on a percentage scale. That is,<br />
<br />
$$\displaystyle D_p = 100r(x_p, X_p) = 100\frac{C(x_p, X_p)}{\sqrt{V(x_P) V(X_p)}}$$.<br />
<br />
The idea is that for a good question (or at least a question that fits in with the other questions in the test), students who have scored highly on the other parts of the test should also have scored highly on this question, so the score for the question and the score for the test as a whole should be well correlated.<br />
<br />
The weakness of this statistic is that, unless the facility index is 50%, it is impossible for the discrimination index to be 100%, or, to put it another way, if $$F_p$$ is close to 0% or 100%, $$D_p$$ will always be very small. That makes interpreting this statistic difficult.<br />
<br />
===Discriminative efficiency===<br />
<br />
This gets around that weakness in the discrimination index by expressing $$C(x_p, X_p)$$ as a percentage of the maximum value it could have taken given the scores the students got on this question, and the test as a whole. That is:<br />
<br />
$$\displaystyle DE_p = 100\frac{C(x_p, X_p)}{C_{max}(x_p, X_p)}$$<br />
<br />
where $$C_{max}(x_p, X_p)$$ is defined as follows:<br />
<br />
When you compute $$C(x_p, X_p)$$, you do the sum <br />
<br />
$$\displaystyle C(x_p, X_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)(X_p(s) - \bar{X}_p)$$<br />
<br />
which involves a term for each student combining their question score and rest of test score. That is, you start with an array of $$x_p(s)$$ with an array of corresponding $$X_p(s)$$, one for each $$s$$. To compute $$C_{max}(x_p, X_p)$$, you just sort these two arrays before applying the above formula. That is, for the purpose of computing $$C_{max}$$, you pretend that the first student scored the lowest $$x_p$$ and the lowest $$X_p$$, the second student scored the second lowest $$x_p$$ and the second lowest $$X_p$$, and so on to the last student, who scored the highest $$x_p$$ and $$X_p$$.<br />
<br />
===Intended question weight===<br />
<br />
How much this question was supposed to contribute to determining the overall test score.<br />
<br />
$$\displaystyle IQW_p = 100\frac{x_p(max) - x_p(min)}{T_{max} - T_{min}}$$.<br />
<br />
===Effective question weight===<br />
<br />
This is an estimate of what proportion of the variance in the students' test scores is due this question.<br />
<br />
$$\displaystyle EQW_p = 100\frac{\sqrt{C(x_p, T)}}{\sum_{p \in P}\sqrt{C(x_p, T)}}$$.<br />
<br />
==Item statistics==<br />
<br />
===Number of attempts===<br />
<br />
The number of students who got this question as part of a quiz attempt. This is just $$S_i$$.<br />
<br />
===Random guess score===<br />
<br />
This is the score that the student would have got by guessing randomly. It depends on the question type. For types like shortanswer, it is 0 - or the score associated with answer '*', if there is one.<br />
<br />
For multiple choice questions (including matching, truefalse, etc.) it is the average score over all the possible choices.<br />
<br />
(There should probably be a method in the question type class to compute this.)<br />
<br />
===Facility index===<br />
<br />
$$\displaystyle F_i = 100\frac{\bar{x}_i - x_i(min)}{x_i(max) - x_i(min)}$$.<br />
<br />
===Standard deviation===<br />
<br />
$$\displaystyle SD_i = 100\frac{\sqrt{V(x_i)}}{x_i(max) - x_i(min)}$$.<br />
<br />
===Discrimination index===<br />
<br />
$$\displaystyle D_i = 100r(x_i, T) = 100\frac{C(x_i, T)}{\sqrt{V(x_i) V(T)}}$$.<br />
<br />
(It is not possible to define $$X_i$$ because it is conceivable that the same item may have been chosen in different positions with different weights, so we substitute $$T$$ instead.)<br />
<br />
===Discriminative efficiency===<br />
<br />
$$\displaystyle DE_i = 100\frac{C(x_i, T)}{C_{max}(x_i, T)}$$.<br />
<br />
==Test statistics==<br />
<br />
===Number of Attempts===<br />
<br />
This is $$S$$.<br />
<br />
Note that depending on the options, we may be counting one or all attempts per student.<br />
<br />
===Mean Score===<br />
<br />
Test mean $$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
===Median Score===<br />
<br />
Sort all the $$T_s$$, and take the middle one if S is odd, or the average of the two middle ones if S is even.<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
Probably of limited interest, but included for completeness. Skewness is a measure of the asymmetry in a distribution. Kurtosis - imagine a normal distribution. Kurtosis tells you if your distribution has more of a bulge, but thinner tails, or vice-versa.<br />
<br />
First calculate:<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
Then compute<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = V(T)$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then<br />
<br />
Skewness $$\displaystyle = \frac{k_3}{k_2^{3/2}}$$<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
===Coefficient of Internal Consistency===<br />
<br />
This is on a percentage scale<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
===Error Ratio===<br />
<br />
Also a percentage.<br />
<br />
$$\displaystyle ER = 100 \sqrt{1 - \frac{CIC}{100}}$$<br />
<br />
===Standard Error===<br />
<br />
$$\displaystyle SE = \frac{ER}{100}SD$$<br />
<br />
These last three are to do with estimating how reliable the test scores are. If you take the view that the score the student got on the test on the day is a combination of their actual ability and a random error (how lucky they were on the day of the test), the the standard error is an estimate of the luck factor. So if SE ~= 10, and the student scored 60, then you can be quite confident that their actual ability is between 50 and 70.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=AMF_Moodle&diff=45538
AMF Moodle
2008-10-20T16:09:40Z
<p>Jamiesensei: </p>
<hr />
<div><div class="sideblock right" style="width: 12em;"><br />
<div class="header">Credits</div><br />
<div class="content"><br />
This page was started on 9th October 2008 by [http://matbury.com Matt Bury]<br />
</div><br />
</div><br />
<br />
* Please note: If you want to use ActionScript 2.0 (Flash 8 and under), please refer to [[Development:AMFPHP]].<br />
<br />
<br />
==What is AMFPHP?==<br />
<br />
===Action Message Format PHP===<br />
[http://sourceforge.net/projects/amfphp/ AMFPHP] is a widely used open source remoting server that allows Flash and Flex client-side applications to call PHP methods directly, as if they were native Flash/Flex ActionScript methods. It is fast and lightweight and presents an efficient, simple and easy to implement method of communicating with PHP and databases.<br />
<br />
===Preserved Data Types===<br />
<br />
[http://sourceforge.net/projects/amfphp/ AMFPHP] preserves the following data types between ActionScript and PHP:<br />
<br />
* Array<br />
* Bitmap<br />
* ByteArray<br />
* int<br />
* Number<br />
* Object<br />
* Recordset (mysql_result)<br />
* String<br />
* XML (ActionScript 3.0 also supports [http://en.wikipedia.org/wiki/E4X E4X] notation)<br />
<br />
Note: Please add to this list if you have successfully tested data types using AMFPHP 1.9.beta+ and ActionScript 3.0.<br />
<br />
[http://sourceforge.net/projects/amfphp/ AMFPHP] automatically converts data types between ActionScript and PHP to their native equivalents. For example, it can convert a PHP array into and ActionScript array or a PHP resource, such as a mysql_result into an Actionscript Recordset.<br />
<br />
===AMF0 and AMF3===<br />
Previous versions of Flash, using ActionScript 2.0 (versions 6, 7 and 8), use AMF0. ActionScript 3.0, Flash CS3+ and Flex, use AMF3 by default but can also use AMF0. What's the difference? AMF3 is compressed and therefore faster. For more details look [http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/ObjectEncoding.html here].<br />
<br />
==What is AMF Moodle?==<br />
<br />
[http://code.google.com/p/amfmoodle/ AMF Moodle] is a new project (9th October 2008) which aims to integrate Flash and Flex with Moodle's API. The aim is to build a library of services that Flash and Flex developers can use to create secure client-side applications that can interact with Moodle. The first step will be to create a Moodle module that facilitates deploying custom made, generic Flash and Flex e-learning interactions in Moodle courses and recording user interaction results in the Moodle gradebook.<br />
<br />
===AMF Moodle Outline===<br />
<br />
There is a summary of some of the specifications for the new AMF Moodle on the [[Talk:AMF_Moodle]] comments page that are under discussion. Once we have a more definite specification, it will be transferred to here. Please feel free to comment, make requests, ask questions etc. on the comments page. It'll really help us alot.<br />
<br />
===AMF Moodle Participants===<br />
<br />
The project's participants at the moment are:<br />
[http://matbury.com/ Matt Bury],<br />
[http://jamiep.org/ Jamie Pratt]<br />
and [http://www86.coolenglishtv.com/ Marcus Potter].<br />
<br />
You can find the project home page at [http://code.google.com/p/amfmoodle/ code.google.com].<br />
<br />
Find the AMF Moodle discussion thread [http://moodle.org/mod/forum/discuss.php?d=105716 here].<br />
<br />
For further discussion, please use the [[Talk:AMF_Moodle]] page comments tab for this wiki page.<br />
<br />
==What Are the Differences between Using AMFPHP and SCORM?==<br />
<br />
Several Moodle developers and contributors have asked the question, "If you want to deploy Flash in Moodle, why not use SCORM?" [http://moodle.org/mod/forum/discuss.php?d=107918#p475832 There is a discussion in the General Developers Forum on the advantages and disadvantages of SCORM.] <br />
<br />
==Installing AMFPHP in Moodle==<br />
<br />
===Download===<br />
* Download the latest version of [http://sourceforge.net/projects/amfphp/ AMFPHP], currently version 1.9.beta (SourceForge repository).<br />
* Unzip the file and find the directory amfphp.<br />
* Upload the amfphp directory to ***MOODLEROOT***/lib/<br />
<br />
===Edit gateway.php===<br />
* Find the file ***MOODLEROOT***/lib/amfphp/gateway.php and open it in your favourite text/PHP editor<br />
* At the beginning of the code, add the line: include_once "../../config.php";<br />
* Find and edit the line: $gateway->setClassPath($servicesPath); and change it to: $gateway->setClassPath($CFG->dirroot."/lib/amfphp/services/");<br />
* Upload the edited ***MOODLEROOT***/lib/amfphp/gateway.php file.<br />
* That's it!<br />
<br />
===Setting PHP 5 as Default===<br />
Please note: AMFPHP requires PHP 5 to work seamlessly, although some report success with version 4. Many servers run both PHP 4 and 5, but have them set to run PHP 4 by default. If you experience problems, you may have to change the default PHP version in the ***MOODLEROOT***/lib/amfphp/ directory with an .htaccess file. The following is an example only. Please check that it is correct for your server configuration. If you have a hosted server, they'll probably have an example in their help files. For example:<br />
<br />
* Find the AMFPHP .htaccess file at ***MOODLEROOT***/lib/amfphp/.htaccess<br />
* Open it with a text editor. You'll see:<br />
<pre>#If you're working with a server which doesn't seem to display errors and you don't <br />
#have access to httpd.conf and you have a good reason to develop remotely instead of<br />
#locally, you may have luck with uploading this configuration file to the server<br />
<br />
php_flag display_errors on<br />
php_flag display_startup_errors on<br />
php_value error_reporting 2047</pre><br />
<br />
* Add another line of code to change the default PHP version setting for the amfphp directory:<br />
<pre>#If you're working with a server which doesn't seem to display errors and you don't <br />
#have access to httpd.conf and you have a good reason to develop remotely instead of<br />
#locally, you may have luck with uploading this configuration file to the server<br />
<br />
php_flag display_errors on<br />
php_flag display_startup_errors on<br />
php_value error_reporting 2047<br />
<br />
SetEnv DEFAULT_PHP_VERSION 5</pre><br />
<br />
==Testing AMFPHP in Moodle==<br />
<br />
Here is an example of a simple AMF Moodle service that checks the login status of your browser.<br />
<br />
* Create a new document in your preferred text/PHP editor<br />
* Copy and paste the code and save it as UserName.php<br />
* Upload it to ***MOODLEROOT***/lib/amfphp/services/<br />
<br />
Now is a good time to find out if your server is running the correct PHP version. If your server is running PHP 4 by default, you'll get error messages caused by the "public" namespace.<br />
<br />
* Navigate to the PHP page you just uploaded in your browser: ***MOODLEROOT***/lib/amfphp/services/UserName.php<br />
* If there are no error messages then you can continue to the "Testing AMFPHP in Flash" section<br />
<br />
<pre><br />
<?php<br />
class UserName<br />
{<br />
public function __construct()<br />
{<br />
<br />
}<br />
/**<br />
*checks whether you're logged in to Moodle<br />
*@returns user login status<br />
*/<br />
function loggedInAs() {<br />
global $USER;<br />
if (isguestuser()){<br />
return get_string('loggedinasguest', 'moodle');<br />
}else if (isloggedin()){<br />
return get_string('loggedinas', 'moodle', fullname($USER));<br />
} else {<br />
return get_string('loggedinnot');<br />
}<br />
}<br />
}<br />
?><br />
</pre><br />
<br />
==Testing AMFPHP in Flash==<br />
<br />
Please note: Flash CS3 and Flex come with the necessary classes for using AMFPHP already installed. It is not necessary to install any new classes!<br />
<br />
* Open the Flash CS3 IDE<br />
* Create a new ActionScript 3.0 class document<br />
* Copy and past the code below and save it as UserName.as<br />
* Create a new ActionScript 3.0 FLA document<br />
* In Properties > Document class: type UserName.as<br />
* Save the FLA file as UserName.fla in the same directory as UserName.as<br />
* Publish the UserName.swf, AC_RunActiveContent.js and UserName.html files<br />
* Upload the published files to your server<br />
* In your browser, navigate to the location of the UserName.html page<br />
* Try logging in and out of Moodle to see the change in your login status<br />
<br />
===ActionScript 3.0 Document Class===<br />
<pre><br />
package {<br />
<br />
import flash.display.Sprite;<br />
import flash.text.*;<br />
import flash.events.MouseEvent;<br />
import flash.events.NetStatusEvent;<br />
import flash.net.NetConnection;<br />
import flash.net.Responder;<br />
<br />
public class UserName extends Sprite {<br />
<br />
private var _format:TextFormat;<br />
private var _display:TextField;<br />
private var _call:Sprite;<br />
private var _gateway:NetConnection;<br />
private var _responder:Responder;<br />
<br />
public function UserName() {<br />
initFormat();<br />
initDisplay();<br />
initCall();<br />
initGateway();<br />
}<br />
<br />
// create text format object<br />
private function initFormat():void {<br />
_format = new TextFormat();<br />
_format.font = "Trebuchet MS";<br />
_format.size = 15;<br />
_format.bold = true;<br />
}<br />
<br />
// create text field to display results<br />
private function initDisplay():void {<br />
_display = new TextField();<br />
_display.autoSize = TextFieldAutoSize.LEFT;<br />
_display.multiline = true;<br />
_display.x = 10;<br />
_display.y = 10;<br />
_display.defaultTextFormat = _format;<br />
_display.text = "Click on \"Call UserName.php\" to test.";<br />
addChild(_display);<br />
}<br />
<br />
// create text button to call UserName.php<br />
private function initCall():void {<br />
_call = new Sprite();<br />
_call.mouseChildren = false;<br />
_call.buttonMode = true;<br />
_call.addEventListener(MouseEvent.MOUSE_DOWN, callDownHandler);<br />
var btn:TextField = new TextField();<br />
btn.autoSize = TextFieldAutoSize.LEFT;<br />
btn.border = true;<br />
btn.background = true;<br />
btn.backgroundColor = 0xdddddd;<br />
btn.defaultTextFormat = _format;<br />
btn.text = " Call UserName.php ";<br />
btn.x = (stage.stageWidth - btn.width) - 10;<br />
btn.y = stage.stageHeight - 30;<br />
_call.addChild(btn);<br />
addChild(_call);<br />
}<br />
<br />
// depress call button and call UserName.loggedInAs method<br />
private function callDownHandler(event:MouseEvent):void {<br />
_call.removeEventListener(MouseEvent.MOUSE_DOWN, callDownHandler);<br />
stage.addEventListener(MouseEvent.MOUSE_UP, callUpHandler);<br />
_call.x += 2;<br />
_call.y += 2;<br />
_gateway.call("UserName.loggedInAs",_responder);<br />
_display.appendText("\n Calling UserName.loggedInAs ... ");<br />
}<br />
<br />
// reset call button<br />
private function callUpHandler(event:MouseEvent):void {<br />
_call.addEventListener(MouseEvent.MOUSE_DOWN, callDownHandler);<br />
stage.removeEventListener(MouseEvent.MOUSE_UP, callUpHandler);<br />
_call.x -= 2;<br />
_call.y -= 2;<br />
}<br />
<br />
// connect to AMFPHP gateway<br />
private function initGateway():void {<br />
_gateway = new NetConnection();<br />
// Edit the following line to reflect your server configuration<br />
_gateway.connect("http://***MOODLEROOT***/lib/amfphp/gateway.php");<br />
_gateway.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);<br />
_responder = new Responder(onResult,onFault);<br />
}<br />
<br />
// show returned results<br />
private function onResult(res:Object):void {<br />
_display.appendText("\n " + String(res));<br />
}<br />
<br />
// show details if call is unsuccessful<br />
private function onFault(res:Object):void {<br />
for(var i:String in res) {<br />
_display.appendText("\n " + String(res[i]));<br />
}<br />
}<br />
<br />
// show all net status events (can be status or error events)<br />
function netStatusHandler(event:NetStatusEvent):void {<br />
for(var i:String in event.info) {<br />
_display.appendText("\n" + String(event.info[i]));<br />
}<br />
}<br />
}<br />
}<br />
</pre><br />
<br />
==AMF Moodle Service Library==<br />
<br />
===AMFPHP Service Browser===<br />
AMFPHP 1.9.beta comes with a Flex service browser ready installed. It allows you to see your library of services in the ***MOODLEROOT***/lib/amfphp/services/ directory and call them. It also displays error messages very well. It's an ideal tool for checking out your services before your write Flash and Flex applications that call them.<br />
<br />
===VERY IMPORTANT!===<br />
DO NOT leave the service browser installed on a production server (i.e. public). It will leave your service library and therefore your Moodle API and databases exposed to the public!<br />
<br />
===List Of AMF Moodle Services===<br />
* User.php - returns user login status, returns an array of config settings you can set, returns a value of a config setting, sets a value of a config setting<br />
* UserName.php - returns user login status<br />
<br />
==User.php Updated==<br />
<br />
If you've already seen the tutorials in [[Development:AMFPHP]], here's an updated version of User.php that works with AMFPHP 1.9.beta. As with UserName.php, upload it tothe services directory at ***MOODLEROOT***/lib/amfphp/services/. You can test it by navigating to ***MOODLEROOT***/lib/amfphp/browser/index.html and selecting User from the menu of services.<br />
<br />
===User.php Script===<br />
<pre><br />
<?php<br />
class User<br />
{<br />
public function __construct()<br />
{<br />
<br />
}<br />
/**<br />
* Returns string indicating whether a user is logged in.<br />
* @access remote<br />
*/<br />
function loggedInAs() {<br />
global $USER;<br />
if (isguestuser()){<br />
return get_string('loggedinasguest', 'moodle');<br />
}else if (isloggedin()){<br />
return get_string('loggedinas', 'moodle', fullname($USER));<br />
} else {<br />
return get_string('loggedinnot');<br />
}<br />
}<br />
/**<br />
* Returns an array of config settings you can set.<br />
* @access remote<br />
*/<br />
function configSettings() {<br />
return array_keys(get_user_preferences());<br />
<br />
}<br />
/**<br />
* Returns a value of a config setting.<br />
* @param string name<br />
* @access remote<br />
*/<br />
function getConfigSetting($name) {<br />
$name = clean_param($name, PARAM_ALPHAEXT);<br />
return get_user_preferences($name);<br />
}<br />
/**<br />
* sets a value of a config setting.<br />
* @param string name<br />
* @param string value<br />
* @access remote<br />
*/<br />
function setConfigSetting($name, $value) {<br />
$name = clean_param($name, PARAM_ALPHAEXT);<br />
$value = clean_param($value, PARAM_NOTAGS);<br />
return set_user_preference($name, $value);<br />
}<br />
}<br />
?><br />
<br />
</pre><br />
<br />
==Useful Links==<br />
<br />
===AMFPHP===<br />
<br />
* AMFPHP home page [http://amfphp.org/ amfphp.org]<br />
* AMFPHP code repository [http://sourceforge.net/projects/amfphp/ SourceForge.net]<br />
<br />
===Sir Lee Brimelow's video tutorials===<br />
* [http://gotoandlearn.com/play?id=78 Introduction to AMFPHP 1]<br />
Learn how to install AMFPHP and create a simple service that sends email.<br />
<br />
* [http://gotoandlearn.com/play?id=79 Introduction to AMFPHP 2]<br />
In this tutorial he shows you how to directly return database records to Flash using AMFPHP.<br />
<br />
===Alessandro Crugnola's tutorials===<br />
* [http://www.sephiroth.it/tutorials/flashPHP/flex_remoteobject/ Flex RemoteObject and AMFPHP 1.9]<br />
* [http://www.sephiroth.it/tutorials/flashPHP/amfphp_bytearray/ Send and Receive ByteArray to AMFPHP]<br />
<br />
===AMF Moodle===<br />
* [http://code.google.com/p/amfmoodle/ AMF Moodle code.google.com]<br />
* [http://moodle.org/mod/forum/discuss.php?d=105716 Moodle Forums - AMF Moodle discussion thread]<br />
<br />
===Adobe ActionScript 3.0 Language Reference===<br />
The two most important classes related to AMFPHP are:<br />
* [http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/NetConnection.html NetConnection class]<br />
* [http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/Responder.html Responder class]<br />
<br />
<br />
===AMFPHP Is Fast===<br />
There's always someone who'll play with a new toy and push it until it breaks. AMFPHP can go pretty fast! [http://www.5etdemi.com/blog/archives/2007/01/amfphp-19-beta-2-ridiculously-faster/ Check out this blog article].</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:AMFPHP&diff=45537
Development:AMFPHP
2008-10-20T15:40:23Z
<p>Jamiesensei: </p>
<hr />
<div>{{AMFPHP}}<br />
<br />
==What is AMFPHP?==<br />
<br />
AMFPHP is a widely used OS remoting server that allows your Flash movies to send and receive data to and from your web server and interact with your PHP scripts. Data to/from PHP is automatically converted into the appropriate Flash variable type and communication is fast because the format data is sent in is compact and is handled efficiently by the Flash player (large XML files can sometimes take time to be processed).<br />
<br />
===AMFPHP 1.9.beta===<br />
<br />
AMFPHP is now in version 1.9.beta (30th September 2008). It is fully compatible with AMF0, Flash 6,7 and 8 ActionScript 2.0, and now with AMF3, Flash 9 ActionScript 3.0. Interfacing with AMFPHP using ActionScript 3.0 has a couple of advantages.<br />
<br />
* There are no ActionScript classes to download and install - Flash CS3 and Flex come with all the remoting classes you need as standard.<br />
<br />
* AMF3 is compressed, meaning it is impressively fast and can now outperform other RPC methods.<br />
<br />
===AMFPHP for Flash/Flex ActionScript 3.0===<br />
<br />
If you want to develop applications and services for ActionScript 3.0 using Flash or the Flex framework, please check this page: [[AMF Moodle]]<br />
<br />
==Using AMFPHP with Moodle==<br />
<br />
* I downloaded AMFPHP 1.2.6 [http://downloads.sourceforge.net/amfphp/amfphp-1.2.6.zip?use_mirror=nchc get it here] and installed it in my moodle site under MOODLEROOT/lib/amfphp/ So that gateway.php is at MOODLEROOT/lib/amfphp/gateway.php<br />
* In gateway.php I :<br />
** added <code>include_once "../../config.php";</code> to the beginning of the file.<br />
** I edited the call to <code>$gateway->setBaseClassPath</code> so it reads <code>$gateway->setBaseClassPath($CFG->libdir."/amfphp/services/");</code><br />
<br />
==Installing Flash Remoting Components in Your Flash Editor==<br />
<br />
[http://www.adobe.com/products/flashremoting/downloads/components/ You must download an extension to the Flash editor here. This installs the necessary code libraries for Flash to communicate with a Flash remoting server]. Restart your Flash editor after installing the components. You should then see NetConnection Debugger under the Window menu->Other Panels. If necessary more info can be found [http://www.amfphp.org/docs/installingremoting.html on the amfphp site here.]<br />
<br />
===Flash Remoting with Flash CS3===<br />
<br />
See here for info on using [http://www.rabidgadfly.com/?p=52 AS2 remoting with Flash CS3]. CS3 has remoting built in in AS3 but the examples on this page use AS2.<br />
<br />
==Testing, testing, 1, 2, 3==<br />
<br />
===Files Created By Steps in this Tutorial===<br />
<br />
For those who are impatient and don't want to follow these step by step instructions you can find [http://jamiep.org/amfphp/amfphp.zip the files created in this tutorial here.] Unzip them in lib/amfphp/ and they should automatically install into src and the services directory.<br />
<br />
===Test service===<br />
<br />
* Create a new file under lib/amfphp/services/ called UserName.php<br />
* Copy and paste the following code :<br />
<pre><br />
<?php<br />
class UserName {<br />
function loggedInAs() {<br />
global $USER;<br />
if (isguestuser()){<br />
return get_string('loggedinasguest', 'moodle');<br />
}else if (isloggedin()){<br />
return get_string('loggedinas', 'moodle', fullname($USER));<br />
} else {<br />
return get_string('loggedinnot');<br />
}<br />
}<br />
}<br />
?><br />
</pre><br />
Notice we are using the Moodle API here (the full Moodle API is available to us!) and also accessing the SESSION data for the currently logged in user in order to fetch their user name. I recommend the use of eclipse for editing your code or vi, you can find info about using both of these editors on Moodle docs and you will find info about browsing the Moodle source code which is the best way to become familiar with the moodle api. In particular see files lib/dmllib.php, lib/moodlelib.php, lib/access.php and possibly lib/weblib.php <br />
* Open MOODLEROOT/lib/amfphp/browser/ in your browser. You should see UserName listed in the left pane of the service browser.<br />
* Hit 'mt' to automatically generate code for a method table to tell AMFPHP what methods are available in your class and their access level. The generated code will look like this :<br />
<pre><br />
$this->methodTable = array(<br />
"loggedInAs" => array(<br />
"description" => "No description given.",<br />
"arguments" => array(),<br />
"access" => "private"<br />
)<br />
);<br />
</pre><br />
<br />
* As the service browser says we must copy and paste this code into the constructor of our service class. Our service class code will look like this after adding a constructor function and editing the automatically generated method table :<br />
<br />
<pre><br />
<?php<br />
class UserName {<br />
function UserName(){<br />
$this->methodTable = array(<br />
"loggedInAs" => array(<br />
"description" => "Returns string indicating whether user is logged in.",<br />
"arguments" => array(),<br />
"access" => "remote"<br />
)<br />
);<br />
}<br />
function loggedInAs() {<br />
global $USER;<br />
if (isguestuser()){<br />
return get_string('loggedinasguest', 'moodle');<br />
}else if (isloggedin()){<br />
return get_string('loggedinas', 'moodle', fullname($USER));<br />
} else {<br />
return get_string('loggedinnot');<br />
}<br />
}<br />
}<br />
?><br />
</pre><br />
<br />
===Test Movie===<br />
<br />
To create a test movie that will access this service function then :<br />
<br />
* open the Flash IDE.<br />
* make sure you have installed [[#Installing_Flash_Remoting_Components_in_Your_Flash_Editor|the remoting extensions as detailed as above.]]<br />
* add a 'dynamic' text box with instance name 'displaytext' to the stage on Frame 1.<br />
* open the service browser at MOODLEROOT/lib/amfphp/browser/ and click on 'code'<br />
* in the text box at the bottom of the page enter UserName and then press 'Save to Disk'. If this doesn't work it is because your web server does not have write access to write to the directory, instead you can copy and paste the code into an editor and save it as MOODLEROOT/lib/src/UserName/UserName.as<br />
* edit the code in MOODLEROOT/lib/src/UserName/UserName.as and you need to tell the service what to do when Moodle returns it's results. Replace the handleLoggedInAs function with :<br />
<pre><br />
function handleLoggedInAs(re:ResultEvent)<br />
{<br />
_root.displaytext.text = re.result;<br />
}<br />
</pre><br />
* Copy and paste this code onto frame 1.<br />
<pre><br />
un = new UserName();<br />
un.loggedInAs();<br />
</pre><br />
<br />
Now from Control / Debug Movie you can open the movie in debug mode, press the green play button to start the movie (it will be paused initially) and you will see 'Please wait..' and then, 'You are not logged in.'<br />
<br />
In your web browser you can open up MOODLEROOT/lib/amfphp/src/UserName/UserName.swf If you are logged into Moodle in that web browser you will see who you are logged in as. If there is a Moodle sesssion, the sesssion info is available to your service code in just the same way that it is in in a php script that generates html.<br />
<br />
==Flash IDE built in panels==<br />
<br />
Don't waste too much time with the built in panels in the IDE - the NetConnection debugger and the Service Browser. The NetConnection debugger doesn't seem to work reliably and the service browser is not necessary amfphp has one built in which will work better for you. For debugging services use plenty of trace statements in Flash.<br />
<br />
==A Second Service and Movie To View And Set Preferences for a User==<br />
<br />
Create a new fla called User.fla, a copy of UserName.fla. And edit the following on the stage :<br />
<br />
* Move the textbox to the top of the stage and rename it loggedinas<br />
* add some static text 'User Preferences :' below the text box<br />
* drag and drop a 'List' component from the 'Components' panel (from the UI section) onto the stage.<br />
* manually resize the list box to fill the available stage space by dragging the sides of the component.<br />
* name the list component settings.<br />
* add another text box and change it to an input text box with instance name 'setting'<br />
* add a button with instance name 'save'.<br />
<br />
Then your stage should look something like this :<br />
<br />
[[Image:amfphpstage.jpg]]<br />
<br />
===frame 1 code===<br />
<br />
Put the following code on frame 1 of the movie :<br />
<br />
<pre><br />
user = new User();<br />
user.loggedInAs();<br />
user.configSettings();<br />
lo = new Object();<br />
lo.change = function(evt){<br />
//user.getConfigSetting(evt.target.value);<br />
user.getConfigSetting(evt.target.value);<br />
}<br />
settings.addEventListener("change", lo);<br />
save.label = 'Save';<br />
buttonlo = new Object();<br />
buttonlo.click = function(evt){<br />
//user.getConfigSetting(evt.target.value);<br />
user.setConfigSetting(_root.settings.value, _root.setting.text);<br />
}<br />
save.addEventListener("click", buttonlo);<br />
</pre><br />
<br />
===User.as code===<br />
<br />
And save the following code in User.as in the same directory as User.fla<br />
<br />
<pre><br />
import mx.remoting.*;<br />
import mx.rpc.*;<br />
import mx.utils.Delegate;<br />
import mx.remoting.debug.NetDebug;<br />
<br />
class User<br />
{<br />
//Change the gateway URL as needed<br />
private var gatewayUrl:String = "***MOODLEROOT***/lib/amfphp/gateway.php";<br />
private var service:Service;<br />
<br />
function User()<br />
{<br />
NetDebug.initialize();<br />
this.service = new Service(this.gatewayUrl, null, "User");<br />
<br />
}<br />
<br />
<br />
//Returns string indicating whether a user is logged in. <br />
function loggedInAs()<br />
{<br />
var pc:PendingCall = service.loggedInAs();<br />
pc.responder = new RelayResponder(this, "handleLoggedInAs", "handleRemotingError");<br />
_root.loggedinas.text = 'Loading...';<br />
}<br />
<br />
//Returns an array of config settings you can set. Not accessible from Flash. <br />
function configSettings()<br />
{<br />
var pc:PendingCall = service.configSettings();<br />
pc.responder = new RelayResponder(this, "handleConfigSettings", "handleRemotingError");<br />
}<br />
<br />
//Returns a value of a config setting. <br />
function getConfigSetting(name)<br />
{<br />
var pc:PendingCall = service.getConfigSetting(name);<br />
pc.responder = new RelayResponder(this, "handleGetConfigSetting", "handleRemotingError");<br />
_root.setting.text = 'Loading...';<br />
}<br />
//Returns a value of a config setting. <br />
function setConfigSetting(name, value)<br />
{<br />
var pc:PendingCall = service.setConfigSetting(name, value);<br />
}<br />
<br />
function handleLoggedInAs(re:ResultEvent)<br />
{<br />
_root.loggedinas.text = re.result;<br />
}<br />
<br />
function handleConfigSettings(re:ResultEvent)<br />
{<br />
_root.settings.dataProvider = re.result;<br />
<br />
}<br />
<br />
function handleGetConfigSetting(re:ResultEvent)<br />
{<br />
_root.setting.text = re.result;<br />
}<br />
<br />
function handleRemotingError( fault:FaultEvent ):Void <br />
{<br />
NetDebug.trace({level:"None", message:"Error: " + fault.fault.faultstring });<br />
}<br />
}<br />
</pre><br />
<br />
===Service code===<br />
<br />
And save the following code in lib/amfphp/services/User.php<br />
<br />
<pre><br />
<?php<br />
include(AMFPHP_BASE . "util/MethodTable.php");<br />
class User{<br />
function User(){<br />
$this->methodTable = MethodTable::create(__FILE__);<br />
}<br />
<br />
/**<br />
* Returns string indicating whether a user is logged in.<br />
* @access remote<br />
*/<br />
function loggedInAs() {<br />
global $USER;<br />
if (isguestuser()){<br />
return get_string('loggedinasguest', 'moodle');<br />
}else if (isloggedin()){<br />
return get_string('loggedinas', 'moodle', fullname($USER));<br />
} else {<br />
return get_string('loggedinnot');<br />
}<br />
}<br />
/**<br />
* Returns an array of config settings you can set.<br />
* @access remote<br />
*/<br />
function configSettings() {<br />
return array_keys(get_user_preferences());<br />
<br />
}<br />
/**<br />
* Returns a value of a config setting.<br />
* @param string name<br />
* @access remote<br />
*/<br />
function getConfigSetting($name) {<br />
$name = clean_param($name, PARAM_ALPHAEXT);<br />
return get_user_preferences($name);<br />
}<br />
<br />
/**<br />
* sets a value of a config setting.<br />
* @param string name<br />
* @param string value<br />
* @access remote<br />
*/<br />
function setConfigSetting($name, $value) {<br />
$name = clean_param($name, PARAM_ALPHAEXT);<br />
$value = clean_param($value, PARAM_NOTAGS);<br />
return set_user_preference($name, $value);<br />
}<br />
}<br />
?><br />
</pre><br />
<br />
===Movie Operation===<br />
<br />
When you are logged in this movie will list all user preferences for you. User preference names are listed in the list box and when you click on them then the value is displayed in the text box to the right. You can edit the contents of the text box and press 'Save' to save the new value. Be careful what values you save if this is a real production server logged in to a real users account. A screen shot is shown below.<br />
<br />
[[Image:amfphpmovie.jpg]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Template:AMFPHP&diff=45536
Template:AMFPHP
2008-10-20T15:39:42Z
<p>Jamiesensei: New page: <div class="sideblock right" style="width: 12em;"> <div class="header">AMFPHP in Moodle</div> <div class="content"> * Original ActionScript 2.0 tutorial * [[AMF Mood...</p>
<hr />
<div><div class="sideblock right" style="width: 12em;"><br />
<div class="header">AMFPHP in Moodle</div><br />
<div class="content"><br />
* [[Development:AMFPHP|Original ActionScript 2.0 tutorial]]<br />
* [[AMF Moodle|New ActionScript 3.0 (Flash CS3 and Flex) page]]<br />
</div><br />
</div></div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:AMFPHP&diff=45531
Development:AMFPHP
2008-10-20T15:27:12Z
<p>Jamiesensei: </p>
<hr />
<div><div class="sideblock right" style="width: 12em;"><br />
<div class="header">Credits</div><br />
<div class="content"><br />
Please note: If you are using ActionScript 3.0 (Flash CS3 and Flex), please refer to [[AMF Moodle]]</div><br />
</div><br />
<br />
<br />
<br />
<br />
==What is AMFPHP?==<br />
<br />
AMFPHP is a widely used OS remoting server that allows your Flash movies to send and receive data to and from your web server and interact with your PHP scripts. Data to/from PHP is automatically converted into the appropriate Flash variable type and communication is fast because the format data is sent in is compact and is handled efficiently by the Flash player (large XML files can sometimes take time to be processed).<br />
<br />
===AMFPHP 1.9.beta===<br />
<br />
AMFPHP is now in version 1.9.beta (30th September 2008). It is fully compatible with AMF0, Flash 6,7 and 8 ActionScript 2.0, and now with AMF3, Flash 9 ActionScript 3.0. Interfacing with AMFPHP using ActionScript 3.0 has a couple of advantages.<br />
<br />
* There are no ActionScript classes to download and install - Flash CS3 and Flex come with all the remoting classes you need as standard.<br />
<br />
* AMF3 is compressed, meaning it is impressively fast and can now outperform other RPC methods.<br />
<br />
===AMFPHP for Flash/Flex ActionScript 3.0===<br />
<br />
If you want to develop applications and services for ActionScript 3.0 using Flash or the Flex framework, please check this page: [[AMF Moodle]]<br />
<br />
==Using AMFPHP with Moodle==<br />
<br />
* I downloaded AMFPHP 1.2.6 [http://downloads.sourceforge.net/amfphp/amfphp-1.2.6.zip?use_mirror=nchc get it here] and installed it in my moodle site under MOODLEROOT/lib/amfphp/ So that gateway.php is at MOODLEROOT/lib/amfphp/gateway.php<br />
* In gateway.php I :<br />
** added <code>include_once "../../config.php";</code> to the beginning of the file.<br />
** I edited the call to <code>$gateway->setBaseClassPath</code> so it reads <code>$gateway->setBaseClassPath($CFG->libdir."/amfphp/services/");</code><br />
<br />
==Installing Flash Remoting Components in Your Flash Editor==<br />
<br />
[http://www.adobe.com/products/flashremoting/downloads/components/ You must download an extension to the Flash editor here. This installs the necessary code libraries for Flash to communicate with a Flash remoting server]. Restart your Flash editor after installing the components. You should then see NetConnection Debugger under the Window menu->Other Panels. If necessary more info can be found [http://www.amfphp.org/docs/installingremoting.html on the amfphp site here.]<br />
<br />
===Flash Remoting with Flash CS3===<br />
<br />
See here for info on using [http://www.rabidgadfly.com/?p=52 AS2 remoting with Flash CS3]. CS3 has remoting built in in AS3 but the examples on this page use AS2.<br />
<br />
==Testing, testing, 1, 2, 3==<br />
<br />
===Files Created By Steps in this Tutorial===<br />
<br />
For those who are impatient and don't want to follow these step by step instructions you can find [http://jamiep.org/amfphp/amfphp.zip the files created in this tutorial here.] Unzip them in lib/amfphp/ and they should automatically install into src and the services directory.<br />
<br />
===Test service===<br />
<br />
* Create a new file under lib/amfphp/services/ called UserName.php<br />
* Copy and paste the following code :<br />
<pre><br />
<?php<br />
class UserName {<br />
function loggedInAs() {<br />
global $USER;<br />
if (isguestuser()){<br />
return get_string('loggedinasguest', 'moodle');<br />
}else if (isloggedin()){<br />
return get_string('loggedinas', 'moodle', fullname($USER));<br />
} else {<br />
return get_string('loggedinnot');<br />
}<br />
}<br />
}<br />
?><br />
</pre><br />
Notice we are using the Moodle API here (the full Moodle API is available to us!) and also accessing the SESSION data for the currently logged in user in order to fetch their user name. I recommend the use of eclipse for editing your code or vi, you can find info about using both of these editors on Moodle docs and you will find info about browsing the Moodle source code which is the best way to become familiar with the moodle api. In particular see files lib/dmllib.php, lib/moodlelib.php, lib/access.php and possibly lib/weblib.php <br />
* Open MOODLEROOT/lib/amfphp/browser/ in your browser. You should see UserName listed in the left pane of the service browser.<br />
* Hit 'mt' to automatically generate code for a method table to tell AMFPHP what methods are available in your class and their access level. The generated code will look like this :<br />
<pre><br />
$this->methodTable = array(<br />
"loggedInAs" => array(<br />
"description" => "No description given.",<br />
"arguments" => array(),<br />
"access" => "private"<br />
)<br />
);<br />
</pre><br />
<br />
* As the service browser says we must copy and paste this code into the constructor of our service class. Our service class code will look like this after adding a constructor function and editing the automatically generated method table :<br />
<br />
<pre><br />
<?php<br />
class UserName {<br />
function UserName(){<br />
$this->methodTable = array(<br />
"loggedInAs" => array(<br />
"description" => "Returns string indicating whether user is logged in.",<br />
"arguments" => array(),<br />
"access" => "remote"<br />
)<br />
);<br />
}<br />
function loggedInAs() {<br />
global $USER;<br />
if (isguestuser()){<br />
return get_string('loggedinasguest', 'moodle');<br />
}else if (isloggedin()){<br />
return get_string('loggedinas', 'moodle', fullname($USER));<br />
} else {<br />
return get_string('loggedinnot');<br />
}<br />
}<br />
}<br />
?><br />
</pre><br />
<br />
===Test Movie===<br />
<br />
To create a test movie that will access this service function then :<br />
<br />
* open the Flash IDE.<br />
* make sure you have installed [[#Installing_Flash_Remoting_Components_in_Your_Flash_Editor|the remoting extensions as detailed as above.]]<br />
* add a 'dynamic' text box with instance name 'displaytext' to the stage on Frame 1.<br />
* open the service browser at MOODLEROOT/lib/amfphp/browser/ and click on 'code'<br />
* in the text box at the bottom of the page enter UserName and then press 'Save to Disk'. If this doesn't work it is because your web server does not have write access to write to the directory, instead you can copy and paste the code into an editor and save it as MOODLEROOT/lib/src/UserName/UserName.as<br />
* edit the code in MOODLEROOT/lib/src/UserName/UserName.as and you need to tell the service what to do when Moodle returns it's results. Replace the handleLoggedInAs function with :<br />
<pre><br />
function handleLoggedInAs(re:ResultEvent)<br />
{<br />
_root.displaytext.text = re.result;<br />
}<br />
</pre><br />
* Copy and paste this code onto frame 1.<br />
<pre><br />
un = new UserName();<br />
un.loggedInAs();<br />
</pre><br />
<br />
Now from Control / Debug Movie you can open the movie in debug mode, press the green play button to start the movie (it will be paused initially) and you will see 'Please wait..' and then, 'You are not logged in.'<br />
<br />
In your web browser you can open up MOODLEROOT/lib/amfphp/src/UserName/UserName.swf If you are logged into Moodle in that web browser you will see who you are logged in as. If there is a Moodle sesssion, the sesssion info is available to your service code in just the same way that it is in in a php script that generates html.<br />
<br />
==Flash IDE built in panels==<br />
<br />
Don't waste too much time with the built in panels in the IDE - the NetConnection debugger and the Service Browser. The NetConnection debugger doesn't seem to work reliably and the service browser is not necessary amfphp has one built in which will work better for you. For debugging services use plenty of trace statements in Flash.<br />
<br />
==A Second Service and Movie To View And Set Preferences for a User==<br />
<br />
Create a new fla called User.fla, a copy of UserName.fla. And edit the following on the stage :<br />
<br />
* Move the textbox to the top of the stage and rename it loggedinas<br />
* add some static text 'User Preferences :' below the text box<br />
* drag and drop a 'List' component from the 'Components' panel (from the UI section) onto the stage.<br />
* manually resize the list box to fill the available stage space by dragging the sides of the component.<br />
* name the list component settings.<br />
* add another text box and change it to an input text box with instance name 'setting'<br />
* add a button with instance name 'save'.<br />
<br />
Then your stage should look something like this :<br />
<br />
[[Image:amfphpstage.jpg]]<br />
<br />
===frame 1 code===<br />
<br />
Put the following code on frame 1 of the movie :<br />
<br />
<pre><br />
user = new User();<br />
user.loggedInAs();<br />
user.configSettings();<br />
lo = new Object();<br />
lo.change = function(evt){<br />
//user.getConfigSetting(evt.target.value);<br />
user.getConfigSetting(evt.target.value);<br />
}<br />
settings.addEventListener("change", lo);<br />
save.label = 'Save';<br />
buttonlo = new Object();<br />
buttonlo.click = function(evt){<br />
//user.getConfigSetting(evt.target.value);<br />
user.setConfigSetting(_root.settings.value, _root.setting.text);<br />
}<br />
save.addEventListener("click", buttonlo);<br />
</pre><br />
<br />
===User.as code===<br />
<br />
And save the following code in User.as in the same directory as User.fla<br />
<br />
<pre><br />
import mx.remoting.*;<br />
import mx.rpc.*;<br />
import mx.utils.Delegate;<br />
import mx.remoting.debug.NetDebug;<br />
<br />
class User<br />
{<br />
//Change the gateway URL as needed<br />
private var gatewayUrl:String = "***MOODLEROOT***/lib/amfphp/gateway.php";<br />
private var service:Service;<br />
<br />
function User()<br />
{<br />
NetDebug.initialize();<br />
this.service = new Service(this.gatewayUrl, null, "User");<br />
<br />
}<br />
<br />
<br />
//Returns string indicating whether a user is logged in. <br />
function loggedInAs()<br />
{<br />
var pc:PendingCall = service.loggedInAs();<br />
pc.responder = new RelayResponder(this, "handleLoggedInAs", "handleRemotingError");<br />
_root.loggedinas.text = 'Loading...';<br />
}<br />
<br />
//Returns an array of config settings you can set. Not accessible from Flash. <br />
function configSettings()<br />
{<br />
var pc:PendingCall = service.configSettings();<br />
pc.responder = new RelayResponder(this, "handleConfigSettings", "handleRemotingError");<br />
}<br />
<br />
//Returns a value of a config setting. <br />
function getConfigSetting(name)<br />
{<br />
var pc:PendingCall = service.getConfigSetting(name);<br />
pc.responder = new RelayResponder(this, "handleGetConfigSetting", "handleRemotingError");<br />
_root.setting.text = 'Loading...';<br />
}<br />
//Returns a value of a config setting. <br />
function setConfigSetting(name, value)<br />
{<br />
var pc:PendingCall = service.setConfigSetting(name, value);<br />
}<br />
<br />
function handleLoggedInAs(re:ResultEvent)<br />
{<br />
_root.loggedinas.text = re.result;<br />
}<br />
<br />
function handleConfigSettings(re:ResultEvent)<br />
{<br />
_root.settings.dataProvider = re.result;<br />
<br />
}<br />
<br />
function handleGetConfigSetting(re:ResultEvent)<br />
{<br />
_root.setting.text = re.result;<br />
}<br />
<br />
function handleRemotingError( fault:FaultEvent ):Void <br />
{<br />
NetDebug.trace({level:"None", message:"Error: " + fault.fault.faultstring });<br />
}<br />
}<br />
</pre><br />
<br />
===Service code===<br />
<br />
And save the following code in lib/amfphp/services/User.php<br />
<br />
<pre><br />
<?php<br />
include(AMFPHP_BASE . "util/MethodTable.php");<br />
class User{<br />
function User(){<br />
$this->methodTable = MethodTable::create(__FILE__);<br />
}<br />
<br />
/**<br />
* Returns string indicating whether a user is logged in.<br />
* @access remote<br />
*/<br />
function loggedInAs() {<br />
global $USER;<br />
if (isguestuser()){<br />
return get_string('loggedinasguest', 'moodle');<br />
}else if (isloggedin()){<br />
return get_string('loggedinas', 'moodle', fullname($USER));<br />
} else {<br />
return get_string('loggedinnot');<br />
}<br />
}<br />
/**<br />
* Returns an array of config settings you can set.<br />
* @access remote<br />
*/<br />
function configSettings() {<br />
return array_keys(get_user_preferences());<br />
<br />
}<br />
/**<br />
* Returns a value of a config setting.<br />
* @param string name<br />
* @access remote<br />
*/<br />
function getConfigSetting($name) {<br />
$name = clean_param($name, PARAM_ALPHAEXT);<br />
return get_user_preferences($name);<br />
}<br />
<br />
/**<br />
* sets a value of a config setting.<br />
* @param string name<br />
* @param string value<br />
* @access remote<br />
*/<br />
function setConfigSetting($name, $value) {<br />
$name = clean_param($name, PARAM_ALPHAEXT);<br />
$value = clean_param($value, PARAM_NOTAGS);<br />
return set_user_preference($name, $value);<br />
}<br />
}<br />
?><br />
</pre><br />
<br />
===Movie Operation===<br />
<br />
When you are logged in this movie will list all user preferences for you. User preference names are listed in the list box and when you click on them then the value is displayed in the text box to the right. You can edit the contents of the text box and press 'Save' to save the new value. Be careful what values you save if this is a real production server logged in to a real users account. A screen shot is shown below.<br />
<br />
[[Image:amfphpmovie.jpg]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:lib/graphlib&diff=40840
Development:lib/graphlib
2008-07-29T06:25:37Z
<p>Jamiesensei: </p>
<hr />
<div>[[Development:lib/graphlib.php]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:lib/graphlib&diff=40839
Development:lib/graphlib
2008-07-29T06:25:13Z
<p>Jamiesensei: redirect to proper page</p>
<hr />
<div>[Development:lib/graphlib.php]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_statistics_calculations&diff=39752
Development:Quiz statistics calculations
2008-07-16T04:13:41Z
<p>Jamiesensei: Undo revision 39690 by Jamiesensei (Talk)</p>
<hr />
<div>{{Moodle 2.0}}<br />
{{Quiz item analysis calculations}}<br />
<br />
==General issues==<br />
<br />
===Quizzes that allow multiple attempts===<br />
<br />
For quizzes that allow multiple attempts, by default the report should only include data from the first attempt by each student. (The data for subsequent attempts probably does not satisfy the assumptions that underlie item analysis statistics.) However, there should be an option 'Include data from all attempts', which should have a disclaimer that this may be statistically invalid either near it on screen, or possibly in the help file. (For small data sets, it may be better to include all data.)<br />
<br />
Using the first attempt also avoids problems caused by each attempt builds on last.<br />
<br />
Within the analysis, when multiple attempts per student are included, each attempt is treated as an independent attempt. (That is, we pretend each attempt was by a different student.)<br />
<br />
===Adaptive mode===<br />
<br />
Adaptive mode does not pose a problem. Item Analysis just supposes that each item in the test returns a score, and these scores are added up to get the test score. Therefore Item Analysis does not care about adaptive/non-adaptive mode. However, just to be clear, for an adaptive question, the score used in the calculation is the final score for the item, including penalties.<br />
<br />
===Certainty based marking===<br />
<br />
Similarly, should CBM, and/or negative scoring for multiple choice questions be implemented, we just use the final item score in the calculations, making sure that the formulae are not assuming that the minimum item score is zero.<br />
<br />
===Incomplete attempts===<br />
<br />
There is an issue about what you do when not all students have answered all questions. Depending on how you handle these missing items, you distort the statistics in different ways.<br />
<br />
There are basically two reasons why a student may not have answered a particular question:<br />
* they may have chosen to omit it, or<br />
* they may have run out of time, if the test is timed. In this case, omitted questions tend to be towards the end of the test.<br />
<br />
Available approaches for handling this are:<br />
<br />
# treat omitted items as having a score of 0.<br />
# exclude any attempt with missing scores from the analysis.<br />
# Analyse each question separately - and when analysing a particular question, just include students who answered that question in the analysis.<br />
<br />
I think we should implement 1 for now. This is how Moodle currently works - a blank answer is marked and receives a score of zero, and so is indistinguishable from a wrong answer. Item analysis is most important for summative tests, and the result of that question being in the test is that it gave that student a contribution of 0 marks towards their final score.<br />
<br />
===Random questions===<br />
<br />
In a quiz with random questions not all students will have attempted the same set of questions. To account for this, the analysis below distinguishes between positions in the test, and test items.<br />
<br />
==Notation used in the calculations==<br />
<br />
''Note: The only way I can think of to write this document with all the maths is to type TeX notation like $$x_i$$ even though MoodleDocs does not currently render it nicely. Maybe one day it will. In the mean time, if you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
We have a lot of students $$s \in S$$, who have completed at least one attempt on the quiz.<br />
<br />
The test has a number of positions $$p \in P$$.<br />
<br />
The test is assembled from a number of items $$i \in I$$.<br />
<br />
Because of random questions, different students may have recieved different items in different positions, so $$i(p, s)$$ is the item student $$s$$ received in position $$p$$.<br />
<br />
Let $$I_s$$ be the set of items that student $$s$$ saw. Let $$S_i$$ be the set of students who attempted item $$i$$.<br />
<br />
Each position has a maximum and minimum possible contribution to the test score, $$x_p(min)$$ and $$x_p(max)$$. At the moment in Moodle, $$x_p(min)$$ is always zero, but we cannot assume that will continue to be the case. $$x_p(max)$$ is database column quiz_question_instances.grade.<br />
<br />
Then, each student achieved an actual score $$x_p(s)$$ on the item in position $$p$$. So $$x_p(min) \le x_p(s) \le x_p(max)$$.<br />
<br />
$$x_p(s)$$ should be measured on the same scale as the final score for the quiz. That is, scaled by quiz_question_instances.grade, but that is already how grades are stored in mdl_question_states.<br />
<br />
We can also think of the student's score on a particular item $$x_i(s)$$. However, in this case, the score should be measured out of the Default question grade for this question. Also, there is a $$x_i(max)$$ ( = Default question grade) and $$x_i(min)$$ (currently, zero, but if we allow negative marking, that will change).<br />
<br />
$$x_{i(p, s)}(s) = x_p(s)\frac{x_i(max)}{x_p(max)}$$.<br />
<br />
Each student has a total score <br />
<br />
$$\displaystyle T_s = \sum_{p \in P} x_p(s)$$<br />
<br />
Similarly, there are the maximum and minimum possible test scores<br />
<br />
$$\displaystyle T_{max} = \sum_{p \in P} x_p(max)$$<br />
<br />
and <br />
<br />
$$\displaystyle T_{min} = \sum_{p \in P} x_p(min)$$<br />
<br />
===Intermediate calculations===<br />
<br />
To simplify the form of the formulas below, we need some intermediate calculated quantities, derived from the ones above.<br />
<br />
Student's rest of test score for a position: $$X_p(s) = T_s - x_p(s)$$.<br />
<br />
For any quantity that depends on position (for example $$x_p$$ or $$X_p$$), it's average is denoted with an overbar, and is an average over all students, so <br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
When a quantity is a property of an item, a bar denotes an average over all students who attempted that item, so<br />
<br />
$$\displaystyle \bar{x}_i = \frac{1}{S_i} \sum_{s \in S_i} x_i(s)$$.<br />
<br />
Similarly we have the variance of a quantity depending on position:<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
and for a quantity depending on items:<br />
<br />
$$\displaystyle V(x_i) = \frac{1}{S_i - 1} \sum_{s \in S_i} (x_i(s) - \bar{x}_i)^2$$.<br />
<br />
Finally, we need co-variances of two quantites, for example:<br />
<br />
$$\displaystyle C(x_p, X_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)(X_p(s) - \bar{X}_p)$$<br />
<br />
$$\displaystyle C(x_i, X_i) = \frac{1}{S_i - 1} \sum_{s \in S_i} (x_i(s) - \bar{x}_i)(X_i(s) - \bar{X}_i)$$.<br />
<br />
==Position statistics==<br />
<br />
===Facility index===<br />
<br />
This is the average score on the item, expressed as a percentage:<br />
<br />
$$\displaystyle F_p = 100\frac{\bar{x}_p - x_p(min)}{x_p(max) - x_p(min)}$$.<br />
<br />
The higher the facility index, the easier the question is (for this cohort of students).<br />
<br />
===Standard deviation===<br />
<br />
Again expressed on a percentage scale:<br />
<br />
$$\displaystyle SD_p = 100\frac{\sqrt{V(x_p)}}{x_p(max) - x_p(min)}$$.<br />
<br />
===Discrimination index===<br />
<br />
This is the product moment correlation coefficient between $$x_p$$ and $$X_p$$, expressed on a percentage scale. That is,<br />
<br />
$$\displaystyle D_p = 100r(x_p, X_p) = 100\frac{C(x_p, X_p)}{\sqrt{V(x_P) V(X_p)}}$$.<br />
<br />
The idea is that for a good question (or at least a question that fits in with the other questions in the test), students who have scored highly on the other parts of the test should also have scored highly on this question, so the score for the question and the score for the test as a whole should be well correlated.<br />
<br />
The weakness of this statistic is that, unless the facility index is 50%, it is impossible for the discrimination index to be 100%, or, to put it another way, if $$F_p$$ is close to 0% or 100%, $$D_p$$ will always be very small. That makes interpreting this statistic difficult.<br />
<br />
===Discriminative efficiency===<br />
<br />
This gets around that weakness in the discrimination index by expressing $$C(x_p, X_p)$$ as a percentage of the maximum value it could have taken given the scores the students got on this question, and the test as a whole. That is:<br />
<br />
$$\displaystyle DE_p = 100\frac{C(x_p, X_p)}{C_{max}(x_p, X_p)}$$<br />
<br />
where $$C_{max}(x_p, X_p)$$ is defined as follows:<br />
<br />
When you compute $$C(x_p, X_p)$$, you do the sum <br />
<br />
$$\displaystyle C(x_p, X_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)(X_p(s) - \bar{X}_p)$$<br />
<br />
which involves a term for each student combining their question score and rest of test score. That is, you start with an array of $$x_p(s)$$ with an array of corresponding $$X_p(s)$$, one for each $$s$$. To compute $$C_{max}(x_p, X_p)$$, you just sort these two arrays before applying the above formula. That is, for the purpose of computing $$C_{max}$$, you pretend that the first student scored the lowest $$x_p$$ and the lowest $$X_p$$, the second student scored the second lowest $$x_p$$ and the second lowest $$X_p$$, and so on to the last student, who scored the highest $$x_p$$ and $$X_p$$.<br />
<br />
===Intended question weight===<br />
<br />
How much this question was supposed to contribute to determining the overall test score.<br />
<br />
$$\displaystyle IQW_p = 100\frac{x_p(max) - x_p(min)}{T_{max} - T_{min}}$$.<br />
<br />
===Effective question weight===<br />
<br />
This is an estimate of what proportion of the variance in the students' test scores is due this question.<br />
<br />
$$\displaystyle EQW_p = 100\frac{\sqrt{C(x_p, T)}}{\sum_{p \in P}\sqrt{C(x_p, T)}}$$.<br />
<br />
==Item statistics==<br />
<br />
===Number of attempts===<br />
<br />
The number of students who got this question as part of a quiz attempt. This is just $$S_i$$.<br />
<br />
===Random guess score===<br />
<br />
This is the score that the student would have got by guessing randomly. It depends on the question type. For types like shortanswer, it is 0 - or the score associated with answer '*', if there is one.<br />
<br />
For multiple choice questions (including matching, truefalse, etc.) it is the average score over all the possible choices.<br />
<br />
(There should probably be a method in the question type class to compute this.)<br />
<br />
===Facility index===<br />
<br />
$$\displaystyle F_i = 100\frac{\bar{x}_i - x_i(min)}{x_i(max) - x_i(min)}$$.<br />
<br />
===Standard deviation===<br />
<br />
$$\displaystyle SD_i = 100\frac{\sqrt{V(x_i)}}{x_i(max) - x_i(min)}$$.<br />
<br />
===Discrimination index===<br />
<br />
$$\displaystyle D_i = 100r(x_i, T) = 100\frac{C(x_i, T)}{\sqrt{V(x_i) V(T)}}$$.<br />
<br />
(It is not possible to define $$X_i$$ because it is conceivable that the same item may have been chosen in different positions with different weights, so we substitute $$T$$ instead.)<br />
<br />
===Discriminative efficiency===<br />
<br />
$$\displaystyle DE_i = 100\frac{C(x_i, T)}{C_{max}(x_i, T)}$$.<br />
<br />
==Test statistics==<br />
<br />
===Number of Attempts===<br />
<br />
This is $$S$$.<br />
<br />
Note that depending on the options, we may be counting one or all attempts per student.<br />
<br />
===Mean Score===<br />
<br />
Test mean $$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
===Median Score===<br />
<br />
Sort all the $$T_s$$, and take the middle one if S is odd, or the average of the two middle ones if S is even.<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
Probably of limited interest, but included for completeness. Skewness is a measure of the asymmetry in a distribution. Kurtosis - imagine a normal distribution. Kurtosis tells you if your distribution has more of a bulge, but thinner tails, or vice-versa.<br />
<br />
First calculate:<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
Then compute<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = V(T)$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then<br />
<br />
Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
===Coefficient of Internal Consistency===<br />
<br />
This is on a percentage scale<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
===Error Ratio===<br />
<br />
Also a percentage.<br />
<br />
$$\displaystyle ER = 100 \sqrt{1 - \frac{CIC}{100}}$$<br />
<br />
===Standard Error===<br />
<br />
$$\displaystyle SE = \frac{ER}{100}SD$$<br />
<br />
These last three are to do with estimating how reliable the test scores are. If you take the view that the score the student got on the test on the day is a combination of their actual ability and a random error (how lucky they were on the day of the test), the the standard error is an estimate of the luck factor. So if SE ~= 10, and the student scored 60, then you can be quite confident that their actual ability is between 50 and 70.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Installing_MSSQL_for_PHP&diff=39737
Installing MSSQL for PHP
2008-07-15T10:55:33Z
<p>Jamiesensei: /* Installation overview */</p>
<hr />
<div>{{Moodle 1.7}}<br />
== Introduction ==<br />
<br />
This short manual is suitable if you are trying to run Moodle 1.7 (and upwards) using the SQL*Server (MSSQL) RDBMS. Steps detailed below must be performed '''before''' installing Moodle itself.<br />
<br />
First of all, minimum required version of MSSQL has been stabilised to MSSQL 2005 (v.9), although it '''might work with MSSQL 2000 (v.8) or newer'''. All the development process has been performed using MSSQL 2005 and there could be some '''unknown problems''' with previous releases.<br />
<br />
While PHP comes with one, more or less, standard extension (mssql) that provides access to MSSQL databases, early we found some hard limits on it. Basically such default extension has some limits that prevent us to use it at all (you can find more info about these problems [[Development:XMLDB problems#MSSQL, PHP, UTF-8 and UCS-2|here]]).<br />
<br />
So, in order to allow PHP (i.e. Moodle) to access to MSSQL DBs properly we have to install a '''mssql extension alternative''' to save us from the problems related above. See the sections below for details about the various options.<br />
<br />
== Installation overview ==<br />
<br />
1. Get MSSQL Server installed and running. ([http://www.microsoft.com/sql/editions/express/default.mspx A free limited version, SQL Server Express Edition] is available for testing.)<br />
:Make sure that you choose mixed authentication (Windows and local accounts) to keep things simpler later. You'll be asked to define the "sa" account password (it's the default System Administrator account which has full access to all databases by default).<br />
<br />
2. Make sure MS SQL Server can accept incoming TCP/IP connections on port 1433 (the standard one).<br />
:You might need to explicitly allow this in your Windows firewall (see the Control Panel). You may also need to edit options in the :'''SQL Server Configuration Manager''' -> '''Network Configuration''' -> '''Protocols''' -> '''TCP/IP enabled'''<br />
<br />
3. Open the "SQL Server Management Studio" and create a new empty database. If you are using the "sa" account then you don't need to do anything else here.<br />
<br />
4. Configure these settings in your created (and still empty) database:<br />
<br />
:* ANSI NULLS Enabled = true (ALTER DATABASE mdl_HEAD SET ANSI_NULLS ON GO)<br />
:* Quoted Identifiers Enabled = true (ALTER DATABASE mdl_HEAD SET QUOTED_IDENTIFIER ON GO)<br />
<br />
5. Get PHP installed with a web server. Unless you want to do it under IIS or some other way, the packages on the [http://download.moodle.org Moodle download page] are a good solution.<br />
<br />
6. Choose one of the following specific sections for your server to install the '''mssql extension alternative''' installed and running properly on your PHP box.<br />
<br />
7. Set the following settings in your php.ini file<br />
:* mssql.textlimit = 20971520<br />
:* mssql.textsize = 20971520<br />
:Also, don't forget to set one of the following '''alternatives''', in order to get all the data properly "slashed":<br />
:* magic_quotes_gpc = Off '''or'''<br />
:* magic_quotes_gpc = On '''and''' magic_quotes_sybase = On <br />
<br />
8. With all this properly configured, you can continue with a [[Installing Moodle|standard Moodle installation]].<br />
<br />
== Using FreeTDS on Unix ==<br />
<br />
<p class="note">'''Important Note 1:''' Due to [http://bugs.php.net/bug.php?id=39213 one bug in PHP] it's highly recommendable to use PHP > 5.1.6 with FreeTDS ([http://tracker.moodle.org/browse/MDL-11810 more info]).</p><br />
<br />
<p class="note">'''Important Note 2:''' Due to one bug in how FreeTDS handles nulls and empty values for some text types it's highly recommendable to use a recent version of FreeTDS (0.64 + official patches) ([http://tracker.moodle.org/browse/MDL-11810#action_38005 more info]).</p><br />
<br />
If you web server is on Linux or some other flavour of Unix, try FreeTDS, http://www.freetds.org (documentation at http://www.freetds.org/docs.html)<br />
<br />
Note that the download link above is a '''source download''', so you will need to install and compile it properly.<br />
<br />
Once downloaded and uncompressed you must '''"configure, make, make install"''' it. This will deploy some stuff in the "/usr/local" directory of your machine, mainly:<br />
* /usr/local/etc: where the freetds conf files will reside.<br />
* /usr/local/lib: where compiled libraries will reside.<br />
* /usr/local/bin: where some executables will reside.<br />
<br />
Then, you must configure FreeTDS to point to your MSSQL DB server. To do so, edit (or create) the /usr/local/etc/freetds.conf file and put in there exclusively these lines:<br />
<br />
[global]<br />
host = xxx.xxx.xxx.xxx (ip of the MSSQL server)<br />
port = 1433<br />
client charset = UTF-8<br />
tds version = 7.0<br />
text size = 20971520<br />
<br />
At this point, and previously to build the '''mssql extension alternative''', you can test conectivity with your MSSQL DB using the "/usr/local/bin/tsql" executable. Just do this:<br />
<br />
tsql -S serverhost -U dbowner -P dbpassword<br />
<br />
If everything is ok, you'll get this output:<br />
<br />
locale is "es_ES.UTF-8"<br />
locale charset is "UTF-8"<br />
1><br />
<br />
just type, for example:<br />
<br />
sp_help sysobjects<br />
<br />
and you might get some output from DB. Finally type:<br />
<br />
exit<br />
<br />
and you'll be out from the "tsql" command line interpreter.<br />
<br />
Now that you've successfully built, configured and tested FreeTDS it is time to create the '''mssql extension alternative''' that will provide us with the capacity of handling MSSQL DBs from within Moodle. To do so, you'll need configure your PHP server adding this new option to the usual ones:<br />
<br />
--with-mssql=/usr/local/ <br />
<br />
then, after the standard "make and make install" steps, your PHP server will be built with MSSQL support provided by FreeTDS.<br />
<br />
Finally, configure your Moodle config.php with this DB related info and continue with a normal Moodle install:<br />
<br />
$CFG->dbtype = 'mssql_n'; // Required<br />
$CFG->dbhost = 'xxx.xxx.xxx.xxx'; // IP of the MSSQL server (also proper hostname is allowed)<br />
$CFG->dbname = 'moodle'; // or whatever you called the database you created<br />
$CFG->dbuser = 'yourusername'; // I usually use the 'sa' account (dbowner perms are enough)<br />
$CFG->dbpass = 'yourpassword';<br />
$CFG->dbpersist = false;<br />
$CFG->prefix = 'mdl_'; //Prefix, you can change it, but '''never''' leave it blank.<br />
<br />
== Using FreeTDS on Windows ==<br />
<br />
If your web server is on Windows, use '''php_dblib.dll''' from Frank Kromann ([http://kromann.info/article.php?Id=11062598797760000 original details here]). Despite the name, it's FreeTDS compiled for Windows. Many thanks to Frank for providing this DLL. Here's how to set it up:<br />
<br />
1. Download the appropriate copy of php_dblib.dll from the list below, and save it into your /PHP/ext directory. (php_dblib.dll does not appear to be available for PHP 4.x at this time.) <br />
<br />
<br />
[http://kromann.info/php5_1-Release_TS/php_dblib.dll php_dblib.dll for PHP 5.1.x]<br />
<br />
[http://kromann.info/php5_2-Release_TS/php_dblib.dll php_dblib.dll for PHP 5.2.x]<br />
<br />
[http://kromann.info/php6-Release_TS/php_dblib.dll php_dblib.dll for PHP 6.x]<br />
<br />
<br />
2. FreeTDS requires the .NET Framework v1.1 to be installed. You can [http://www.microsoft.com/downloads/details.aspx?FamilyID=262d25e3-f589-4842-8157-034d1e7cf3a3&DisplayLang=en download it from the Microsoft website] along with its [http://www.microsoft.com/downloads/details.aspx?FamilyID=a8f5654f-088e-40b2-bbdb-a83353618b38&DisplayLang=en service pack]. Alternatively, if you do not wish to install this framework, you can [http://kromann.info/ms-libs/msvcr71.dll download the required DLL] from Frank's site, and save it into your /PHP root directory.<br />
<br />
<br />
3. Edit your /PHP/php.ini file and add this line:<br />
<br />
extension=php_dblib.dll <br />
<br />
Make sure that any lines referring to the php_mssql.dll extension are DISABLED (commented out).<br />
<br />
<br />
4. Create a file called C:\freetds.conf with:<br />
<br />
[global]<br />
host = xxx.xxx.xxx.xxx (ip of the MSSQL server)<br />
port = 1433<br />
client charset = UTF-8<br />
tds version = 7.0<br />
text size = 20971520<br />
<br />
<br />
5. Your Moodle config.php should include lines like these:<br />
<br />
$CFG->dbtype = 'mssql_n'; // Required<br />
$CFG->dbhost = 'localhost'; // assuming MS SQL is on the same server, otherwise use an IP<br />
$CFG->dbname = 'moodle'; // or whatever you called the database you created<br />
$CFG->dbuser = 'yourusername'; // I usually use the 'sa' account (dbowner perms are enough)<br />
$CFG->dbpass = 'yourpassword';<br />
$CFG->dbpersist = false;<br />
$CFG->prefix = 'mdl_'; //Prefix, you can change it, but '''never''' leave it blank.<br />
<br />
<br />
If you don't have a config.php file yet, it can be generated as normal from the Moodle installer.<br />
<br />
<br />
6. Restart or start your web server. If Moodle still cannot communicate with the database server, please turn display_startup_errors to "On" in your /PHP/php.ini file, then restart the web server and check for any errors that may indicate incorrect DLL versions or missing dependencies. These error reports, turned off by default in PHP, can be vital in locating a problem with new extension installations.<br />
<br />
<br />
7. Install Moodle as usual. Good luck!<br />
<br />
<br />
=== Troubleshooting ===<br />
If you encounter some problems you can try:<br />
*check that you have DotNet framework 1.1 installed (later version are installed on Vista, but you could need this specific one)<br /><br />
*enable TCP/IP for MSSQL: SQL Server 2005 Network Configuration -> Protocols for MSSQLSERVER -> TCP/IP (Enable) -> Properties -> Ip Addresses -> 127.0.0.1 (Active+Enable)<br /><br />
*if you are using SQL Server 2005 and you have the error ''4004: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier'', try the ODBTP method (next chapter). The SQL Server complaining that it doesn't support pure Unicode via TDS or older versions of ODBC. Microsoft has deprecated DB-Library a long ago, in favor of ODBC, OLE DB, or SQL Native Client. Many new features of SQL 2005 aren't accessible via DB-Library so if you need them, you could have to switch away from tools based on TDS and DB-Library :(<br />
<br />
== Using ODBTP on Unix or Windows ==<br />
<br />
You can download ODBTP from http://odbtp.sourceforge.net/. Also you will access to the documentation from the same page.<br />
<br />
The downloaded package includes both the source code and some binaries to be installed in the server and some ready-to-use '''mssql extension alternatives''' for some platforms/PHP versions (so you won't need to compile it if your PHP server/version binary package is present).<br />
<br />
First of all, we have to install the Win32 service that comes with the package. Let's assume that it's going to run in the same Win32 machine where your MSSQL server is running (although it can run in any other Win32 server in your network).<br />
<br />
To do do, following the instructions present in http://odbtp.sourceforge.net/install.html, you must:<br />
<br />
# Create a directory on the Windows host where the service program files will reside, i.e., md odbtp.<br />
# Copy the files odbtpctl.exe, odbtpsrv.exe and odbtpsrv.ini files from the winservice directory into the directory created in step 1.<br />
# Edit the file odbtpsrv.ini of the previous step and this line: <pre>MaxRequestSize=20971520</pre><br />
# Open a command prompt (cmd) window on the Windows host.<br />
# Change to the directory to which the service program files were copied, i.e., cd odbtp.<br />
# Run the following commands to install and start the service:<br />
#* odbtpctl install ''(NOTE: at the date this note is written -23/06/08- the ODBTP service can only be installed on Windows NT 4.0, 2000 or XP Pro. The service cannot be installed on Microsoft Windows Vista)''<br />
#* odbtpctl start<br />
# With these steps you should have one new service running in your host called "odbtp". Verify it's present and running in the "Services" control panel.<br />
# Don't forget to enable TCP/IP incoming connections to port 2799 in the host you have installed the service!<br />
<br />
Now it's time to build the '''mssql extension alternative'''. First of all, verify if, in the downloaded package, under the "php" dir, there is one extension suitable for your PHP server/version. If it's present, you can simply copy it to the php/extensions dir in your PHP server and skip next points about compiling it from source. It's important to point that, inside each directory, you'll find '''two different''' libraries/dll files. The one that must be copied to the extensions dir is the one called '''"php_odbtp_mssql.xxx"'''!<br />
<br />
If in the downloaded package isn't present the extension matching your PHP platform/version, you should build if from source files. To do that, just '''"configure, make, make install"'''. That will create some stuff under "/usr/local".<br />
<br />
Now that you've successfully built ODBTP is time to create the '''mssql extension alternative''' that will provide us with the capacity of handling MSSQL DBs from within Moodle. To do so, just configure your PHP server adding this new option to the usual ones:<br />
<br />
--with-odbtp-mssql<br />
<br />
then, after the standard "make and make install" steps, your PHP server will be built with MSSQL support provided by ODBTP.<br />
<br />
Finally, independently if we are using the binary extension provided in the download or if you have built it from source files, it's time to configure the extension. To do so, add this lines, if no present, to your php.ini file:<br />
<br />
extension=php_odbtp.dll<br />
<br />
(only for Win32 PHP servers!)<br />
<br />
And, for all the server platforms: <br />
<br />
[odbtp]<br />
odbtp.interface_file = "/path/to/your/odbtp.conf"<br />
odbtp.datetime_format = mdyhmsf<br />
odbtp.detach_default_queries = yes<br />
<br />
(where ''/path/to/your/odbtp.conf" is usually "/usr/local/etc/odbtp.conf"" for Unix systems and "C:\odbtp\odbtp.conf" for Windows systems)<br />
<br />
Then, edit such "odbtp.conf" file and put there these contents:<br />
<br />
[global]<br />
odbtp host = xxx.xxx.xxx (ip or hostname of the Win32 box running the ODBTP service)<br />
type = mssql<br />
unicode sql = yes<br />
use row cache = yes<br />
right trim text = yes<br />
var data size = 20971520<br />
<br />
With this, your PHP server will be able to connect with the MSSQL DB server using ODBTP. From here, just continue with the installation.<br />
<br />
Finally, if you find the ODBTP executables and '''mssql extension alternative''' in binary formats, it only will be necessary to install them in your server (binary packages...) without the need to recompile anything (just the php.ini and odbtp.conf edition steps above will be necessary). Of course, it will be really welcome to have all those binary alternatives documented here.<br />
<br />
Once ODBTP is working, Moodle config.php should include lines like these:<br />
<br />
$CFG->dbtype = 'mssql_n'; // Required<br />
$CFG->dbhost = 'localhost'; // assuming MS SQL is on the same server, otherwise use an IP<br />
$CFG->dbname = 'moodle'; // or whatever you called the database you created<br />
$CFG->dbuser = 'yourusername'; // I usually use the 'sa' account (dbowner perms are enough)<br />
$CFG->dbpass = 'yourpassword';<br />
$CFG->dbpersist = false;<br />
$CFG->prefix = 'mdl_'; //Prefix, you can change it, but '''never''' leave it blank.<br />
<br />
<br />
If you don't have a config.php file yet, it can be generated as normal from the Moodle installer.<br />
<br />
== Using ODBC on Windows ==<br />
<br />
{{Not for production sites}}<br />
<br />
1. Go to the '''Administrative Tools''' control panel, then the '''Data Sources (ODBC)''' panel.<br />
<br />
2. Configure one new System/User DSN (call it, for example "moodle"). Dont forget to enable these options if the driver asks for them:<br />
<br />
:* ANSI NULLS Enabled = true<br />
:* Quoted Identifiers Enabled = true<br />
<br />
3. Your Moodle config.php should include lines like these:<br />
<br />
$CFG->dbtype = 'odbc_mssql'; // Note this is different to all the other configs on this page!<br />
$CFG->dbhost = 'moodle'; // Where this matches the Data source name you chose above<br />
$CFG->dbname = '''''''; // Keep it blank!!<br />
$CFG->dbuser = 'yourusername'; // I usually use the 'sa' account (dbowner perms are enough)<br />
$CFG->dbpass = 'yourpassword';<br />
$CFG->dbpersist = false;<br />
$CFG->prefix = 'mdl_'; //Prefix, you can change it, but '''never''' leave it blank.<br />
<br />
4. Install Moodle as usual. Good luck!<br />
<br />
== Related links ==<br />
<br />
[[Installing Oracle for PHP]]<br />
<br />
[[Category:Installation]]<br />
[[Category:Developer]]<br />
[[Category:XMLDB]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_statistics_calculations&diff=39690
Development:Quiz statistics calculations
2008-07-14T12:43:44Z
<p>Jamiesensei: /* Discrimination index */</p>
<hr />
<div>{{Moodle 2.0}}<br />
{{Quiz item analysis calculations}}<br />
<br />
==General issues==<br />
<br />
===Quizzes that allow multiple attempts===<br />
<br />
For quizzes that allow multiple attempts, by default the report should only include data from the first attempt by each student. (The data for subsequent attempts probably does not satisfy the assumptions that underlie item analysis statistics.) However, there should be an option 'Include data from all attempts', which should have a disclaimer that this may be statistically invalid either near it on screen, or possibly in the help file. (For small data sets, it may be better to include all data.)<br />
<br />
Using the first attempt also avoids problems caused by each attempt builds on last.<br />
<br />
Within the analysis, when multiple attempts per student are included, each attempt is treated as an independent attempt. (That is, we pretend each attempt was by a different student.)<br />
<br />
===Adaptive mode===<br />
<br />
Adaptive mode does not pose a problem. Item Analysis just supposes that each item in the test returns a score, and these scores are added up to get the test score. Therefore Item Analysis does not care about adaptive/non-adaptive mode. However, just to be clear, for an adaptive question, the score used in the calculation is the final score for the item, including penalties.<br />
<br />
===Certainty based marking===<br />
<br />
Similarly, should CBM, and/or negative scoring for multiple choice questions be implemented, we just use the final item score in the calculations, making sure that the formulae are not assuming that the minimum item score is zero.<br />
<br />
===Incomplete attempts===<br />
<br />
There is an issue about what you do when not all students have answered all questions. Depending on how you handle these missing items, you distort the statistics in different ways.<br />
<br />
There are basically two reasons why a student may not have answered a particular question:<br />
* they may have chosen to omit it, or<br />
* they may have run out of time, if the test is timed. In this case, omitted questions tend to be towards the end of the test.<br />
<br />
Available approaches for handling this are:<br />
<br />
# treat omitted items as having a score of 0.<br />
# exclude any attempt with missing scores from the analysis.<br />
# Analyse each question separately - and when analysing a particular question, just include students who answered that question in the analysis.<br />
<br />
I think we should implement 1 for now. This is how Moodle currently works - a blank answer is marked and receives a score of zero, and so is indistinguishable from a wrong answer. Item analysis is most important for summative tests, and the result of that question being in the test is that it gave that student a contribution of 0 marks towards their final score.<br />
<br />
===Random questions===<br />
<br />
In a quiz with random questions not all students will have attempted the same set of questions. To account for this, the analysis below distinguishes between positions in the test, and test items.<br />
<br />
==Notation used in the calculations==<br />
<br />
''Note: The only way I can think of to write this document with all the maths is to type TeX notation like $$x_i$$ even though MoodleDocs does not currently render it nicely. Maybe one day it will. In the mean time, if you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
We have a lot of students $$s \in S$$, who have completed at least one attempt on the quiz.<br />
<br />
The test has a number of positions $$p \in P$$.<br />
<br />
The test is assembled from a number of items $$i \in I$$.<br />
<br />
Because of random questions, different students may have recieved different items in different positions, so $$i(p, s)$$ is the item student $$s$$ received in position $$p$$.<br />
<br />
Let $$I_s$$ be the set of items that student $$s$$ saw. Let $$S_i$$ be the set of students who attempted item $$i$$.<br />
<br />
Each position has a maximum and minimum possible contribution to the test score, $$x_p(min)$$ and $$x_p(max)$$. At the moment in Moodle, $$x_p(min)$$ is always zero, but we cannot assume that will continue to be the case. $$x_p(max)$$ is database column quiz_question_instances.grade.<br />
<br />
Then, each student achieved an actual score $$x_p(s)$$ on the item in position $$p$$. So $$x_p(min) \le x_p(s) \le x_p(max)$$.<br />
<br />
$$x_p(s)$$ should be measured on the same scale as the final score for the quiz. That is, scaled by quiz_question_instances.grade, but that is already how grades are stored in mdl_question_states.<br />
<br />
We can also think of the student's score on a particular item $$x_i(s)$$. However, in this case, the score should be measured out of the Default question grade for this question. Also, there is a $$x_i(max)$$ ( = Default question grade) and $$x_i(min)$$ (currently, zero, but if we allow negative marking, that will change).<br />
<br />
$$x_{i(p, s)}(s) = x_p(s)\frac{x_i(max)}{x_p(max)}$$.<br />
<br />
Each student has a total score <br />
<br />
$$\displaystyle T_s = \sum_{p \in P} x_p(s)$$<br />
<br />
Similarly, there are the maximum and minimum possible test scores<br />
<br />
$$\displaystyle T_{max} = \sum_{p \in P} x_p(max)$$<br />
<br />
and <br />
<br />
$$\displaystyle T_{min} = \sum_{p \in P} x_p(min)$$<br />
<br />
===Intermediate calculations===<br />
<br />
To simplify the form of the formulas below, we need some intermediate calculated quantities, derived from the ones above.<br />
<br />
Student's rest of test score for a position: $$X_p(s) = T_s - x_p(s)$$.<br />
<br />
For any quantity that depends on position (for example $$x_p$$ or $$X_p$$), it's average is denoted with an overbar, and is an average over all students, so <br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
When a quantity is a property of an item, a bar denotes an average over all students who attempted that item, so<br />
<br />
$$\displaystyle \bar{x}_i = \frac{1}{S_i} \sum_{s \in S_i} x_i(s)$$.<br />
<br />
Similarly we have the variance of a quantity depending on position:<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
and for a quantity depending on items:<br />
<br />
$$\displaystyle V(x_i) = \frac{1}{S_i - 1} \sum_{s \in S_i} (x_i(s) - \bar{x}_i)^2$$.<br />
<br />
Finally, we need co-variances of two quantites, for example:<br />
<br />
$$\displaystyle C(x_p, X_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)(X_p(s) - \bar{X}_p)$$<br />
<br />
$$\displaystyle C(x_i, X_i) = \frac{1}{S_i - 1} \sum_{s \in S_i} (x_i(s) - \bar{x}_i)(X_i(s) - \bar{X}_i)$$.<br />
<br />
==Position statistics==<br />
<br />
===Facility index===<br />
<br />
This is the average score on the item, expressed as a percentage:<br />
<br />
$$\displaystyle F_p = 100\frac{\bar{x}_p - x_p(min)}{x_p(max) - x_p(min)}$$.<br />
<br />
The higher the facility index, the easier the question is (for this cohort of students).<br />
<br />
===Standard deviation===<br />
<br />
Again expressed on a percentage scale:<br />
<br />
$$\displaystyle SD_p = 100\frac{\sqrt{V(x_p)}}{x_p(max) - x_p(min)}$$.<br />
<br />
===Discrimination index===<br />
<br />
This is the product moment correlation coefficient between $$x_p$$ and $$X_p$$, expressed on a percentage scale. That is,<br />
<br />
$$\displaystyle D_p = 100V(x_p, X_p) = 100\frac{C(x_p, X_p)}{\sqrt{V(x_P) V(X_p)}}$$.<br />
<br />
The idea is that for a good question (or at least a question that fits in with the other questions in the test), students who have scored highly on the other parts of the test should also have scored highly on this question, so the score for the question and the score for the test as a whole should be well correlated.<br />
<br />
The weakness of this statistic is that, unless the facility index is 50%, it is impossible for the discrimination index to be 100%, or, to put it another way, if $$F_p$$ is close to 0% or 100%, $$D_p$$ will always be very small. That makes interpreting this statistic difficult.<br />
<br />
===Discriminative efficiency===<br />
<br />
This gets around that weakness in the discrimination index by expressing $$C(x_p, X_p)$$ as a percentage of the maximum value it could have taken given the scores the students got on this question, and the test as a whole. That is:<br />
<br />
$$\displaystyle DE_p = 100\frac{C(x_p, X_p)}{C_{max}(x_p, X_p)}$$<br />
<br />
where $$C_{max}(x_p, X_p)$$ is defined as follows:<br />
<br />
When you compute $$C(x_p, X_p)$$, you do the sum <br />
<br />
$$\displaystyle C(x_p, X_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)(X_p(s) - \bar{X}_p)$$<br />
<br />
which involves a term for each student combining their question score and rest of test score. That is, you start with an array of $$x_p(s)$$ with an array of corresponding $$X_p(s)$$, one for each $$s$$. To compute $$C_{max}(x_p, X_p)$$, you just sort these two arrays before applying the above formula. That is, for the purpose of computing $$C_{max}$$, you pretend that the first student scored the lowest $$x_p$$ and the lowest $$X_p$$, the second student scored the second lowest $$x_p$$ and the second lowest $$X_p$$, and so on to the last student, who scored the highest $$x_p$$ and $$X_p$$.<br />
<br />
===Intended question weight===<br />
<br />
How much this question was supposed to contribute to determining the overall test score.<br />
<br />
$$\displaystyle IQW_p = 100\frac{x_p(max) - x_p(min)}{T_{max} - T_{min}}$$.<br />
<br />
===Effective question weight===<br />
<br />
This is an estimate of what proportion of the variance in the students' test scores is due this question.<br />
<br />
$$\displaystyle EQW_p = 100\frac{\sqrt{C(x_p, T)}}{\sum_{p \in P}\sqrt{C(x_p, T)}}$$.<br />
<br />
==Item statistics==<br />
<br />
===Number of attempts===<br />
<br />
The number of students who got this question as part of a quiz attempt. This is just $$S_i$$.<br />
<br />
===Random guess score===<br />
<br />
This is the score that the student would have got by guessing randomly. It depends on the question type. For types like shortanswer, it is 0 - or the score associated with answer '*', if there is one.<br />
<br />
For multiple choice questions (including matching, truefalse, etc.) it is the average score over all the possible choices.<br />
<br />
(There should probably be a method in the question type class to compute this.)<br />
<br />
===Facility index===<br />
<br />
$$\displaystyle F_i = 100\frac{\bar{x}_i - x_i(min)}{x_i(max) - x_i(min)}$$.<br />
<br />
===Standard deviation===<br />
<br />
$$\displaystyle SD_i = 100\frac{\sqrt{V(x_i)}}{x_i(max) - x_i(min)}$$.<br />
<br />
===Discrimination index===<br />
<br />
$$\displaystyle D_i = 100r(x_i, T) = 100\frac{C(x_i, T)}{\sqrt{V(x_i) V(T)}}$$.<br />
<br />
(It is not possible to define $$X_i$$ because it is conceivable that the same item may have been chosen in different positions with different weights, so we substitute $$T$$ instead.)<br />
<br />
===Discriminative efficiency===<br />
<br />
$$\displaystyle DE_i = 100\frac{C(x_i, T)}{C_{max}(x_i, T)}$$.<br />
<br />
==Test statistics==<br />
<br />
===Number of Attempts===<br />
<br />
This is $$S$$.<br />
<br />
Note that depending on the options, we may be counting one or all attempts per student.<br />
<br />
===Mean Score===<br />
<br />
Test mean $$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
===Median Score===<br />
<br />
Sort all the $$T_s$$, and take the middle one if S is odd, or the average of the two middle ones if S is even.<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
Probably of limited interest, but included for completeness. Skewness is a measure of the asymmetry in a distribution. Kurtosis - imagine a normal distribution. Kurtosis tells you if your distribution has more of a bulge, but thinner tails, or vice-versa.<br />
<br />
First calculate:<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
Then compute<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = V(T)$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then<br />
<br />
Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
===Coefficient of Internal Consistency===<br />
<br />
This is on a percentage scale<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
===Error Ratio===<br />
<br />
Also a percentage.<br />
<br />
$$\displaystyle ER = 100 \sqrt{1 - \frac{CIC}{100}}$$<br />
<br />
===Standard Error===<br />
<br />
$$\displaystyle SE = \frac{ER}{100}SD$$<br />
<br />
These last three are to do with estimating how reliable the test scores are. If you take the view that the score the student got on the test on the day is a combination of their actual ability and a random error (how lucky they were on the day of the test), the the standard error is an estimate of the luck factor. So if SE ~= 10, and the student scored 60, then you can be quite confident that their actual ability is between 50 and 70.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37463
Development:Quiz item analysis calculations in practice
2008-06-11T10:21:23Z
<p>Jamiesensei: /*==Code==*/</p>
<hr />
<div>{{Moodle 2.0}}<br />
{{Quiz item analysis calculations}}<br />
<br />
==Purpose of this page==<br />
<br />
Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Code==<br />
<br />
The calculations below are all done in quiz/report/statistics/report.php The code refers to links to this doc in php comments.<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
So :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2}\sum_{p \in P} \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)= 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2(S - 1)} \sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) $$<br />
<br />
We fetch :<br />
<br />
$$\displaystyle \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) $$<br />
<br />
From the db for all questions and then sum them all so we have :<br />
<br />
$$\displaystyle sum =\sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)$$<br />
<br />
Then we do :<br />
<br />
$$sumofvarianceforallpositions = sum/(S - 1)$$<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{sumofvarianceforallpositions}{k_2} \right) $$<br />
<br />
And :<br />
<br />
$$\displaystyle ER = 100 \sqrt{1 - \frac{CIC}{100}}$$<br />
<br />
And : <br />
<br />
$$\displaystyle SE = \frac{ER}{100}SD$$<br />
<br />
Since SE is a grade we divide it by the maximum possible grade and times by 100 to get a percentage of the max possible grade for the whole quiz.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_report_enhancements&diff=37462
Development:Quiz report enhancements
2008-06-11T10:17:53Z
<p>Jamiesensei: added templates</p>
<hr />
<div>{{Moodle 2.0}}<br />
{{Quiz item analysis calculations}}<br />
<br />
This document describes a package of work relating to the quiz reports that we (The Open University) hope to outsource. Please [http://moodle.org/mod/forum/discuss.php?d=86598 discuss this proposal in this forum thread].<br />
<br />
The work falls into four areas: improvements to the Item Analysis report; improvements to the Overview report; improvements to the Regrade report; and general improvements and bug fixing. Some of the general improvements may be necessary to enable the other two tasks to be done. The remainder are things that it would be nice to have fixed while this code is being worked on to improve the long-term maintainability, providing that does not add too much to the development cost.<br />
<br />
The Open University uses the four standard quiz reports, and the third-party [http://moodle.org/mod/data/view.php?d=13&rid=96 Detailed Responses] report. (If, as a result of this work, the Detailed responses report becomes reliable enough, we may move it back into core Moodle. In fact, I think this is quite likely.)<br />
<br />
All the work done must conform to our [[#OU_VLE_general_requirements_for_outsourcing|general requirements for outsourced work]]. We would like all this work contributed directly into Moodle 2.0, as well as provided to us as a patch we can apply against our own Moodle, which is currently Moodle 1.9 with customisations.<br />
<br />
==Improvements to the Item Analysis report==<br />
<br />
I propose that we break up the current item analysis report into two separate bits, an overview for the whole quiz, and then drill-down into the details for each question. I propose we call these the "Test Statistics report" and the "Individual Item Analysis report". Better suggestions are welcome.<br />
<br />
===Calculation details===<br />
<br />
I will describe the details of the calculations of the various statistic on a separate, maths-heavy, page [[Development:Quiz_item_analysis_calculations]]. Then this page will just refer to those statistics and say which is displayed where. The statistics fall into three categories:<br />
* statistics that are properties of the whole test;<br />
* statistics that are properties of a particular position in the test;<br />
* statistics that are properties of a particular test item.<br />
The last two are different because of random questions, which mean that different students may have received different questions in the position "question 1".<br />
<br />
Implementation of these calculations should be prime candidates for unit testing. I think in the code, we should try to separate<br />
* Extracting the necessary data from the database<br />
* Doing the calculations<br />
* Displaying the results to users<br />
However, we need to do it in a way that does not just load all the data into memory at once and crash the server!<br />
<br />
Although the specification below says that all statistics should be displayed, wherever it can be done conveniently, the code should be structured so that if a particular Moodle installation does not like a particular statistic, it is easy to see which bits of code to comment out to hide that statistic. (It is probably overkill to make configuration options for this.)<br />
<br />
[[Image:Ou-quiz-reports-proposal-test-stats-report.png|right|520px]]<br />
<br />
===Quiz Statistics report===<br />
<br />
The mock-up on the right may help clarify our intentions.<br />
<br />
This report has two sections. The first section is "Overall quiz statistics" which contains all the statistics that are properties of the test as a whole. For convenience, the course shortname, quiz open and close dates, and quiz name and idnumber (if set) should be repeated with these overall statistics.<br />
<br />
The second section is "Quiz structure", containing a table. The table will have one column for each position statistic and each item statistic.<br />
<br />
Where a position in the test is filled with a non-random question, there is a single row in the table with all the statistics.<br />
<br />
Where a position is filled with a random question, there will be one row in the table giving the position statistics, followed by a number of rows giving the item statistics for each question that a student received in this position. (This means that, if there are two random questions picking from the same categorie(s), there may be repeated rows in the table.)<br />
<br />
Positions or items that appear to be performing particularly badly (Discrimination coefficient below XXX? perhaps other conditions too?) should be highlighted. We don't yet have a clear picture what constitutes 'particularly badly', so structure the code so that it is clear which part you need to tweak to change this. For example, have a function is_dubious_question($row_of_data).<br />
<br />
Our "Early warning test" generate a graph like this showing the discrimination coefficient of each question.<br />
<br />
[[Image:Quiz_report_enhancements_descrim.png]]<br />
<br />
That is, the x-axis is test position, and the y-axis is Discrimination Index. We want a graph like this at the bottom of the report.<br />
<br />
[[Image:Ou-quiz-reports-proposal-item-analysis-report.png|right|500px]]<br />
<br />
===Individual Item Analysis report===<br />
<br />
The mock-up on the right may help clarify our intentions.<br />
<br />
Each question in the overview analysis report should be a link to a more detailed analysis of that question.<br />
<br />
At the top of the page, all of the item statistics relating to this question should be shown. (This information is repeated from the Test Statistics report.)<br />
<br />
[[Image:Ou-quiz-reports-proposal-ia-sa-report.png|right|411px]]<br />
<br />
Then there is a section analysing all of the student responses, with frequency counts, like the middle columns of the existing Item Analysis report. However, we want this to be more sophisticated for shortanswer and numerical questions that use wildcards. Hopefully the illustration on the right makes this clear.<br />
<br />
Beneath the details for a particular question, if the question is used in other quizzes (that the current user has reports access to) then we should provide cross links the detailed analysis of this question in those quizzes too. This effectively solves MDL-8974. (We may want to consider adding these links somewhere in the question bank interface too, perhaps on the question preview page?)<br />
<br />
There should be a link back to the Quiz Statistics report.<br />
<br />
(Note: I have a Word document that has examples of how we want this to look for various question types, but I don't think it adds much, so I have not copied it here. Also, there is an implementation decision to make about how much control we give individual question types about how their responses are analysed.)<br />
<br />
(An interesting idea would be to draw a scatter plot of question score against test score at the bottom of this report. Discrimination index/efficiency is meant to be a measure of how good that correlation is, and a scatter plot would illustrate that nicely. However, it is probably beyond the scope of this work.)<br />
<br />
===Performance considerations===<br />
<br />
This report has to perform a lot of expensive calculations. Instead of re-computing this every time the report is viewed, we probably need to cache the computed values in a separate database table. This would rely on [[#Enhance_how_quiz_reports_work_to_match_recent_developments_in_the_gradebook|one of the general improvements described below]].<br />
<br />
At the top of both the Test Statistics and Individual Item Analysis reports, there should be a message, "This reports shows data computed at ''date and time''. Since then ''XX'' more attempts have been completed." With a 'Recompute now' button.<br />
<br />
The data will have to be cached separately for each possible combination of options.<br />
<br />
When the recompute button is pressed, go to a progress bar for the duration of the calculation, then redirect back to the report.<br />
<br />
===Other minor improvements===<br />
<br />
Implement this suggestion: MDL-8464 In the item analysis report, give teachers an icon to edit the question. Do this in both the Test Statistics and Individual Item Analysis reports.<br />
<br />
===Export options===<br />
<br />
It should be possible to export each of the Test Statistics and Individual Item Analysis reports in XLS, ODS or CSV format.<br />
<br />
In addition, there should be an options to export (as XLS, ODS, CSV or HTML), a single file that contains first the Test Statistics report, followed by the Individual Item Analysis report for each item in the test. This is so that the data can conveniently be taken away and analysed off-line. The HTML version of this combined report should look reasonably good when printed.<br />
<br />
[[Image:Ou-quiz-reports-proposal-overview-report.png|right|511px]]<br />
<br />
==Improvements to the Overview report==<br />
<br />
The mock-up on the right may help clarify our intentions.<br />
<br />
===Add group and course averages===<br />
<br />
Like for the gradebook reports, we should add a row showing the average over all students in the course (even if the current user is only allowed to see one group). And for a quiz in group mode, add another row above that giving group averages. These averages should match the ones in the gradebook, that is, they should be averages of the students' final scores, not the individual attempt scores.<br />
<br />
===Make it clear which student attempt gives the final grade===<br />
<br />
Like on the quiz view page, where a student has made multiple attempts, highlight the one that gives the final score, if the scoring method is first, last or highest score. Perhaps it would be useful to add an option to only show/export the 'final score' attempts.<br />
<br />
Add the same highlighting/option to the detailed responses report.<br />
<br />
===Add a summary graph===<br />
<br />
Our "Early warning test" ([[#Improvements_to_the_Item_Analysis_report|see above]]) generates a graph like this showing score frequencies for all students:<br />
[[Image:Quiz_report_enhancements_historgram.png]]<br />
<br />
It should be possible to produce a graph like this using graphlib.php, and a single database query, so I think we should, and display it after the results table. It should count the number of attempts with a score in each of an appropriate number of score brackets, depending on the quiz total score.<br />
<br />
===Add a column for the user's idnumber, controllable by a site-wide setting===<br />
<br />
Add a site-wide configuration option "Show idnumber in quiz reports", defaulting to No. (Or maybe just use the existing setting grade_report_showuseridnumber in the Gradebook grader report settings.)<br />
<br />
Change the overview report and the detailed responses report so that if this setting is turned on, you get an additional column containing each user's idnumber.<br />
<br />
===Add a site-wide setting to hide the user profile image from quiz reports===<br />
<br />
Add a site-wide configuration option "Hide user images in quiz reports", defaulting to No.<br />
<br />
Change the overview report and the detailed responses report so that if this setting is turned on, you don't get the column with users' images.<br />
<br />
==Improvements to the Regrade report==<br />
<br />
At the moment, if you follow a link to the regrade report, it immediately does a regrade. This is dangerous. We want more control. This is MDL-5519. Completing this work should also deal with MDL-3032.<br />
<br />
The workflow we would like to see for regrading is:<br />
<br />
1. When you go to the regrade report, it should just show some introductory instructions and some controls for selecting particular users and/or questions. By default, it should be set up so that all users and questions are selected. There are then two buttons: 'Dry run' and 'Regrade'<br />
<br />
2. If the 'Dry run' button is pressed, it does a pretend regrade of the selected questions for the selected users. This does not change anything in the database, instead it just tells you what would change if you did a regrade for real. The gives you further controls so that you can easily select a subset of the users and/or questions included in the dry run. In addition, the main controls from step 1 are also shown again so you can change things and do another 'Dry run'.<br />
<br />
3. Clicking the 'Regrade' button actually performs the regrade, displaying what has been changed like in the dry run. This display should be more understandable than the one the regrade report currently provides.<br />
<br />
==General improvements and bug fixing==<br />
<br />
The quiz reports have not been substantially revised since at least Moodle 1.6. This means the conversion to roles and capabilites was somewhat superficial, and the interface has not been converted to formslib. Elsewhere in Moodle there have been improvements that these reports could benefit from, for example the moodle_url class, and some of the features implemented for the new gradebook reports in 1.9.<br />
<br />
Bringing the quiz reports up to the standard expected in Moodle 1.9/2.0 would greatly simplify long-term maintenance of these reports, and so reduce costs long term. The will also mean that people who learn how to write Gradebook reports will then easily be able to write Quiz reports, and vice versa.<br />
<br />
On the other hand, not all of these requirements are critical to the OU, so please provide a separate estimate for each one. Then we will decide which ones we actually want to include in the outsourcing contract.<br />
<br />
===Enhance how quiz reports work to match recent developments in the gradebook===<br />
<br />
In Moodle 1.9, gradebook reports are fully-featured plugins with a db folder, so they can create tables if they need to store their own data, or define capabilities. Also there is a nice mechanism that allows gradebook reports to add configuration settings to the admin tree, and they use get/set_user_preferences to store users' options for viewing the reports (perhaps some of these preferences, like records per page, should be shared between the reports). We would like quiz reports enhanced so quiz report developers have the same facilities available.<br />
<br />
Using the ability to define new capabilities, we would like a separate 'view' capability (e.g. quizreport/overview:view) for each report, to replace the existing mod/quiz:viewreports capability, so we can choose which roles can see which reports.<br />
<br />
===Switch to using formslib and improve the interface===<br />
<br />
The current user interface for controlling the reports is not very well thought out, so don't just reproduce the existing interface using formslib. Devise a new one by thinking about what teachers actually want to achieve using these reports, and which is as consistent as possible between reports.<br />
<br />
===Switch to using moodle_url===<br />
<br />
The quiz reports are prime candidates for using moodle_url to clean up the code and eliminate uses of $SESSION.<br />
<br />
===Refactoring opportunities===<br />
<br />
There is some common functionality between reports, for example the interface and SQL for determining which users' attempts are included in the reports. This could usefully be moved into a mod/quiz/report/lib.php file, or something similar.<br />
<br />
Most of the reports have parallel code paths with very similar code to do the on-screen display and the export to different formats. We should really improve tablelib so that this sort of duplicate code is not necessary.<br />
<br />
===Developer documentation===<br />
<br />
Having worked on these reports, you will probably know more about quiz reports than anyone else, so please write the docs page [[Development:How to write a quiz report plugin]].<br />
<br />
===Performance testing===<br />
<br />
The Open University has 400,000 users and 3,000 courses in its database. Our largest courses have around 5,000 students, often in groups of about 20 (so up to 250 groups on a course). Naturally some operations may be slow, but all operations should scale to this sort of sized dataset. (Naturally our hardware is quite powerful to help cope with this.)<br />
<br />
[http://tracker.moodle.org/browse/CONTRIB-183 CONTRIB-183 Detailed responses report does not cope with lots of data] is one instance of this.<br />
<br />
Perhaps one change we should make it to use get_recordsets, instead of get_records, where possible in the reports, to reduce memory requirements, particularly when exporting large datasets.<br />
<br />
===[http://tracker.moodle.org/browse/MDL-7772 MDL-7772] Not all combinations of "Show ..." and Groups settings work properly in the overview report===<br />
<br />
The bug has plenty of details of the various cases, and what they should mean.<br />
<br />
This is one of the places that may need more thought since Roles and capabilities were introduced in Moodle 1.7. (At the moment, the quiz considers someone a 'Student' if they have the mod/quiz:attempt capability.)<br />
<br />
Similar controls appear on some of the other reports. These need to be tested and fixed too.<br />
<br />
===[http://tracker.moodle.org/browse/MDL-12418 MDL-12418] Problems with quiz item analysis and TeX-filter===<br />
<br />
This is just a bug and needs to be fixed. MDL-12258 is probably the same issue and needs to be fixed too. There is some useful discussion in MDL-12369.<br />
<br />
===[http://tracker.moodle.org/browse/MDL-12547 MDL-12547] Manual grading report does not take any notice of groups===<br />
<br />
It would be useful if group mode could be added to this report. The bug has a proposed fix from Karlene Clapp, which needs to reviewed before being checked in.<br />
<br />
===[http://tracker.moodle.org/browse/MDL-12392 MDL-12392] Manual grading report does not recognise global role assignments of students===<br />
<br />
Similar to MDL-7772.<br />
<br />
===[http://tracker.moodle.org/browse/MDL-12824 MDL-12824] Essay type of quiz questions needs to color mark which students have been graded and which have NOT===<br />
<br />
Hopefully easy.<br />
<br />
===[http://tracker.moodle.org/browse/MDL-13427 MDL-13427] Export Item Analysis Table to Files (excel or text format) Including <br /> Tags===<br />
<br />
Just a bug.<br />
<br />
===[http://tracker.moodle.org/browse/MDL-13428 MDL-13428] When a quiz attempt is reviewed in "Item Analysis Table"; the general comments on Essay appears in the "answer" block===<br />
<br />
Seems weird, could you have a quick look please.<br />
<br />
===[http://tracker.moodle.org/browse/MDL-13429 MDL-13429] The "Go" button on "Item Analysis Table" page in moodle 1.8.x keeps moving once clicked===<br />
<br />
I remember fixing this in another report. There was some really weird HTML and CSS. I think that while working on reports and making the layout more consistent, you will just fix this in passing.<br />
<br />
===[http://tracker.moodle.org/browse/MDL-13678 MDL-13678] Change default number of rows per page on quiz reports===<br />
<br />
We want a default that is most useful to teachers. 30 is a typical class size. I think the current value of 10 is so that it fits on one screen on a typical monitor, but I don't think that is a good reason for keeping it at 10.<br />
<br />
==Some background to assessment at the OU==<br />
<br />
To help understand the rationale behind some of the above requirements I am adding this section which gives a bit of context about how the Moodle quiz is used at the OU. Recall that the OU is entirely a distance learning university.<br />
<br />
===Courses===<br />
<br />
Generally, our courses are produced over a period of a year or two by academic staff in our Faculties. Then, only when they are finished, do we present them to students. Typically there is one presentation per year of each course (but sometimes more or less). Each presentation of a course gets a new Moodle course, created using backup and restore without student data of the previous presentation's Moodle course. During presentation, the academic staff are responsible for settings exams and assessments, and updating the course if necessary. Typically a course will last for 5-10 years before being rewritten.<br />
<br />
Popular first level courses can have several thousand students enrolled in each presentation. Many higher-level undergraduate courses have a few hundred per presentation. Obscure post-graduate courses have tens of students. There are about 600 course-presentations per year.<br />
<br />
During their studies of a course students are directly supported by a tutor, who answers any questions they have, moderates online activities, and marks their assessed work. Due to UK data protection law, Tutors are only allowed to see the work of their own students, however, they may see aggregate statistics for the whole cohort of students.<br />
<br />
In Moodle, we achieve this using groups. A tutor and their students go into a group, and then certain activities in the course are set to Separate groups mode. Sometimes, one Tutor will be responsible for two separate Tutor groups. In this case, in Moodle, they see the groups dropdown, so they only look at one group at a time. That is how we want it to work.<br />
<br />
Students are sometimes divided into groups in different ways for different activities, using the groupings feature. In this case, the quiz will be set to use the 'Tutor Groups' grouping.<br />
<br />
===Significant roles===<br />
<br />
====Course staff====<br />
<br />
The Academic and Administrative staff who produce the course (and the administrative staff who assist them) get a role in Moodle called Course Staff. This is very close to the (editing) Teacher role.<br />
<br />
Course staff will be able to view any of the quiz reports.<br />
<br />
====Tutors====<br />
<br />
Guide students through their students. This role is close to the Moodle Non-editing Teacher role, but crucially without the moodle/site:accessallgroups capability, because Tutors may only see data for Students in their own tutor group (apart from aggregate data like whole-course averages).<br />
<br />
We expect Tutors will only have the capability to see the Overview and Detailed responses reports; and the Manual grading report, if that particular quiz requires it.<br />
<br />
====Students====<br />
<br />
As normal.<br />
<br />
Will not be able to access any quiz reports.<br />
<br />
===Use of quizzes===<br />
<br />
As mentioned above, quizzes are normally in separate groups mode, Tutors can only see the results of Students in their group(s).<br />
<br />
Virtually none of our quizzes use a time-limit. We don't use any of the 'security' options. We don't use 'Shuffle questions', but we sometimes use 'Shuffle within questions'. Sometimes we use adaptive mode. Sometimes we don't.<br />
<br />
There are two common ways we use quizzes<br />
<br />
====Summative quizzes (for credit)====<br />
<br />
These will be set up with an Open and Close date. Students will be allowed one attempt only. Students will probably not be allowed to see scores until after the close date.<br />
<br />
One common set up is for each question to by chosen randomly from a category with several variants. So you might have category "CMA41: Q1 variants" containing several questions Q1-V1, Q1-V2, Q1-V3 that are very similar, but different (for example different numbers in a calculation). Then the first question in the quiz is then a random question picking from that category. Then you have another category with variants of question 2, etc.<br />
<br />
====Formative quizzes (self-assessment)====<br />
<br />
No open or close dates. Unlimited attempts. Students given results immediately. May or may not use random questions.<br />
<br />
===Previous systems===<br />
<br />
For many years, the OU had a paper-based Computer Marked Assessment system - the type where students answer multiple-choice questions by filling in a form with pencil that was then scanned into a computer. That system had an "Early warning test" to analyse results, and part of the purpose of this work is to ensure that Moodle can do all the things that system did.<br />
<br />
==OU VLE general requirements for outsourcing==<br />
<br />
''(Copied from our internal wiki 3rd December 2007.)''<br />
<br />
* Code must be developed against the Moodle 1.9 release version.<br />
<br />
* The contractor should do a design describing, where applicable, any<br />
** database changes<br />
** capabilities will be created/used to control access to different features<br />
** interface mock-ups<br />
** APIs<br />
** file formats<br />
This must be agreed with the Open University before proceeding to implementation. (It does not have to be a long document. If the feature being developed is very simple then the design might also be very brief.)<br />
<br />
* The [[Development:Coding|Moodle coding guidelines]] must be followed. In particular, the development must use:<br />
** PHP QuickForm (introduced in Moodle 1.8) rather than the old HTML forms.<br />
** Capabilities (from the role/capability system introduced in Moodle 1.7) to control access to features, rather than <tt>isteacher()</tt> etc.<br />
** XMLDB install scripts for database tables.<br />
** Language files rather than hard-coded strings (except for error messages that are not expected to appear to users under normal circumstances; these can be hard-coded if desired).<br />
** Additional libraries, beyond those already included in the moodle code base, can only be used if this is agreed with the Open University in advance. The new libraries be placed in the main lib directory rather than within the developed solution. Where suitable functionality already exists within the moodle code base, those libraries should be used in preference new ones, to reduce long-term maintenance and support costs.<br />
** Any customization of the moodle user interface should be contained within the developed solution unless agreed in advance with the Open University.<br />
<br />
* Must develop and test against a Moodle install using the following databases:<br />
** PostgreSQL. <br />
** Microsoft SQL Server. (A [http://www.microsoft.com/sql/editions/express/default.mspx free limited version, SQL Server Express Edition] is available for testing.)<br />
<br />
* The code must be delivered as a patch in standard (universal) format that applies to Moodle 1.9. (This does not preclude the changes being committed directly to the Moodle CVS repository too.)<br />
** the patch should be minimal. That is, it should not change things like whitespace in parts of a file that were not otherwise touched.<br />
** If multiple outsourced tasks affect the same area of code then they can be combined into one patch, or the order of application should be noted.<br />
** Patches should be checked against a current CVS version Moodle 1.9.x+ (MOODLE_19_STABLE) installation (to make sure they at least apply successfully) before handover.<br />
<br />
* In addition to the code, we also require a functionality document that describes how the code works. This will be used by our testers, and as a basis for user documentation. Normally, this will be very close to the original specification, but where things changed during implementation, the functionality document needs to be updated. This is in addition to the normal Moodle help-files that should be included in the code.<br />
<br />
[[Category:Developer]]<br />
[[Category:Quiz]]</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Template:Quiz_item_analysis_calculations&diff=37461
Template:Quiz item analysis calculations
2008-06-11T10:15:55Z
<p>Jamiesensei: </p>
<hr />
<div><div class="sideblock right" style="width: 16em;"><br />
<div class="header">Quiz report enhancements</div><br />
<div class="content"><br />
* [[Development:Quiz report enhancements|Quiz report enhancements]]<br />
* [[Development:Quiz item analysis calculations|Item Analysis Calculations]]<br />
* [[Development:Quiz item analysis calculations in practise|Item Analysis Calculations in practise]]<br />
'''Images'''<br />
* [https://docs.moodle.org/en/images_en/5/51/Ou-quiz-reports-proposal-test-stats-report.png test-stats-report]<br />
* [https://docs.moodle.org/en/images_en/3/35/Ou-quiz-reports-proposal-item-analysis-report.png Item-analysis-report]<br />
* [https://docs.moodle.org/en/Image:Ou-quiz-reports-proposal-ia-sa-report.png Item analysis of short answer]<br />
</div><br />
</div></div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37458
Development:Quiz item analysis calculations in practice
2008-06-11T10:01:31Z
<p>Jamiesensei: /* CIC, ER and SE */</p>
<hr />
<div>Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
So :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2}\sum_{p \in P} \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)= 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2(S - 1)} \sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) $$<br />
<br />
We fetch :<br />
<br />
$$\displaystyle \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) $$<br />
<br />
From the db for all questions and then sum them all so we have :<br />
<br />
$$\displaystyle sum =\sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)$$<br />
<br />
Then we do :<br />
<br />
$$sumofvarianceforallpositions = sum/(S - 1)$$<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{sumofvarianceforallpositions}{k_2} \right) $$<br />
<br />
And :<br />
<br />
$$\displaystyle ER = 100 \sqrt{1 - \frac{CIC}{100}}$$<br />
<br />
And : <br />
<br />
$$\displaystyle SE = \frac{ER}{100}SD$$<br />
<br />
Since SE is a grade we divide it by the maximum possible grade and times by 100 to get a percentage of the max possible grade for the whole quiz.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37456
Development:Quiz item analysis calculations in practice
2008-06-11T09:57:31Z
<p>Jamiesensei: </p>
<hr />
<div>Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
So :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2}\sum_{p \in P} \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)= 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2(S - 1)} \sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) $$<br />
<br />
We fetch :<br />
<br />
$$\sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) $$<br />
<br />
From the db for all questions and then sum them all so we have :<br />
<br />
$$sum =\sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)$$<br />
<br />
Then we do :<br />
<br />
$$sumofvarianceforallpositions = sum/(S - 1)$$<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{sumofvarianceforallpositions}{k_2} \right) $$<br />
<br />
And :<br />
<br />
$$\displaystyle ER = 100 \sqrt{1 - \frac{CIC}{100}}$$<br />
<br />
And : <br />
<br />
$$\displaystyle SE = \frac{ER}{100}SD$$<br />
<br />
Since SE is a grade we divide it by the maximum possible grade and times by 100 to get a percentage of the max possible grade for the whole quiz.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37454
Development:Quiz item analysis calculations in practice
2008-06-11T09:55:48Z
<p>Jamiesensei: /* CIC, ER and SE */</p>
<hr />
<div>Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
So :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2}\sum_{p \in P} \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)= 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2(S - 1)} \sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) $$<br />
<br />
We fetch :<br />
<br />
$$\sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) $$<br />
<br />
From the db for all questions and then sum them all so we have :<br />
<br />
$$sum =\sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)$$<br />
<br />
Then we do :<br />
<br />
$$sumofvarianceforallpositions = sum/(S - 1)$$<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2} sumofvarianceforallpositions) $$<br />
<br />
And :<br />
<br />
$$\displaystyle ER = 100 \sqrt{1 - \frac{CIC}{100}}$$<br />
<br />
And : <br />
<br />
$$\displaystyle SE = \frac{ER}{100}SD$$<br />
<br />
Since SE is a grade we divide it by the maximum possible grade and times by 100 to get a percentage of the max possible grade for the whole quiz.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37449
Development:Quiz item analysis calculations in practice
2008-06-11T09:49:39Z
<p>Jamiesensei: /* CIC, ER and SE */</p>
<hr />
<div>Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
So :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2}\sum_{p \in P} \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)= 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2(S - 1)} \sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) $$<br />
<br />
And :<br />
<br />
$$\displaystyle ER = 100 \sqrt{1 - \frac{CIC}{100}}$$<br />
<br />
And : <br />
<br />
$$\displaystyle SE = \frac{ER}{100}SD$$<br />
<br />
Since SE is a grade we divide it by the maximum possible grade and times by 100 to get a percentage of the max possible grade for the whole quiz.</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37448
Development:Quiz item analysis calculations in practice
2008-06-11T09:40:28Z
<p>Jamiesensei: /* CIC, ER and SE */</p>
<hr />
<div>Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
So :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2}\sum_{p \in P} \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)= 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2(S - 1)} \sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) $$</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37447
Development:Quiz item analysis calculations in practice
2008-06-11T09:38:46Z
<p>Jamiesensei: /* CIC, ER and SE */</p>
<hr />
<div>Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
So :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2}\sum_{p \in P} \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)$$</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37446
Development:Quiz item analysis calculations in practice
2008-06-11T09:38:01Z
<p>Jamiesensei: /* CIC, ER and SE */</p>
<hr />
<div>Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(x_p) = $$\frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2$$<br />
<br />
So :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2}\sum_{p \in P} \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)$$</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37445
Development:Quiz item analysis calculations in practice
2008-06-11T09:36:58Z
<p>Jamiesensei: /* CIC, ER and SE */</p>
<hr />
<div>Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(x_p) = $$<br />
<br />
So :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2}\sum_{p \in P} \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)$$</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37441
Development:Quiz item analysis calculations in practice
2008-06-11T09:33:08Z
<p>Jamiesensei: /* CIC, ER and SE */</p>
<hr />
<div>Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$<br />
<br />
So :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{\frac{S}{S - 1} m_2}\sum_{p \in P} V(x_p) \right)$$</div>
Jamiesensei
https://docs.moodle.org/19/en/index.php?title=Development:Quiz_item_analysis_calculations_in_practice&diff=37438
Development:Quiz item analysis calculations in practice
2008-06-11T09:30:54Z
<p>Jamiesensei: </p>
<hr />
<div>Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)<br />
<br />
==Notation used in the calculations==<br />
<br />
If you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter, or copy and paste the following magic into your browser's Address bar and hit enter (or get the [http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet MathTran bookmarklet):''<br />
javascript:(function(){function searchWithinNode(node,re){var pos,imgnnode,middlebit,endbitskip=0;if(node.nodeType==3){pos=node.data.search(re);if(pos>=0){middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.lastMatch.length);imgnode=document.createElement(%22img%22);imgnode.src=%22http://www.mathtran.org/cgi-bin/mathtran?tex=%22 + encodeURI(middlebit.data).replace(%22+%22,%22%252B%22);middlebit.parentNode.replaceChild(imgnode,middlebit);}}else if(node.nodeType==1&& node.childNodes){for (var child=0; child < node.childNodes.length; ++child){searchWithinNode(node.childNodes[child], re);}}}searchWithinNode(document.body, /\$\$(.*?)\$\$/);})();<br />
<br />
==Calculating MEAN of grades for all attempts by students==<br />
<br />
$$\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s$$<br />
<br />
We calculate the MEAN of first and all attempts by :<br />
<br />
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.<br />
* then to get the mean of first attempts :<br />
** we divide the total grade for all first attempts by the number of all first attempts.<br />
* for the mean for all attempts :<br />
** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.<br />
<br />
==Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students==<br />
<br />
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.<br />
<br />
We can get sql to do the following calculations :<br />
<br />
power2 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2$$<br />
<br />
power3 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3$$<br />
<br />
power4 $$\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4$$<br />
<br />
===Standard Deviation===<br />
<br />
Test standard deviation $$\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}$$<br />
<br />
$$= \sqrt{\frac{power2}{S-1}$$<br />
<br />
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.<br />
<br />
===Skewness and Kurtosis===<br />
<br />
So then :<br />
<br />
$$\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}$$<br />
<br />
$$\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}$$<br />
<br />
$$\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}$$<br />
<br />
<br />
$$\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}$$<br />
<br />
$$\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}$$<br />
<br />
$$\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)$$<br />
<br />
Then Skewness $$\displaystyle = \frac{k_3}{k_2^{2/3}}$$<br />
<br />
and :<br />
<br />
Kurtosis $$\displaystyle = \frac{k_4}{k_2^2}$$<br />
<br />
==CIC, ER and SE==<br />
<br />
First we fetch the average grade for each position :<br />
<br />
$$\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)$$.<br />
<br />
Then :<br />
<br />
$$\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)$$<br />
<br />
and :<br />
<br />
$\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2$$</div>
Jamiesensei