Add a new field to "Create a course"

Add a new field to "Create a course"

per Chien-Hao Chen -
Nombre de respostes: 4

im a new for PHP and Moodle 2.7.1+ ..., i want to add a field "Number of student" for control limited count of a course.

I did this in moodle\course\edit_form.php:

$mform->addElement('text','CountStudent', get_string('CountStudentcourse'),'maxlength="100"  size="10"');
        $mform->addHelpButton('CountStudent','CountStudentcourse');
        $mform->setType('CountStudent', PARAM_RAW);if(!empty($course->id)and!has_capability('moodle/course:changeCountStudent', $coursecontext)){
            $mform->hardFreeze('CountStudent');
            $mform->setConstants('CountStudent', $course->CountStudent);}


In the view show: CountStudentcourse and HelpButton Error

have some simple example for it?? thanks for all helps!! Somrient

Mitjana de qualificacions: -
En resposta a Chien-Hao Chen

Re: Add a new field to "Create a course"

per Mary Cooch -
Imatge de Documentation writers Imatge de Moodle HQ Imatge de Particularly helpful Moodlers Imatge de Testers Imatge de Translators

Do you mean you want to limit the number of students who can  be enrolled in a course? You can do this with the self enrolment plugin settings,where you specify the maximum number of enrolled users. Would that work instead? See the documentation Self enrolment

En resposta a Mary Cooch

Re: Add a new field to "Create a course"

per Chien-Hao Chen -

Thanks u so much!! Finally I found plugin!! :D

But the option "Max enroll Users" of "Self Enroll", can I move to the page "Add a new course"??

For easy configuration....


Thanks again!! Somrient

En resposta a Chien-Hao Chen

Re: Add a new field to "Create a course"

per Eder dos Santos -

Hi, Chien-Hao Chen!

Once you created a course, you can set this property only for that course you've created, instead of setting it at site-level.

You must check the enrollment method at:

<yoururl>/enrol/self/edit.php?courseid=<courseid>

Regards.

En resposta a Eder dos Santos

Re: Add a new field to "Create a course"

per Chien-Hao Chen -

Hi,  Sr. Santos! 

       M... I know I can set porperty (Max enrolled users) in the page "/moodle/enrol/self/edit.php?courseid=2&id=3" for the course i've created. 

       But my question is... how can i move or show this option "Max enrolled users" in the page "add a new course" (/moodle/course/edit.php?category=1&returnto=topcat) for easy setting "Max enrolled users" when Im creating a new course.


thanks so much for respond! Somrient

Salud!