Details

    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_27_STABLE

      Description

      This contribution extends the system used for user profiles. Custom fields and categories can now be defined for courses, and potentially other objects.

      The full description is at https://github.com/silecs/moodle-course-custom-fields/wiki/Custom-fields-for-courses

      The repository is https://github.com/silecs/moodle-course-custom-fields

      Please review this contribution.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            salvetore Michael de Raadt added a comment -

            Thanks for sharing that.

            Perhaps you could add some details about what this change allows users to do.

            Show
            salvetore Michael de Raadt added a comment - Thanks for sharing that. Perhaps you could add some details about what this change allows users to do.
            Hide
            mytskine François Gannaz added a comment -

            Alright, there's a need for a description between the 2 short sentences in this ticket and the long wiki page referenced above. The goal is to add many metadata to courses. This is mainly a structural development, so there are only 2 interface changes.

            1. Any user (with the right global capabilities) can define custom fields for courses. These fields are organized in custom categories (not the course categories). The interface for defining the fields and categories is the same as the UI for defining user profiles (it shares much of the code and the same SQL tables, though the data is independent).

            2. Any user (with the right local capabilities) that creates or modifies a course can fill in values for the existing custom fields.

            An example :
            1. In the menu, I choose the page "Site administration > Courses > Course custom fields".
            2. I use the drop-down list "Create a new field" at the bottom of the page to define a checkbox field.
            3. In the form that appears, I give this custom field a unique name, a long name ("Passing is required") and a description. The other lines of the form are kept at their default values (e.g. default category: "Other fields").
            4. Now I create a new course: at the bottom of the form, there's a fieldset whose name is "Other fields" and that contains a checkbox with the label "Passing is required".

            Show
            mytskine François Gannaz added a comment - Alright, there's a need for a description between the 2 short sentences in this ticket and the long wiki page referenced above. The goal is to add many metadata to courses. This is mainly a structural development, so there are only 2 interface changes. 1. Any user (with the right global capabilities) can define custom fields for courses. These fields are organized in custom categories (not the course categories). The interface for defining the fields and categories is the same as the UI for defining user profiles (it shares much of the code and the same SQL tables, though the data is independent). 2. Any user (with the right local capabilities) that creates or modifies a course can fill in values for the existing custom fields. An example : 1. In the menu, I choose the page "Site administration > Courses > Course custom fields". 2. I use the drop-down list "Create a new field" at the bottom of the page to define a checkbox field. 3. In the form that appears, I give this custom field a unique name, a long name ("Passing is required") and a description. The other lines of the form are kept at their default values (e.g. default category: "Other fields"). 4. Now I create a new course: at the bottom of the form, there's a fieldset whose name is "Other fields" and that contains a checkbox with the label "Passing is required".
            Hide
            poltawski Dan Poltawski added a comment -

            Hi François,

            What branch is this based off? Can you provide a github diff url?

            Show
            poltawski Dan Poltawski added a comment - Hi François, What branch is this based off? Can you provide a github diff url?
            Hide
            mytskine François Gannaz added a comment -

            Hi Dan
            The branch is named "WIP_course_custom_fields". It is the default branch for the project page on Github.
            I don't know how to display a branch diff in Github, so here is a paste, thanks to nopaste-cli: http://paste.ubuntu.com/1132547/
            BTW, the diff is a bit large:

            $ git diff MOODLE_23_STABLE..WIP_course_custom_fields | wc -l
            6033

            Show
            mytskine François Gannaz added a comment - Hi Dan The branch is named "WIP_course_custom_fields". It is the default branch for the project page on Github. I don't know how to display a branch diff in Github, so here is a paste, thanks to nopaste-cli: http://paste.ubuntu.com/1132547/ BTW, the diff is a bit large: $ git diff MOODLE_23_STABLE..WIP_course_custom_fields | wc -l 6033
            Hide
            sulak Ludek Sulak added a comment -

            Hallo,
            We are using this extension(patch) in one of our Moodle implementation. We are very happy for this extension, but we have some problems.

            The situation is:
            We have installed Moodle ver. 2.2.5+ and we want to upgrade to MOODLE_23_STABLE..WIP_course_custom_fields.
            During the upgrade process we get the system error message "Cannot downgrade moodle from 2012062500.02 to 2012062500.02."
            Any idea where is the problem?

            Next situation:
            We have installed MOODLE_23_STABLE..WIP_course_custom_fields. We have added some custom attributes to the course, it works OK. But, after we deleted that course, the custom attributes still persist in the database.

            Question:
            When this extension will be integrated into the moodle standard package?

            Thank you for your response.
            Best regards

            Show
            sulak Ludek Sulak added a comment - Hallo, We are using this extension(patch) in one of our Moodle implementation. We are very happy for this extension, but we have some problems. The situation is: We have installed Moodle ver. 2.2.5+ and we want to upgrade to MOODLE_23_STABLE..WIP_course_custom_fields. During the upgrade process we get the system error message "Cannot downgrade moodle from 2012062500.02 to 2012062500.02." Any idea where is the problem? Next situation: We have installed MOODLE_23_STABLE..WIP_course_custom_fields. We have added some custom attributes to the course, it works OK. But, after we deleted that course, the custom attributes still persist in the database. Question: When this extension will be integrated into the moodle standard package? Thank you for your response. Best regards
            Hide
            mytskine François Gannaz added a comment -

            Both problems are fixed in the Moodle clone. I can't answer the question about the integration of this patch, of course.

            Show
            mytskine François Gannaz added a comment - Both problems are fixed in the Moodle clone. I can't answer the question about the integration of this patch, of course.
            Hide
            midi3057 Mindaugas added a comment -

            Hello,
            when and in which version this issue will be resolved and implemented?
            Thanks

            Show
            midi3057 Mindaugas added a comment - Hello, when and in which version this issue will be resolved and implemented? Thanks
            Hide
            sulak Ludek Sulak added a comment -

            Hi François,

            We are still experimenting with this great extension, but we would like to discus with you a new problem.

            If we create a new account on login/signup.php page, and we fill the form, after the submit we obtain the message:

            Fatal error: Call to undefined function profile_validation() in /var/www/moodle/login/signup_form.php on line 188 Call Stack: 0.0008 677208 1.

            {main}

            () /var/www/moodle/login/signup.php:0 0.1960 35286048 2. moodleform->get_data() /var/www/moodle/login/signup.php:51 0.1960 35286048 3. moodleform->is_validated() /var/www/moodle/lib/formslib.php:606 0.1960 35286264 4. moodleform->validate_defined_fields() /var/www/moodle/lib/formslib.php:509 0.1971 35289984 5. login_signup_form->validation() /var/www/moodle/lib/formslib.php:560

            Can you help us with this?
            Thank you very much,
            best regards

            Show
            sulak Ludek Sulak added a comment - Hi François, We are still experimenting with this great extension, but we would like to discus with you a new problem. If we create a new account on login/signup.php page, and we fill the form, after the submit we obtain the message: Fatal error: Call to undefined function profile_validation() in /var/www/moodle/login/signup_form.php on line 188 Call Stack: 0.0008 677208 1. {main} () /var/www/moodle/login/signup.php:0 0.1960 35286048 2. moodleform->get_data() /var/www/moodle/login/signup.php:51 0.1960 35286048 3. moodleform->is_validated() /var/www/moodle/lib/formslib.php:606 0.1960 35286264 4. moodleform->validate_defined_fields() /var/www/moodle/lib/formslib.php:509 0.1971 35289984 5. login_signup_form->validation() /var/www/moodle/lib/formslib.php:560 Can you help us with this? Thank you very much, best regards
            Hide
            mytskine François Gannaz added a comment -

            @Ludek
            Hi.
            The bug you mentioned is fixed in the github repository. We don't use the self-inscription process, so we were never hit by this bug.

            Our client is using a variant of this code in production with thousands of users. I have backported (cherry-picked as says git) a few changes to the branch published on github. Unfortunately, as time pass by, it will be harder for us to fix or enhance this forked code. It will also be harder to merge it into the stable Moodle branches.

            Please, could an official developer review this feature? It's been 3 months and a half since the ticket/pull-query was opened.

            Show
            mytskine François Gannaz added a comment - @Ludek Hi. The bug you mentioned is fixed in the github repository. We don't use the self-inscription process, so we were never hit by this bug. Our client is using a variant of this code in production with thousands of users. I have backported (cherry-picked as says git) a few changes to the branch published on github. Unfortunately, as time pass by, it will be harder for us to fix or enhance this forked code. It will also be harder to merge it into the stable Moodle branches. Please, could an official developer review this feature? It's been 3 months and a half since the ticket/pull-query was opened.
            Hide
            jenny-gray Jenny Gray added a comment - - edited

            There was some discussion about custom fields more generally in Moodle at the recent Developer meeting in Perth. You may wish to participate in the discussion at https://moodle.org/mod/forum/discuss.php?d=215422.

            I doubt that any solution solely aimed at courses would be accepted into core at this time, while we're actively investigating the more general solution (my personal view only - I'm sure other HQ participants in this issue will correct me if they disagree!!).

            However, if you want an official developer to review your work, you will need to submit it for Peer Review through the tracker workflow. If you haven't done already, please read http://docs.moodle.org/dev/Peer_reviewing_checklist and http://docs.moodle.org/dev/Integration_Review to make sure that you've covered everything that they'll be looking for.

            Show
            jenny-gray Jenny Gray added a comment - - edited There was some discussion about custom fields more generally in Moodle at the recent Developer meeting in Perth. You may wish to participate in the discussion at https://moodle.org/mod/forum/discuss.php?d=215422 . I doubt that any solution solely aimed at courses would be accepted into core at this time, while we're actively investigating the more general solution (my personal view only - I'm sure other HQ participants in this issue will correct me if they disagree!!). However, if you want an official developer to review your work, you will need to submit it for Peer Review through the tracker workflow. If you haven't done already, please read http://docs.moodle.org/dev/Peer_reviewing_checklist and http://docs.moodle.org/dev/Integration_Review to make sure that you've covered everything that they'll be looking for.
            Hide
            mytskine François Gannaz added a comment -

            Thank you Jenny Gray for this interesting link to this discussion. We'll soon contribute to it.

            As stated in the description of this ticket, the metadata system we developed can be applied to any kind of object. But since our purpose was to use this on courses, we only implemented an interface to handle course custom fields.

            Could you please elaborate on our "need to submit it for Peer Review through the tracker workflow"? If we missed a step in the procedure for integration and peer reviewing, please tell us explicitly. The two links you gave seem to be addressed at Moodle developers that review and integrate contributions into the main code. Of course, we followed the official guides: http://docs.moodle.org/dev/Guidelines_for_contributed_code and http://docs.moodle.org/dev/Coding .

            Show
            mytskine François Gannaz added a comment - Thank you Jenny Gray for this interesting link to this discussion. We'll soon contribute to it. As stated in the description of this ticket, the metadata system we developed can be applied to any kind of object. But since our purpose was to use this on courses, we only implemented an interface to handle course custom fields. Could you please elaborate on our "need to submit it for Peer Review through the tracker workflow"? If we missed a step in the procedure for integration and peer reviewing, please tell us explicitly. The two links you gave seem to be addressed at Moodle developers that review and integrate contributions into the main code. Of course, we followed the official guides: http://docs.moodle.org/dev/Guidelines_for_contributed_code and http://docs.moodle.org/dev/Coding .
            Hide
            jenny-gray Jenny Gray added a comment -

            I understood from your earlier comments that you are offering this work for inclusion in the main code. Is that not true?

            See also http://docs.moodle.org/dev/Process, where you have reached the section on peer review and you may find this helpful too https://moodle.org/mod/forum/discuss.php?d=207872

            Show
            jenny-gray Jenny Gray added a comment - I understood from your earlier comments that you are offering this work for inclusion in the main code. Is that not true? See also http://docs.moodle.org/dev/Process , where you have reached the section on peer review and you may find this helpful too https://moodle.org/mod/forum/discuss.php?d=207872
            Hide
            mytskine François Gannaz added a comment -

            This ticket was created to ask for inclusion of our patch into the main repository. So, yes, we are offering this work for inclusion.

            I'm sorry, but I don't understand how the instructions you pointed out apply to me. As stated in the forum post you mentioned, "the request peer review button only appears if the bug is assigned to you": I can't assign the bug to myself, it already has an assignee.

            Show
            mytskine François Gannaz added a comment - This ticket was created to ask for inclusion of our patch into the main repository. So, yes, we are offering this work for inclusion. I'm sorry, but I don't understand how the instructions you pointed out apply to me. As stated in the forum post you mentioned, "the request peer review button only appears if the bug is assigned to you": I can't assign the bug to myself, it already has an assignee.
            Hide
            jenny-gray Jenny Gray added a comment -

            Then I think you need one of the HQ people to help you, as you don't appear to have the right level of permissions to do what you are asking.

            Show
            jenny-gray Jenny Gray added a comment - Then I think you need one of the HQ people to help you, as you don't appear to have the right level of permissions to do what you are asking.
            Hide
            nadavkav Nadav Kavalerchik added a comment -

            Hi François Gannaz,

            Researching about "Custom course fields", I came across this issue. And I would like to help you prepare it for core integration or at least code review. So please see if you can help me clear out some questions, first.
            I was looking at a recent diff between your Moodle 24 path and a stable Moodle 2.4 release. (link to diff) Is this correct?
            If so...

            • You need to assign yourself to this issue (If you can not, I will help you do that)
            • Then, you need to get an updated local copy of Moodle's master branch and create a branch out of it, let's say "git checkout -b MDL-34634_master origin/master"
            • Apply all your patches and push it into github.com/silecs/moodle-course-custom-fields
            • Go back to this tracker and fill in the proper major fields (pull from repository, pull master branch and pull master diff)
            • Then, click the "request peer review" button.
            Show
            nadavkav Nadav Kavalerchik added a comment - Hi François Gannaz , Researching about "Custom course fields", I came across this issue. And I would like to help you prepare it for core integration or at least code review. So please see if you can help me clear out some questions, first. I was looking at a recent diff between your Moodle 24 path and a stable Moodle 2.4 release. ( link to diff ) Is this correct? If so... You need to assign yourself to this issue (If you can not, I will help you do that) Then, you need to get an updated local copy of Moodle's master branch and create a branch out of it, let's say "git checkout -b MDL-34634 _master origin/master" Apply all your patches and push it into github.com/silecs/moodle-course-custom-fields Go back to this tracker and fill in the proper major fields (pull from repository, pull master branch and pull master diff) Then, click the "request peer review" button.
            Hide
            allegre Guillaume Allegre added a comment -

            Hi Nadav,

            I'm a work colleague of François Gannaz, who is on vacations these days.

            As a previous comment from Jenny Gray, we found this discussion https://moodle.org/mod/forum/discuss.php?d=215422,
            where it appears that other ways are being (loosely) studied to include this functionality into Moodle core.
            So, to be honest, we are not confident any longer that François' patch will eventually be included.

            I will let François give a longer answer when he is back.

            Show
            allegre Guillaume Allegre added a comment - Hi Nadav, I'm a work colleague of François Gannaz, who is on vacations these days. As a previous comment from Jenny Gray, we found this discussion https://moodle.org/mod/forum/discuss.php?d=215422 , where it appears that other ways are being (loosely) studied to include this functionality into Moodle core. So, to be honest, we are not confident any longer that François' patch will eventually be included. I will let François give a longer answer when he is back.
            Hide
            nadavkav Nadav Kavalerchik added a comment -

            Hi Guillaume Allegre,

            Thank you for the quick reply!

            I think the whole concept of implementing generic Metadata in Moodle's core is stucked (Every discussion/issue is dated a year ago) and I wish to help it move forward.

            I found the following resources:

            I would love to get some feedback or status from Moodle HQ on all of this (or even if Martin Dougiamas could have a quick look?)

            Show
            nadavkav Nadav Kavalerchik added a comment - Hi Guillaume Allegre , Thank you for the quick reply! I think the whole concept of implementing generic Metadata in Moodle's core is stucked (Every discussion/issue is dated a year ago) and I wish to help it move forward. I found the following resources: https://tracker.moodle.org/browse/CONTRIB-3527 https://tracker.moodle.org/browse/MDL-18319 https://tracker.moodle.org/browse/MDL-34634 Totara's course custom patch : https://moodle.org/mod/forum/discuss.php?d=203936#p903046 Remote-Learner's ELIS : https://moodle.org/mod/forum/discuss.php?d=203936#p889626 https://moodle.org/mod/forum/discuss.php?d=215422 block boaidp: https://tracker.moodle.org/browse/CONTRIB-3517 block, mod, repository: https://moodle.org/plugins/view.php?plugin=mod_sharedresource And linked some of them to this issue. I would love to get some feedback or status from Moodle HQ on all of this (or even if Martin Dougiamas could have a quick look?)
            Hide
            marina Marina Glancy added a comment -

            Hi guys,
            just to mention here that using the course formats API in 2.4 you can add as many custom fields to the course format as you want (called "course format options") and they will be backed up and restored together with the other course information.
            If several course formats are used on the site and they share the same names for the additional options, the values will be preserved when switching between those formats. For example, weeks and topics share 'numsections' and 'hiddensections'.

            When you introduce the new custom course fields you also need to create some interface to show those fields and showing the course information is the responsibility of the course format anyway. So it may be a double work.

            Dev docs: http://docs.moodle.org/dev/Course_formats

            Regards
            Marina

            Show
            marina Marina Glancy added a comment - Hi guys, just to mention here that using the course formats API in 2.4 you can add as many custom fields to the course format as you want (called "course format options") and they will be backed up and restored together with the other course information. If several course formats are used on the site and they share the same names for the additional options, the values will be preserved when switching between those formats. For example, weeks and topics share 'numsections' and 'hiddensections'. When you introduce the new custom course fields you also need to create some interface to show those fields and showing the course information is the responsibility of the course format anyway. So it may be a double work. Dev docs: http://docs.moodle.org/dev/Course_formats Regards Marina
            Hide
            nadavkav Nadav Kavalerchik added a comment -

            Thank you Marina Glancy for the info! I was not aware of it.

            It does seem interesting but I (Actually... we, The Israeli ministry of Education) need a solution for all the courses regardless the course format, and much more. We already set up an exchange hub for LMSes (not just Moodle) resources, activities and courses. And we need a proper (standardized) way to add metadata to items (a course,a resource and an activity) when they are exported out of Moodle and shared.

            Show
            nadavkav Nadav Kavalerchik added a comment - Thank you Marina Glancy for the info! I was not aware of it. It does seem interesting but I (Actually... we, The Israeli ministry of Education) need a solution for all the courses regardless the course format, and much more. We already set up an exchange hub for LMSes (not just Moodle) resources, activities and courses. And we need a proper (standardized) way to add metadata to items (a course,a resource and an activity) when they are exported out of Moodle and shared.
            Hide
            emdalton1 Elizabeth Dalton added a comment -

            I would really like to see this move forward for 2.6. Presently we have three different kinds of data being crammed into the "Course ID" field because it's the only field available, and when I create reports I have to parse this field to get the information out again. This field is also not visible to everyone who needs to see it. As I posted in the discussion linked above, I worry that we are letting "perfect" be the enemy of "good" by delaying this integration to evaluate other possible implementations. If there is a serious concern that this method has substantial performance risks, then those should be addressed, but otherwise, why wait?

            Show
            emdalton1 Elizabeth Dalton added a comment - I would really like to see this move forward for 2.6. Presently we have three different kinds of data being crammed into the "Course ID" field because it's the only field available, and when I create reports I have to parse this field to get the information out again. This field is also not visible to everyone who needs to see it. As I posted in the discussion linked above, I worry that we are letting "perfect" be the enemy of "good" by delaying this integration to evaluate other possible implementations. If there is a serious concern that this method has substantial performance risks, then those should be addressed, but otherwise, why wait?
            Hide
            mytskine François Gannaz added a comment -

            I'm the author of the proposed patch. I'll be blunt: it's a bit late to revive this offer. I'll try to work on it next week, with no guarantee I'll succeed in a limited time. Comments on the technical documentation I submitted in 2012-07 would be much appreciated.
            Now, I'll try to be constructive, but I'm on for a big rant.

            On the technical side, the patch was developed for Moodle 2.3. We proposed it more than 13 months ago. Unfortunately, there were changes in the "user profile" API in v2.4. IIRC, these changes were undocumented in the wiki, and unused in the PHP code of M2.4, yet they were added to Moodle. We chose not to port them when we migrated our forked Moodle to v2.4. I mean we have a working patch for Moodle 2.4 (in the same github repository), but the new (unused) 2.4 profile API was deleted because it would have duplicated our own API. I haven't looked at v2.5, but if this new API is used, it will conflict with ours. Even setting this aside, there have been 13 months of Moodle development, so it would be a hard work to replay this massive patch on the master branch.

            On the human side, I haven't worked on this part of the code for months, and I'm reluctant to go back to it. Seeing how the previous internal process of "investigating the more general solution" went immediately astray then died with no visible progress (see forum link in a 2012-11-19 note above), I'm not confident that Moodle's team has an idea of what they think suitable for generic metadata. The new profile API I've talked about is another reason for my disillusion: if generic metadata were being investigated, then introducing an API for user-specific metadata was a bad idea, and probably shows a lack of internal communication. I'm afraid I'll redo this patch for nothing. One year ago, did anyone at least read the technical documentation I submitted with the patch?

            Show
            mytskine François Gannaz added a comment - I'm the author of the proposed patch. I'll be blunt: it's a bit late to revive this offer. I'll try to work on it next week, with no guarantee I'll succeed in a limited time. Comments on the technical documentation I submitted in 2012-07 would be much appreciated. Now, I'll try to be constructive, but I'm on for a big rant. On the technical side, the patch was developed for Moodle 2.3. We proposed it more than 13 months ago. Unfortunately, there were changes in the "user profile" API in v2.4. IIRC, these changes were undocumented in the wiki, and unused in the PHP code of M2.4, yet they were added to Moodle. We chose not to port them when we migrated our forked Moodle to v2.4. I mean we have a working patch for Moodle 2.4 (in the same github repository), but the new (unused) 2.4 profile API was deleted because it would have duplicated our own API. I haven't looked at v2.5, but if this new API is used, it will conflict with ours. Even setting this aside, there have been 13 months of Moodle development, so it would be a hard work to replay this massive patch on the master branch. On the human side, I haven't worked on this part of the code for months, and I'm reluctant to go back to it. Seeing how the previous internal process of "investigating the more general solution" went immediately astray then died with no visible progress (see forum link in a 2012-11-19 note above), I'm not confident that Moodle's team has an idea of what they think suitable for generic metadata. The new profile API I've talked about is another reason for my disillusion: if generic metadata were being investigated, then introducing an API for user-specific metadata was a bad idea, and probably shows a lack of internal communication. I'm afraid I'll redo this patch for nothing. One year ago, did anyone at least read the technical documentation I submitted with the patch?
            Hide
            emdalton1 Elizabeth Dalton added a comment -

            @Marina,

            Course formats are not the right place for us to keep information about a course. Course formats can be changed by the instructor or another editor, and then information would be lost.

            (I think Course formats are getting overloaded with features at this point.)

            Show
            emdalton1 Elizabeth Dalton added a comment - @Marina, Course formats are not the right place for us to keep information about a course. Course formats can be changed by the instructor or another editor, and then information would be lost. (I think Course formats are getting overloaded with features at this point.)
            Hide
            nadavkav Nadav Kavalerchik added a comment -

            Quick update:
            Eventually, we used the MDL-18319 patch to add custom course metadata fields to our Moodle 2.5 system.
            It is a similar idea but with different implementation. It works fine for some time now.

            Show
            nadavkav Nadav Kavalerchik added a comment - Quick update: Eventually, we used the MDL-18319 patch to add custom course metadata fields to our Moodle 2.5 system. It is a similar idea but with different implementation. It works fine for some time now.
            Hide
            amanda.doughty Amanda Doughty added a comment -

            Why has nobody responded to Francois?

            Show
            amanda.doughty Amanda Doughty added a comment - Why has nobody responded to Francois?
            Hide
            emdalton1 Elizabeth Dalton added a comment - - edited

            We gave up on this process. We are going to use ELIS, since we host with Remote Learner. Note that this means we are going to need to pay additional fees each year for functionality that many, many users think should be "core." Also, ELIS implements the extra fields in a parallel "class instance" tied to the Moodle course using an extra table, rather than within the course itself, which isn't very elegant. But at least it is available and supported.

            With 36 votes supporting, maybe the priority of this issue could be revisited.... I assume Francois' offer is no longer available, so development would need to be started from scratch.

            Show
            emdalton1 Elizabeth Dalton added a comment - - edited We gave up on this process. We are going to use ELIS, since we host with Remote Learner. Note that this means we are going to need to pay additional fees each year for functionality that many, many users think should be "core." Also, ELIS implements the extra fields in a parallel "class instance" tied to the Moodle course using an extra table, rather than within the course itself, which isn't very elegant. But at least it is available and supported. With 36 votes supporting, maybe the priority of this issue could be revisited.... I assume Francois' offer is no longer available, so development would need to be started from scratch.
            Hide
            philippesiw Philippe Siwinski added a comment -

            Hi, any thoughts on how could we use Totara's source code to add custom course fields to Moodle?

            Should we continue to use this issue in the tracker or should we open a more recent one?

            Show
            philippesiw Philippe Siwinski added a comment - Hi, any thoughts on how could we use Totara's source code to add custom course fields to Moodle? Should we continue to use this issue in the tracker or should we open a more recent one?
            Hide
            abias Alexander Bias added a comment -

            Hi Philippe Siwinski, dear all,

            I'd like to add my two cents to this ticket here:

            we have an upcoming project which will integrate Moodle with our SAP SLcM campus management solution. One aspect of this integration is to provide a interface for course metadata:

            There are many course metadata in SAP SLcM like time and venue information for the "real life course", consultation hours of the teacher, direct URL of the course information in SAP SLcM and so on. Moodle does not provide metadata fields to save this data within courses.
            It would be possible to combine all these metadata fields into one string and save it into the summary field of the course. This approach would be feasible, but does not seem optimal. So we were thinking about better methods to provide these metadata fields which come from SAP SLcM to students in a Moodle course.

            We had a look at Totara and its custom course fields and it seems to be the tool we need in Moodle. So we had a discussion with our Moodle partner how to bring custom course fields to Moodle and we came to this conclusion:

            • Create a local plugin for Moodle with the libs for custom course fields.
            • This local plugin adds a new page to the "Course administration" tree within a course where the custom course fields of the course can be seen / set. This diverges from the place where custom course fields are placed in Totara, but it comes with the upside that there is no need to hack the edit course form in Moodle.
            • The possibility to globally manage custom course fields will be created as a dedicated admin page just like it is done in Totara (https://demo.totaralms.com/totara/customfield/index.php?prefix=course). The local plugin can provide this admin page, no need to hack Moodle core again.
            • If this local plugin will work without any core hacks then, we would release it in the Moodle plugin repository.

            This local plugin would bring the possibility to manage custom course fields to Moodle. Yet, it does not do anything with this data.

            Therefore, in addition to this local plugin, we would create two more things:

            • Webservices for creating and updating courses which will be able to fill and manipulate the custom profile fields. We would create new webservices in the aforementioned local plugin to provide this functionality.
            • Additionally, we would create a block which can be placed in a course, gets the course's custom fields and displays them in a nice way. The block can then be released in the Moodle plugin repository, too.

            With this implementation strategy for custom course fields, we knowingly decided against a new course format with support for custom course fields and against a simple block with the ability to save and display the metadata in its own.

            It has to be made clear that our project will not do anything more with the custom course fields in terms of course search, reporting or whatever. Our purpose is just to display the metadata in course, but it would be possible to build additional local plugins on top of our libraries for other purposes.

            The project will be running in late summer and we will be happy to release our results to the community. However, we are still asking ourselves if our way is really the right one, especially as we would have to maintain the plugins for each new Moodle version and as our solution won't be a 1:1 transfer of Totara code and functionality to Moodle.

            Therefore, I'd like to ask Marina Glancy for a quick appraisal if there is any chance to bring custom course fields to Moodle core so that we can invest our time and budget into a core patch instead of a local plugin.

            Thanks,
            Alex

            Show
            abias Alexander Bias added a comment - Hi Philippe Siwinski , dear all, I'd like to add my two cents to this ticket here: we have an upcoming project which will integrate Moodle with our SAP SLcM campus management solution. One aspect of this integration is to provide a interface for course metadata: There are many course metadata in SAP SLcM like time and venue information for the "real life course", consultation hours of the teacher, direct URL of the course information in SAP SLcM and so on. Moodle does not provide metadata fields to save this data within courses. It would be possible to combine all these metadata fields into one string and save it into the summary field of the course. This approach would be feasible, but does not seem optimal. So we were thinking about better methods to provide these metadata fields which come from SAP SLcM to students in a Moodle course. We had a look at Totara and its custom course fields and it seems to be the tool we need in Moodle. So we had a discussion with our Moodle partner how to bring custom course fields to Moodle and we came to this conclusion: Create a local plugin for Moodle with the libs for custom course fields. This local plugin adds a new page to the "Course administration" tree within a course where the custom course fields of the course can be seen / set. This diverges from the place where custom course fields are placed in Totara, but it comes with the upside that there is no need to hack the edit course form in Moodle. The possibility to globally manage custom course fields will be created as a dedicated admin page just like it is done in Totara ( https://demo.totaralms.com/totara/customfield/index.php?prefix=course ). The local plugin can provide this admin page, no need to hack Moodle core again. If this local plugin will work without any core hacks then, we would release it in the Moodle plugin repository. This local plugin would bring the possibility to manage custom course fields to Moodle. Yet, it does not do anything with this data. Therefore, in addition to this local plugin, we would create two more things: Webservices for creating and updating courses which will be able to fill and manipulate the custom profile fields. We would create new webservices in the aforementioned local plugin to provide this functionality. Additionally, we would create a block which can be placed in a course, gets the course's custom fields and displays them in a nice way. The block can then be released in the Moodle plugin repository, too. With this implementation strategy for custom course fields, we knowingly decided against a new course format with support for custom course fields and against a simple block with the ability to save and display the metadata in its own. It has to be made clear that our project will not do anything more with the custom course fields in terms of course search, reporting or whatever. Our purpose is just to display the metadata in course, but it would be possible to build additional local plugins on top of our libraries for other purposes. The project will be running in late summer and we will be happy to release our results to the community. However, we are still asking ourselves if our way is really the right one, especially as we would have to maintain the plugins for each new Moodle version and as our solution won't be a 1:1 transfer of Totara code and functionality to Moodle. Therefore, I'd like to ask Marina Glancy for a quick appraisal if there is any chance to bring custom course fields to Moodle core so that we can invest our time and budget into a core patch instead of a local plugin. Thanks, Alex
            Hide
            philippesiw Philippe Siwinski added a comment -

            Thanks for your input Alex.

            While we all agree this feature should be included in Moodle's core, your solution seems to present solid arguments.
            The question of maintaining the code is crucial. We saw older projects fail because of the lack of resources.

            Show
            philippesiw Philippe Siwinski added a comment - Thanks for your input Alex. While we all agree this feature should be included in Moodle's core, your solution seems to present solid arguments. The question of maintaining the code is crucial. We saw older projects fail because of the lack of resources.
            Hide
            abias Alexander Bias added a comment -

            The question of maintaining the code is crucial. We saw older projects fail because of the lack of resources.

            Well, as we will use this feature in production, we will keep it alive for Moodle as lang as our SAP system is in production and try to update it to new Moodle versions as soon as possible. But as this is a big piece of code and others might build mission-critical solutions on top of it, the maintainance shouldn't be on our shoulders only. Let's see what Marina says about my questions concerning integration into Moodle core.

            Show
            abias Alexander Bias added a comment - The question of maintaining the code is crucial. We saw older projects fail because of the lack of resources. Well, as we will use this feature in production, we will keep it alive for Moodle as lang as our SAP system is in production and try to update it to new Moodle versions as soon as possible. But as this is a big piece of code and others might build mission-critical solutions on top of it, the maintainance shouldn't be on our shoulders only. Let's see what Marina says about my questions concerning integration into Moodle core.
            Hide
            tstclair Tim St.Clair added a comment -

            Hi all,
            I'd already done some work on an local plugin based on the Totara source (and other contributors). For me, it was for a custom catalogue, but it has all the bones there for adding metadata categories and fields to courses. The code for it is up on my github (https://github.com/frumbert/moodle-course_meta). In my implementation, I used a customscript over-ride and modified the course edit page. This isn't as good as something built-in, but it works and is relatively easy to update when new releases roll by. Unfortunately it looks like I've neglected to keep the github repo up to date since I've revamped this for newer versions than listed on github. I'll try to get on that in the next day or two.

            p.s. If there's a way of voting to have custom fields implemented in core, I'd definitely add my +1

            Tim

            Show
            tstclair Tim St.Clair added a comment - Hi all, I'd already done some work on an local plugin based on the Totara source (and other contributors). For me, it was for a custom catalogue, but it has all the bones there for adding metadata categories and fields to courses. The code for it is up on my github ( https://github.com/frumbert/moodle-course_meta ). In my implementation, I used a customscript over-ride and modified the course edit page. This isn't as good as something built-in, but it works and is relatively easy to update when new releases roll by. Unfortunately it looks like I've neglected to keep the github repo up to date since I've revamped this for newer versions than listed on github. I'll try to get on that in the next day or two. p.s. If there's a way of voting to have custom fields implemented in core, I'd definitely add my +1 Tim
            Hide
            srihari123 srihari added a comment - - edited

            Hi Tim St.Clair,

            I installed moodle-course_meta file in my moodle.But it is not installing successfully it is getting errors.only course catalogoe is installed sucessfully but course meta_data is getting errors.Please give me any idea or solution.I want to add custom fields to add course page.Please Help me.
            This is my mail id:: gsrihari.1990@gmail.com send any solution about this.
            Thanks in Advance.

            Show
            srihari123 srihari added a comment - - edited Hi Tim St.Clair, I installed moodle-course_meta file in my moodle.But it is not installing successfully it is getting errors.only course catalogoe is installed sucessfully but course meta_data is getting errors.Please give me any idea or solution.I want to add custom fields to add course page.Please Help me. This is my mail id:: gsrihari.1990@gmail.com send any solution about this. Thanks in Advance.

              People

              • Votes:
                46 Vote for this issue
                Watchers:
                42 Start watching this issue

                Dates

                • Created:
                  Updated: