/**
 * This function displays the form for moving a post message to a different (already existing) or a new thread.
 * @return void HTML
 *
 * @author Patrick Cool <*****@*****.**>, Ghent University
 * @version february 2006, dokeos 1.8
 */
function move_post_form()
{
    // initiate the object
    $form = new FormValidator('movepost', 'post', api_get_self() . '?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&thread=' . intval($_GET['thread']) . '&post=' . intval($_GET['post']) . '&action=' . Security::remove_XSS($_GET['action']) . '&post=' . intval($_GET['post']));
    // The header for the form
    $form->addElement('header', '', get_lang('MovePost'));
    // Invisible form: the post_id
    $form->addElement('hidden', 'post_id', intval($_GET['post']));
    // Dropdown list: Threads of this forum
    $threads = get_threads($_GET['forum']);
    //my_print_r($threads);
    $threads_list[0] = get_lang('ANewThread');
    foreach ($threads as $key => $value) {
        $threads_list[$value['thread_id']] = $value['thread_title'];
    }
    $form->addElement('select', 'thread', get_lang('MoveToThread'), $threads_list);
    $form->applyFilter('thread', 'html_filter');
    // The OK button
    $form->addButtonSave(get_lang('MovePost'), 'submit');
    // Setting the rules
    $form->addRule('thread', get_lang('ThisFieldIsRequired'), 'required');
    // Validation or display
    if ($form->validate()) {
        $values = $form->exportValues();
        store_move_post($values);
    } else {
        $form->display();
    }
}
/**
 * This function displays the form for moving a post message to a different (already existing) or a new thread.
 * @return void HTML
 *
 * @author Patrick Cool <*****@*****.**>, Ghent University
 * @version february 2006, dokeos 1.8
 */
function move_post_form()
{
    global $origin;
    $gradebook = Security::remove_XSS($_GET['gradebook']);
    // initiate the object
    $form = new FormValidator('movepost', 'post', api_get_self() . '?forum=' . Security::remove_XSS($_GET['forum']) . '&thread=' . Security::remove_XSS($_GET['thread']) . '&origin=' . $origin . '&gradebook=' . $gradebook . '&post=' . Security::remove_XSS($_GET['post']) . '&action=' . Security::remove_XSS($_GET['action']) . '&post=' . Security::remove_XSS($_GET['post']));
    // The header for the form
    $form->addElement('header', '', get_lang('MovePost'));
    // Invisible form: the post_id
    $form->addElement('hidden', 'post_id', strval(intval($_GET['post'])));
    // Note: This has to be cleaned first.
    // Dropdown list: Threads of this forum
    $threads = get_threads(strval(intval($_GET['forum'])));
    // Note: This has to be cleaned.
    //my_print_r($threads);
    $threads_list[0] = get_lang('ANewThread');
    foreach ($threads as $key => $value) {
        $threads_list[$value['thread_id']] = $value['thread_title'];
    }
    $form->addElement('select', 'thread', get_lang('MoveToThread'), $threads_list);
    $form->applyFilter('thread', 'html_filter');
    // The OK button
    $form->addElement('style_submit_button', 'submit', get_lang('MovePost'), 'class="save"');
    // Setting the rules
    $form->addRule('thread', get_lang('ThisFieldIsRequired'), 'required');
    // Validation or display
    if ($form->validate()) {
        $values = $form->exportValues();
        store_move_post($values);
    } else {
        $form->display();
    }
}