Plugin to create user and course profiles by category

Plugin to create user and course profiles by category

by Paolo Oprandi -
Number of replies: 45
Attached is a plugin which provides a Moodle interface for creating:

1. course profiles by category (department) including pages to define:
    - course settings including base/topic zero activities
    - course blocks
    - forum, glossary and wiki profiles

2. user profiles

I have modified Dan Stowell's IMS Enterprise enrolment plugin to work with these profiles, but could be made to work with any other enrolment/course creation method. The plugin has been created for Moodle 1.6 (pre-multi-enrol).

Here are some images:

Profile pages

I welcome all comments and suggestions.

Paolo
Average of ratings: Useful (3)
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Dan Stowell -
Hi Paolo - I've had a quick play with this to see how the admin pages look, and it looks good. I think this will be a great extra feature for Moodle, for creating new courses according to different 'templates'.

I don't have anything very fundamental to add, but here are some small "proofreading" points:
  • After I've saved the data, I don't want to go back to the Moodle front page! I want to go back to the profiles config main page.
  • There's a problem in admin/profiles/defaultcourses.php - on line 21 you use "short PHP tags" rather than long, i.e. <? instead of <?php - please avoid this since many people (including us!) turn off the short tags option, and as a result the PHP code is written to the page rather than executed!
  • The trick of creating the tables the first time the form is submitted is nice and convenient. Not the way Moodle normally does it though! It seems fine in this context, but I wonder what the big cheeses will make of it.
  • I strongly recommend using the <label> tag to associate form elements with their labels - it's important for accessibility. It's convenient too - allows you to click the text next to a checkbox to turn it on and off! Nice.
  • You've created links dynamically by using $PHP_SELF, which works fine, but isn't Moodle coding style. It's preferable to use $CFG->wwwroot and add on the rest of the URL.
These are all small points, they're things which I think other moodlers would insist upon before adding this to the main Moodle codebase. However, I think this is a really useful improvement and should eventually become part of core Moodle. Certainly the ordinary course-creation code should use it as well as the IMS-E. Beyond v1.6...
Average of ratings: Useful (1)
In reply to Dan Stowell

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Hi Dan,
Thanks for your feedback. I have attached the modified files so that manual course creation references the course profile tables too. I agree with all your points and have made the suggested changes with the exception of the <label> tag. This needs to be added to the appropriate functions (print_checkbox, print_radiobuttons) of weblib.php. The changes made in the admin/profiles directory are attached too.

I am really excited about this because it is so easy and scalable. Big cheeses, get a whiff of this. smile It will be as easy to add the functions to the LDAP and External Database enrolment methods so they reference the course / user profiles (by category, of course) as it was to add them to manual course creation. If anyone wants me to do it, and is willing to test it for me, please ask - it won't take a moment. It would also be easy to tweak authentication methods or the addusers method to reference the user profile.

Paolo
p.s I think $PHP_SELF is deprecated anyway - should have been $_SERVER['PHP_SELF']
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Dan Stowell -
Re the <label> tag, I do think you have to do it yourself, because the writing of the actual label isn't done by the weblib functions. For example, I would modify

<td align="right"><?php print_string("chooseauthmethod","auth") ?>:</td>
<td><?php
    choose_from_menu ($auth_options, 'auth', $form->auth);
    helpbutton('authchange', get_string('chooseauthmethod', 'auth'));
    ?>
    </td>
to
<td align="right"><label for="auth"><?php print_string("chooseauthmethod","auth") ?>:</label></td>
<td><?php
    choose_from_menu ($auth_options, 'auth', $form->auth);
    helpbutton('authchange', get_string('chooseauthmethod', 'auth'));
    ?>
    </td>

The example is from defaultusers.html.

It's very picky of me to go on about this - since a lot of Moodle forms don't currently do this yet! Just thought I would mention it, since it's going to have to happen to all forms eventually, and because it makes it easier to hit checkboxes...

Have you added the functionality to the manual course creation? Nice one - I'll try that out when I can.
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Michael Penney -
Hi Paolo, if you can add the functions to make this work with LDAP enrollment, we would be happy to test it for you!
In reply to Michael Penney

Re: user and course templates

