From 9d936bab1b88fff50b872f910a98a817164eb778 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Fri, 31 Jan 2014 16:34:00 +1100 Subject: [PATCH] Tidy up formatting of study week group table --- booking.css | 5 +++++ booking.studygroups.inc | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 booking.css diff --git a/booking.css b/booking.css new file mode 100644 index 0000000..3b051f8 --- /dev/null +++ b/booking.css @@ -0,0 +1,5 @@ +#leader-row {background: #6495ED;} +#helper-row {background: #6495ED;} +#new-group-row {border-top: thick double #ff0000;} +#leader-new-group-row {background: #6495ED; border-top: thick double #ff0000;} +#helper-new-group-row {background: #6495ED; border-top: thick double #ff0000;} \ No newline at end of file diff --git a/booking.studygroups.inc b/booking.studygroups.inc index 248e197..41afe9b 100644 --- a/booking.studygroups.inc +++ b/booking.studygroups.inc @@ -471,6 +471,7 @@ function booking_studygroups_view_form($node, &$form_state, $single_view, $group $form = array(); $options = array(); + $last_session = ""; //attach the custom css $form['#attached']['css'] = array( @@ -530,7 +531,7 @@ function booking_studygroups_view_form($node, &$form_state, $single_view, $group foreach($result as $data) { - //watchdog('booking', 'Study groups raw data: @info', array ('@info' => var_export($data, TRUE))); + $class = ""; //apply theme as required if ($data->booking_is_leader == 1) @@ -539,7 +540,18 @@ function booking_studygroups_view_form($node, &$form_state, $single_view, $group $class = "helper-row"; else $class = "normal-row"; - + + //Add a different id for first entry of new session, with a border-top to distinguish it + if ($last_session <> $data->booking_session_id && $last_session <> "") + { + if ($class === "leader-row") + $class = "leader-new-group-row"; + elseif ($class === "helper-row") + $class = "helper-new-group-row"; + else + $class = "new-group-row"; + } + $options[$data->nid] = array ( 'booking_session_id' => $data->booking_session_id, 'booking_name' => $data->booking_firstname . " " . $data->booking_lastname, @@ -547,6 +559,8 @@ function booking_studygroups_view_form($node, &$form_state, $single_view, $group 'booking_is_helper' => $data->booking_is_helper == 1 ? 'Yes' : 'No', '#attributes' => array('id' => array($class)) ); + + $last_session = $data->booking_session_id; } $prefix = t("

Study Group !descrip

", array('!descrip' => $group->booking_studygroup_descrip));