'../admin/index.php', 'name' => get_lang('PlatformAdmin')); /** * Filter to display the modify-buttons * * @param - int $id The ResourceType-id */ function modify_filter($id) { return ''.' '; } switch ($_GET['action']) { case 'add' : $interbreadcrumb[] = array ("url" => "m_category.php", "name" => $tool_name); Display :: display_header(get_lang('AddNewResourceType')); api_display_tool_title(get_lang('AddNewResourceType')); $form = new FormValidator('category', 'post', 'm_category.php?action=add'); $form->add_textfield('name', get_lang('ResourceTypeName'), true, array ('maxlength' => '128')); $form->addElement('style_submit_button', 'submit', get_lang('CreateResourceType'),'class="add"'); if ($form->validate()) { $values = $form->exportValues(); if (Rsys :: add_category($values['name'])) Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceTypeAdded'), "m_category.php", $tool_name),false); else Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceTypeExist'), "m_category.php?action=add", get_lang('AddNewResourceType')),false); } else $form->display(); break; case 'edit' : $interbreadcrumb[] = array ("url" => "m_category.php", "name" => $tool_name); Display :: display_header(get_lang('EditResourceType')); api_display_tool_title(get_lang('EditResourceType')); $form = new FormValidator('category', 'post', 'm_category.php?action=edit'); $form->add_textfield('name', get_lang('ResourceTypeName'), true, array ('maxlength' => '128')); $form->addElement('hidden', 'id', $_GET['id']); $form->addElement('style_submit_button', 'submit', get_lang('ModifyResourceType'),'class="save"'); $form->setDefaults(Rsys :: get_category($_GET['id'])); if ($form->validate()) { $values = $form->exportValues(); if (Rsys :: edit_category($values['id'], $values['name'])) Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceTypeEdited'), "m_category.php", $tool_name),false); else Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceTypeExist'), "m_category.php?action=edit&id=".$values['id'], get_lang('EditRight')),false); } else $form->display(); break; case 'delete' : $result = Rsys :: delete_category($_GET['id']); ob_start(); if ($result == 0) Display :: display_normal_message(get_lang('ResourceTypeDeleted'),false); else Display :: display_normal_message(str_replace('#NUM#', $result, get_lang('ResourceTypeHasItems')),false); $msg = ob_get_contents(); ob_end_clean(); default : $NoSearchResults = get_lang('NoCategories'); Display :: display_header($tool_name); api_display_tool_title($tool_name); echo $msg; echo '