Skip to content

Commit

Permalink
MDL-34571 accessibility compliance for report: Add label to select an…
Browse files Browse the repository at this point in the history
…d input text form
  • Loading branch information
Rossiani Wijaya committed Sep 17, 2012
1 parent c8ac480 commit 2bbd896
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
9 changes: 6 additions & 3 deletions report/courseoverview/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@
$table->width = '*';
$table->align = array('left','left','left','left','left','left');

$reporttypemenu = html_writer::select($reportoptions,'report',$report, false);
$timeoptionsmenu = html_writer::select($timeoptions,'time',$time, false);
$reporttypemenu = html_writer::label(get_string('statsreporttype'), 'menureport', false, array('class' => 'accesshide'));
$reporttypemenu .= html_writer::select($reportoptions,'report',$report, false);
$timeoptionsmenu = html_writer::label(get_string('time'), 'menutime', false, array('class' => 'accesshide'));
$timeoptionsmenu .= html_writer::select($timeoptions,'time',$time, false);

$table->data[] = array(get_string('statsreporttype'),$reporttypemenu,
get_string('statstimeperiod'),$timeoptionsmenu,
'<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
'<label class="accesshide" for="numcourses">' . get_string('numberofcourses') . '</label>' .
'<input type="text" id="numcourses" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
'<input type="submit" value="'.get_string('view').'" />') ;

echo html_writer::table($table);
Expand Down
1 change: 1 addition & 0 deletions report/log/lang/en/report_log.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

