function book_access_admin_form_submit in Book access 5
File
- ./
book_access.module, line 261 - Allows access control for Drupal book nodes.
Code
function book_access_admin_form_submit($form_id, $form_values) {
foreach ($form_values['access'] as $book_nid => $form) {
db_query("DELETE FROM {book_access} WHERE nid = %d", $book_nid);
foreach ($form['view'] as $rid => $checked) {
$gid = $rid;
$grant_view = (bool) $checked;
$grant_update = $form['update'][$rid] > 0 ? TRUE : FALSE;
$grant_delete = $form['delete'][$rid] > 0 ? TRUE : FALSE;
$sql = "INSERT INTO {book_access} (nid, rid, grant_view, grant_update, grant_delete)\n VALUES (%d, %d, %d, %d, %d)";
db_query($sql, $book_nid, $rid, $grant_view, $grant_update, $grant_delete);
}
}
node_access_rebuild();
}