You are here

function uc_recurring_admin_edit_form in UC Recurring Payments and Subscriptions 6

Same name and namespace in other branches
  1. 6.2 uc_recurring.admin.inc \uc_recurring_admin_edit_form()
  2. 7.2 uc_recurring.admin.inc \uc_recurring_admin_edit_form()
1 string reference to 'uc_recurring_admin_edit_form'
uc_recurring_menu in ./uc_recurring.module
Implementation of hook_menu().

File

./uc_recurring.admin.inc, line 142
Recurring payments administration menu items.

Code

function uc_recurring_admin_edit_form() {
  drupal_add_css(drupal_get_path('module', 'uc_recurring') . '/uc_recurring.css');
  $fee = uc_recurring_fee_load('user', arg(4));
  list($fee['regular_interval_value'], $fee['regular_interval_unit']) = explode(' ', $fee['regular_interval']);
  $form['fee_amount'] = array(
    '#type' => 'textfield',
    '#title' => t('Recurring fee amount'),
    '#description' => t('Charge this amount each billing period.'),
    '#default_value' => $fee['fee_amount'],
    '#size' => 16,
    '#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'),
    '#field_suffix' => variable_get('uc_sign_after_amount', FALSE) ? variable_get('uc_currency_sign', '$') : '',
  );
  $form['remaining_intervals'] = array(
    '#type' => 'textfield',
    '#title' => t('Remaining billing periods'),
    '#description' => t('Specify how many more times to charge the fee.'),
    '#size' => 16,
    '#default_value' => $fee['remaining_intervals'],
  );
  $form['regular'] = array(
    '#type' => 'fieldset',
    '#title' => t('Regular interval'),
    '#collapsible' => FALSE,
    '#description' => t('Modify the length of the billing period for this fee. Changing this value will reset the timer for the next charge. You can also charge the fee manually to collect payment ahead of time and reset the interval.'),
    '#attributes' => array(
      'class' => 'interval-fieldset',
    ),
  );
  $form['regular']['regular_interval_value'] = array(
    '#type' => 'select',
    '#options' => drupal_map_assoc(uc_range(1, 52)),
    '#default_value' => $fee['regular_interval_value'],
  );
  $form['regular']['regular_interval_unit'] = array(
    '#type' => 'select',
    '#options' => array(
      'days' => t('day(s)'),
      'weeks' => t('week(s)'),
      'months' => t('month(s)'),
      'years' => t('year(s)'),
    ),
    '#default_value' => $fee['regular_interval_unit'],
  );
  $form['reset_next_charge'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reset the next charge timer upon form submission using the specified interval.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#suffix' => l(t('Cancel'), uc_referer_uri()),
  );
  return $form;
}