You are here

function sms_valid_admin_rulesets_form in SMS Framework 7

Same name and namespace in other branches
  1. 6.2 modules/sms_valid/sms_valid.admin.inc \sms_valid_admin_rulesets_form()
  2. 6 modules/sms_valid/sms_valid.admin.inc \sms_valid_admin_rulesets_form()

Form constructor for validation rulesets list form.

1 string reference to 'sms_valid_admin_rulesets_form'
sms_valid_menu in modules/sms_valid/sms_valid.module
Implements hook_menu().

File

modules/sms_valid/sms_valid.admin.inc, line 165
SMS Framework core module: Admin settings form functions.

Code

function sms_valid_admin_rulesets_form($form, &$form_state) {
  $rulesets = sms_valid_get_all_rulesets();
  $form['note'] = array(
    '#type' => 'item',
    '#value' => t('A ruleset is a number prefix with a set of deeper number prefixes, each with an allow/deny directive. For example, a ruleset prefix "64" and a rule like "21+" would allow a number like "64-21-123-4567". You can choose to have one big ruleset or you can split them into manageable rulesets by country, category, or whatever you decide.'),
  );
  foreach ($rulesets as $r) {
    $prefix = $r->prefix;
    $qty_rules = count($r->rules);
    $rule_edit = ' (' . l(t('edit'), "admin/smsframework/validation/ruleset/{$prefix}") . ')';
    $form[$prefix]['prefix'] = array(
      '#type' => 'textfield',
      '#size' => 5,
      '#maxlength' => 5,
      '#disabled' => TRUE,
      '#value' => $r->prefix,
    );
    $form[$prefix]['name'] = array(
      '#markup' => $r->name,
    );
    $form[$prefix]['iso2'] = array(
      '#markup' => $r->iso2,
    );
    $form[$prefix]['qty_rules'] = array(
      '#markup' => $qty_rules . $rule_edit,
    );
    $form[$prefix][$prefix . '_out'] = array(
      '#type' => 'checkbox',
      '#title' => 'Outbound',
      '#default_value' => sms_valid_ruleset_is_enabled($prefix, SMS_DIR_OUT),
    );
    $form[$prefix][$prefix . '_in'] = array(
      '#type' => 'checkbox',
      '#title' => 'Inbound',
      '#default_value' => sms_valid_ruleset_is_enabled($prefix, SMS_DIR_IN),
    );
    $form[$prefix][$prefix . '_delete'] = array(
      '#type' => 'checkbox',
      '#title' => 'Delete',
      '#default_value' => FALSE,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save Changes'),
  );
  return $form;
}