Make it easier to see leaders and helpers in studygroup lists
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#leader-row {background: #6495ED;}
|
#leader-row {background: #6495ED;}
|
||||||
#helper-row {background: #6495ED;}
|
#helper-row {background: #9dd781;}
|
||||||
|
#reserveleader-row {background: #d4dc5c;}
|
||||||
#new-group-row {border-top: thick double #ff0000;}
|
#new-group-row {border-top: thick double #ff0000;}
|
||||||
#leader-new-group-row {background: #6495ED; 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;}
|
@@ -136,6 +136,21 @@ function _booking_get_waitinglist_top()
|
|||||||
watchdog('booking', "First person on the waiting list: @info", array('@info' => var_export($person, TRUE)));
|
watchdog('booking', "First person on the waiting list: @info", array('@info' => var_export($person, TRUE)));
|
||||||
return $person->nid;
|
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
|
//in case there was no one on the waiting list
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -380,7 +380,7 @@ function booking_menu() {
|
|||||||
'access arguments' => array('edit study groups'),
|
'access arguments' => array('edit study groups'),
|
||||||
//'type' => MENU_LOCAL_ACTION,
|
//'type' => MENU_LOCAL_ACTION,
|
||||||
);
|
);
|
||||||
|
/*
|
||||||
$items['admin/booking/studygroups/calculate'] = array(
|
$items['admin/booking/studygroups/calculate'] = array(
|
||||||
'title' => 'Calculate Study Groups',
|
'title' => 'Calculate Study Groups',
|
||||||
'description' => 'Calculate Study Group memberships',
|
'description' => 'Calculate Study Group memberships',
|
||||||
@@ -389,7 +389,7 @@ function booking_menu() {
|
|||||||
'access arguments' => array('edit study groups'),
|
'access arguments' => array('edit study groups'),
|
||||||
'type' => MENU_LOCAL_ACTION,
|
'type' => MENU_LOCAL_ACTION,
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
$items['admin/booking/studygroups/%/update'] = array(
|
$items['admin/booking/studygroups/%/update'] = array(
|
||||||
'title' => 'Update Study Groups',
|
'title' => 'Update Study Groups',
|
||||||
'description' => 'Calculate updated Study Group memberships',
|
'description' => 'Calculate updated Study Group memberships',
|
||||||
@@ -758,7 +758,7 @@ function booking_generate_luckynumbers() {
|
|||||||
$attendees = $attendee_query->fetchAll();
|
$attendees = $attendee_query->fetchAll();
|
||||||
|
|
||||||
//assuming there's less than 900 people, generate numbers within that range and shuffle the order
|
//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);
|
shuffle($numbers);
|
||||||
|
|
||||||
foreach ($attendees as $attendee)
|
foreach ($attendees as $attendee)
|
||||||
|
@@ -51,6 +51,12 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id)
|
|||||||
$group_options = array();
|
$group_options = array();
|
||||||
$session_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
|
//verify that $group_id is a number
|
||||||
if (! preg_match('/^[0-9]+$/', $group_id)) {
|
if (! preg_match('/^[0-9]+$/', $group_id)) {
|
||||||
@@ -70,6 +76,10 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$form['#attached']['css'] = array(
|
||||||
|
drupal_get_path('module', 'booking') . '/booking.css',
|
||||||
|
);
|
||||||
|
|
||||||
$prefix = t("<h2>Study Group ‐ !descrip</h2><p>Allocate a leader/helper session for attendees.</p>",
|
$prefix = t("<h2>Study Group ‐ !descrip</h2><p>Allocate a leader/helper session for attendees.</p>",
|
||||||
array('!descrip' => $studygroup->booking_studygroup_descrip));
|
array('!descrip' => $studygroup->booking_studygroup_descrip));
|
||||||
|
|
||||||
@@ -129,6 +139,7 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id)
|
|||||||
$role_listing = "";
|
$role_listing = "";
|
||||||
$assigned_role = 0;
|
$assigned_role = 0;
|
||||||
$session_id = 0;
|
$session_id = 0;
|
||||||
|
$class = $class_array[0];
|
||||||
|
|
||||||
//work out what this person is currently leading/helping
|
//work out what this person is currently leading/helping
|
||||||
foreach ($group_mapping as $group)
|
foreach ($group_mapping as $group)
|
||||||
@@ -152,6 +163,7 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id)
|
|||||||
{
|
{
|
||||||
$text = _booking_studygroup_role_lookup($role);
|
$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];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -187,6 +199,7 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id)
|
|||||||
),
|
),
|
||||||
'booking_currently_leadhelp' => $role_listing,
|
'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",
|
0 => "normal-row",
|
||||||
1 => "leader-row",
|
1 => "leader-row",
|
||||||
2 => "helper-row",
|
2 => "helper-row",
|
||||||
3 => "helper-row",
|
3 => "reserveleader-row",
|
||||||
);
|
);
|
||||||
|
|
||||||
//attach the custom css
|
//attach the custom css
|
||||||
@@ -1695,47 +1708,27 @@ function booking_studygroups_view_form($node, &$form_state, $group_id) {
|
|||||||
//only add the lines separating groups if we're sorting by the session id
|
//only add the lines separating groups if we're sorting by the session id
|
||||||
if ($sort['sql'] == "m.booking_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
|
//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 ($last_session <> $data->booking_session_id)
|
||||||
{
|
{
|
||||||
if ($data->booking_studygroup_role == 1)
|
switch ($data->booking_studygroup_role) {
|
||||||
{
|
case 1:
|
||||||
$class = "leader-new-group-row";
|
$class = "leader-new-group-row";
|
||||||
}
|
break;
|
||||||
elseif ($data->booking_studygroup_role == 2 || $data->booking_studygroup_role == 3)
|
case 2:
|
||||||
{
|
$class = "helper-new-group-row";
|
||||||
$class = "helper-new-group-row";
|
break;
|
||||||
}
|
case 3:
|
||||||
else
|
$class = "reserveleader-new-group-row";
|
||||||
{
|
break;
|
||||||
$class = "new-group-row";
|
default:
|
||||||
}
|
$class = "new-group-row";
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} //end class calculation
|
||||||
|
|
||||||
$session = $is_reading_group == TRUE ? _booking_readinggroup_colour_lookup($data->booking_session_id) : $data->booking_session_id;
|
$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 (
|
$rows[] = array (
|
||||||
'data' => array(
|
'data' => array(
|
||||||
|
Reference in New Issue
Block a user