Browse Source

Add abilty to view student password from session list page.

MOODLE_34_STABLE
Dan Marsden 8 years ago
parent
commit
c18dcd64e6
  1. 1
      pix/key.svg
  2. 20
      renderer.php
  3. 3
      styles.css

1
pix/key.svg

@ -0,0 +1 @@
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M832 512q0-80-56-136t-136-56-136 56-56 136q0 42 19 83-41-19-83-19-80 0-136 56t-56 136 56 136 136 56 136-56 56-136q0-42-19-83 41 19 83 19 80 0 136-56t56-136zm851 704q0 17-49 66t-66 49q-9 0-28.5-16t-36.5-33-38.5-40-24.5-26l-96 96 220 220q28 28 28 68 0 42-39 81t-81 39q-40 0-68-28l-671-671q-176 131-365 131-163 0-265.5-102.5t-102.5-265.5q0-160 95-313t248-248 313-95q163 0 265.5 102.5t102.5 265.5q0 189-131 365l355 355 96-96q-3-3-26-24.5t-40-38.5-33-36.5-16-28.5q0-17 49-66t66-49q13 0 23 10 6 6 46 44.5t82 79.5 86.5 86 73 78 28.5 41z"/></svg>

After

Width:  |  Height:  |  Size: 638 B

20
renderer.php

@ -257,8 +257,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
get_string('actions'),
html_writer::checkbox('cb_selector', 0, false, '', array('id' => 'cb_selector'))
);
$table->align = array('', 'right', '', '', 'left', 'center', 'center');
$table->size = array('1px', '1px', '1px', '', '*', '110px', '1px');
$table->align = array('', 'right', '', '', 'left', 'right', 'center');
$table->size = array('1px', '1px', '1px', '', '*', '120px', '1px');
$i = 0;
foreach ($sessdata->sessions as $key => $sess) {
@ -300,6 +300,18 @@ class mod_attendance_renderer extends plugin_renderer_base {
*/
private function construct_date_time_actions(attendance_manage_data $sessdata, $sess) {
$actions = '';
if (!empty($sess->studentpassword) &&
(has_capability('mod/attendance:manageattendances', $sessdata->att->context) ||
has_capability('mod/attendance:takeattendances', $sessdata->att->context) ||
has_capability('mod/attendance:changeattendances', $sessdata->att->context))) {
$icon = new pix_icon('key', '', 'attendance');
$attributes = array("class" => "btn-link p-a-0", "role" => "button",
"data-toggle" => "popover", "data-placement" => "left", "data-html" => "true",
"tabindex" => "0", "data-trigger" => "manual");
$attributes['data-content'] = html_writer::span($sess->studentpassword, 'student-pass');
$actions .= html_writer::tag('a', $this->output->render($icon), $attributes);
}
$date = userdate($sess->sessdate, get_string('strftimedmyw', 'attendance'));
$time = $this->construct_time($sess->sessdate, $sess->duration);
@ -311,7 +323,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$date = html_writer::link($url, $date, array('title' => $title));
$time = html_writer::link($url, $time, array('title' => $title));
$actions = $this->output->action_icon($url, new pix_icon('redo', $title, 'attendance'));
$actions .= $this->output->action_icon($url, new pix_icon('redo', $title, 'attendance'));
} else {
$date = '<i>' . $date . '</i>';
$time = '<i>' . $time . '</i>';
@ -320,7 +332,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
if (has_capability('mod/attendance:takeattendances', $sessdata->att->context)) {
$url = $sessdata->url_take($sess->id, $sess->groupid);
$title = get_string('takeattendance', 'attendance');
$actions = $this->output->action_icon($url, new pix_icon('t/go', $title));
$actions .= $this->output->action_icon($url, new pix_icon('t/go', $title));
}
}

3
styles.css

@ -186,3 +186,6 @@
.path-mod-attendance .attreport .narrow {
width: 1px;
}
.path-mod-attendance .student-pass {
font-size: x-large;
}

Loading…
Cancel
Save