Make it easier to see leaders and helpers in studygroup lists

This commit is contained in:
2014-06-27 15:06:19 +10:00
parent 57b9b065df
commit 53ea1fd2fe
4 changed files with 54 additions and 44 deletions

View File

@@ -1,5 +1,7 @@
#leader-row {background: #6495ED;}
#helper-row {background: #6495ED;}
#helper-row {background: #9dd781;}
#reserveleader-row {background: #d4dc5c;}
#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;}
#helper-new-group-row {background: #9dd781; border-top: thick double #ff0000;}
#reserveleader-new-group-row {background: #d4dc5c; border-top: thick double #ff0000;}

View File

@@ -136,6 +136,21 @@ function _booking_get_waitinglist_top()
watchdog('booking', "First person on the waiting list: @info", array('@info' => var_export($person, TRUE)));
return $person->nid;
}
//in case there's no people with status waiting list, but there is some with missed payment deadline
$result = db_query('SELECT p.nid, p.booking_firstname, p.booking_lastname, pay.booking_payment_date
FROM {booking_person} p, {booking_payment} pay
WHERE booking_status = 4 and booking_event_id = :eid and p.nid = pay.booking_person_nid
ORDER BY pay.booking_payment_date
LIMIT 1',
array(':eid' => $event->eid));
foreach ($result as $person)
{
watchdog('booking', "First person on the missed-payment-deadline list: @info", array('@info' => var_export($person, TRUE)));
return $person->nid;
}
//in case there was no one on the waiting list
return -1;
}

View File

@@ -380,7 +380,7 @@ function booking_menu() {
'access arguments' => array('edit study groups'),
//'type' => MENU_LOCAL_ACTION,
);
/*
$items['admin/booking/studygroups/calculate'] = array(
'title' => 'Calculate Study Groups',
'description' => 'Calculate Study Group memberships',
@@ -389,7 +389,7 @@ function booking_menu() {
'access arguments' => array('edit study groups'),
'type' => MENU_LOCAL_ACTION,
);
*/
$items['admin/booking/studygroups/%/update'] = array(
'title' => 'Update Study Groups',
'description' => 'Calculate updated Study Group memberships',
@@ -758,7 +758,7 @@ function booking_generate_luckynumbers() {
$attendees = $attendee_query->fetchAll();
//assuming there's less than 900 people, generate numbers within that range and shuffle the order
$numbers = range(100,999);
$numbers = range(100,650);
shuffle($numbers);
foreach ($attendees as $attendee)

View File

@@ -51,7 +51,13 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id)
$group_options = array();
$session_options = array();
$class_array = array(
0 => "normal-row",
1 => "leader-row",
2 => "helper-row",
3 => "reserveleader-row",
);
//verify that $group_id is a number
if (! preg_match('/^[0-9]+$/', $group_id)) {
drupal_set_message("Error: Invalid study group ID '" . $group_id . "' supplied. Unable to edit group leaders and helpers.", 'error', FALSE);
@@ -69,6 +75,10 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id)
drupal_goto('admin/booking/studygroups');
return "";
}
$form['#attached']['css'] = array(
drupal_get_path('module', 'booking') . '/booking.css',
);
$prefix = t("<h2>Study Group &dash; !descrip</h2><p>Allocate a leader/helper session for attendees.</p>",
array('!descrip' => $studygroup->booking_studygroup_descrip));
@@ -129,6 +139,7 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id)
$role_listing = "";
$assigned_role = 0;
$session_id = 0;
$class = $class_array[0];
//work out what this person is currently leading/helping
foreach ($group_mapping as $group)
@@ -151,7 +162,8 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id)
if ($role > 0)
{
$text = _booking_studygroup_role_lookup($role);
$role_listing .= "<b>" . $text . "</b> group " . $group->booking_studygroup_id . " #" . $group->booking_session_id . "; ";
$role_listing .= "<b>" . $text . "</b> group " . $group->booking_studygroup_id . " #" . $group->booking_session_id . "; ";
$class = $class_array[$role];
}
}
@@ -186,7 +198,8 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id)
)
),
'booking_currently_leadhelp' => $role_listing,
'booking_group_edit' => l(t('Edit'), t('admin/booking/!id/edit-studygroup', array('!id' => $data->nid))),
'booking_group_edit' => l(t('Edit'), t('admin/booking/!id/edit-studygroup', array('!id' => $data->nid))),
'#attributes' => array('id' => array($class))
);
}
@@ -1614,7 +1627,7 @@ function booking_studygroups_view_form($node, &$form_state, $group_id) {
0 => "normal-row",
1 => "leader-row",
2 => "helper-row",
3 => "helper-row",
3 => "reserveleader-row",
);
//attach the custom css
@@ -1695,48 +1708,28 @@ function booking_studygroups_view_form($node, &$form_state, $group_id) {
//only add the lines separating groups if we're sorting by the session id
if ($sort['sql'] == "m.booking_session_id")
{
/*
if ($data->nid == "924")
{
watchdog('booking', 'Reading group test. Last session: !last. This session: !curr. Class: !class',
array ('!last' => $last_session, '!curr' => $data->booking_session_id, '!class' => $class));
}
*/
//Add a different id for first entry of new session, with a border-top to distinguish it
if ($last_session <> $data->booking_session_id)
{
if ($data->booking_studygroup_role == 1)
{
$class = "leader-new-group-row";
switch ($data->booking_studygroup_role) {
case 1:
$class = "leader-new-group-row";
break;
case 2:
$class = "helper-new-group-row";
break;
case 3:
$class = "reserveleader-new-group-row";
break;
default:
$class = "new-group-row";
}
elseif ($data->booking_studygroup_role == 2 || $data->booking_studygroup_role == 3)
{
$class = "helper-new-group-row";
}
else
{
$class = "new-group-row";
}
}
}
} //end class calculation
$session = $is_reading_group == TRUE ? _booking_readinggroup_colour_lookup($data->booking_session_id) : $data->booking_session_id;
/*
$options[$data->nid] = array (
'booking_session_id' => $session,
'booking_name' => l(t('!first !last', array('!first' => $data->booking_firstname, '!last' => $data->booking_lastname)),
t('admin/booking/!id/edit-studygroup', array('!id' => $data->nid))),
'booking_status' => _booking_status_generate($data->booking_status),
'booking_studygroup_role' => _booking_studygroup_role_lookup($data->booking_studygroup_role),
'booking_committee' => $data->booking_committee_member == 'Y' ? 'Yes' : 'No',
//'booking_is_leader' => $data->booking_is_leader == 'Y' ? 'Yes' : 'No',
//'booking_is_helper' => $data->booking_is_helper == 'Y' ? 'Yes' : 'No',
//'booking_is_reserveleader' => $data->booking_is_reserveleader == 'Y' ? 'Yes' : 'No',
'#attributes' => array('id' => array($class))
);
*/
$rows[] = array (
'data' => array(
$session,