Ejemplo n.º 1
0
if (isset($_GET['action']) && $_GET['action'] == 'addcategory') {
    add_category_form($_GET['action']);
    display_add_category();
} else {
    if (isset($_GET['action']) && $_GET['action'] == 'editcategory') {
        edit_category_form($_GET['action']);
    } else {
        if (isset($_GET['action']) && $_GET['action'] == 'deletecategory') {
            delete_category_form($_GET['action']);
            display_add_category();
        } else {
            display_add_category();
        }
    }
}
echo $category->displayCategories($courseId, $sessionId);
Display::display_footer();
/**
 * Form to edit a category
 * @todo move to TestCategory.class.php
 * @param string $action
 */
function edit_category_form($action)
{
    $action = Security::remove_XSS($action);
    if (isset($_GET['category_id']) && is_numeric($_GET['category_id'])) {
        $category_id = Security::remove_XSS($_GET['category_id']);
        $objcat = new TestCategory($category_id);
        $form = new FormValidator('note', 'post', api_get_self() . '?action=' . $action . '&category_id=' . $category_id);
        // Setting the form elements
        $form->addElement('header', get_lang('EditCategory'));