html_project_manage_menu();
html_project_manage_tests_menu();
if (!user_has_rights($selected_project_id, $user_id, MANAGER)) {
    print "<div align=center>";
    error_report_display_msg(NO_RIGHTS_TO_VIEW_PAGE);
    print "</div>";
    exit;
}
error_report_check($_GET);
print "<div align=center>" . NEWLINE;
print "<form action='project_archive_tests_page.php' method=post>" . NEWLINE;
print "<br>" . NEWLINE;
print "<table class=hide80>" . NEWLINE;
print "<tr>" . NEWLINE;
print "<td>" . NEWLINE;
$row = admin_get_tests($selected_project_id, $page_number, $order_by, $order_dir);
print "<input type=hidden name='order_dir' value='{$order_dir}'>";
print "<input type=hidden name='order_by' value='{$order_by}'>";
print "</td>" . NEWLINE;
print "</tr>" . NEWLINE;
print "</table>" . NEWLINE;
########################################################################################
#
if (empty($row)) {
    print lang_get('no_archive_tests');
} else {
    //print"<form action='project_archive_tests_page.php' method=post>". NEWLINE;
    print "<input type=hidden name=project_id value={$selected_project_id}>";
    print "<table id='sortabletable' class='sortable' rules=cols>" . NEWLINE;
    print "<thead>" . NEWLINE;
    print "<tr>" . NEWLINE;
function project_archive_tests($project_id)
{
    global $db;
    $tbl_test = TEST_TBL;
    $f_name = $tbl_test . "." . TEST_NAME;
    $f_type = $tbl_test . "." . TEST_TESTTYPE;
    $f_priority = $tbl_test . "." . TEST_PRIORITY;
    $f_id = $tbl_test . "." . TEST_ID;
    $f_steps = $tbl_test . "." . TEST_MANUAL;
    $f_script = $tbl_test . "." . TEST_AUTOMATED;
    $f_status = $tbl_test . "." . TEST_STATUS;
    $f_area = $tbl_test . "." . TEST_AREA_TESTED;
    $f_deleted = $tbl_test . "." . TEST_DELETED;
    $f_archive = $tbl_test . "." . TEST_ARCHIVED;
    $f_area_tested = $tbl_test . "." . TEST_AREA_TESTED;
    $f_project_id = $tbl_test . "." . PROJECT_ID;
    foreach (admin_get_tests($project_id) as $row_test) {
        if (session_records_ischecked("archive_tests", $row_test[TEST_ID])) {
            $q = "\tUPDATE {$tbl_test}\n\t\t\t\t\tSET\n\t\t\t\t\t\t{$f_archive} = 'Y'\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t{$f_id} = " . $row_test[TEST_ID];
            db_query($db, $q);
        } else {
            $q = "\tUPDATE {$tbl_test}\n\t\t\t\t\tSET\n\t\t\t\t\t\t{$f_archive} = 'N'\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t{$f_id} = " . $row_test[TEST_ID];
            db_query($db, $q);
        }
    }
}