From: jamiesensei Date: Mon, 9 Oct 2006 11:23:23 +0000 (+0000) Subject: fix for bug that value of restrictmodules field wasn't available which breaks disabli... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0d26ea7af9fea4cb4123806157d1e7583cc78189;p=moodle.git fix for bug that value of restrictmodules field wasn't available which breaks disabling of allowedmods multiple select --- diff --git a/course/edit2.php b/course/edit2.php index 794ebbdbfb..da9c2c0c4f 100644 --- a/course/edit2.php +++ b/course/edit2.php @@ -164,9 +164,9 @@ if(!isset($default->defaultrole)) { $default->defaultrole = 0; // Use site default } - include("edit_form.php"); $mform->setDefaults((array)$default); - + include("edit_form.php"); + /* //setconstant overrides data coming from the form as well as default //we use this to pass data into the form which we've already processed. $mform->setConstants(array('id'=>$id, diff --git a/course/edit_form.php b/course/edit_form.php index 7509bf4caf..963a9afb54 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -204,7 +204,9 @@ "((this.selectedIndex==0)?true:false);")); $mods = array(0=>get_string('allownone')); $mods += get_records_menu("modules", '','','','id, name'); - $disabled=($mform->exportValue('restrictmodules')===0) ? array('disabled' => 'disabled') : array(); + $disabled=($mform->exportValue('restrictmodules')==1) ? array() :array('disabled' => 'disabled') ; + + $mform->addElement('select', 'allowedmods', get_string("to"),$mods, array('multiple'=>"multiple", 'size'=>"10", 'id'=>"allowedmods") +$disabled);