Skip to content

Instantly share code, notes, and snippets.

@kumarmanish
Created April 23, 2012 13:55
Show Gist options
  • Save kumarmanish/2471051 to your computer and use it in GitHub Desktop.
Save kumarmanish/2471051 to your computer and use it in GitHub Desktop.
doc_retrieval.php
<?php
$service_guid = $this->services[0]->guid;
$service_items = sundoc_get_service_items_by_service_id($service_guid);
$jurisdiction_prices = sundoc_get_fees_by_service_id_and_state('36a0e6b1-afd8-4fe6-88ee-a007010bb5af', 'AL');
$groups = array();
foreach($service_items as $item) {
$matches = array();
preg_match('/^(.+)-/', $item->description, $matches);
$group_label = $matches[1];
if (!array_key_exists($group_label, $groups)) {
$groups[$group_label] = array();
$groups[$group_label]['group_key'] = strtolower(trim(com_create_guid(), '{}'));
$groups[$group_label]['data']['service_name'] = $item->description;
$groups[$group_label]['data']['guid'] = $item->guid;
$groups[$group_label]['data']['service_id'] = $item->service_id;
$groups[$group_label]['data']['price'] = $item->price;
}
}
$form['items'] = array(
'#type' => 'container',
'#tree' => TRUE,
//'#theme' => 'sundoc_doc_retrieval_selection',
);
$form['items']['service_item_type'] = array(
'#type' => 'radios',
'#options' => array(
'standard' => t('Standard'),
'rush' => t('Rush'),
),
);
$form['items']['groups'] = array(
'#type' => 'container',
'#tree' => TRUE,
);
$qty_options = array(1,2,3,4,5,6,7,8,9,10);
foreach($groups as $group_key => $group_data) {
$form['items']['groups'][$group_key] = array(
'#type' => 'container',
'#tree' => TRUE,
);
$form['items']['groups'][$group_key]['quantity'] = array(
'#type' => 'select',
'#options' => $qty_options,
'#default_value' => (isset($form_state['values']['items']['groups'][$group_key]['quantity'])) ? $form_state['values']['items']['groups'][$group_key]['quantity'] : 1,
);
$form['items']['groups'][$group_key]['service_name'] = array(
'#type' => 'markup',
'#markup' => $group_data['data']['service_name'],
);
$form['items']['groups'][$group_key]['price'] = array(
'#type' => 'markup',
'#markup' => $group_data['data']['price'],
);
$form['items']['groups'][$group_key]['sundoc_standard_guid'] = array(
'#type' => 'value',
'#value' => $group_data['sundoc_standard_guid'],
);
$form['items']['groups'][$group_key]['sundoc_rush_guid'] = array(
'#type' => 'value',
'#value' => $group_data['sundoc_rush_guid'],
);
$form['items']['groups'][$group_key]['state_fee'] = array(
'#type' => 'radios',
'#options' => array(
'standard' => t('Standard'),
'rush' => t('Rush'),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment