$form = new FormValidator('itemright', 'post', "m_item.php?id=" . $item['id'] . "&action=m_rights&subaction=edit"); $form->add_textfield('classn', get_lang('LangClass'), true, array('readonly' => 'readonly')); $form->addElement('checkbox', 'edit_right', get_lang('EditRight')); $form->addElement('checkbox', 'delete_right', get_lang('DeleteRight')); $form->addElement('checkbox', 'm_reservation', get_lang('MReservationRight')); $form->addElement('hidden', 'item_id', $item['id']); $form->addElement('hidden', 'class_id', $_GET['class_id']); $item_right['classn'] = $classDB[0]['name']; $item_right['edit_right'] = $item_rights[0]['edit_right']; $item_right['delete_right'] = $item_rights[0]['delete_right']; $item_right['m_reservation'] = $item_rights[0]['m_reservation']; $form->setDefaults($item_right); $form->addElement('submit', 'submit', get_lang('Ok')); if ($form->validate()) { $values = $form->exportValues(); Rsys::edit_item_right($values['item_id'], $values['class_id'], $values['edit_right'], $values['delete_right'], $values['m_reservation']); Display::display_normal_message(Rsys::get_return_msg(get_lang('ItemRightEdited'), "m_item.php?id=" . $_GET['id'] . "&action=m_rights", str_replace('#ITEM#', $item['name'], get_lang('MItemRights'))), false); } else { $form->display(); } break; case 'delete': Rsys::delete_item_right($_GET['item_id'], $_GET['class_id']); ob_start(); Display::display_normal_message(get_lang('ItemRightDeleted'), false); $msg = ob_get_contents(); ob_end_clean(); case 'switch': switch ($_GET['switch']) { case 'edit': Rsys::set_new_right($_GET['item_id'], $_GET['class_id'], 'edit_right', $_GET['set']);