report.php (mrbs-1.9.4) | : | report.php (mrbs-1.10.0) | ||
---|---|---|---|---|
skipping to change at line 543 | skipping to change at line 543 | |||
{ | { | |||
return $string; | return $string; | |||
} | } | |||
} | } | |||
// Output the first row (header row) for CSV reports | // Output the first row (header row) for CSV reports | |||
function report_header() | function report_header() | |||
{ | { | |||
global $output_format, $is_ajax; | global $output_format, $is_ajax; | |||
global $custom_fields; | global $custom_fields; | |||
global $approval_somewhere, $confirmation_somewhere; | global $approval_somewhere, $confirmation_somewhere, $registration_somewhere; | |||
global $field_order_list, $booking_types; | global $field_order_list, $booking_types; | |||
// Don't do anything if this is an Ajax request: we only want to send the data | // Don't do anything if this is an Ajax request: we only want to send the data | |||
if ($is_ajax) | if ($is_ajax) | |||
{ | { | |||
return; | return; | |||
} | } | |||
// Build an array of values to go into the header row | // Build an array of values to go into the header row | |||
$values = array(); | $values = array(); | |||
skipping to change at line 585 | skipping to change at line 585 | |||
break; | break; | |||
case 'description': | case 'description': | |||
$values[] = get_vocab("fulldescription_short"); | $values[] = get_vocab("fulldescription_short"); | |||
break; | break; | |||
case 'type': | case 'type': | |||
if (isset($booking_types) && (count($booking_types) > 1)) | if (isset($booking_types) && (count($booking_types) > 1)) | |||
{ | { | |||
$values[] = get_vocab("type"); | $values[] = get_vocab("type"); | |||
} | } | |||
break; | break; | |||
case 'allow_registration': | ||||
if ($registration_somewhere) | ||||
{ | ||||
$values[] = get_vocab("registered"); | ||||
} | ||||
break; | ||||
case 'create_by': | case 'create_by': | |||
$values[] = get_vocab("createdby"); | $values[] = get_vocab("createdby"); | |||
break; | break; | |||
case 'confirmation_enabled': | case 'confirmation_enabled': | |||
if ($confirmation_somewhere) | if ($confirmation_somewhere) | |||
{ | { | |||
$values[] = get_vocab("confirmation_status"); | $values[] = get_vocab("confirmation_status"); | |||
} | } | |||
break; | break; | |||
case 'approval_enabled': | case 'approval_enabled': | |||
skipping to change at line 788 | skipping to change at line 794 | |||
{ | { | |||
output_row($row, $format, FALSE); | output_row($row, $format, FALSE); | |||
} | } | |||
echo ($format == OUTPUT_HTML) ? "</tfoot>\n" : ""; | echo ($format == OUTPUT_HTML) ? "</tfoot>\n" : ""; | |||
} | } | |||
function report_row(&$rows, $data) | function report_row(&$rows, $data) | |||
{ | { | |||
global $output_format, $is_ajax, $ajax_capable; | global $output_format, $is_ajax, $ajax_capable; | |||
global $custom_fields, $field_natures, $field_lengths; | global $custom_fields, $field_natures, $field_lengths; | |||
global $approval_somewhere, $confirmation_somewhere; | global $approval_somewhere, $confirmation_somewhere, $registration_somewhere; | |||
global $select_options, $booking_types; | global $select_options, $booking_types; | |||
global $field_order_list; | global $field_order_list; | |||
// If we're capable of delivering an Ajax request and this is not Ajax request , | // If we're capable of delivering an Ajax request and this is not Ajax request , | |||
// then don't do anything. We're going to save sending the data until we actu ally | // then don't do anything. We're going to save sending the data until we actu ally | |||
// get the Ajax request; we just send the rest of the page at this stage. | // get the Ajax request; we just send the rest of the page at this stage. | |||
if (($output_format == OUTPUT_HTML) && $ajax_capable && !$is_ajax) | if (($output_format == OUTPUT_HTML) && $ajax_capable && !$is_ajax) | |||
{ | { | |||
return; | return; | |||
} | } | |||
skipping to change at line 862 | skipping to change at line 868 | |||
$value = ($data['awaiting_approval']) ? get_vocab('awaiting_approval') : get_vocab('approved'); | $value = ($data['awaiting_approval']) ? get_vocab('awaiting_approval') : get_vocab('approved'); | |||
} | } | |||
else | else | |||
{ | { | |||
$value = ''; | $value = ''; | |||
} | } | |||
break; | break; | |||
case 'last_updated': | case 'last_updated': | |||
$value = time_date_string($value); | $value = time_date_string($value); | |||
break; | break; | |||
case 'allow_registration': | ||||
if ($data['allow_registration']) | ||||
{ | ||||
$value = implode(', ', auth()->getRegistrantsDisplayNames($data)); | ||||
} | ||||
else | ||||
{ | ||||
$value = get_vocab('na'); | ||||
} | ||||
break; | ||||
default: | default: | |||
// Custom fields | // Custom fields | |||
if (array_key_exists($field, $custom_fields)) | if (array_key_exists($field, $custom_fields)) | |||
{ | { | |||
// Output a yes/no if it's a boolean or integer <= 2 bytes (which we w ill | // Output a yes/no if it's a boolean or integer <= 2 bytes (which we w ill | |||
// assume are intended to be booleans) | // assume are intended to be booleans) | |||
if (($field_natures[$field] == 'boolean') || | if (($field_natures[$field] == 'boolean') || | |||
(($field_natures[$field] == 'integer') && isset($field_lengths[$fi eld]) && ($field_lengths[$field] <= 2)) ) | (($field_natures[$field] == 'integer') && isset($field_lengths[$fi eld]) && ($field_lengths[$field] <= 2)) ) | |||
{ | { | |||
$value = empty($value) ? get_vocab("no") : get_vocab("yes"); | $value = empty($value) ? get_vocab("no") : get_vocab("yes"); | |||
skipping to change at line 1351 | skipping to change at line 1367 | |||
$ajax_capable = $datatable; | $ajax_capable = $datatable; | |||
if ($is_ajax) | if ($is_ajax) | |||
{ | { | |||
$json_data['aaData'] = array(); | $json_data['aaData'] = array(); | |||
} | } | |||
$private_somewhere = some_area('private_enabled') || some_area('private_mandator y'); | $private_somewhere = some_area('private_enabled') || some_area('private_mandator y'); | |||
$approval_somewhere = some_area('approval_enabled'); | $approval_somewhere = some_area('approval_enabled'); | |||
$confirmation_somewhere = some_area('confirmation_enabled'); | $confirmation_somewhere = some_area('confirmation_enabled'); | |||
$registration_somewhere = registration_somewhere(); | ||||
$times_somewhere = (db()->query1("SELECT COUNT(*) FROM " . _tbl('area') . " WHER E enable_periods=0") > 0); | $times_somewhere = (db()->query1("SELECT COUNT(*) FROM " . _tbl('area') . " WHER E enable_periods=0") > 0); | |||
$periods_somewhere = (db()->query1("SELECT COUNT(*) FROM " . _tbl('area') . " WH ERE enable_periods!=0") > 0); | $periods_somewhere = (db()->query1("SELECT COUNT(*) FROM " . _tbl('area') . " WH ERE enable_periods!=0") > 0); | |||
// Build the report search field order | // Build the report search field order | |||
$report_presentation_fields = array('output', 'output_format', 'sortby', 'sumby' ); | $report_presentation_fields = array('output', 'output_format', 'sortby', 'sumby' ); | |||
foreach ($report_presentation_fields as $field) | foreach ($report_presentation_fields as $field) | |||
{ | { | |||
if (!in_array($field, $report_presentation_field_order)) | if (!in_array($field, $report_presentation_field_order)) | |||
{ | { | |||
skipping to change at line 1421 | skipping to change at line 1438 | |||
$$var = trim($$var); | $$var = trim($$var); | |||
if ($$var !== '') | if ($$var !== '') | |||
{ | { | |||
$$var = intval($$var); | $$var = intval($$var); | |||
} | } | |||
} | } | |||
} | } | |||
// Set the field order list | // Set the field order list | |||
$field_order_list = array('name', 'area_name', 'room_name', 'start_time', 'end_t ime', | $field_order_list = array('name', 'area_name', 'room_name', 'start_time', 'end_t ime', | |||
'description', 'type', 'create_by', 'confirmation_enab led', | 'description', 'type', 'allow_registration', 'create_b y', 'confirmation_enabled', | |||
'approval_enabled'); | 'approval_enabled'); | |||
foreach ($custom_fields as $key => $value) | foreach ($custom_fields as $key => $value) | |||
{ | { | |||
$field_order_list[] = $key; | $field_order_list[] = $key; | |||
} | } | |||
$field_order_list[] = 'last_updated'; | $field_order_list[] = 'last_updated'; | |||
// PHASE 2: SQL QUERY. We do the SQL query now to see if there's anything ther e | // PHASE 2: SQL QUERY. We do the SQL query now to see if there's anything ther e | |||
if ($phase == 2) | if ($phase == 2) | |||
{ | { | |||
End of changes. 6 change blocks. | ||||
3 lines changed or deleted | 20 lines changed or added |