You are here

function mobile_tools_roles_configuration_form_submit in Mobile Tools 6.2

Same name and namespace in other branches
  1. 5 mobile_tools.module \mobile_tools_roles_configuration_form_submit()
  2. 6.3 mobile_tools_roles.admin.inc \mobile_tools_roles_configuration_form_submit()

Submit function for the mobile_tools_roles_configuration_form().

1 string reference to 'mobile_tools_roles_configuration_form_submit'
mobile_tools_roles_configuration_form in modules/mobile_tools_roles/mobile_tools_roles.admin.inc
Configuration form for creating mobile user roles.

File

modules/mobile_tools_roles/mobile_tools_roles.admin.inc, line 75
Generate configuration form and save settings.

Code

function mobile_tools_roles_configuration_form_submit($form, &$form_state) {

  // Check if the mobile roles fieldset is available
  if (isset($form_state['values']['mobile_tools_roles'])) {

    // Process each of the roles found in the mobile roles fieldset tree
    foreach ($form_state['values']['mobile_tools_roles'] as $rid => $value) {

      // Get information about the current role ID
      $mobile_role = mobile_tools_roles_get_mobile_role($rid);

      // If a role's checkbox was checked add a mobile version of the role, otherwise
      // delete any mobile versions of the role
      if (!empty($mobile_role) && $value == 0) {
        _mobile_tools_roles_edit_mobile_role('delete', $rid, $mobile_role['mrid']);
      }
      elseif (empty($mobile_role) && $value == 1) {
        _mobile_tools_roles_edit_mobile_role('add', $rid);
      }
    }
  }
}