change logic

This commit is contained in:
Nathan Coad
2016-06-08 12:26:54 +10:00
parent a689917c39
commit fd64685504

View File

@@ -114,10 +114,11 @@ function booking_studygroups_leadhelp_view_summary() {
//get study group definitions
$query = db_select('booking_studygroup_list', 's')
->fields('s')
->condition('s.booking_eventid', $event->eid, '=');
$result = $query->execute();
->condition('s.booking_eventid', $event->eid, '=')
->orderBy('sid');
$studygroup_list = $query->execute();
foreach ($result as $group) {
foreach ($studygroup_list as $group) {
$header[] = $group->booking_studygroup_descrip;
}
@@ -129,17 +130,27 @@ function booking_studygroups_leadhelp_view_summary() {
$group_mapping = $query->execute()->fetchAllAssoc('sid');
watchdog('booking_debug', "<pre>Leader Helper studygroup query result\n@info</pre>", array('@info' => print_r( $group_mapping, true)));
/*
foreach ($group_mapping as $group) {
$header[] = $group->booking_studygroup_descrip;
}
*/
$person_query = db_query("SELECT * FROM {booking_person_view} WHERE booking_gender = 'M' ORDER BY booking_lastname, booking_firstname")->fetchAllAssoc('nid');
foreach ($person_query as $person) {
//add the name to an array for this line
$newline = array($person->booking_firstname, $person->booking_lastname);
foreach ($studygroup_list as $group) {
$session = 'session' . $group->sid
$session_role = 'session' . $group->sid . '_role';
if ($person->$session_role > 0) {
$text = _booking_studygroup_role_lookup($person->$session_role);
$newline[] .= "<b>" . $text . "</b> for session #" . $group->booking_session_id;
}
else {
$newline[] = "";
}
}
/*
//go through each of the studygroups and check if the person belongs to the group
foreach ($group_mapping as $group) {
$role = $group->booking_studygroup_role;
@@ -151,6 +162,7 @@ function booking_studygroups_leadhelp_view_summary() {
$newline[] = "";
}
}
*/
//add the line to the array of rows
$rows[] = $newline;
}