[Cdb-cvs] entry entry.module,1.1,1.2
Status: Pre-Alpha
Brought to you by:
kenrickturner
|
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 |