Skip to content

Commit

Permalink
GH-533 add time of booking to sign-in sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
eynimeni committed Jul 10, 2024
1 parent f4dfd51 commit a1c7b14
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
19 changes: 14 additions & 5 deletions classes/signinsheet/signinsheet_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public function download_signinsheet() {
}

$users = $DB->get_records_sql(
"SELECT u.id, " . $mainuserfields . $userfields .
"SELECT u.id, ba.timecreated as bookingtime, " . $mainuserfields . $userfields .
" FROM {booking_answers} ba
LEFT JOIN {user} u ON u.id = ba.userid
WHERE ba.optionid = :optionid AND ba.waitinglist = 0 " .
Expand Down Expand Up @@ -511,14 +511,14 @@ function ($role) {
break;
case 'userpic':
$name = "";
$user = singleton_service::get_instance_of_user($user->id);
if (empty($user->id) || empty($user)) {
$userobj = singleton_service::get_instance_of_user($user->id);
if (empty($user->id) || empty($userobj)) {
// In case row is empty. No user given.
// Make sure column with is respected.
$w = 20;
break;
}
$userpic = new user_picture($user);
$userpic = new user_picture($userobj);
if (empty($userpic)) {
break;
}
Expand All @@ -529,7 +529,12 @@ function ($role) {
true, 400, '', false, false, 1, false, false, false);
$escape = true;
break;
case 'indexnumber':
case 'timecreated':
$w = 30;
$name = "";
if ($user->bookingtime > 0) {
$name = userdate($user->bookingtime, get_string('strftimedatetime', 'langconfig'));
}
break;
case 'signinextracols1':
case 'signinextracols2':
Expand Down Expand Up @@ -919,6 +924,10 @@ private function set_table_headerrow() {
$w = 20;
$name = get_string('userpic');
break;
case 'timecreated':
$w = 30;
$name = get_string('bookingdate', 'mod_booking');
break;
default:
$rotate = true;
$this->hasrotatedfields = true;
Expand Down
1 change: 1 addition & 0 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ public function definition() {
'address' => new lang_string('address'),
'role' => new lang_string('role'),
'userpic' => get_string('userpic'),
'timecreated' => get_string('timecreated', 'mod_booking'),
];

for ($i = 1; $i < 4; $i++) {
Expand Down

0 comments on commit a1c7b14

Please sign in to comment.