Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions classes/observation_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,44 @@ public static function submit_point_response(int $sessionid, int $pointid, $data
}
}

/**
* Renders a labelled info box showing the observee's details to the grader.
* @param int $observeeid ID of the observee being observed in this session
* @param context $context context to check permissions against for which fields to show
* @return string HTML string
*/
public static function render_observee_details(int $observeeid, \context $context) {
global $OUTPUT;

// Display the learner (observee) being observed.
$observee = \core_user::get_user($observeeid, '*', MUST_EXIST);

// Determine which identity fields the current user (grader) is permitted to see.
$identityfields = \core_user\fields::get_identity_fields($context, false);

// Variable fullname() respects $CFG->fullnamedisplay / $CFG->alternativefullnameformat.
$canviewfullnames = has_capability('moodle/site:viewfullnames', $context);

$out = $OUTPUT->container_start('my-2');
$out .= $OUTPUT->heading(get_string('observee', 'observation') . ': ' . fullname($observee, $canviewfullnames), 5);

// Build secondary details line - only include fields the admin has enabled and the
// Current user is permitted to view.
$observeedetails = [];
if (in_array('email', $identityfields) && !empty($observee->email)) {
$observeedetails[] = get_string('email') . ': ' .
\html_writer::tag('a', $observee->email, ['href' => 'mailto:' . $observee->email]);
}
if (in_array('username', $identityfields) && !empty($observee->username)) {
$observeedetails[] = get_string('username') . ': ' . s($observee->username);
}
if (!empty($observeedetails)) {
$out .= \html_writer::tag('p', implode('  |  ', $observeedetails), ['class' => 'text-muted mb-0']);
}
$out .= $OUTPUT->container_end();
return $out;
}

/**
* Generates a HTML table that summarises the observation points and their responses
* @param int $observationid ID of the observation instance
Expand Down
3 changes: 3 additions & 0 deletions session.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('markingobservation', 'observation'), 2);

// Display the learner (observee) being observed.
echo \mod_observation\observation_manager::render_observee_details($sessiondata['observee'], $PAGE->context);

if ($markingform->no_submit_button_pressed()) {
$fromform = $markingform->get_submitted_data();

Expand Down
3 changes: 3 additions & 0 deletions sessionsummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@

echo $OUTPUT->heading(get_string('sessionsummary', 'observation'), 2);

// Display the learner (observee) being observed.
echo \mod_observation\observation_manager::render_observee_details($sessioninfo['observee'], $PAGE->context);

// Summary of points and responses.
echo \mod_observation\observation_manager::format_points_and_responses($obid, $sessionid);

Expand Down