Browse Source

Add user profile image to teacher marking page.

MOODLE_35_STABLE
Dan Marsden 6 years ago
parent
commit
310522bb93
  1. 7
      classes/output/mobile.php
  2. 2
      db/mobile.php
  3. 4
      mobilestyles.css
  4. 12
      templates/mobile_teacher_form.mustache

7
classes/output/mobile.php

@ -353,7 +353,7 @@ class mobile {
* @return array HTML, javascript and other data * @return array HTML, javascript and other data
*/ */
public static function mobile_teacher_form($args) { public static function mobile_teacher_form($args) {
global $OUTPUT, $DB, $CFG; global $OUTPUT, $DB, $CFG, $PAGE;
require_once($CFG->dirroot.'/mod/attendance/locallib.php'); require_once($CFG->dirroot.'/mod/attendance/locallib.php');
@ -405,7 +405,10 @@ class mobile {
$data['users'] = array(); $data['users'] = array();
$users = $att->get_users($att->get_session_info($sessid)->groupid, 0); $users = $att->get_users($att->get_session_info($sessid)->groupid, 0);
foreach ($users as $user) { foreach ($users as $user) {
$data['users'][] = array('userid' => $user->id, 'fullname' => $user->fullname); $userpicture = new \user_picture($user);
$userpicture->size = 1; // Size f1.
$profileimageurl = $userpicture->get_url($PAGE)->out(false);
$data['users'][] = array('userid' => $user->id, 'fullname' => $user->fullname, 'profileimageurl' => $profileimageurl);
// Generate args to use in submission button here. // Generate args to use in submission button here.
$data['btnargs'] .= ', status'. $user->id. ': CONTENT_OTHERDATA.status'. $user->id; $data['btnargs'] .= ', status'. $user->id. ': CONTENT_OTHERDATA.status'. $user->id;
} }

2
db/mobile.php

@ -36,7 +36,7 @@ $addons = [
'method' => 'mobile_view_activity', 'method' => 'mobile_view_activity',
'styles' => [ 'styles' => [
'url' => '/mod/attendance/mobilestyles.css', 'url' => '/mod/attendance/mobilestyles.css',
'version' => 21 'version' => 22
] ]
] ]
], ],

4
mobilestyles.css

@ -24,3 +24,7 @@
.attendance_mobile_view_page .messages .label { .attendance_mobile_view_page .messages .label {
white-space: normal; white-space: normal;
} }
.attendance_mobile_teacher_form .attendance_user_row {
padding-bottom: 5px;
}

12
templates/mobile_teacher_form.mustache

@ -59,12 +59,15 @@
<%/messages%> <%/messages%>
<%/showmessage%> <%/showmessage%>
<%#users%> <%#users%>
<ion-item> <span class="attendance_user_row">
<span class="studentname"> <!-- User and status of the submission. -->
<span ion-item text-wrap title="<% fullname %>">
<ion-avatar item-start>
<img src="<% profileimageurl %>" core-external-content role="presentation" onError="this.src='assets/img/user-avatar.png'">
</ion-avatar>
<h2><% fullname %></h2> <h2><% fullname %></h2>
<ng-container *ngTemplateOutlet="submissionStatus"></ng-container>
</span> </span>
</ion-item>
<ion-list radio-group [(ngModel)]="CONTENT_OTHERDATA.status<% userid %>"> <ion-list radio-group [(ngModel)]="CONTENT_OTHERDATA.status<% userid %>">
<%#statuses%> <%#statuses%>
<span class="radiolabel"> <span class="radiolabel">
@ -75,6 +78,7 @@
</span> </span>
<%/statuses%> <%/statuses%>
</ion-list> </ion-list>
</span>
<%/users%> <%/users%>
<ion-item> <ion-item>
<button ion-button core-site-plugins-new-content component="mod_attendance" method="mobile_view_activity" [args]="{cmid: <% cmid %>, courseid: <% courseid %>, sessid: <% sessid %><% btnargs %>}"> <button ion-button core-site-plugins-new-content component="mod_attendance" method="mobile_view_activity" [args]="{cmid: <% cmid %>, courseid: <% courseid %>, sessid: <% sessid %><% btnargs %>}">

Loading…
Cancel
Save