ADD FIELDS TO COURSES

ADD FIELDS TO COURSES

by Tommaso Gri -
Number of replies: 7

Hi all,

i need to add field (like numer of credits, duration of course...) when i create a new course (maybe course/edit.php page?)

I need to modificate the php page or there is a way to modificate the structure with a plug in?

Average of ratings: Useful (1)
In reply to Tommaso Gri

Re: ADD FIELDS TO COURSES

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Dear Tommaso,

As far as I am aware, there is no way to modify the course settings to add new fields. I wanted to do the same and posted a question in the developer forum - http://moodle.org/mod/forum/discuss.php?d=144835 - but never received a reply.

I suspect that it is possible, but would require a lot of code changes. Try posting on that forum and see if you do get a response.

Cheers,

Gareth
In reply to Tommaso Gri

Re: ADD FIELDS TO COURSES

by Maryel Mendiola -
Hi Tommaso and Gareth smile


we use to do this instead of change php files:


In each course we upload all that information in a pdf file at topic 0 for participants, and in other pdf file the content of all course, objectives, outcomes, whatever you need or want.


And it's better than change php files, just because every upgrading you'll need to do the same.

We (my fellows teachers and) bet to keep it simple smile


Just try to make a template for you pdf files smile



best regards for both

Maryel
In reply to Maryel Mendiola

Re: ADD FIELDS TO COURSES

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Dear Maryel,

Thanks for the reply, but what I want to do involves my format.php in my course format reacting to the values of two stored variables so that it can automatically manipulate the content in terms of number of weeks that are displayed.  A sort of dynamic viewable window of time without user intevention.

Hence I need to add attributes to the course that are stored and edited in course settings.

Cheers,

Gareth

In reply to Gareth J Barnard

Re: ADD FIELDS TO COURSES

by Teresa Gibbison -
Hi Gareth & Tommaso

I'm sure adding fields would be possible. You might like to have a look at the Developer Documentation for hints on how to develop Moodle. Also have a look at the Introduction to Moodle Programming online course for other resources.

You would need to (and just to let you know, I'm not a developer!) create the additional fields in the database then modify the course edit form so the fields can be populated & updated, then you'll need to modify other relevant files (probably course/edit.php & course/lib) to do something with those fields. I suggest you take a look at an existing field to see how it's populated and updated.

As Mayrel advises though, once you change part of the core code you need to make sure your changes still work every time you update your Moodle code. It's always best to check upgrades with a duplicate of your site before upgrading your production server.

Just a quick search of Moodle forums and the Adding custom fields forum thread may also help.

I hope this helps
Cheers
Teresa
Average of ratings: Useful (1)
In reply to Tommaso Gri

Re: ADD FIELDS TO COURSES

by stuti bhavsar -

Hi Tommaso,

I am even trying to add a field in course page. This is getting added through course/edit_form.php. But I want to add through plugin.

If you have an idea about adding through plugin, please sugges me.

In reply to stuti bhavsar

Re: ADD FIELDS TO COURSES

by M Adil Mazhar -

looking for any result/solution of the same issue but not getting the exact solution!