You are here

function mobile_tools_roles_configuration_form in Mobile Tools 5

Same name and namespace in other branches
  1. 6.3 mobile_tools_roles.admin.inc \mobile_tools_roles_configuration_form()
  2. 6 mobile_tools_roles.inc \mobile_tools_roles_configuration_form()
  3. 6.2 modules/mobile_tools_roles/mobile_tools_roles.admin.inc \mobile_tools_roles_configuration_form()
  4. 7.2 mobile_tools_roles/mobile_tools_roles.module \mobile_tools_roles_configuration_form()
  5. 7.2 mobile_tools_roles/mobile_tools_roles.inc \mobile_tools_roles_configuration_form()

Configuration form for configuring the mobile context in the permission system

1 string reference to 'mobile_tools_roles_configuration_form'
mobile_tools_menu in ./mobile_tools.module
Implementation of hook_menu().

File

./mobile_tools.module, line 426
Mobile Tools provides a range of functionality assisting in creating a mobile drupal site . this functionality contains:

Code

function mobile_tools_roles_configuration_form() {
  global $base_url;
  $form['mobile_tools_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Mobile Tools settings'),
    '#collapsible' => TRUE,
    '#description' => t('The Mobile Tools module allows the creation of a mobile version of each role . these mobile versions of each role will be assigned to the mobile user. In the !url configuration panel, you can assign permissions to the mobile user.', array(
      '!url' => l('permissions', 'admin/user/access'),
    )),
  );
  $form['mobile_tools_settings']['mobile_tools_enable_roles'] = array(
    '#type' => 'checkbox',
    '#title' => t('Activate mobile user roles'),
    '#description' => t('When activated, mobile users will get the mobile versions of their normal roles when the site is being mobilized.'),
    '#default_value' => variable_get('mobile_tools_enable_roles', 0),
  );
  $form['mobile_tools_roles'] = array(
    '#type' => 'fieldset',
    '#title' => t('Mobile roles'),
    '#collapsible' => TRUE,
    '#description' => t('Enable or disable the mobile version of each user role. When no mobile role is created, the user will
    keep it\'s normal role . the settings can also be configured in the !roles configuration section', array(
      '!roles' => l('roles', 'admin/user/roles'),
    )),
    '#suffix' => mobile_tools_roles_overview(),
  );
  $result = db_query("SELECT * FROM {role}");
  while ($item = db_fetch_object($result)) {
    $role = mobile_tools_roles_info(array(
      'id' => $item->rid,
    ));
    if ($role->type == 'desktop') {
      $form['mobile_tools_roles']['mobile_tools_role_' . $item->rid] = array(
        '#type' => 'checkbox',
        '#title' => $item->name,
        '#default_value' => $role->has_sibling ? TRUE : FALSE,
        '#description' => t('Enabling will create the %role role . the name can be changed aferwards in the !roles settings page', array(
          '%role' => $role->name . ' (Mobile)',
          '!roles' => l('roles', 'admin/user/roles'),
        )),
      );
    }
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}