From 2cb87c286350ada6aac08b24822505619f878cf7 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Tue, 4 Feb 2014 09:13:31 +1100 Subject: [PATCH] re-arrange study group menus --- booking.module | 20 +++++++++++--------- booking.reports.inc | 4 ++-- booking.studygroups.inc | 25 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/booking.module b/booking.module index 86777c3..f903935 100644 --- a/booking.module +++ b/booking.module @@ -284,13 +284,21 @@ function booking_menu() { */ //configure study groups + $items['admin/config/booking/studygroups'] = array( + 'title' => 'View All Study Groups', + 'description' => 'View Study Group memberships', + 'page callback' => 'booking_studygroups_view_summary', + 'access arguments' => array("access administration pages"), + 'type' => MENU_NORMAL_ITEM, + ); + $items['admin/config/booking/studygroups/selectleaders'] = array( 'title' => 'Study Group Leaders', 'description' => 'Define attendees to lead or help study groups', 'page callback' => 'drupal_get_form', 'page arguments' => array('booking_available_leadhelp_select_form'), 'access arguments' => array('access administration pages'), - //'type' => MENU_NORMAL_ITEM, + 'type' => MENU_LOCAL_ACTION, ); $items['admin/config/booking/studygroups/calculate'] = array( @@ -299,16 +307,10 @@ function booking_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('booking_studygroups_calculate'), 'access arguments' => array('access administration pages'), - //'type' => MENU_NORMAL_ITEM, + 'type' => MENU_LOCAL_ACTION, ); - $items['admin/config/booking/studygroups/view'] = array( - 'title' => 'View All Study Groups', - 'description' => 'View Study Group memberships', - 'page callback' => 'booking_studygroups_view_summary', - 'access arguments' => array("access administration pages"), - //'type' => MENU_NORMAL_ITEM, - ); + $items['admin/config/booking/studygroups/%/view'] = array( 'title' => 'View Study Group', diff --git a/booking.reports.inc b/booking.reports.inc index 97d5fab..6bf57bc 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -39,7 +39,7 @@ function booking_report_summary() { $rows = array(); $state_header = array('State', 'Count'); $state_rows = array(); - $ecclesia_heaeder = array('State','Ecclesia', 'Count'); + $ecclesia_header = array('State','Ecclesia', 'Count'); $ecclesia_rows = array(); //do some analysis about the people booked in @@ -147,7 +147,7 @@ function booking_report_summary() { $output .= t("

Bookings by state

"); $output .= theme('table', array('header' => $state_header, 'rows' => $state_rows, 'attributes' => $stats_attributes)); $output .= t("

Bookings by ecclesia

"); - $output .= theme('table', array('header' => $ecclesia_heaeder, 'rows' => $ecclesia_rows, 'attributes' => $stats_attributes)); + $output .= theme('table', array('header' => $ecclesia_header, 'rows' => $ecclesia_rows, 'attributes' => $stats_attributes)); $output .= t("

Summary of attendees for !event.

", array('!event' => $event->booking_eventname)); $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'sort-table'))); diff --git a/booking.studygroups.inc b/booking.studygroups.inc index 8be7cac..b4431dc 100644 --- a/booking.studygroups.inc +++ b/booking.studygroups.inc @@ -558,6 +558,31 @@ function booking_studygroups_calculate() { */ function booking_studygroups_view_summary() { + global $event; + $output = ""; + $header = array('Link','Study Group', 'Session Count'); + $attributes = array('style' => 'max-width:30%'); + + //get study groups + $query = db_select('booking_studygroup_list', 's') + ->fields('s') + ->condition('s.booking_eventid', $event->eid, '='); + $result = $query->execute(); + + foreach ($result as $group) { + $rows[] = array( + l(t('!id', array('!id' => $group->sid)), t('admin/config/booking/studygroups/!id/view', array('!id' => $group->sid))), + $group->booking_studygroup_descrip, + $group->booking_num_group_sessions, + ); + } + + //output everything + $output .= t("

!event Study Groups

", array('!event' => $event->booking_eventname)); + $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $stats_attributes)); + + return $output; + } /**