You are here

function mobile_tools_roles_configuration_submit in Mobile Tools 6

Same name and namespace in other branches
  1. 5 mobile_tools.module \mobile_tools_roles_configuration_submit()
  2. 7.2 mobile_tools_roles/mobile_tools_roles.module \mobile_tools_roles_configuration_submit()
  3. 7.2 mobile_tools_roles/mobile_tools_roles.inc \mobile_tools_roles_configuration_submit()

Submit handler for the roles configuration form. It organises the mobile context for each user role.

1 string reference to 'mobile_tools_roles_configuration_submit'
mobile_tools_form_alter in ./mobile_tools.module
Alteration to global setting form

File

./mobile_tools_roles.inc, line 235
Contains the functionality to add mobile user roles

Code

function mobile_tools_roles_configuration_submit($form) {
  $role = mobile_tools_roles_info(array(
    'id' => $form['rid']['#value'],
  ));
  switch ($form['#post']['op']) {
    case 'Save role':
      if ($role->has_sibling == 1 && $form['#post']['mobile_tools_configure_role_' . $form['rid']['#value']] == FALSE && $role->type == 'desktop') {
        mobile_tools_edit_mobile_role('delete', $role);
      }
      elseif ($role->has_sibbling == FALSE && $form['#post']['mobile_tools_configure_role_' . $form['rid']['#value']] == TRUE && $role->type == 'desktop') {
        mobile_tools_edit_mobile_role('add', $role);
      }
      break;
    case 'Delete role':
      if ($role->type == 'mobile') {
        $role = mobile_tools_roles_info(array(
          'id' => $role->sibling['id'],
        ));
      }
      mobile_tools_edit_mobile_role('delete', $role);
  }
}