function uc_recurring_admin in Ubercart 5
1 string reference to 'uc_recurring_admin'
- uc_recurring_menu in payment/
uc_recurring/ uc_recurring.module - Implementation of hook_menu().
File
- payment/
uc_recurring/ uc_recurring.module, line 627 - Allows you to add a recurring fee to a product/SKU to handle subscription type services.
Code
function uc_recurring_admin() {
$output = drupal_get_form('uc_recurring_admin_filter_form');
$header = array(
array(
'data' => t('ID'),
'field' => 'ru.rfid',
'sort' => 'desc',
),
array(
'data' => t('Order'),
'field' => 'ru.order_id',
),
array(
'data' => t('Amount'),
'field' => 'ru.fee_amount',
),
array(
'data' => t('Next'),
'field' => 'ru.next_charge',
),
array(
'data' => t('Interval'),
'field' => 'ru.regular_interval',
),
array(
'data' => t('Left'),
'field' => 'ru.remaining_intervals',
),
array(
'data' => t('Total'),
),
array(
'data' => t('Operations'),
),
);
if (arg(4) == 'view' && intval(arg(6)) > 0) {
if (arg(5) == 'fee') {
$result = db_query("SELECT * FROM {uc_recurring_users} AS ru WHERE ru.rfid = %d", arg(6));
}
elseif (arg(5) == 'order') {
$result = db_query("SELECT * FROM {uc_recurring_users} AS ru WHERE ru.order_id = %d", arg(6));
}
}
else {
$result = pager_query("SELECT * FROM {uc_recurring_users} AS ru" . tablesort_sql($header), 30);
}
while ($fee = db_fetch_array($result)) {
$ops = array();
// Get the $ops from the module implementing the handler.
$callback = $fee['fee_handler'] . '_recurring_fee_ops';
if (function_exists($callback)) {
$ops = $callback('fee_admin', $fee);
}
$rows[] = array(
l($fee['rfid'], 'admin/store/orders/recurring/view/fee/' . $fee['rfid']),
l($fee['order_id'], 'admin/store/orders/' . $fee['order_id']),
uc_currency_format($fee['fee_amount']),
$fee['remaining_intervals'] == 0 ? '-' : format_date($fee['next_charge'], 'small'),
array(
'data' => check_plain($fee['regular_interval']),
'nowrap' => 'nowrap',
),
$fee['remaining_intervals'],
$fee['remaining_intervals'] + $fee['charged_intervals'],
array(
'data' => implode(' ', $ops),
'nowrap' => 'nowrap',
),
);
}
$output .= theme('table', $header, $rows);
$output .= theme('pager', NULL, 30, 0);
if (arg(4) == 'view') {
$output .= l(t('Back to the full list.'), 'admin/store/orders/recurring');
}
return $output;
}