You are here

function mobile_tools_roles_settings_submit in Mobile Tools 6

Same name and namespace in other branches
  1. 7.2 mobile_tools_roles/mobile_tools_roles.module \mobile_tools_roles_settings_submit()
  2. 7.2 mobile_tools_roles/mobile_tools_roles.inc \mobile_tools_roles_settings_submit()

Submit function for the mobile tools / mobile roles configuration page

1 string reference to 'mobile_tools_roles_settings_submit'
mobile_tools_roles_configuration_form in ./mobile_tools_roles.inc
Configuration form for configuring the mobile context in the permission system

File

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

Code

function mobile_tools_roles_settings_submit($form) {
  $query = "SELECT * FROM {role}";
  $result = db_query($query);
  while ($item = db_fetch_object($result)) {
    $role = mobile_tools_roles_info(array(
      'id' => $item->rid,
    ));
    if ($role->type == 'desktop') {
      $choice = $form['#post']['mobile_tools_role_' . $item->rid]['#value'];
      if ($role->has_sibling == 1 && $choice == 0) {

        // DELETE
        mobile_tools_edit_mobile_role('delete', $role);
      }
      elseif ($role->has_sibling == 0 && $choice == 1) {
        mobile_tools_edit_mobile_role('add', $role);
      }
    }
  }
}