Browse Source

added biblio display so they can see it when they submit their patron info

9.x-1.0
Paul Pound 8 years ago
parent
commit
788be96295
  1. 3
      includes/form.inc
  2. 1
      includes/relais.inc
  3. 35
      includes/utilities.inc

3
includes/form.inc

@ -93,7 +93,8 @@ function upei_roblib_ill_form_submit($form, &$form_state) {
* An array representing the bibliographic form. * An array representing the bibliographic form.
*/ */
function upei_roblib_ill_auth_form($form, &$form_state) { function upei_roblib_ill_auth_form($form, &$form_state) {
$_REQUEST; module_load_include('inc', 'upei_roblib_ill', 'includes/utilities');
$form['#prefix'] = upei_roblib_format_biblio_info($form_state);
$form['FirstName'] = array( $form['FirstName'] = array(
'#type' => 'textfield', '#type' => 'textfield',

1
includes/relais.inc

@ -18,7 +18,6 @@ function upei_roblib_ill_add_request($form_state, $aid) {
"SupplyingLibrarySymbol" => 'PCU', "SupplyingLibrarySymbol" => 'PCU',
); );
$relais_arr['BibliographicInfo'] = upei_roblib_ill_clean_array($form_state['storage']['upei_roblib_ill_request_form']); $relais_arr['BibliographicInfo'] = upei_roblib_ill_clean_array($form_state['storage']['upei_roblib_ill_request_form']);
//$relais_arr['BibliographicInfo']
$relais_arr['DeliveryAddress'] = upei_roblib_ill_clean_array($form_state['storage']['upei_roblib_ill_auth_form']); $relais_arr['DeliveryAddress'] = upei_roblib_ill_clean_array($form_state['storage']['upei_roblib_ill_auth_form']);
$request_info = upei_roblib_ill_request_info_array($relais_arr['BibliographicInfo'], $form_state['values']['notes']); $request_info = upei_roblib_ill_request_info_array($relais_arr['BibliographicInfo'], $form_state['values']['notes']);
$relais_arr['RequestInfo'] = $request_info; $relais_arr['RequestInfo'] = $request_info;

35
includes/utilities.inc

@ -21,6 +21,14 @@ function upei_roblib_ill_clean_array($values) {
if (isset($arr['ISBN'])) { if (isset($arr['ISBN'])) {
$arr['ISBN'] = array($arr['ISBN']); $arr['ISBN'] = array($arr['ISBN']);
} }
//in some cases values need to moved to other fields or eliminated do that here
if(isset($arr['PagesRequested']) || isset($arr['ImageOrPageNumber'])) {
$arr['PagesRequested'] = $arr['ImageOrPageNumber'] . ' to ' . $arr['PagesRequested'];
unset($arr['ImageOrPageNumber']);
}
if(isset($arr['Genre']) && $arr['Genre'] == 'article' && isset($arr['Author'])) {
unset($arr['Author']);
}
unset($arr['form_build_id']); unset($arr['form_build_id']);
unset($arr['form_token']); unset($arr['form_token']);
unset($arr['form_id']); unset($arr['form_id']);
@ -29,12 +37,13 @@ function upei_roblib_ill_clean_array($values) {
unset($arr['next']); unset($arr['next']);
unset($arr['certify']); unset($arr['certify']);
unset($arr['doi']); unset($arr['doi']);
unset($arr['doi_button']);
return $arr; return $arr;
} }
/** /**
* Allows us to ask for _REQUEST variables that may or may not exist without generating a php warning. * Allows us to ask for _REQUEST variables that may or may not exist without generating a php warning.
* Also does some formating for certain variables. * Also does some formatting for certain variables.
* @param string $variable * @param string $variable
* The name of the $_REQUEST variable to check * The name of the $_REQUEST variable to check
* @return string * @return string
@ -74,3 +83,27 @@ function upei_roblib_ill_request_info_array($values, $notes) {
} }
return $requestInfo; return $requestInfo;
} }
/**
* Creates a summary Table based on the biblio information in the form_state array for display
* @param $form_state
* @return string
*/
function upei_roblib_format_biblio_info($form_state) {
$data = upei_roblib_ill_clean_array($form_state['storage']['upei_roblib_ill_request_form']);
$rows = array();
foreach($data as $key => $value) {
if($key == 'ISSN' || $key == 'ISBN') {
$value = reset($value);
}
array_push($rows, array($key, $value));
}
$output = array(
'#theme' => 'table',
'#rows' => $rows,
'#prefix' => '<div class=upei-roblib-ill-biblio-info>',
'#suffix' => '</div>',
);
$html_output = drupal_render($output);
return $html_output;
}

Loading…
Cancel
Save