$string['log:view'] = 'View course logs';
$string['log:viewtoday'] = 'View today\'s logs';
$string['logsformat'] = 'Logs format';
$string['page-report-log-x'] = 'Any log report';
$string['page-report-log-index'] = 'Course log report';
$string['page-report-log-user'] = 'User course log report';
Expand Down
18 changes: 18 additions & 0 deletions report/log/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,12 @@ function report_log_print_mnet_selector_form($hostid, $course, $selecteduser=0,
echo "<input type=\"hidden\" name=\"showcourses\" value=\"$showcourses\" />\n";
if (has_capability('report/log:view', $sitecontext) && $showcourses) {
$cid = empty($course->id)? '1' : $course->id;
echo html_writer::label(get_string('selectacoursesite'), 'menuhost_course', false, array('class' => 'accesshide'));
echo html_writer::select($dropdown, "host_course", $hostid.'/'.$cid);
} else {
$courses = array();
$courses[$course->id] = $course->fullname . ((empty($course->category)) ? ' ('.get_string('site').') ' : '');
echo html_writer::label(get_string('selectacourse'), 'menuid', false, array('class' => 'accesshide'));
echo html_writer::select($courses,"id",$course->id, false);
if (has_capability('report/log:view', $sitecontext)) {
$a = new stdClass();
Expand All @@ -328,10 +330,12 @@ function report_log_print_mnet_selector_form($hostid, $course, $selecteduser=0,
else {
$groups = array();
}
echo html_writer::label(get_string('selectagroup'), 'menugroup', false, array('class' => 'accesshide'));
echo html_writer::select($groups, "group", $selectedgroup, get_string("allgroups"));
}

if ($showusers) {
echo html_writer::label(get_string('participantslist'), 'menuuser', false, array('class' => 'accesshide'));
echo html_writer::select($users, "user", $selecteduser, get_string("allparticipants"));
}
else {
Expand All @@ -343,20 +347,25 @@ function report_log_print_mnet_selector_form($hostid, $course, $selecteduser=0,
else {
$users[0] = get_string('allparticipants');
}
echo html_writer::label(get_string('participantslist'), 'menuuser', false, array('class' => 'accesshide'));
echo html_writer::select($users, "user", $selecteduser, false);
$a->url = "$CFG->wwwroot/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
."&id=$course->id&date=$selecteddate&modid=$selectedactivity&showusers=1&showcourses=$showcourses";
print_string('logtoomanyusers','moodle',$a);
}

echo html_writer::label(get_string('date'), 'menudate', false, array('class' => 'accesshide'));
echo html_writer::select($dates, "date", $selecteddate, get_string("alldays"));
echo html_writer::label(get_string('showreports'), 'menumodid', false, array('class' => 'accesshide'));
echo html_writer::select($activities, "modid", $selectedactivity, get_string("allactivities"));
echo html_writer::label(get_string('actions'), 'menumodaction', false, array('class' => 'accesshide'));
echo html_writer::select($actions, 'modaction', $modaction, get_string("allactions"));

$logformats = array('showashtml' => get_string('displayonpage'),
'downloadascsv' => get_string('downloadtext'),
'downloadasods' => get_string('downloadods'),
'downloadasexcel' => get_string('downloadexcel'));
echo html_writer::label(get_string('logsformat', 'report_log'), 'menulogformat', false, array('class' => 'accesshide'));
echo html_writer::select($logformats, 'logformat', $logformat, false);
echo '<input type="submit" value="'.get_string('gettheselogs').'" />';
echo '</div>';
Expand Down Expand Up @@ -546,11 +555,13 @@ function report_log_print_selector_form($course, $selecteduser=0, $selecteddate=
echo "<input type=\"hidden\" name=\"showusers\" value=\"$showusers\" />\n";
echo "<input type=\"hidden\" name=\"showcourses\" value=\"$showcourses\" />\n";
if (has_capability('report/log:view', $sitecontext) && $showcourses) {
echo html_writer::label(get_string('selectacourse'), 'menuid', false, array('class' => 'accesshide'));
echo html_writer::select($courses, "id", $course->id, false);
} else {
// echo '<input type="hidden" name="id" value="'.$course->id.'" />';
$courses = array();
$courses[$course->id] = $course->fullname . (($course->id == SITEID) ? ' ('.get_string('site').') ' : '');
echo html_writer::label(get_string('selectacourse'), 'menuid', false, array('class' => 'accesshide'));
echo html_writer::select($courses,"id",$course->id, false);
if (has_capability('report/log:view', $sitecontext)) {
$a = new stdClass();
Expand All @@ -569,10 +580,12 @@ function report_log_print_selector_form($course, $selecteduser=0, $selecteddate=
else {
$groups = array();
}
echo html_writer::label(get_string('selectagroup'), 'menugroup', false, array('class' => 'accesshide'));
echo html_writer::select($groups, "group", $selectedgroup, get_string("allgroups"));
}

if ($showusers) {
echo html_writer::label(get_string('selctauser'), 'menuuser', false, array('class' => 'accesshide'));
echo html_writer::select($users, "user", $selecteduser, get_string("allparticipants"));
}
else {
Expand All @@ -584,22 +597,27 @@ function report_log_print_selector_form($course, $selecteduser=0, $selecteddate=
else {
$users[0] = get_string('allparticipants');
}
echo html_writer::label(get_string('selctauser'), 'menuuser', false, array('class' => 'accesshide'));
echo html_writer::select($users, "user", $selecteduser, false);
$a = new stdClass();
$a->url = "$CFG->wwwroot/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
."&id=$course->id&date=$selecteddate&modid=$selectedactivity&showusers=1&showcourses=$showcourses";
print_string('logtoomanyusers','moodle',$a);
}
echo html_writer::label(get_string('date'), 'menudate', false, array('class' => 'accesshide'));
echo html_writer::select($dates, "date", $selecteddate, get_string("alldays"));

echo html_writer::label(get_string('activities'), 'menumodid', false, array('class' => 'accesshide'));
echo html_writer::select($activities, "modid", $selectedactivity, get_string("allactivities"));
echo html_writer::label(get_string('actions'), 'menumodaction', false, array('class' => 'accesshide'));
echo html_writer::select($actions, 'modaction', $modaction, get_string("allactions"));

$logformats = array('showashtml' => get_string('displayonpage'),
'downloadascsv' => get_string('downloadtext'),
'downloadasods' => get_string('downloadods'),
'downloadasexcel' => get_string('downloadexcel'));

echo html_writer::label(get_string('logsformat', 'report_log'), 'menulogformat', false, array('class' => 'accesshide'));
echo html_writer::select($logformats, 'logformat', $logformat, false);
echo '<input type="submit" value="'.get_string('gettheselogs').'" />';
echo '</div>';
Expand Down
2 changes: 1 addition & 1 deletion report/participation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
}
echo '</div>';
echo '<div>';
echo '<label for="formaction">'.get_string('withselectedusers').'</label>';
echo '<label for="formactionselect">'.get_string('withselectedusers').'</label>';
$displaylist['messageselect.php'] = get_string('messageselectadd');
echo html_writer::select($displaylist, 'formaction', '', array(''=>'choosedots'), array('id'=>'formactionselect'));
echo $OUTPUT->help_icon('withselectedusers');
Expand Down
19 changes: 10 additions & 9 deletions report/stats/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function report_stats_mode_menu($course, $mode, $time, $url) {
}
$popupurl = $url."?course=$course->id&time=$time";
$select = new single_select(new moodle_url($popupurl), 'mode', $options, $mode, null);
$select->set_label(get_string('reports'), array('class' => 'accesshide'));
$select->formid = 'switchmode';
return $OUTPUT->render($select);
}
Expand Down Expand Up @@ -126,21 +127,21 @@ function report_stats_report($course, $report, $mode, $user, $roleid, $time) {
}

$table->align = array('left','left','left','left','left','left','left','left');
$table->data[] = array(get_string('course'),html_writer::select($courseoptions,'course',$course->id,false),
get_string('users'),html_writer::select($users,'userid',$userid,false),
get_string('statsreporttype'),html_writer::select($reportoptions,'report',($report == 5) ? $report.$roleid : $report,false),
get_string('statstimeperiod'),html_writer::select($timeoptions,'time',$time,false),
$table->data[] = array(html_writer::label(get_string('course'), 'menucourse'), html_writer::select($courseoptions, 'course', $course->id, false),
html_writer::label(get_string('users'), 'menuuserid'), html_writer::select($users, 'userid', $userid, false),
html_writer::label(get_string('statsreporttype'), 'menureport'), html_writer::select($reportoptions,'report',($report == 5) ? $report.$roleid : $report,false),
html_writer::label(get_string('statstimeperiod'), 'menutime') ,html_writer::select($timeoptions,'time',$time,false),
'<input type="submit" value="'.get_string('view').'" />') ;
} else if ($mode == STATS_MODE_RANKED) {
$table->align = array('left','left','left','left','left','left');
$table->data[] = array(get_string('statsreporttype'),html_writer::select($reportoptions,'report',($report == 5) ? $report.$roleid : $report,false),
get_string('statstimeperiod'),html_writer::select($timeoptions,'time',$time,false),
$table->data[] = array(html_writer::label(get_string('statsreporttype'), 'menureport'), html_writer::select($reportoptions,'report',($report == 5) ? $report.$roleid : $report,false),
html_writer::label(get_string('statstimeperiod'), 'menutime'), html_writer::select($timeoptions,'time',$time,false),
'<input type="submit" value="'.get_string('view').'" />') ;
} else if ($mode == STATS_MODE_GENERAL) {
$table->align = array('left','left','left','left','left','left','left');
$table->data[] = array(get_string('course'),html_writer::select($courseoptions,'course',$course->id,false),
get_string('statsreporttype'),html_writer::select($reportoptions,'report',($report == 5) ? $report.$roleid : $report,false),
get_string('statstimeperiod'),html_writer::select($timeoptions,'time',$time,false),
$table->data[] = array(html_writer::label(get_string('course'), 'menucourse'), html_writer::select($courseoptions,'course',$course->id,false),
html_writer::label(get_string('statsreporttype'), 'menureport'), html_writer::select($reportoptions,'report',($report == 5) ? $report.$roleid : $report,false),
html_writer::label(get_string('statstimeperiod'), 'menutime'), html_writer::select($timeoptions,'time',$time,false),
'<input type="submit" value="'.get_string('view').'" />') ;
}

Expand Down

0 comments on commit 2bbd896

Please sign in to comment.