by Paolo Oprandi -
Hi Michael,
Will have a look into this when I get time.
Paolo
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Moien Abadi -
Picture of Testers
Hi Dear Paolo
Thanks a lot for this useful plugin.

I am New in moodle. (as a Technical Support)
I using moodle 1.5.3+ on windows server + MySQL
I have some Questions:

1. Would you please clarify me about this in Install.txt file?
"... If using MySQL the database it will be created the first time you
    submit a profile form else look into the "/admin/profiles/db"
    folder of the Moodle server directory to create you database  ..."
What should i do exactly?

2. when i choose "Define course profile by category" and press "save changes" button i get this error message:
"Error      could not insert course default record"
What is wrong with me?

Attachment Error_could_not_insert_course_default_record.JPG
In reply to Moien Abadi

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Oh! That is odd. Sounds like the table didn't get created when you submitted. Can you confirm? Otherwise, a field was missing from the table.

Did you download the course_default_admin.zip posted on the Friday, 9 June 2006, 11:51 PM or the zip file on the first posting? 
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Moien Abadi -
Picture of Testers
Dear Paolo

Thanks a lat for fast answer.
The result till now:
  1. I download the course_default_admin.zip and use it. but after that i get this message(see the attachment):
Fatal error: Undefined class name 'enrolment_factory' in e:\easyphp1-7\www\sandbox\admin\profiles\defaultcourses.html on line 69

What is wrong with me?

2. Which tables and How Should i create them?
Attachment 2nd_Error.JPG
In reply to Moien Abadi

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Hmm... What version of Moodle are running?

What do you see if you create a new course or go to enrolment plugins at/admin/enrol.php?
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by ian lake -
paolo

my college will be installing a live version of moodle on 4 august and this plug-in would appear to be exactly what i have been looking for, we have a number of different schools (departments) who will all want their own identity on the college moodle.

i am currently able to test version 1.6 on my laptop although i do have a live test site it is only running 'fantastico 1.5.2'.

which files do i need to download to give me the most options and a fully working version of the plug-in. i could download everything on the page but i think that will probably end up confusing me more than i already am.

your help would be appreciated.

ian
In reply to ian lake

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Hi Ian,
Great! Like you, at Sussex Uni we think giving departments their own identity will get more buy-in to the software. This plugin won't work on versions before 1.6. Having said that I could easily tweak it so that it runs without the enrolment error. The only other problem I can think of would be that you have more options than are possible on Moodle 1.5.2, but this would have no adverse effect.

I have split up the files because it is likely that each instutution will have chosen their enrolment methods. It will only be these methods that will need to access the defaults this plugin creates. So before I can answer your question, which files you should download, I must know which methods will students and staff enrol/sign up and how will you create courses.

There are two things to mention:

1) In the latest version of Moodle 1.6+ /admin/index.php has been changed so attached is the new version. (It is basically a list of links to admin functions, which you can only get to through the navigation of the breadcrumb bar).

2) Currently, if no default profile has been set the course profile will be the internal Moodle default, but I think I should change that so it is the Miscellaneous category default.
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by ian lake -

many thanks for the prompt reply. the college is likely to enrol via ldap although that might all change so the other option would be e-mail based authentication.

what i was hoping to do was to run the windows version of v1.6 (with xampp) on my laptop and then export the course templates to the college moodle on demand.

alternatively - actually thinking about it there probably is no alternative other than to run the plug in on the college server but as moodle is going to be a new toy from the college point of view i don't want to burden them with too much and would like some element of surprise when demonstrating moodle capabilities.

using the hosted 1.5.2 version is really a non-runner, that site will be used as an information portal for the learning centres with all the college side of things run from the college moodle. 

i tried this morning to run the plug in on my laptop but received an error - which i did not record but had something to do with line 127 in moodle admin. but i'm not worried, i'll try again.

In reply to ian lake

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Do tell me what error you got.

You will need to download both zip files for creating user and course default tables user_admin_default.zip and course_default_admin.zip

There are two ways Moodle may run with LDAP.  The first is simply for authentication - making sure the person is associated with institution. The second is enrolment where ldap will create the course and add the students on to it.  

