Jump to content
xisto Community
mamer

Moodle: Your Own Report Wizard

Recommended Posts

To save your time I'll assume that my readers know what Moodle is otherwise this post will not be relevant to them. For info. about Moodle please visit the official website

 

The Problem:

 

Moodle has it's own reports module where you can use a well organized interface for pulling out different reports about the activities of the users.

 

For me as a course tutor, I need to have a quick check on the assignments submitted by my students in a certain course, certain course topic.

 

The current reports module in Moodle is not straight forward with that regard. It pulls more data than I need which kind of doesn't highlight the parts that I'm interested in.

 

I also hate to login every time I need to check the assignments submission. Moodle usually is a bit slow script.

 

The Solution:

 

It would be more practical to write a code that queries the Moodle data base and displays only what I need. A wizard interface would be ideal in my situation.

 

Just to be specific, I'm using:

 

Moodle version: 1.9

PHP version 5.2.17

MySQL version 5.5.29-log

 

Application Outline:

 

1- A code to connect to the database : db-config.php, that will be included wheneverf we need to query the database

2- The index.php includes the db-config.php and:

connects to the Moodle DB

query table mdl_course to select the id and fullname fields to populate a drop-down list for the user to choose.

posts the user input to sections.php

3- The sections.php will:

connect to the Moodle DB

query table mdl_course_sections and select the sections field that match the previously selected course id.

populate a drop-down list for the user to choose

posts the user input to report.php

4- Finally the report.php will:

connect to the Moodle DB

query mdl_assignment, mdl_assignment_submissions and mdl_user using RIGHT JOIN on the id field

select only the submitted assignments using WHERE ( --- OR ----) AND ------ based on the user input, ie the course and section you selected in the previous steps in the wizard.

use a while loop to display the record set in a table

The Code:

 

I tried to post the code using the BBcode but it doesn't show in the preview, so I'll try to attach it.

 

Your feedbak is most welcome

 

Thank you

 

db-config.phpindex.phpsections.phpreport.php

Share this post


Link to post
Share on other sites

Hey, thanks for this! I haven't dug into Moodle yet so I can't test this yet but I can see it being very useful both as it is and for learning how to make other customizations, :).

Share this post


Link to post
Share on other sites

You may want to update your tutorial to work with 2.x version of the Moodle software as there have been many changes since 1.9 and odds are the changes made in 2.2 and 2.3 might affect the way people would use this tutorial.

Share this post


Link to post
Share on other sites

You may want to update your tutorial to work with 2.x version of the Moodle software as there have been many changes since 1.9 and odds are the changes made in 2.2 and 2.3 might affect the way people would use this tutorial.


Thanks for the tip. I think I'm going to do that next step once I have Moodle 2.4 installed on my website. I'm not sure how this is going to work but in principle it should be ok since I'm not doing much work inside Moodle itself other than querying the database and pulling out results from certain tables according to the criteria set by the form. It might be the case of different table and field names.

Share this post


Link to post
Share on other sites

Hi mamer!If you do get the newer version of Moodle working, do let me know. I had the installer tell me that the target version of the interpreter for the current version of Moodle was greater than what I had, and so it would not install. It may, however, be possible to edit the installer so that it no longer performs the check for the version of the interpreter or maybe the version can be hard-coded such that the conditional check always evaluates to true, even when the minimum version required isn't met. It should not be too hard to back-port some of the code to work with an older interpreter because it was not a complete re-write but rather a gradual change in the code base to require the newer version of the interpreter.As Saint Michael says, a tutorial updated to work with a newer version of Moodle will be more helpful because very few people still run Moodle 1.9.

Share this post


Link to post
Share on other sites

Hi k_nitin_r,I think the installer is running that kind of checking for a reason. If you tweak it to bypass the checking there's no guarantee that the script will work after installation is done.I managed to install these versions: 2.0.1, 2.1 and 2.3.3. The PHP settings wouldn't allow 2.4 to be installed. From my experience with Moodle I tend to obey the installer checkups otherwise there will be allays some fatal error waiting for you down the road even after the install is complete.Comparing the three installations: 2.0 is not good for me because it doesn't restore courses from 1.92.1 is cool and stable as long as you are restoring files files than 8MB (php setting limitation)2.3.4 is very slow and throws database errors every now and then.I installed version 2.4 on a free php cloud hosting and it works like a cjarm with no need to tweak the installer. I set the PHP to version 5.4 from the host cpanle.My conclusion is that Moodle 2.4 is not designed to run on shared hosting with the common php settings.. Only cloud hosting with higher versions of PHP welcomes Moodle.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.