2009-11-04 06:14:06 +00:00
|
|
|
<?php
|
2006-10-13 09:58:53 +00:00
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
defined('MOODLE_INTERNAL') || die;
|
2010-05-13 02:02:05 +00:00
|
|
|
|
2006-11-09 22:08:30 +00:00
|
|
|
require_once($CFG->libdir.'/formslib.php');
|
2010-11-17 06:23:56 +00:00
|
|
|
require_once($CFG->libdir.'/completionlib.php');
|
2006-11-09 22:08:30 +00:00
|
|
|
|
2006-10-13 09:58:53 +00:00
|
|
|
class course_edit_form extends moodleform {
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
protected $course;
|
|
|
|
protected $context;
|
2006-10-13 09:58:53 +00:00
|
|
|
|
|
|
|
function definition() {
|
2008-05-15 21:40:00 +00:00
|
|
|
global $USER, $CFG, $DB;
|
2006-10-13 09:58:53 +00:00
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
$mform = $this->_form;
|
2006-10-13 09:58:53 +00:00
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
$course = $this->_customdata['course']; // this contains the data of this form
|
|
|
|
$category = $this->_customdata['category'];
|
2009-11-04 06:14:06 +00:00
|
|
|
$editoroptions = $this->_customdata['editoroptions'];
|
2010-07-16 07:10:49 +00:00
|
|
|
$returnto = $this->_customdata['returnto'];
|
2006-10-13 09:58:53 +00:00
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
2006-10-13 09:58:53 +00:00
|
|
|
$categorycontext = get_context_instance(CONTEXT_COURSECAT, $category->id);
|
|
|
|
|
2009-11-04 06:14:06 +00:00
|
|
|
if (!empty($course->id)) {
|
2006-10-13 09:58:53 +00:00
|
|
|
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
|
|
|
$context = $coursecontext;
|
2006-10-10 07:05:19 +00:00
|
|
|
} else {
|
2006-10-13 09:58:53 +00:00
|
|
|
$coursecontext = null;
|
|
|
|
$context = $categorycontext;
|
|
|
|
}
|
2009-11-04 08:11:02 +00:00
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
$courseconfig = get_config('moodlecourse');
|
|
|
|
|
|
|
|
$this->course = $course;
|
|
|
|
$this->context = $context;
|
|
|
|
|
2006-10-13 09:58:53 +00:00
|
|
|
/// form definition with new course defaults
|
|
|
|
//--------------------------------------------------------------------------------
|
2006-11-07 08:48:18 +00:00
|
|
|
$mform->addElement('header','general', get_string('general', 'form'));
|
2006-10-13 09:58:53 +00:00
|
|
|
|
2010-07-16 07:10:49 +00:00
|
|
|
$mform->addElement('hidden', 'returnto', null);
|
|
|
|
$mform->setType('returnto', PARAM_ALPHANUM);
|
|
|
|
$mform->setConstant('returnto', $returnto);
|
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
// verify permissions to change course category or keep current
|
|
|
|
if (empty($course->id)) {
|
|
|
|
if (has_capability('moodle/course:create', $categorycontext)) {
|
|
|
|
$displaylist = array();
|
|
|
|
$parentlist = array();
|
|
|
|
make_categories_list($displaylist, $parentlist, 'moodle/course:create');
|
|
|
|
$mform->addElement('select', 'category', get_string('category'), $displaylist);
|
|
|
|
$mform->addHelpButton('category', 'category');
|
|
|
|
$mform->setDefault('category', $category->id);
|
|
|
|
} else {
|
|
|
|
$mform->addElement('hidden', 'category', null);
|
|
|
|
$mform->setType('category', PARAM_INT);
|
|
|
|
$mform->setConstant('category', $category->id);
|
|
|
|
}
|
2006-10-13 09:58:53 +00:00
|
|
|
} else {
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
if (has_capability('moodle/course:changecategory', $coursecontext)) {
|
|
|
|
$displaylist = array();
|
|
|
|
$parentlist = array();
|
|
|
|
make_categories_list($displaylist, $parentlist, 'moodle/course:create');
|
|
|
|
if (!isset($displaylist[$course->category])) {
|
|
|
|
//always keep current
|
|
|
|
$displaylist[$course->category] = format_string($DB->get_field('course_categories', 'name', array('id'=>$course->category)));
|
|
|
|
}
|
|
|
|
$mform->addElement('select', 'category', get_string('category'), $displaylist);
|
|
|
|
$mform->addHelpButton('category', 'category');
|
|
|
|
} else {
|
|
|
|
//keep current
|
|
|
|
$mform->addElement('hidden', 'category', null);
|
|
|
|
$mform->setType('category', PARAM_INT);
|
|
|
|
$mform->setConstant('category', $course->category);
|
|
|
|
}
|
2009-10-02 07:05:02 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 09:05:04 +00:00
|
|
|
$mform->addElement('text','fullname', get_string('fullnamecourse'),'maxlength="254" size="50"');
|
2010-04-13 21:55:02 +00:00
|
|
|
$mform->addHelpButton('fullname', 'fullnamecourse');
|
2008-10-08 20:56:38 +00:00
|
|
|
$mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
|
|
|
|
$mform->setType('fullname', PARAM_MULTILANG);
|
2009-11-04 06:14:06 +00:00
|
|
|
if (!empty($course->id) and !has_capability('moodle/course:changefullname', $coursecontext)) {
|
2008-10-08 20:56:38 +00:00
|
|
|
$mform->hardFreeze('fullname');
|
2008-10-13 19:39:27 +00:00
|
|
|
$mform->setConstant('fullname', $course->fullname);
|
2008-10-08 13:23:35 +00:00
|
|
|
}
|
2008-05-30 16:47:21 +00:00
|
|
|
|
MDL-13481 Strings fullname and shortname are now deprecated
This is a final cleanup commit of fullname and shortname issue. All
places where these strings were detected yet have been replaced with
proper fullnamecourse or fullnameuser or some other context specific
string.
AMOS BEGIN
CPY [fullname,core],[outcomefullname,core_grades]
CPY [shortname,core],[outcomeshortname,core_grades]
CPY [name,core],[rolefullname,core_role]
CPY [shortname,core],[roleshortname,core_role]
AMOS END
2011-02-22 10:12:10 +01:00
|
|
|
$mform->addElement('text', 'shortname', get_string('shortnamecourse'), 'maxlength="100" size="20"');
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('shortname', 'shortnamecourse');
|
2008-10-08 20:56:38 +00:00
|
|
|
$mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
|
|
|
|
$mform->setType('shortname', PARAM_MULTILANG);
|
2009-11-04 06:14:06 +00:00
|
|
|
if (!empty($course->id) and !has_capability('moodle/course:changeshortname', $coursecontext)) {
|
2008-10-08 20:56:38 +00:00
|
|
|
$mform->hardFreeze('shortname');
|
2008-10-13 19:39:27 +00:00
|
|
|
$mform->setConstant('shortname', $course->shortname);
|
2008-10-08 13:23:35 +00:00
|
|
|
}
|
|
|
|
|
2008-10-08 20:56:38 +00:00
|
|
|
$mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100" size="10"');
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('idnumber', 'idnumbercourse');
|
2008-10-08 20:56:38 +00:00
|
|
|
$mform->setType('idnumber', PARAM_RAW);
|
2009-11-04 06:14:06 +00:00
|
|
|
if (!empty($course->id) and !has_capability('moodle/course:changeidnumber', $coursecontext)) {
|
2008-10-08 20:56:38 +00:00
|
|
|
$mform->hardFreeze('idnumber');
|
2008-10-13 19:39:27 +00:00
|
|
|
$mform->setConstants('idnumber', $course->idnumber);
|
2008-10-08 13:23:35 +00:00
|
|
|
}
|
2006-09-24 17:14:44 +00:00
|
|
|
|
2009-11-04 08:11:02 +00:00
|
|
|
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addElement('editor','summary_editor', get_string('coursesummary'), null, $editoroptions);
|
|
|
|
$mform->addHelpButton('summary_editor', 'coursesummary');
|
2009-11-04 06:14:06 +00:00
|
|
|
$mform->setType('summary_editor', PARAM_RAW);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
2009-11-04 06:14:06 +00:00
|
|
|
if (!empty($course->id) and !has_capability('moodle/course:changesummary', $coursecontext)) {
|
|
|
|
$mform->hardFreeze('summary_editor');
|
2009-10-02 07:05:02 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 14:25:56 +00:00
|
|
|
$courseformats = get_plugin_list('format');
|
2006-10-13 09:58:53 +00:00
|
|
|
$formcourseformats = array();
|
2009-06-19 14:25:56 +00:00
|
|
|
foreach ($courseformats as $courseformat => $formatdir) {
|
MDL-22054 converting course formats to have own lang packs
AMOS START
MOV [formatscorm,core],[pluginname,format_scorm]
MOV [formatsocial,core],[pluginname,format_social]
MOV [formattopics,core],[pluginname,format_topics]
MOV [formatweeks,core],[pluginname,format_weeks]
AMOS END
2010-04-11 12:46:14 +00:00
|
|
|
$formcourseformats[$courseformat] = get_string('pluginname', "format_$courseformat");
|
2006-10-13 09:58:53 +00:00
|
|
|
}
|
|
|
|
$mform->addElement('select', 'format', get_string('format'), $formcourseformats);
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('format', 'format');
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('format', $courseconfig->format);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
2011-03-07 18:08:04 +00:00
|
|
|
for ($i = 0; $i <= $courseconfig->maxsections; $i++) {
|
|
|
|
$sectionmenu[$i] = "$i";
|
2006-10-13 09:58:53 +00:00
|
|
|
}
|
|
|
|
$mform->addElement('select', 'numsections', get_string('numberweeks'), $sectionmenu);
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('numsections', $courseconfig->numsections);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
|
|
|
$mform->addElement('date_selector', 'startdate', get_string('startdate'));
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('startdate', 'startdate');
|
2006-10-13 09:58:53 +00:00
|
|
|
$mform->setDefault('startdate', time() + 3600 * 24);
|
|
|
|
|
|
|
|
$choices = array();
|
|
|
|
$choices['0'] = get_string('hiddensectionscollapsed');
|
|
|
|
$choices['1'] = get_string('hiddensectionsinvisible');
|
|
|
|
$mform->addElement('select', 'hiddensections', get_string('hiddensections'), $choices);
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('hiddensections', 'hiddensections');
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('hiddensections', $courseconfig->hiddensections);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
2007-01-21 09:26:33 +00:00
|
|
|
$options = range(0, 10);
|
2006-10-13 09:58:53 +00:00
|
|
|
$mform->addElement('select', 'newsitems', get_string('newsitemsnumber'), $options);
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('newsitems', 'newsitemsnumber');
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('newsitems', $courseconfig->newsitems);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
2007-01-21 09:26:33 +00:00
|
|
|
$mform->addElement('selectyesno', 'showgrades', get_string('showgrades'));
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('showgrades', 'showgrades');
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('showgrades', $courseconfig->showgrades);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
2007-01-21 09:26:33 +00:00
|
|
|
$mform->addElement('selectyesno', 'showreports', get_string('showreports'));
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('showreports', 'showreports');
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('showreports', $courseconfig->showreports);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
|
|
|
$choices = get_max_upload_sizes($CFG->maxbytes);
|
|
|
|
$mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('maxbytes', 'maximumupload');
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('maxbytes', $courseconfig->maxbytes);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
2010-09-03 12:00:59 +00:00
|
|
|
if (!empty($course->legacyfiles) or !empty($CFG->legacyfilesinnewcourses)) {
|
|
|
|
if (empty($course->legacyfiles)) {
|
|
|
|
//0 or missing means no legacy files ever used in this course - new course or nobody turned on legacy files yet
|
|
|
|
$choices = array('0'=>get_string('no'), '2'=>get_string('yes'));
|
|
|
|
} else {
|
|
|
|
$choices = array('1'=>get_string('no'), '2'=>get_string('yes'));
|
|
|
|
}
|
2010-05-22 13:10:05 +00:00
|
|
|
$mform->addElement('select', 'legacyfiles', get_string('courselegacyfiles'), $choices);
|
|
|
|
$mform->addHelpButton('legacyfiles', 'courselegacyfiles');
|
2010-09-22 08:18:18 +00:00
|
|
|
if (!isset($courseconfig->legacyfiles)) {
|
|
|
|
// in case this was not initialised properly due to switching of $CFG->legacyfilesinnewcourses
|
|
|
|
$courseconfig->legacyfiles = 0;
|
|
|
|
}
|
2010-09-10 03:58:54 +00:00
|
|
|
$mform->setDefault('legacyfiles', $courseconfig->legacyfiles);
|
2010-05-22 13:10:05 +00:00
|
|
|
}
|
|
|
|
|
2006-10-13 09:58:53 +00:00
|
|
|
if (!empty($CFG->allowcoursethemes)) {
|
2010-01-28 07:00:16 +00:00
|
|
|
$themeobjects = get_list_of_themes();
|
2006-10-13 09:58:53 +00:00
|
|
|
$themes=array();
|
|
|
|
$themes[''] = get_string('forceno');
|
2010-01-28 07:00:16 +00:00
|
|
|
foreach ($themeobjects as $key=>$theme) {
|
2011-08-10 12:56:04 +08:00
|
|
|
if (empty($theme->hidefromselector)) {
|
|
|
|
$themes[$key] = get_string('pluginname', 'theme_'.$theme->name);
|
|
|
|
}
|
2010-01-28 07:00:16 +00:00
|
|
|
}
|
2006-10-13 09:58:53 +00:00
|
|
|
$mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
|
|
|
|
}
|
2006-10-10 07:05:19 +00:00
|
|
|
|
2007-07-18 08:57:28 +00:00
|
|
|
//--------------------------------------------------------------------------------
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
enrol_course_edit_form($mform, $course, $context);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
2007-01-19 11:10:09 +00:00
|
|
|
$mform->addElement('header','', get_string('groups', 'group'));
|
2006-10-13 09:58:53 +00:00
|
|
|
|
|
|
|
$choices = array();
|
2007-10-29 09:47:13 +00:00
|
|
|
$choices[NOGROUPS] = get_string('groupsnone', 'group');
|
|
|
|
$choices[SEPARATEGROUPS] = get_string('groupsseparate', 'group');
|
|
|
|
$choices[VISIBLEGROUPS] = get_string('groupsvisible', 'group');
|
2010-05-04 10:07:47 +00:00
|
|
|
$mform->addElement('select', 'groupmode', get_string('groupmode', 'group'), $choices);
|
|
|
|
$mform->addHelpButton('groupmode', 'groupmode', 'group');
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('groupmode', $courseconfig->groupmode);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
|
|
|
$choices = array();
|
|
|
|
$choices['0'] = get_string('no');
|
|
|
|
$choices['1'] = get_string('yes');
|
2010-05-04 10:07:47 +00:00
|
|
|
$mform->addElement('select', 'groupmodeforce', get_string('groupmodeforce', 'group'), $choices);
|
|
|
|
$mform->addHelpButton('groupmodeforce', 'groupmodeforce', 'group');
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('groupmodeforce', $courseconfig->groupmodeforce);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
2010-04-07 07:37:12 +00:00
|
|
|
//default groupings selector
|
|
|
|
$options = array();
|
|
|
|
$options[0] = get_string('none');
|
|
|
|
$mform->addElement('select', 'defaultgroupingid', get_string('defaultgrouping', 'group'), $options);
|
2007-08-17 08:05:04 +00:00
|
|
|
|
2006-10-13 09:58:53 +00:00
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
$mform->addElement('header','', get_string('availability'));
|
|
|
|
|
|
|
|
$choices = array();
|
|
|
|
$choices['0'] = get_string('courseavailablenot');
|
|
|
|
$choices['1'] = get_string('courseavailable');
|
|
|
|
$mform->addElement('select', 'visible', get_string('availability'), $choices);
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('visible', 'availability');
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('visible', $courseconfig->visible);
|
2010-07-14 14:23:32 +00:00
|
|
|
if (!has_capability('moodle/course:visibility', $context)) {
|
2008-12-08 02:31:05 +00:00
|
|
|
$mform->hardFreeze('visible');
|
2010-07-14 14:23:32 +00:00
|
|
|
if (!empty($course->id)) {
|
|
|
|
$mform->setConstant('visible', $course->visible);
|
|
|
|
} else {
|
|
|
|
$mform->setConstant('visible', $category->visible);
|
|
|
|
}
|
2008-12-08 02:31:05 +00:00
|
|
|
}
|
2006-10-13 09:58:53 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
$mform->addElement('header','', get_string('language'));
|
|
|
|
|
|
|
|
$languages=array();
|
|
|
|
$languages[''] = get_string('forceno');
|
2010-04-14 09:45:49 +00:00
|
|
|
$languages += get_string_manager()->get_list_of_translations();
|
2006-10-13 09:58:53 +00:00
|
|
|
$mform->addElement('select', 'lang', get_string('forcelanguage'), $languages);
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('lang', $courseconfig->lang);
|
2006-10-13 09:58:53 +00:00
|
|
|
|
2008-07-28 12:31:29 +00:00
|
|
|
//--------------------------------------------------------------------------------
|
2010-11-17 06:23:56 +00:00
|
|
|
if (completion_info::is_enabled_for_site()) {
|
2008-07-28 12:31:29 +00:00
|
|
|
$mform->addElement('header','', get_string('progress','completion'));
|
2008-10-08 13:23:35 +00:00
|
|
|
$mform->addElement('select', 'enablecompletion', get_string('completion','completion'),
|
2008-07-28 12:31:29 +00:00
|
|
|
array(0=>get_string('completiondisabled','completion'), 1=>get_string('completionenabled','completion')));
|
2008-09-25 07:33:22 +00:00
|
|
|
$mform->setDefault('enablecompletion', $courseconfig->enablecompletion);
|
2010-04-30 03:06:22 +00:00
|
|
|
|
|
|
|
$mform->addElement('checkbox', 'completionstartonenrol', get_string('completionstartonenrol', 'completion'));
|
|
|
|
$mform->setDefault('completionstartonenrol', $courseconfig->completionstartonenrol);
|
|
|
|
$mform->disabledIf('completionstartonenrol', 'enablecompletion', 'eq', 0);
|
2008-07-28 12:31:29 +00:00
|
|
|
} else {
|
|
|
|
$mform->addElement('hidden', 'enablecompletion');
|
2009-09-26 17:07:08 +00:00
|
|
|
$mform->setType('enablecompletion', PARAM_INT);
|
2008-07-28 12:31:29 +00:00
|
|
|
$mform->setDefault('enablecompletion',0);
|
2010-04-30 03:06:22 +00:00
|
|
|
|
|
|
|
$mform->addElement('hidden', 'completionstartonenrol');
|
|
|
|
$mform->setType('completionstartonenrol', PARAM_INT);
|
|
|
|
$mform->setDefault('completionstartonenrol',0);
|
2008-07-28 12:31:29 +00:00
|
|
|
}
|
|
|
|
|
2006-10-13 09:58:53 +00:00
|
|
|
//--------------------------------------------------------------------------------
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
if (has_capability('moodle/site:config', $systemcontext)) {
|
|
|
|
if (((!empty($course->requested) && $CFG->restrictmodulesfor == 'requested') || $CFG->restrictmodulesfor == 'all')) {
|
|
|
|
$mform->addElement('header', '', get_string('restrictmodules'));
|
|
|
|
|
|
|
|
$options = array();
|
|
|
|
$options['0'] = get_string('no');
|
|
|
|
$options['1'] = get_string('yes');
|
|
|
|
$mform->addElement('select', 'restrictmodules', get_string('restrictmodules'), $options);
|
|
|
|
if (!empty($CFG->restrictbydefault)) {
|
|
|
|
$mform->setDefault('restrictmodules', 1);
|
|
|
|
}
|
2006-10-13 09:58:53 +00:00
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
$mods = array(0=>get_string('allownone'));
|
2011-11-22 16:16:23 +00:00
|
|
|
$allmods = $DB->get_records_menu('modules', array('visible' => 1),
|
|
|
|
'name', 'id, name');
|
|
|
|
foreach ($allmods as $key => $value) {
|
|
|
|
// Add module to list unless it cannot be added by users anyway
|
|
|
|
if (plugin_supports('mod', $value, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER) !==
|
|
|
|
MOD_ARCHETYPE_SYSTEM) {
|
|
|
|
$mods[$key] = get_string('pluginname', $value);
|
|
|
|
}
|
|
|
|
}
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
$mform->addElement('select', 'allowedmods', get_string('to'), $mods, array('multiple'=>'multiple', 'size'=>'10'));
|
|
|
|
$mform->disabledIf('allowedmods', 'restrictmodules', 'eq', 0);
|
|
|
|
// defaults are already in $course
|
|
|
|
} else {
|
|
|
|
// remove any mod restriction
|
|
|
|
$mform->addElement('hidden', 'restrictmodules', 0);
|
|
|
|
$mform->setType('restrictmodules', PARAM_INT);
|
|
|
|
}
|
2006-11-28 08:04:00 +00:00
|
|
|
} else {
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
$mform->addElement('hidden', 'restrictmodules');
|
2009-09-26 17:07:08 +00:00
|
|
|
$mform->setType('restrictmodules', PARAM_INT);
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
if (empty($course->id)) {
|
|
|
|
$mform->setConstant('restrictmodules', (int)($CFG->restrictmodulesfor == 'all'));
|
|
|
|
} else {
|
|
|
|
// keep previous
|
|
|
|
$mform->setConstant('restrictmodules', $course->restrictmodules);
|
2006-10-13 09:58:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-22 08:11:30 +00:00
|
|
|
/// customizable role names in this course
|
|
|
|
//--------------------------------------------------------------------------------
|
2008-05-13 06:16:51 +00:00
|
|
|
$mform->addElement('header','rolerenaming', get_string('rolerenaming'));
|
MDL-21695 Course settings page help strings
Many of them are missing at the moment, Helen shall fix that soon
AMOS BEGIN
HLP courseavailability.html,[availability_help,core]
HLP coursecategory.html,[category_help,core]
HLP courseenrollable2.html,[enrollable_help,core]
HLP courseenrolmentplugins.html,[enrolmentplugins_help,core]
HLP courseformats.html,[format_help,core]
HLP coursegrades.html,[showgrades_help,core]
HLP coursehiddensections.html,[hiddensections_help,core]
HLP courseidnumber.html,[idnumbercourse_help,core]
HLP coursenewsitems.html,[newsitemsnumber_help,core]
HLP coursereports.html,[showreports_help,core]
HLP courseshortname.html,[shortnamecourse_help,core]
HLP coursestartdate.html,[startdate_help,core]
HLP courseuploadsize.html,[maximumupload_help,core]
HLP expirynotify.html,[expirynotify_help,core]
HLP expirynotifystudents.html,[expirynotifystudents_help,core]
HLP expirythreshold.html,[expirythreshold_help,core]
HLP groupmodeforce.html,[groupmodeforce_help,core]
HLP groupmode.html,[groupmode_help,core]
HLP metacourse.html,[managemeta_help,core]
HLP rolerenaming.html,[rolerenaming_help,core]
AMOS END
2010-05-03 17:07:51 +00:00
|
|
|
$mform->addHelpButton('rolerenaming', 'rolerenaming');
|
2007-03-22 08:11:30 +00:00
|
|
|
|
2008-11-13 08:11:10 +00:00
|
|
|
if ($roles = get_all_roles()) {
|
|
|
|
if ($coursecontext) {
|
2008-11-13 08:40:57 +00:00
|
|
|
$roles = role_fix_names($roles, $coursecontext, ROLENAME_ALIAS_RAW);
|
2008-11-13 08:11:10 +00:00
|
|
|
}
|
|
|
|
$assignableroles = get_roles_for_contextlevels(CONTEXT_COURSE);
|
2007-03-22 08:11:30 +00:00
|
|
|
foreach ($roles as $role) {
|
2008-11-13 08:11:10 +00:00
|
|
|
$mform->addElement('text', 'role_'.$role->id, get_string('yourwordforx', '', $role->name));
|
|
|
|
if (isset($role->localname)) {
|
|
|
|
$mform->setDefault('role_'.$role->id, $role->localname);
|
|
|
|
}
|
|
|
|
$mform->setType('role_'.$role->id, PARAM_TEXT);
|
|
|
|
if (!in_array($role->id, $assignableroles)) {
|
|
|
|
$mform->setAdvanced('role_'.$role->id);
|
2007-03-22 08:11:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-13 09:58:53 +00:00
|
|
|
//--------------------------------------------------------------------------------
|
2006-12-19 07:03:08 +00:00
|
|
|
$this->add_action_buttons();
|
2006-10-13 09:58:53 +00:00
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
$mform->addElement('hidden', 'id', null);
|
|
|
|
$mform->setType('id', PARAM_INT);
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
|
|
|
|
/// finally set the current form data
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
$this->set_data($course);
|
2006-10-16 12:07:44 +00:00
|
|
|
}
|
2006-11-28 08:04:00 +00:00
|
|
|
|
2007-08-17 08:05:04 +00:00
|
|
|
function definition_after_data() {
|
2008-05-30 16:47:21 +00:00
|
|
|
global $DB;
|
2007-08-17 08:05:04 +00:00
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
$mform = $this->_form;
|
2007-08-17 08:05:04 +00:00
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
// add available groupings
|
2007-08-17 08:05:04 +00:00
|
|
|
if ($courseid = $mform->getElementValue('id') and $mform->elementExists('defaultgroupingid')) {
|
|
|
|
$options = array();
|
2008-05-30 16:47:21 +00:00
|
|
|
if ($groupings = $DB->get_records('groupings', array('courseid'=>$courseid))) {
|
2007-08-17 08:05:04 +00:00
|
|
|
foreach ($groupings as $grouping) {
|
|
|
|
$options[$grouping->id] = format_string($grouping->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$gr_el =& $mform->getElement('defaultgroupingid');
|
|
|
|
$gr_el->load($options);
|
|
|
|
}
|
|
|
|
}
|
2008-10-08 13:23:35 +00:00
|
|
|
|
2006-10-13 09:58:53 +00:00
|
|
|
|
|
|
|
/// perform some extra moodle validation
|
2007-11-23 22:15:07 +00:00
|
|
|
function validation($data, $files) {
|
2008-12-06 21:20:42 +00:00
|
|
|
global $DB, $CFG;
|
2008-05-30 16:47:21 +00:00
|
|
|
|
2007-11-23 22:15:07 +00:00
|
|
|
$errors = parent::validation($data, $files);
|
2008-05-30 16:47:21 +00:00
|
|
|
if ($foundcourses = $DB->get_records('course', array('shortname'=>$data['shortname']))) {
|
2006-10-13 09:58:53 +00:00
|
|
|
if (!empty($data['id'])) {
|
|
|
|
unset($foundcourses[$data['id']]);
|
2006-09-24 17:14:44 +00:00
|
|
|
}
|
|
|
|
if (!empty($foundcourses)) {
|
|
|
|
foreach ($foundcourses as $foundcourse) {
|
|
|
|
$foundcoursenames[] = $foundcourse->fullname;
|
|
|
|
}
|
2006-10-13 09:58:53 +00:00
|
|
|
$foundcoursenamestring = implode(',', $foundcoursenames);
|
|
|
|
$errors['shortname']= get_string('shortnametaken', '', $foundcoursenamestring);
|
2006-09-24 17:14:44 +00:00
|
|
|
}
|
|
|
|
}
|
2006-10-13 09:58:53 +00:00
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
$errors = array_merge($errors, enrol_course_edit_validation($data, $this->context));
|
2008-12-06 21:20:42 +00:00
|
|
|
|
2007-11-23 22:15:07 +00:00
|
|
|
return $errors;
|
2006-09-24 17:14:44 +00:00
|
|
|
}
|
2006-10-13 09:58:53 +00:00
|
|
|
}
|
2009-11-04 08:11:02 +00:00
|
|
|
|