Download /auth/ldap/lib.php if you are using the first - we use this with IMS Enterprise enrolment and it is tested

Download /auth/ldap/lib.php and /enrol/ldap/enrol.php  if you are using the second - we don't use this and cannot test it

I am not sure if you are going to test either method on your local machine unless it is connected to the LDAP server.

If you are using the email-based authentication system I think this file will suffice: /user/edit.php

And you will probably be manually creating courses so download: courseedit.zip

Manual course creation removes the urgent need for a default, but there are advantages nevertheless.
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by ian lake -

many thanks for this.

i have downloaded all the files but will not as you surmised be using the ldap stuff just yet.

could i trouble you just one more time and ask if there is an idiots guide to installation.

 

many thanks

ian

In reply to ian lake

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
The closest thing to documentation is what I put in my initial post, but don't use anything, but the documentation. Basically, add or replace the files in the directories shown. You could do a diff on the files to see what has changed. I downloaded the latest version on the 17th July and only the admin/index.php had been changed from the version I edited.

Once installed:

1. Follow links to setup user profiles from the administration pages.
2. Setup as desired
3. Follow links to setup course profiles from the administration pages.
4. Setup as desired.
5. Try adding users - hopefully, they will use the profile settings by default
6. Try setting up a course - hopefully, they will use the profile settings by default

Let me know how you get on.
In reply to ian lake

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Hi Ian,
Two of the mails I sent you yesterday have been returned. I don't think your mailbox is working properly.
Best wishes, Paolo
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by ian lake -

the college is in the process of moving from one building to another and consequently network traffic and mail is 'chaotic'. could you please resend them to ianlake@mynow.co.uk

many thanks

ian

 

In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Moien Abadi -
Picture of Testers
Dear Paolo

Thanks a lot for your attention.

My Moodle version is 1.5.3 and as i understand this plug, just works with moodle 1.6, is it?

In reply to Moien Abadi

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Yes, the problem is that
1) it does not recognise the enrolment classes that were introduced in 1.6, and
2) you have more options than are available on 1.5.3
I may be able to tweak it so it does work but what course and user creation methods and enrolment method do you use or do you intend to use with this?
Paolo
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Moien Abadi -
Picture of Testers
Dear Paolo

I get this error message when i want to create a new course:

Fatal error: Call to undefined function: update_restricted_mods() in e:\easyphp1-7\www\sandbox\course\edit.php on line 132


In reply to Moien Abadi

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Okay yes -the files I adapted from Moodle 1.6 will make calls to 1.6 functions. If I get a chance I shall try to provide 1.5.3-friendly version of the plugin, but in reality, I don't think I'll get the time.
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Moien Abadi -
Picture of Testers
Dear Paolo

When ever you have time and do it, I'll thankful.
I'll be very glad to use this plugin for this term.



In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Carol Shergold -
Hi Paolo

I think this looks really interesting and useful - thanks for posting it.

Seems to me that the features you've developed here, of being able to manage multiple default course profiles according to category, will be extremely useful for any medium/large institution wanting to adopt Moodle, as it will mean that different departments can define their own default course template etc.

V sensible too to allow the glossary to be based on category.

Cheers

Carol
In reply to Carol Shergold

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Hi Carol,

yes , all modules are based on category, but warning - this doesn't mean glossaries now have the functionality to span a category - indeed, it would be cool, but for now glossaries are still either by site (global) or by course.

Hi Dan,

got you... will add <label> tags in profiles_plugin_0.3. Let me know if the manual course creation works for you.

Cheers,
Paolo

In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Attached is a modified version of the plugin.

I have corrected the database table structure for $CFG->prefix.'_course_defaults' so you can create profile course blocks and I have modified it so if a form variable is submitted incorrectly and you are prompted to re-enter it, the form variables are not lost (and importantly you are modifying the same category profile).

Dan, I still haven't added the <label> tag as I have hardly been in the office, but I certainly will when I get time. The above changes seemed more vital for anyone finding this plugin of interest.

Paolo
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category HOW to Do.

by poll yakadi -
I installed profiles_plugin 0.2 together with IMS Enterprise enrolment plugin v0.6 in moodle 1.5.3+.

