Example #1
0
                                    file_put_contents($logfile, 'OK' . "\t" . $answerfile . "\t" . 'SUCCESSFULLY DECODED' . "\n", FILE_APPEND);
                                } else {
                                    F_print_error('ERROR', '[OMR ANSWER SHEET ' . $answerfile . '] ' . $l['m_omr_wrong_answer_sheet']);
                                    file_put_contents($logfile, 'ERROR' . "\t" . $answerfile . "\t" . 'UNABLE TO DECODE' . "\n", FILE_APPEND);
                                }
                            } else {
                                F_print_error('ERROR', '[OMR ANSWER SHEET ' . $answerfile . '] ' . $l['m_omr_wrong_answer_sheet']);
                                file_put_contents($logfile, 'ERROR' . "\t" . $answerfile . "\t" . 'MISSING IMAGE FILE' . "\n", FILE_APPEND);
                            }
                        }
                        // sort answers
                        ksort($omr_answers);
                        // get user ID from user registration code
                        $user_id = F_getUIDfromRegnum($matches[1]);
                        // import answers
                        if ($user_id > 0 and F_isAuthorizedEditorForUser($user_id) and F_importOMRTestData($user_id, $date, $omr_testdata, $omr_answers, $overwrite)) {
                            F_print_error('MESSAGE', '[' . $matches[1] . '] ' . $l['m_import_ok'] . ': <a href="tce_show_result_user.php?testuser_id=32&test_id=' . $omr_testdata[0] . '&user_id=' . $user_id . '" title="' . $l['t_result_user'] . '" style="text-decoration:underline;color:#0000ff;">' . $l['w_results'] . '</a>');
                            file_put_contents($logfile, 'OK' . "\t" . $matches[1] . "\t" . 'SUCCESSFULLY IMPORTED - UID: ' . $user_id . "\n", FILE_APPEND);
                        } else {
                            F_print_error('ERROR', '[' . $matches[1] . '] ' . $l['m_import_error']);
                            file_put_contents($logfile, 'ERROR' . "\t" . $matches[1] . "\t" . 'UNABLE TO IMPORT - UID: ' . $user_id . "\n", FILE_APPEND);
                        }
                    }
                }
                // if QR file
            }
        }
        // print a link to log file
        F_print_error('MESSAGE', 'LOGFILE: <a href="tce_filemanager.php?d=' . urlencode(K_PATH_CACHE . 'OMR/') . '&f=' . urlencode($logfile) . '&v=1" title="' . $l['w_select'] . '">' . $logfilename . '</a>');
    }
}
Example #2
0
        for ($i = 1; $i <= $num_pages; ++$i) {
            if ($_FILES['omrfile']['error'][$i] == 0) {
                $answers_page = F_decodeOMRPage($_FILES['omrfile']['tmp_name'][$i]);
                if ($answers_page !== false and !empty($answers_page)) {
                    $omr_answers += $answers_page;
                } else {
                    F_print_error('ERROR', '[OMR ANSWER SHEET ' . $i . '] ' . $l['m_omr_wrong_answer_sheet']);
                }
            } else {
                F_print_error('ERROR', '[OMR ANSWER SHEET ' . $i . '] ' . $l['m_omr_wrong_answer_sheet']);
            }
        }
        // sort answers
        ksort($omr_answers);
        // import answers
        if (F_importOMRTestData($user_id, $date, $omr_testdata, $omr_answers, $overwrite)) {
            F_print_error('MESSAGE', $l['m_import_ok'] . ': <a href="tce_show_result_user.php?testuser_id=32&test_id=' . $omr_testdata[0] . '&user_id=' . $user_id . '" title="' . $l['t_result_user'] . '" style="text-decoration:underline;color:#0000ff;">' . $l['w_results'] . '</a>');
        } else {
            F_print_error('ERROR', $l['m_import_error']);
        }
    }
    // remove uploaded files
    for ($i = 0; $i <= $max_omr_sheets; ++$i) {
        if ($_FILES['omrfile']['error'][$i] == 0) {
            @unlink($_FILES['omrfile']['tmp_name'][$i]);
        }
    }
}
// -----------------------------------------------------------------------------
echo '<div class="container">' . K_NEWLINE;
echo '<div class="tceformbox">' . K_NEWLINE;