Add a new field to "Create a course"

Add a new field to "Create a course"

بواسطة - Chien-Hao Chen
عدد الردود: 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!! مبتسم

متوسط التقييمات: -
رداً على Chien-Hao Chen

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

بواسطة - Mary Cooch
صورة Documentation writers صورة Moodle HQ صورة Particularly helpful Moodlers صورة Testers صورة 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

رداً على Mary Cooch

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

بواسطة - 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!! مبتسم

رداً على Chien-Hao Chen

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

بواسطة - 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.

رداً على Eder dos Santos

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

بواسطة - 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! مبتسم

Salud!