though you said profilespluggin 0.2 is for moodle 1.6. It's installed correctly in moodle 1.5.3+??? (but don't know how it working)

I found it difficult to know how to properly use profilespluggin 0.2 and IMS Enterprise enrolment plugin? (concept?)

Its really effective if you can instruct me to how to use
profilespluggin 0.2 and IMS Enterprise enrolment plugin to categorise users and enroll them to particular courses?

Any help materials that are more instructive on these pluggins?

Thank you.



In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by Paul Ortman -
I'm looking to use this with a PostgreSQL db backend and was wondering what the best way was to port things over? Looks like it is to create a mirror of the mysql.php file and name it as postgresql.php. Is that your understanding as well?

I'm new to the whole moodle development world, but would it make sense to to use the adodb library to try to create these cross platform? Maybe not, but I thought I'd ask to get some suggestions.
In reply to Paul Ortman

Re: Plugin to create user and course profiles by category

by Paolo Oprandi -
Hi Paul,
I copied the database table creation method from the standard Moodle method. I should try to compare and contrast say mysql.php to postgres7.php in lib/db or any mod/ { module } / db and create an adapted progres7.php for the plugin. If you do, please, post it here and I will include it in the plugin.

I did think of using adodb and changing the database defaults, but the idea was not liked by the programming community for maintenance reasons.
Paolo
In reply to Paolo Oprandi

Default user settings

by Paolo Oprandi -
I have improved this plugin and divided it up (for Moodle1.6). Attached to this posting are the files to create site-specific defaults for user settings.

admin/profiles/defaultsusers.php (new file)
admin/profiles/defaultsusers.html (new file)
admin/users.php (updated file to link to user profiles)
admin/profiles/db/mysql.php (new file)
lang/en_utf8/profiles.php (new file)

For it to work you will have to also install one of the plugins attached to the postings below so the user creation mechanism you use references the user defaults table.

Still not modified to work in Postgres. If there's big demand I will make it so it does, but I shan't be able to test it.

Hopefully the zipped attachment won't have any extraneous mac files

In reply to Paolo Oprandi

Manual subscriptions to use default user settings

by Paolo Oprandi -
Attached to this post are the changes needed to use the user default settings if set with manual subscriptions to a Moodle site

Attached is the following file.
/user/edit.php (modified file)

It should be copied over the current edit.php in folder: user

In reply to Paolo Oprandi

Upload users to use default user settings

by Paolo Oprandi -
Attached to this post are the changes needed to use the user default settings if set with batch enrolment from a text file

Attached is the following file.
/admin/uploadusers.php (modified file)

It should be copied over the current uploadusers.php in folder: admin
In reply to Paolo Oprandi

ldap to use default user settings

by Paolo Oprandi -
Attached to this post are the changes needed to use the user default settings if set with ldap

Attached is the following file.
/auth/ldap/lib.php (modified file)

It should be copied over the current lib.php in folder: auth/ldap

In reply to Paolo Oprandi

Default course settings

by Paolo Oprandi -
Attached to this posting are the files to create site-specific defaults for course settings.

admin/profiles/defaultcourses.php (new file)
admin/profiles/defaultcourses.html (new file)
admin/profiles/defaultblocks.php (new file)
admin/profiles/defaultblocks.html (new file)
admin/profiles/defaultforum.php (new file)
admin/profiles/defaultforum.html (new file)
admin/profiles/defaultglossary.php (new file)
admin/profiles/defaultglossary.html (new file)
admin/profiles/defaultwiki.php (new file)
admin/profiles/defaultwiki.html (new file)
admin/configure.php (updated file to link to user profiles)
admin/profiles/db/mysql.php (new file)
lang/en_utf8/profiles.php (new file)
lib/courseprofileslib.php (new file)

For it to work you will have to also install one of the plugins attached to the postings below so the user creation mechanism you use references the course defaults table.

Still not modified to work in Postgres. If there's big demand I will make it so it does, but I shan't be able to test it.

Hopefully the zipped attachment won't have any extraneous mac files
In reply to Paolo Oprandi

Manual course creation to use default course settings

by Paolo Oprandi -
Attached to this post are the changes needed to use the course default settings if set with manual course creation

