mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-21235 support for optgroups in select
This commit is contained in:
parent
d776d59ee2
commit
6770330d17
5 changed files with 50 additions and 28 deletions
|
@ -130,6 +130,8 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
|
|||
$hostarray[$CFG->mnet_localhost_id] = $SITE->fullname;
|
||||
asort($hostarray);
|
||||
|
||||
$dropdown = array();
|
||||
|
||||
foreach($hostarray as $hostid => $name) {
|
||||
$courses = array();
|
||||
$sites = array();
|
||||
|
@ -161,7 +163,7 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
|
|||
}
|
||||
|
||||
asort($courses);
|
||||
$dropdown[$name] = $sites + $courses;
|
||||
$dropdown[] = array($name=>($sites + $courses));
|
||||
}
|
||||
|
||||
|
||||
|
@ -255,9 +257,7 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
|
|||
echo "<input type=\"hidden\" name=\"showcourses\" value=\"$showcourses\" />\n";
|
||||
if (has_capability('coursereport/log:view', $sitecontext) && $showcourses) {
|
||||
$cid = empty($course->id)? '1' : $course->id;
|
||||
$select = html_select::make($dropdown, "host_course", $hostid.'/'.$cid);
|
||||
$select->nested = true;
|
||||
echo $OUTPUT->select($select);
|
||||
echo html_writer::select($dropdown, "host_course", $hostid.'/'.$cid);
|
||||
} else {
|
||||
$courses = array();
|
||||
$courses[$course->id] = $course->fullname . ((empty($course->category)) ? ' ('.get_string('site').') ' : '');
|
||||
|
|
|
@ -64,11 +64,11 @@
|
|||
if (empty($modinfo->instances[$module->name])) {
|
||||
continue;
|
||||
}
|
||||
$agroup = get_string('modulenameplural', $module->name);
|
||||
$instanceoptions[$agroup] = array();
|
||||
$instances = array();
|
||||
foreach ($modinfo->instances[$module->name] as $cm) {
|
||||
$instanceoptions[$agroup][$cm->id] = format_string($cm->name);
|
||||
$instances[$cm->id] = format_string($cm->name);
|
||||
}
|
||||
$instanceoptions[] = array(get_string('modulenameplural', $module->name)=>$instances);
|
||||
}
|
||||
|
||||
$timeoptions = array();
|
||||
|
@ -117,9 +117,7 @@
|
|||
echo '<form class="participationselectform" action="index.php" method="get"><div>'."\n".
|
||||
'<input type="hidden" name="id" value="'.$course->id.'" />'."\n";
|
||||
echo '<label for="menuinstanceid">'.get_string('activitymodule').'</label>'."\n";
|
||||
$select = html_select::make($instanceoptions, 'instanceid', $instanceid);
|
||||
$select->nested = true;
|
||||
echo $OUTPUT->select($select);
|
||||
echo html_writer::select($instanceoptions, 'instanceid', $instanceid);
|
||||
echo '<label for="menutimefrom">'.get_string('lookback').'</label>'."\n";
|
||||
echo html_writer::select($timeoptions,'timefrom',$timefrom);
|
||||
echo '<label for="menuroleid">'.get_string('showonly').'</label>'."\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue