From 119946f24ab257d2070dcdc495b0c97fce4eb7ef Mon Sep 17 00:00:00 2001 From: Nadav Kavalerchik Date: Thu, 3 Oct 2019 00:37:35 +0300 Subject: [PATCH] Swap hour:min input fields in a new session form, when in RTL (#434) Should fix issue #432 --- locallib.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/locallib.php b/locallib.php index b27aa51..597fb06 100644 --- a/locallib.php +++ b/locallib.php @@ -177,12 +177,21 @@ function attendance_form_sessiondate_selector (MoodleQuickForm $mform) { } $sesendtime = array(); - $sesendtime[] =& $mform->createElement('static', 'from', '', get_string('from', 'attendance')); - $sesendtime[] =& $mform->createElement('select', 'starthour', get_string('hour', 'form'), $hours, false, true); - $sesendtime[] =& $mform->createElement('select', 'startminute', get_string('minute', 'form'), $minutes, false, true); - $sesendtime[] =& $mform->createElement('static', 'to', '', get_string('to', 'attendance')); - $sesendtime[] =& $mform->createElement('select', 'endhour', get_string('hour', 'form'), $hours, false, true); - $sesendtime[] =& $mform->createElement('select', 'endminute', get_string('minute', 'form'), $minutes, false, true); + if (!right_to_left()) { + $sesendtime[] =& $mform->createElement('static', 'from', '', get_string('from', 'attendance')); + $sesendtime[] =& $mform->createElement('select', 'starthour', get_string('hour', 'form'), $hours, false, true); + $sesendtime[] =& $mform->createElement('select', 'startminute', get_string('minute', 'form'), $minutes, false, true); + $sesendtime[] =& $mform->createElement('static', 'to', '', get_string('to', 'attendance')); + $sesendtime[] =& $mform->createElement('select', 'endhour', get_string('hour', 'form'), $hours, false, true); + $sesendtime[] =& $mform->createElement('select', 'endminute', get_string('minute', 'form'), $minutes, false, true); + } else { + $sesendtime[] =& $mform->createElement('static', 'from', '', get_string('from', 'attendance')); + $sesendtime[] =& $mform->createElement('select', 'startminute', get_string('minute', 'form'), $minutes, false, true); + $sesendtime[] =& $mform->createElement('select', 'starthour', get_string('hour', 'form'), $hours, false, true); + $sesendtime[] =& $mform->createElement('static', 'to', '', get_string('to', 'attendance')); + $sesendtime[] =& $mform->createElement('select', 'endminute', get_string('minute', 'form'), $minutes, false, true); + $sesendtime[] =& $mform->createElement('select', 'endhour', get_string('hour', 'form'), $hours, false, true); + } $mform->addGroup($sesendtime, 'sestime', get_string('time', 'attendance'), array(' '), true); }