cdb-cvs Mailing List for crewDB
Status: Pre-Alpha
Brought to you by:
kenrickturner
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: Kenrick <ken...@us...> - 2006-02-09 00:32:32
|
Update of /cvsroot/cdb/entry In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14472 Modified Files: entry.module Log Message: Changed default sorting in admin table to by club, not id Index: entry.module =================================================================== RCS file: /cvsroot/cdb/entry/entry.module,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** entry.module 9 Feb 2006 00:20:12 -0000 1.3 --- entry.module 9 Feb 2006 00:32:20 -0000 1.4 *************** *** 109,114 **** // Build table header $header = array( ! array('data' => t('ID'), 'field' => 'id', 'sort' => 'asc'), ! array('data' => t('Club'), 'field' => 'name'), array('data' => t('M/W'), 'field' => 'mw'), array('data' => t('Boat'), 'field' => 'category'), --- 109,114 ---- // Build table header $header = array( ! array('data' => t('ID'), 'field' => 'id'), ! array('data' => t('Club'), 'field' => 'name', sort => 'asc'), array('data' => t('M/W'), 'field' => 'mw'), array('data' => t('Boat'), 'field' => 'category'), |
|
From: Kenrick <ken...@us...> - 2006-02-09 00:20:20
|
Update of /cvsroot/cdb/entry In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9593 Modified Files: entry.module Log Message: Added starting order editing features Index: entry.module =================================================================== RCS file: /cvsroot/cdb/entry/entry.module,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** entry.module 8 Feb 2006 23:29:10 -0000 1.2 --- entry.module 9 Feb 2006 00:20:12 -0000 1.3 *************** *** 114,117 **** --- 114,118 ---- array('data' => t('Boat'), 'field' => 'category'), array('data' => t('Event'), 'field' => 'friendly_name'), + array('data' => t('Start'), 'field' => 'start_position'), array('data' => t('Deadline'), 'field' => 'entries_close'), array('data' => t('Paid'), 'field' => 'paid'), *************** *** 135,139 **** $entry->category, $entry->friendly_name, ! gmdate('H:i d-M-y', $entry->entries_close), $entry->paid); $row[] = l(t('view'), 'crews/' . $entry->id); --- 136,141 ---- $entry->category, $entry->friendly_name, ! $entry->start_position, ! gmdate('H:i d-m-y', $entry->entries_close), $entry->paid); $row[] = l(t('view'), 'crews/' . $entry->id); *************** *** 236,239 **** --- 238,242 ---- if (user_access('administer entry')) { $form .= form_checkbox(t('Paid?'), 'paid', 'Y', FALSE, 'Tick *only* if money has been received.', NULL, FALSE); + $form .= form_textfield(t('Starting Position'), 'start_position', '', 4, 3, 'e.g. 42', NULL, FALSE); } *************** *** 404,407 **** --- 407,412 ---- } $form .= form_checkbox(t('Paid?'), 'paid', 'Y', $check, 'Tick *only* if money has been received.', NULL, FALSE); + + $form .= form_textfield(t('Starting Position'), 'start_position', $entry->start_position, 4, 3, 'e.g. 42', NULL, FALSE); } *************** *** 463,468 **** function display_crew($id) { $entry = get_nice_entry($id); $output = ''; ! $output .= '<h1>'.$entry->name.' '.$entry->mw.$entry->category.' for the '.$entry->friendly_name.'</h1>'; $output .= '<h2>Crew</h2>'; $output .= '<p><strong>Bow:</strong> '.$entry->bow.'</p>'; --- 468,480 ---- function display_crew($id) { $entry = get_nice_entry($id); + + if ($entry->mw == 'M') { + $gen = 'Men\'s VIII'; + } else { + $gen = 'Women\'s VIII'; + } + $output = ''; ! $output .= '<h1>'.$entry->name.' '.ordinalize($entry->category).' '.$gen.' for the '.$entry->friendly_name.'</h1>'; $output .= '<h2>Crew</h2>'; $output .= '<p><strong>Bow:</strong> '.$entry->bow.'</p>'; *************** *** 477,487 **** $output .= '<h2>Details</h2>'; ! $output .= '<p><strong>Starting Position:</strong> '.$entry->start_position.'</p>'; ! $output .= '<p><strong>Finishing Position:</strong> '.$entry->finish_position.'</p>'; return $output; } ! function _show_crew($id) { if (!user_access('view crew')) { return message_access(); --- 489,500 ---- $output .= '<h2>Details</h2>'; ! $output .= '<p><strong>Crew ID:</strong> '. $id .'</p>'; ! $output .= '<p><strong>Starting Position:</strong> '.bumps_position($entry->start_position,$entry->mw).'</p>'; ! $output .= '<p><strong>Finishing Position:</strong> '.bumps_position($entry->finish_position,$entry->mw).'</p>'; return $output; } ! function _show_crew() { if (!user_access('view crew')) { return message_access(); *************** *** 496,498 **** --- 509,555 ---- print theme('page', $output); } + + // Ordinalizes a given number + function ordinalize($num) { + + if (!is_numeric($num)) { + return $num; + } + + if ($num >= 11 and $num <= 19) + return $num."th"; + elseif ( $num % 10 == 1 ) + return $num."st"; + elseif ( $num % 10 == 2 ) + return $num."nd"; + elseif ( $num % 10 == 3 ) + return $num."rd"; + else + return $num."th"; + } + + // Retuns a string describing the bumps position of a crew. + function bumps_position($num,$mw) { + if (empty($num) OR empty($mw)) { + return; + } + // First work out which division it is in + $div = $num / 17; + $div = ceil($div); + + // Work out where in the division it is + $pos_num = $num % 17; + $pos_div = ordinalize($pos_num).' in '; + $pos_overall = ordinalize($num).' overall'; + + if ($num == 1) { + $pos_overall = 'Head of the River'; + } + if ($pos_num == 1) { + $pos_div = 'Head of '; + } + + $output = $pos_div.$mw.$div.' ('.$pos_overall.')'; + return $output; + } ?> \ No newline at end of file |
|
From: Kenrick <ken...@us...> - 2006-02-08 23:29:20
|
Update of /cvsroot/cdb/entry In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17305 Modified Files: entry.module Log Message: Added 'view crew' functionality Index: entry.module =================================================================== RCS file: /cvsroot/cdb/entry/entry.module,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** entry.module 30 Jan 2006 23:23:16 -0000 1.1 --- entry.module 8 Feb 2006 23:29:10 -0000 1.2 *************** *** 34,37 **** --- 34,42 ---- 'access' => user_access('add entry'), 'type' => MENU_CALLBACK); + $items[] = array('path' => 'crews', + 'title' => t('crew details'), + 'callback' => '_show_crew', + 'access' => user_access('view crew'), + 'type' => MENU_CALLBACK); return $items; } *************** *** 65,69 **** */ function entry_perm() { ! return array('access entry', 'add entry', 'administer entry'); } --- 70,74 ---- */ function entry_perm() { ! return array('access entry', 'add entry', 'administer entry', 'view crew'); } *************** *** 111,115 **** array('data' => t('Deadline'), 'field' => 'entries_close'), array('data' => t('Paid'), 'field' => 'paid'), ! array('data' => t('Operations'), 'colspan' => 2)); // Decide whether to show just user's club crews or all crews, based on whether admin or not... --- 116,120 ---- array('data' => t('Deadline'), 'field' => 'entries_close'), array('data' => t('Paid'), 'field' => 'paid'), ! array('data' => t('Operations'), 'colspan' => 3)); // Decide whether to show just user's club crews or all crews, based on whether admin or not... *************** *** 132,135 **** --- 137,141 ---- gmdate('H:i d-M-y', $entry->entries_close), $entry->paid); + $row[] = l(t('view'), 'crews/' . $entry->id); if ((time() < $entry->entries_close) OR (user_access('administer entry'))) { $row[] = l(t('edit'), 'entry/edit/' . $entry->id); *************** *** 250,253 **** --- 256,260 ---- + function _withdraw_crew() { if (!user_access('add entry')) { *************** *** 449,453 **** --- 456,498 ---- } + function get_nice_entry($id) { + return db_fetch_object(db_query('SELECT bumps_crews.id, clubs.name, mw, category, notes, boat_name, friendly_name, start_position, finish_position, bow, two, three, four, five, six, seven, stroke, cox FROM bumps_crews INNER JOIN clubs ON bumps_crews.club_id = clubs.id INNER JOIN events ON bumps_crews.event_id = events.id WHERE bumps_crews.id = %d', $id)); + } + // Returns HTML-ised crew list + function display_crew($id) { + $entry = get_nice_entry($id); + $output = ''; + $output .= '<h1>'.$entry->name.' '.$entry->mw.$entry->category.' for the '.$entry->friendly_name.'</h1>'; + $output .= '<h2>Crew</h2>'; + $output .= '<p><strong>Bow:</strong> '.$entry->bow.'</p>'; + $output .= '<p><strong>Two:</strong> '.$entry->two.'</p>'; + $output .= '<p><strong>Three:</strong> '.$entry->three.'</p>'; + $output .= '<p><strong>Four:</strong> '.$entry->four.'</p>'; + $output .= '<p><strong>Five:</strong> '.$entry->five.'</p>'; + $output .= '<p><strong>Six:</strong> '.$entry->six.'</p>'; + $output .= '<p><strong>Seven:</strong> '.$entry->seven.'</p>'; + $output .= '<p><strong>Stroke:</strong> '.$entry->stroke.'</p>'; + $output .= '<p><strong>Cox:</strong> '.$entry->cox.'</p>'; + + $output .= '<h2>Details</h2>'; + $output .= '<p><strong>Starting Position:</strong> '.$entry->start_position.'</p>'; + $output .= '<p><strong>Finishing Position:</strong> '.$entry->finish_position.'</p>'; + + return $output; + } + function _show_crew($id) { + if (!user_access('view crew')) { + return message_access(); + } + $id = arg(1); + // check to see if id is empty + if (empty($id)) { + drupal_set_message('No crew id provided', 'error'); + drupal_goto(''); + } + $output = display_crew($id); + print theme('page', $output); + } ?> \ No newline at end of file |