tce_functions_omr.php

Functions to import test data from scanned OMR (Optical Mark Recognition) sheets.

Source: admin/code/tce_functions_omr.php

Functions to import test data from scanned OMR (Optical Mark Recognition) sheets.

Functions

F_decodeOMRPage()

Decode a single OMR Page and return data array.

This function requires ImageMagick library and zbarimg (http://zbar.sourceforge.net/).

function F_decodeOMRPage(mixed $image): array

Parameters:

  • $image (mixed): (string) image file to be decoded (scanned OMR page at 200 DPI with full color range).

Returns: array: of answers data or false in case of error.

Source: admin/code/tce_functions_omr.php:79

F_decodeOMRTestData()

Decode OMR test data string (read from QR-Code) as array.

function F_decodeOMRTestData(mixed $str): array

Parameters:

  • $str (mixed): (string) string to be decoded.

Returns: array: with test data (0 => test_id, n => array(0 => question_n_ID, 1 => array(answers_IDs)), or false in case of error.

Source: admin/code/tce_functions_omr.php:42

F_decodeOMRTestDataQRCode()

Read QR-Code from OMR page and return Test data.

This function uses the external application zbarimg (http://zbar.sourceforge.net/).

function F_decodeOMRTestDataQRCode(mixed $image): array

Parameters:

  • $image (mixed): (string) image file to be decoded (scanned OMR page).

Returns: array: with test data or false in case o error

Source: admin/code/tce_functions_omr.php:61

F_encodeOMRTestData()

Encode OMR test data array as a string to be printed on QR-Code.

function F_encodeOMRTestData(mixed $data): encoded

Parameters:

  • $data (mixed): (array) array to be encoded

Returns: encoded: string.

Source: admin/code/tce_functions_omr.php:29

F_importOMRTestData()

Import user’s test data from OMR.

function F_importOMRTestData(
    mixed $user_id,
    mixed $date,
    mixed $omr_testdata,
    mixed $omr_answers,
    mixed $overwrite = false
): bool

Parameters:

  • $user_id (mixed): (int) user ID.
  • $date (mixed): (string) date-time field.
  • $omr_testdata (mixed): (array) Array containing test data.
  • $omr_answers (mixed): (array) Array containing test answers (from OMR).
  • $overwrite (mixed): (boolean) If true overwrites the previous answers on non-repeatable tests.

Returns: bool: TRUE in case of success, FALSE otherwise.

Source: admin/code/tce_functions_omr.php:214