Ejemplo n.º 1
0
                $("#example").html("' . addslashes(Display::return_icon('userfield_data.png')) . '");
                break;
        }
    });
});
</script>';
// The header.
Display::display_header($tool_name);
// Action handling: Add
switch ($action) {
    case 'add':
        if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
            api_not_allowed();
        }
        $url = api_get_self() . '?type=' . $obj->type . '&action=' . Security::remove_XSS($_GET['action']);
        $form = $obj->return_form($url, 'add');
        // The validation or display
        if ($form->validate()) {
            //if ($check) {
            $values = $form->exportValues();
            $res = $obj->save($values);
            if ($res) {
                Display::display_confirmation_message(get_lang('ItemAdded'));
            }
            //}
            $obj->display();
        } else {
            echo '<div class="actions">';
            echo '<a href="' . api_get_self() . '?type=' . $obj->type . '">' . Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM) . '</a>';
            echo '</div>';
            $form->addElement('hidden', 'sec_token');