Attached to this post are:
course/edit.php (modifed file)
course/edit.html (modified file)

Both files to be copied into the course directory.

In reply to Paolo Oprandi

ldap enrolment to use default course settings

by Paolo Oprandi -
Attached to this post are the changes needed to use the course default settings if set with ldap enrolment.

Attached to this post is:
enrol/ldap/enrol.php (modifed file)


File to be copied into the directory: enrol/ldap.
In reply to Paolo Oprandi

imsenterprise enrolment to use default course settings

by Paolo Oprandi -
Attached to this post are the changes needed to use the course default settings if set with imsenterprise enrolment.

Attached to this post is:
enrol/imsenterprise/enrol.php (modifed file)
enrol/imsenterprise/config.html (modifed file)

Both files to be copied into the directory: enrol/imsenterprise.

This version of the imsenterprise enrolment has been altered quite a lot.  One key change is  that it will unenrol people who have been enrolled using imsenterprise, but are no longer enrolled according to the central records system.

For more information about changes to this enrolment method see our blog:
http://www.sussex.ac.uk/its/minted
In reply to Paolo Oprandi

Re: ldap enrolment to use default course settings

by Paolo Oprandi -
actually use the attachment here for ldap enrolment - I can't test this, but perhaps Michael will? smile
In reply to Paolo Oprandi

Re: ldap enrolment to use default course settings

by Marion de Groot -

Hi Paolo,

You plugin seems very interesting. Could you post a new zip with the latest files? I'm not sure which files to use now with alle these different files attachted to different postings in this thread...

Thanks in advance,

Marion

In reply to Marion de Groot

Re: ldap enrolment to use default course settings

by Paolo Oprandi -
Hi Marion,

Are you using Moodle 1.6?
How do manage user and course creation and course enrolments?

Paolo
In reply to Paolo Oprandi

Re: ldap enrolment to use default course settings

by Marion de Groot -

I'm using both: I have a current site that uses 1.5.3. and I'm building a new site for which I'd like to use 1.6 (if I can get all the custom modules I need to work with 1.6)

On my site are courses for medical doctors. They can do these courses to keep their knowledge up to date and gain study points ( every medical doctor needs e certain number of study points every year in order to keep their licence in the Netherlands ). I'd like all my members to have their own group, based on their medical specialism. My members enrol by email, my courses are made seperatly by hand. But they all have the same structure, the same length etc. So I thought: there should be a way to do this quicker and easier. I thought maybe your module could help me do this?

Marion

In reply to Marion de Groot

Re: ldap enrolment to use default course settings

by Paolo Oprandi -
Marion,
Sorry for my lateness in replying. 

my courses are made seperatly by hand. But they all have the same structure, the same length etc

I think, perhaps, the best way to do what you want is to backup and restore one course with the desired structure on to your other courses, including only modules you want to copy

I'd like all my members to have their own group, based on their medical specialism

I am not quite sure what you mean here, but I believe you can maintain groups through courses with metacourses.

On testing recently, prompted in part by problems Ian Lake was having, I noticed some trivial, but annoying bugs in the latest course profiles zip I uploaded.  Also I saw some more worrying differences in behaviours of the peer-to-peer activity profiles in 1.6.1 that needs more investigation. 

The good thing is that on talking to Martin Dougiamos at the Moot he said he was keen on implementing this feature after Google Summer of Code project has finished enhancing the administration pages.
In reply to Paolo Oprandi

Re: Plugin to create user and course profiles by category

by sac sam -

Hi, i wanna know if there is some changes to Work in a postgres database.

Thanks!

In reply to sac sam

Re: Plugin to create user and course profiles by category

by Carl Thelen -
Is there any thought to upgrading this module to Moodle 1.9 or 2.0?

I'm trying to use it with 1.9, and not having a lot of luck. I don't want to replace my admin/index.php or course/edit.php because they're 1.6 versions....

Cheers!
In reply to Paolo Oprandi

How Create Contract and multiple Organization

by ashwani rai -

Hello  paolo,

How to create a contract and multiple organizations account in moodle and courses mapped with organization.

Also mapped the organization administrator -> to create a user for organization and mapped the external user with organization.

Please, give me suggestions.

 

Ashwani