function mobile_tools_edit_mobile_role in Mobile Tools 5
Same name and namespace in other branches
- 6 mobile_tools_roles.inc \mobile_tools_edit_mobile_role()
- 7.2 mobile_tools_roles/mobile_tools_roles.module \mobile_tools_edit_mobile_role()
- 7.2 mobile_tools_roles/mobile_tools_roles.inc \mobile_tools_edit_mobile_role()
Function helping in saving and deleting the mobile roles
Parameters
$op: the operation that has to be performed: 'delete' will delete the mobile role, 'add' will add the mobile role.
$role: the $role object of the normal role (the already existing non-mobile role)
2 calls to mobile_tools_edit_mobile_role()
- mobile_tools_roles_configuration_form_submit in ./
mobile_tools.module - Implementation of hook_submit().
- mobile_tools_roles_configuration_submit in ./
mobile_tools.module - Implementation of hook_submit()
File
- ./
mobile_tools.module, line 963 - Mobile Tools provides a range of functionality assisting in creating a mobile drupal site . this functionality contains:
Code
function mobile_tools_edit_mobile_role($op, $role) {
switch ($op) {
case 'delete':
db_query('DELETE FROM {role} WHERE rid = %d', $role->sibling['id']);
db_query('DELETE FROM {mobile_tools_roles_relations} WHERE mrid = %d', $role->sibling['id']);
break;
case 'add':
$result = db_query("INSERT INTO {role} (name) VALUES ('%s')", $role->name . ' (Mobile)');
db_query("INSERT INTO {mobile_tools_roles_relations} (rid, mrid) VALUES (%d, %d)", $role->id, db_last_insert_id('role', 'rid'));
break;
}
}