mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
changed $default to $toform - more meaningful
This commit is contained in:
parent
461f512795
commit
d9dce4e7b1
1 changed files with 67 additions and 67 deletions
|
@ -4,46 +4,46 @@
|
||||||
/// options could have been submitted by the form eg submitted value for a single selection
|
/// options could have been submitted by the form eg submitted value for a single selection
|
||||||
/// select field must be one of the options of the select field.
|
/// select field must be one of the options of the select field.
|
||||||
|
|
||||||
// $default will be used for the default value of a field if no data has been submitted.
|
// $toform will be used for the default value of a field if no data has been submitted.
|
||||||
|
|
||||||
if (!empty($course)) {
|
if (!empty($course)) {
|
||||||
//this is what we do if we are editing a record from the db
|
//this is what we do if we are editing a record from the db
|
||||||
$default = $course;
|
$toform = $course;
|
||||||
$default->allowedmods = array();
|
$toform->allowedmods = array();
|
||||||
if ($am = get_records("course_allowed_modules","course",$course->id)) {
|
if ($am = get_records("course_allowed_modules","course",$course->id)) {
|
||||||
foreach ($am as $m) {
|
foreach ($am as $m) {
|
||||||
$default->allowedmods[] = $m->module;
|
$toform->allowedmods[] = $m->module;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (empty($course->restrictmodules)) {
|
if (empty($course->restrictmodules)) {
|
||||||
$default->allowedmods = explode(',',$CFG->defaultallowedmodules);
|
$toform->allowedmods = explode(',',$CFG->defaultallowedmodules);
|
||||||
} // it'll be greyed out but we want these by default anyway.
|
} // it'll be greyed out but we want these by default anyway.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//this is a brand new course!
|
//this is a brand new course!
|
||||||
$default->startdate = time() + 3600 * 24;
|
$toform->startdate = time() + 3600 * 24;
|
||||||
$default->fullname = get_string("defaultcoursefullname");
|
$toform->fullname = get_string("defaultcoursefullname");
|
||||||
$default->shortname = get_string("defaultcourseshortname");
|
$toform->shortname = get_string("defaultcourseshortname");
|
||||||
$default->summary = get_string("defaultcoursesummary");
|
$toform->summary = get_string("defaultcoursesummary");
|
||||||
$default->format = "weeks";
|
$toform->format = "weeks";
|
||||||
$default->password = "";
|
$toform->password = "";
|
||||||
$default->guest = 0;
|
$toform->guest = 0;
|
||||||
$default->numsections = 10;
|
$toform->numsections = 10;
|
||||||
$default->idnumber = '';
|
$toform->idnumber = '';
|
||||||
$default->cost = '';
|
$toform->cost = '';
|
||||||
$default->currency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency;
|
$toform->currency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency;
|
||||||
$default->newsitems = 5;
|
$toform->newsitems = 5;
|
||||||
$default->showgrades = 1;
|
$toform->showgrades = 1;
|
||||||
$default->groupmode = 0;
|
$toform->groupmode = 0;
|
||||||
$default->groupmodeforce = 0;
|
$toform->groupmodeforce = 0;
|
||||||
$default->category = $category;
|
$toform->category = $category;
|
||||||
$default->id = "";
|
$toform->id = "";
|
||||||
$default->visible = 1;
|
$toform->visible = 1;
|
||||||
$default->allowedmods = array();
|
$toform->allowedmods = array();
|
||||||
if ($CFG->restrictmodulesfor == 'all') {
|
if ($CFG->restrictmodulesfor == 'all') {
|
||||||
$default->allowedmods = explode(',',$CFG->defaultallowedmodules);
|
$toform->allowedmods = explode(',',$CFG->defaultallowedmodules);
|
||||||
if (!empty($CFG->restrictbydefault)) {
|
if (!empty($CFG->restrictbydefault)) {
|
||||||
$default->restrictmodules = 1;
|
$toform->restrictmodules = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,22 +51,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$mform->addElement('header','general', get_string("general"));
|
$mform->addElement('header','general', get_string("general"));
|
||||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $default->category))) {
|
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $toform->category))) {
|
||||||
$displaylist = array();
|
$displaylist = array();
|
||||||
$parentlist = array();
|
$parentlist = array();
|
||||||
make_categories_list($displaylist, $parentlist);
|
make_categories_list($displaylist, $parentlist);
|
||||||
$mform->addElement('select', "category", get_string("category"), $displaylist );
|
$mform->addElement('select', "category", get_string("category"), $displaylist );
|
||||||
}
|
}
|
||||||
$mform->setDefault('fullname', $default->fullname);
|
$mform->setDefault('fullname', $toform->fullname);
|
||||||
$mform->addElement('text','fullname', get_string("fullname"),'maxlength="254" size="50"');
|
$mform->addElement('text','fullname', get_string("fullname"),'maxlength="254" size="50"');
|
||||||
$mform->setDefault('shortname', $default->shortname);
|
$mform->setDefault('shortname', $toform->shortname);
|
||||||
$mform->addElement('text','shortname', get_string("shortname"),'maxlength="15" size="10"');
|
$mform->addElement('text','shortname', get_string("shortname"),'maxlength="15" size="10"');
|
||||||
$mform->setDefault('idnumber', $default->idnumber);
|
$mform->setDefault('idnumber', $toform->idnumber);
|
||||||
$mform->addElement('text','idnumber', get_string("idnumbercourse"),'maxlength="100" size="10"');
|
$mform->addElement('text','idnumber', get_string("idnumbercourse"),'maxlength="100" size="10"');
|
||||||
$mform->setDefault('summary', $default->summary);
|
$mform->setDefault('summary', $toform->summary);
|
||||||
$mform->addElement('htmleditor','summary', get_string("summary"), array('rows'=>'10', 'cols'=>'65'));
|
$mform->addElement('htmleditor','summary', get_string("summary"), array('rows'=>'10', 'cols'=>'65'));
|
||||||
|
|
||||||
$mform->setDefault('format', $default->format);
|
$mform->setDefault('format', $toform->format);
|
||||||
$courseformats = get_list_of_plugins("course/format");
|
$courseformats = get_list_of_plugins("course/format");
|
||||||
$formcourseformats = array();
|
$formcourseformats = array();
|
||||||
|
|
||||||
|
@ -76,21 +76,21 @@
|
||||||
|
|
||||||
$mform->addElement('select', 'format', get_string("format"), $formcourseformats );
|
$mform->addElement('select', 'format', get_string("format"), $formcourseformats );
|
||||||
|
|
||||||
$mform->setDefault('numsections', $default->numsections);
|
$mform->setDefault('numsections', $toform->numsections);
|
||||||
for ($i=1; $i<=52; $i++) {
|
for ($i=1; $i<=52; $i++) {
|
||||||
$sectionmenu[$i] = "$i";
|
$sectionmenu[$i] = "$i";
|
||||||
}
|
}
|
||||||
$mform->addElement('select', 'numsections', get_string("numberweeks"), $sectionmenu);
|
$mform->addElement('select', 'numsections', get_string("numberweeks"), $sectionmenu);
|
||||||
$mform->setDefault('startdate', $default->startdate);
|
$mform->setDefault('startdate', $toform->startdate);
|
||||||
$mform->addElement('date_selector', 'startdate', get_string('startdate'));
|
$mform->addElement('date_selector', 'startdate', get_string('startdate'));
|
||||||
|
|
||||||
$mform->setDefault('hiddensections',(isset($default->hiddensections))?$default->hiddensections:0);
|
$mform->setDefault('hiddensections',(isset($toform->hiddensections))?$toform->hiddensections:0);
|
||||||
unset($choices);
|
unset($choices);
|
||||||
$choices["0"] = get_string("hiddensectionscollapsed");
|
$choices["0"] = get_string("hiddensectionscollapsed");
|
||||||
$choices["1"] = get_string("hiddensectionsinvisible");
|
$choices["1"] = get_string("hiddensectionsinvisible");
|
||||||
$mform->addElement('select', 'hiddensections', get_string("hiddensections"), $choices);
|
$mform->addElement('select', 'hiddensections', get_string("hiddensections"), $choices);
|
||||||
|
|
||||||
$mform->setDefault('newsitems', $default->newsitems);
|
$mform->setDefault('newsitems', $toform->newsitems);
|
||||||
$newsitem = get_string("newsitem");
|
$newsitem = get_string("newsitem");
|
||||||
$newsitems = get_string("newsitems");
|
$newsitems = get_string("newsitems");
|
||||||
$options = array("0" => "0 $newsitems",
|
$options = array("0" => "0 $newsitems",
|
||||||
|
@ -106,21 +106,21 @@
|
||||||
"10" => "10 $newsitems");
|
"10" => "10 $newsitems");
|
||||||
$mform->addElement('select', 'newsitems', get_string("newsitemsnumber"), $options);
|
$mform->addElement('select', 'newsitems', get_string("newsitemsnumber"), $options);
|
||||||
|
|
||||||
$mform->setDefault('showgrades', $default->showgrades);
|
$mform->setDefault('showgrades', $toform->showgrades);
|
||||||
unset($choices);
|
unset($choices);
|
||||||
$choices["0"] = get_string("no");
|
$choices["0"] = get_string("no");
|
||||||
$choices["1"] = get_string("yes");
|
$choices["1"] = get_string("yes");
|
||||||
$mform->addElement('select', 'showgrades', get_string("showgrades"), $choices);
|
$mform->addElement('select', 'showgrades', get_string("showgrades"), $choices);
|
||||||
unset($choices);
|
unset($choices);
|
||||||
$mform->setDefault('showreports',(isset($default->showreports))?$default->showreports:0);
|
$mform->setDefault('showreports',(isset($toform->showreports))?$toform->showreports:0);
|
||||||
$choices["0"] = get_string("no");
|
$choices["0"] = get_string("no");
|
||||||
$choices["1"] = get_string("yes");
|
$choices["1"] = get_string("yes");
|
||||||
$mform->addElement('select', 'showreports', get_string("showreports"), $choices);
|
$mform->addElement('select', 'showreports', get_string("showreports"), $choices);
|
||||||
$mform->setDefault('maxbytes',(isset($default->maxbytes))?$default->maxbytes:0);
|
$mform->setDefault('maxbytes',(isset($toform->maxbytes))?$toform->maxbytes:0);
|
||||||
$choices = get_max_upload_sizes($CFG->maxbytes);
|
$choices = get_max_upload_sizes($CFG->maxbytes);
|
||||||
$mform->addElement('select', 'maxbytes', get_string("maximumupload"), $choices);
|
$mform->addElement('select', 'maxbytes', get_string("maximumupload"), $choices);
|
||||||
if (!empty($CFG->allowcoursethemes)) {
|
if (!empty($CFG->allowcoursethemes)) {
|
||||||
$mform->setDefault('theme',(isset($default->theme))?$default->theme:'');
|
$mform->setDefault('theme',(isset($toform->theme))?$toform->theme:'');
|
||||||
|
|
||||||
$themes=array();
|
$themes=array();
|
||||||
$themes[''] = get_string("forceno");
|
$themes[''] = get_string("forceno");
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
$mform->addElement('select', 'theme', get_string("forcetheme"), $themes);
|
$mform->addElement('select', 'theme', get_string("forcetheme"), $themes);
|
||||||
}
|
}
|
||||||
unset($choices);
|
unset($choices);
|
||||||
$mform->setDefault('metacourse',(isset($default->metacourse))?$default->metacourse:0);
|
$mform->setDefault('metacourse',(isset($toform->metacourse))?$toform->metacourse:0);
|
||||||
|
|
||||||
if (empty($disable_meta)) {
|
if (empty($disable_meta)) {
|
||||||
$meta=array();
|
$meta=array();
|
||||||
|
@ -137,12 +137,12 @@
|
||||||
$mform->addElement('select', 'metacourse', get_string("managemeta"), $meta);
|
$mform->addElement('select', 'metacourse', get_string("managemeta"), $meta);
|
||||||
}else{
|
}else{
|
||||||
$mform->addElement('static', 'metacourse', get_string("managemeta"),
|
$mform->addElement('static', 'metacourse', get_string("managemeta"),
|
||||||
((empty($default->metacourse)) ? get_string("no") : get_string("yes"))
|
((empty($toform->metacourse)) ? get_string("no") : get_string("yes"))
|
||||||
. " - $disable_meta ");
|
. " - $disable_meta ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$mform->setDefault('defaultrole',(isset($default->defaultrole))?$default->defaultrole:0);
|
$mform->setDefault('defaultrole',(isset($toform->defaultrole))?$toform->defaultrole:0);
|
||||||
$roles = get_assignable_roles($context);
|
$roles = get_assignable_roles($context);
|
||||||
asort($roles);
|
asort($roles);
|
||||||
$choices = array();
|
$choices = array();
|
||||||
|
@ -166,7 +166,7 @@
|
||||||
|
|
||||||
|
|
||||||
$mform->addElement('header','enrolhdr', get_string("enrolment"));
|
$mform->addElement('header','enrolhdr', get_string("enrolment"));
|
||||||
$mform->setDefault('enrol',(isset($default->enrol))?$default->enrol:'');
|
$mform->setDefault('enrol',(isset($toform->enrol))?$toform->enrol:'');
|
||||||
|
|
||||||
$modules = explode(',', $CFG->enrol_plugins_enabled);
|
$modules = explode(',', $CFG->enrol_plugins_enabled);
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
|
@ -181,34 +181,34 @@
|
||||||
$choices = array_merge(array('' => get_string('sitedefault').' ('.get_string("enrolname", "enrol_$CFG->enrol").')'), $choices);
|
$choices = array_merge(array('' => get_string('sitedefault').' ('.get_string("enrolname", "enrol_$CFG->enrol").')'), $choices);
|
||||||
$mform->addElement('select', 'enrol', get_string("enrolmentplugins"), $choices );
|
$mform->addElement('select', 'enrol', get_string("enrolmentplugins"), $choices );
|
||||||
|
|
||||||
$mform->setDefault('enrollable',(isset($default->enrollable))?$default->enrollable:1);
|
$mform->setDefault('enrollable',(isset($toform->enrollable))?$toform->enrollable:1);
|
||||||
$radio = array();
|
$radio = array();
|
||||||
$radio[] = &moodleform::createElement('radio', 'enrollable', null, get_string("no"), 0);
|
$radio[] = &moodleform::createElement('radio', 'enrollable', null, get_string("no"), 0);
|
||||||
$radio[] = &moodleform::createElement('radio', 'enrollable', null, get_string("yes"), 1);
|
$radio[] = &moodleform::createElement('radio', 'enrollable', null, get_string("yes"), 1);
|
||||||
$radio[] = &moodleform::createElement('radio', 'enrollable', null, get_string("enroldate"), 2);
|
$radio[] = &moodleform::createElement('radio', 'enrollable', null, get_string("enroldate"), 2);
|
||||||
$mform->addGroup($radio, 'enrollable', get_string("enrollable"), ' ', false);
|
$mform->addGroup($radio, 'enrollable', get_string("enrollable"), ' ', false);
|
||||||
|
|
||||||
$mform->setDefault('enrolstartdate',(isset($default->enrolstartdate))?$default->enrolstartdate:0);
|
$mform->setDefault('enrolstartdate',(isset($toform->enrolstartdate))?$toform->enrolstartdate:0);
|
||||||
$mform->setDefault('enrolstartdisabled',
|
$mform->setDefault('enrolstartdisabled',
|
||||||
(!isset($default->enrolstartdate)||
|
(!isset($toform->enrolstartdate)||
|
||||||
(isset($default->enrolstartdate)&&!$default->enrolstartdate)
|
(isset($toform->enrolstartdate)&&!$toform->enrolstartdate)
|
||||||
?1:0));
|
?1:0));
|
||||||
$enroldatestartgrp = array();
|
$enroldatestartgrp = array();
|
||||||
$enroldatestartgrp[] = &moodleform::createElement('date_selector', 'enrolstartdate');
|
$enroldatestartgrp[] = &moodleform::createElement('date_selector', 'enrolstartdate');
|
||||||
$enroldatestartgrp[] = &moodleform::createElement('checkbox', 'enrolstartdisabled', null, get_string('disable'));
|
$enroldatestartgrp[] = &moodleform::createElement('checkbox', 'enrolstartdisabled', null, get_string('disable'));
|
||||||
$mform->addGroup($enroldatestartgrp, '', get_string('enrolstartdate'), ' ', false);
|
$mform->addGroup($enroldatestartgrp, '', get_string('enrolstartdate'), ' ', false);
|
||||||
|
|
||||||
$mform->setDefault('enrolenddate',(isset($default->enrolenddate))?$default->enrolenddate:0);
|
$mform->setDefault('enrolenddate',(isset($toform->enrolenddate))?$toform->enrolenddate:0);
|
||||||
$mform->setDefault('enrolenddisabled',
|
$mform->setDefault('enrolenddisabled',
|
||||||
(!isset($default->enrolenddate)||
|
(!isset($toform->enrolenddate)||
|
||||||
(isset($default->enrolenddate)&&!$default->enrolenddate)
|
(isset($toform->enrolenddate)&&!$toform->enrolenddate)
|
||||||
?1:0));
|
?1:0));
|
||||||
$enroldateendgrp = array();
|
$enroldateendgrp = array();
|
||||||
$enroldateendgrp[] = &moodleform::createElement('date_selector', 'enrolenddate');
|
$enroldateendgrp[] = &moodleform::createElement('date_selector', 'enrolenddate');
|
||||||
$enroldateendgrp[] = &moodleform::createElement('checkbox', 'enrolenddisabled', null, get_string('disable'));
|
$enroldateendgrp[] = &moodleform::createElement('checkbox', 'enrolenddisabled', null, get_string('disable'));
|
||||||
$mform->addGroup($enroldateendgrp, 'enroldateendgrp', get_string('enrolenddate'), ' ', false);
|
$mform->addGroup($enroldateendgrp, 'enroldateendgrp', get_string('enrolenddate'), ' ', false);
|
||||||
|
|
||||||
$mform->setDefault('enrolperiod',(isset($default->enrolperiod))?$default->enrolperiod:0);
|
$mform->setDefault('enrolperiod',(isset($toform->enrolperiod))?$toform->enrolperiod:0);
|
||||||
$periodmenu=array();
|
$periodmenu=array();
|
||||||
$periodmenu[0] = get_string('unlimited');
|
$periodmenu[0] = get_string('unlimited');
|
||||||
for ($i=1; $i<=365; $i++) {
|
for ($i=1; $i<=365; $i++) {
|
||||||
|
@ -220,14 +220,14 @@
|
||||||
|
|
||||||
$mform->addElement('header','expirynotifyhdr', get_string("expirynotify"));
|
$mform->addElement('header','expirynotifyhdr', get_string("expirynotify"));
|
||||||
|
|
||||||
$mform->setDefault('expirynotify',(isset($default->expirynotify))?$default->expirynotify:0);
|
$mform->setDefault('expirynotify',(isset($toform->expirynotify))?$toform->expirynotify:0);
|
||||||
unset($choices);
|
unset($choices);
|
||||||
$choices["0"] = get_string("no");
|
$choices["0"] = get_string("no");
|
||||||
$choices["1"] = get_string("yes");
|
$choices["1"] = get_string("yes");
|
||||||
$mform->addElement('select', 'expirynotify', get_string("expirynotify"), $choices);
|
$mform->addElement('select', 'expirynotify', get_string("expirynotify"), $choices);
|
||||||
$mform->setDefault('notifystudents',(isset($default->notifystudents))?$default->notifystudents:0);
|
$mform->setDefault('notifystudents',(isset($toform->notifystudents))?$toform->notifystudents:0);
|
||||||
$mform->addElement('select', 'notifystudents', get_string("expirynotifystudents"), $choices);
|
$mform->addElement('select', 'notifystudents', get_string("expirynotifystudents"), $choices);
|
||||||
$mform->setDefault('expirythreshold',(isset($default->expirythreshold))?$default->expirythreshold:10 * 86400);
|
$mform->setDefault('expirythreshold',(isset($toform->expirythreshold))?$toform->expirythreshold:10 * 86400);
|
||||||
$thresholdmenu=array();
|
$thresholdmenu=array();
|
||||||
for ($i=1; $i<=30; $i++) {
|
for ($i=1; $i<=30; $i++) {
|
||||||
$seconds = $i * 86400;
|
$seconds = $i * 86400;
|
||||||
|
@ -238,13 +238,13 @@
|
||||||
|
|
||||||
$mform->addElement('header','', get_string("groupmode"));
|
$mform->addElement('header','', get_string("groupmode"));
|
||||||
|
|
||||||
$mform->setDefault('groupmode', $default->groupmode);
|
$mform->setDefault('groupmode', $toform->groupmode);
|
||||||
unset($choices);
|
unset($choices);
|
||||||
$choices[NOGROUPS] = get_string("groupsnone");
|
$choices[NOGROUPS] = get_string("groupsnone");
|
||||||
$choices[SEPARATEGROUPS] = get_string("groupsseparate");
|
$choices[SEPARATEGROUPS] = get_string("groupsseparate");
|
||||||
$choices[VISIBLEGROUPS] = get_string("groupsvisible");
|
$choices[VISIBLEGROUPS] = get_string("groupsvisible");
|
||||||
$mform->addElement('select', 'groupmode', get_string("groupmode"), $choices);
|
$mform->addElement('select', 'groupmode', get_string("groupmode"), $choices);
|
||||||
$mform->setDefault('groupmodeforce', $default->groupmodeforce);
|
$mform->setDefault('groupmodeforce', $toform->groupmodeforce);
|
||||||
unset($choices);
|
unset($choices);
|
||||||
$choices["0"] = get_string("no");
|
$choices["0"] = get_string("no");
|
||||||
$choices["1"] = get_string("yes");
|
$choices["1"] = get_string("yes");
|
||||||
|
@ -252,22 +252,22 @@
|
||||||
|
|
||||||
$mform->addElement('header','', get_string("availability"));
|
$mform->addElement('header','', get_string("availability"));
|
||||||
|
|
||||||
$mform->setDefault('visible', $default->visible);
|
$mform->setDefault('visible', $toform->visible);
|
||||||
unset($choices);
|
unset($choices);
|
||||||
$choices["0"] = get_string("courseavailablenot");
|
$choices["0"] = get_string("courseavailablenot");
|
||||||
$choices["1"] = get_string("courseavailable");
|
$choices["1"] = get_string("courseavailable");
|
||||||
$mform->addElement('select', 'visible', get_string("availability"), $choices);
|
$mform->addElement('select', 'visible', get_string("availability"), $choices);
|
||||||
$mform->setDefault('password', $default->password);
|
$mform->setDefault('password', $toform->password);
|
||||||
$mform->addElement('text', 'password', get_string("enrolmentkey"), 'size="25"');
|
$mform->addElement('text', 'password', get_string("enrolmentkey"), 'size="25"');
|
||||||
$mform->setDefault('guest', $default->guest);
|
$mform->setDefault('guest', $toform->guest);
|
||||||
unset($choices);
|
unset($choices);
|
||||||
$choices["0"] = get_string("guestsno");
|
$choices["0"] = get_string("guestsno");
|
||||||
$choices["1"] = get_string("guestsyes");
|
$choices["1"] = get_string("guestsyes");
|
||||||
$choices["2"] = get_string("guestskey");
|
$choices["2"] = get_string("guestskey");
|
||||||
$mform->addElement('select', 'guest', get_string("opentoguests"), $choices);
|
$mform->addElement('select', 'guest', get_string("opentoguests"), $choices);
|
||||||
if (isset($course) && method_exists(enrolment_factory::factory($course->enrol), 'print_entry') && $course->enrol != 'manual') {
|
if (isset($course) && method_exists(enrolment_factory::factory($course->enrol), 'print_entry') && $course->enrol != 'manual') {
|
||||||
$mform->setDefault('cost', $default->cost);
|
$mform->setDefault('cost', $toform->cost);
|
||||||
$mform->setDefault('currency', $default->currency);
|
$mform->setDefault('currency', $toform->currency);
|
||||||
$costgroup=array();
|
$costgroup=array();
|
||||||
$currencies = get_list_of_currencies();
|
$currencies = get_list_of_currencies();
|
||||||
$costgroup[]= &moodleform::createElement('text','cost', '', 'maxlength="6" size="6"');
|
$costgroup[]= &moodleform::createElement('text','cost', '', 'maxlength="6" size="6"');
|
||||||
|
@ -276,18 +276,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$mform->addElement('header','', get_string("language"));
|
$mform->addElement('header','', get_string("language"));
|
||||||
$mform->setDefault('lang',(isset($default->lang))?$default->lang:'');
|
$mform->setDefault('lang',(isset($toform->lang))?$toform->lang:'');
|
||||||
$languages=array();
|
$languages=array();
|
||||||
$languages[''] = get_string("forceno");
|
$languages[''] = get_string("forceno");
|
||||||
$languages += get_list_of_languages();
|
$languages += get_list_of_languages();
|
||||||
$mform->addElement('select', 'lang', get_string("forcelanguage"), $languages);
|
$mform->addElement('select', 'lang', get_string("forcelanguage"), $languages);
|
||||||
|
|
||||||
if(!has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $default->category))) {
|
if(!has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $toform->category))) {
|
||||||
$mform->addElement('hidden', 'category', null);
|
$mform->addElement('hidden', 'category', null);
|
||||||
}
|
}
|
||||||
$mform->addElement('hidden', 'id', null);
|
$mform->addElement('hidden', 'id', null);
|
||||||
|
|
||||||
$mform->setDefault('restrictmodules',(isset($default->restrictmodules))?$default->restrictmodules:0);
|
$mform->setDefault('restrictmodules',(isset($toform->restrictmodules))?$toform->restrictmodules:0);
|
||||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)) && ((!empty($course->requested) && $CFG->restrictmodulesfor == 'requested') || $CFG->restrictmodulesfor == 'all')) {
|
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)) && ((!empty($course->requested) && $CFG->restrictmodulesfor == 'requested') || $CFG->restrictmodulesfor == 'all')) {
|
||||||
unset($options);
|
unset($options);
|
||||||
$options[0] = get_string("no");
|
$options[0] = get_string("no");
|
||||||
|
@ -301,12 +301,12 @@
|
||||||
$disabled=($mform->exportValue('restrictmodules')==1) ? array() :array('disabled' => 'disabled') ;
|
$disabled=($mform->exportValue('restrictmodules')==1) ? array() :array('disabled' => 'disabled') ;
|
||||||
|
|
||||||
|
|
||||||
$mform->setDefault('allowedmods', $default->allowedmods);
|
$mform->setDefault('allowedmods', $toform->allowedmods);
|
||||||
$mform->addElement('select', 'allowedmods', get_string("to"),$mods,
|
$mform->addElement('select', 'allowedmods', get_string("to"),$mods,
|
||||||
array('multiple'=>"multiple", 'size'=>"10", 'id'=>"allowedmods")
|
array('multiple'=>"multiple", 'size'=>"10", 'id'=>"allowedmods")
|
||||||
+$disabled);
|
+$disabled);
|
||||||
}else {
|
}else {
|
||||||
$mform->addElement('hidden', 'restrictmodules', $default->restrictmodules);
|
$mform->addElement('hidden', 'restrictmodules', $toform->restrictmodules);
|
||||||
}
|
}
|
||||||
$mform->setHelpButtons(array('category'=>array("coursecategory", get_string("category")),
|
$mform->setHelpButtons(array('category'=>array("coursecategory", get_string("category")),
|
||||||
'fullname'=>array("coursefullname", get_string("fullname")),
|
'fullname'=>array("coursefullname", get_string("fullname")),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue