tce_functions_test.php

tce_functions_test.php source file reference

Package: com\tecnick\tcexam\shared

Tags

  • file: Functions to handle test generation, status and user access.
  • author: Nicola Asuni
  • since: 2004-05-28

Functions

F_getUserTests()

File: tce_functions_test.php line 28

F_getUserTests() : string

Return values

string —

containing an XHTML table of user’s tests.

F_repeatTest()

File: tce_functions_test.php line 243

F_repeatTest(mixed $test_id) : mixed

Parameters

  • $test_id : mixed: (int) Test ID

F_isValidIP()

File: tce_functions_test.php line 287

F_isValidIP(mixed $user_ip, mixed $test_ips) : bool

Parameters

  • $user_ip : mixed: (string) user’s IP address (IPv4 or IPv6).
  • $test_ips : mixed: (string) comma separated list of valid test IP addresses. The ‘*’ character may be used to indicate any number in IPv4 addresses. Intervals must be specified using the ‘-’ character.

Return values

bool —

true if IP is valid, false otherwise

F_isValidSSLCert()

File: tce_functions_test.php line 368

F_isValidSSLCert(mixed $test_id) : true

Parameters

  • $test_id : mixed: (int) Test ID

Return values

true —

if the client certifiate is valid, false otherwise

F_isValidTestUser()

File: tce_functions_test.php line 401

F_isValidTestUser(mixed $test_id, mixed $user_ip, mixed $test_ip) : true

Parameters

  • $test_id : mixed: (int) ID of the selected test
  • $user_ip : mixed: (int) user’s IP address.
  • $test_ip : mixed: (int) test IP valid addresses. Various IP addresses may be separated using comma character. The asterisk character may be used to indicate “any number”.

Return values

true —

if is user is authorized, false otherwise

F_terminateUserTest()

File: tce_functions_test.php line 435

F_terminateUserTest(mixed $test_id) : mixed

Parameters

  • $test_id : mixed: (int) test ID

Tags

  • since: 4.0.000 (2006-09-27)

F_countUserTest()

File: tce_functions_test.php line 464

F_countUserTest(mixed $user_id, mixed $test_id) : retried

Parameters

  • $user_id : mixed: (int) user ID
  • $test_id : mixed: (int) test ID

Return values

retried —

times

F_checkTestStatus()

File: tce_functions_test.php line 479

F_checkTestStatus(mixed $user_id, mixed $test_id, mixed $duration) : array<string|int, mixed>

Parameters

  • $user_id : mixed: (int) user ID
  • $test_id : mixed: (int) test ID
  • $duration : mixed: (int) test duration in seconds

Return values

array<string|int, mixed> —

of (test_status_code, testuser_id). test_status_code:

  • 0 = the test generation process is started but not completed;
  • 1 = the test has been successfully created;
  • 2 = all questions have been displayed to the user;
  • 3 = all questions have been answered;
  • 4 = test locked (for timeout);
  • 5 or more = old version of repeated test;

File: tce_functions_test.php line 596

F_testInfoLink(mixed $test_id[, mixed $link_name = '' ]) : mixed

Parameters

  • $test_id : mixed: (int) test ID
  • $link_name : mixed = ‘’: (string) link caption return XHTML code

F_printTestInfo()

File: tce_functions_test.php line 630

F_printTestInfo(mixed $test_id[, mixed $showip = false ]) : string

Parameters

  • $test_id : mixed: (int) test ID
  • $showip : mixed = false: (boolean) if true display enabled users’ IP range

Return values

string —

containing an XHTML code

F_getTestData()

File: tce_functions_test.php line 709

F_getTestData(mixed $test_id) : array<string|int, mixed>

Parameters

  • $test_id : mixed: (int) test ID.

Return values

array<string|int, mixed> —

containing test data.

F_getUserData()

File: tce_functions_test.php line 733

F_getUserData(mixed $user_id) : array<string|int, mixed>

Parameters

  • $user_id : mixed: (int) User ID.

Return values

array<string|int, mixed> —

containing test data.

F_getTestPassword()

File: tce_functions_test.php line 757

F_getTestPassword(mixed $test_id) : string

Parameters

  • $test_id : mixed: (int) test ID.

Return values

string —

test password or empty string in case of error.

F_getTestName()

File: tce_functions_test.php line 769

F_getTestName(mixed $test_id) : string

Parameters

  • $test_id : mixed: (int) test ID.

Return values

string —

test name or empty string in case of error.

F_getTestDuration()

File: tce_functions_test.php line 781

F_getTestDuration(mixed $test_id) : int

Parameters

  • $test_id : mixed: (int) test ID

Return values

int —

test duration time in seconds

F_getTestStartTime()

File: tce_functions_test.php line 794

F_getTestStartTime(mixed $testuser_id) : int

Parameters

  • $testuser_id : mixed: (int) user’s test ID

Return values

int —

start time in seconds

F_twoColRow()

File: tce_functions_test.php line 826

F_twoColRow([mixed $label = '' ][, mixed $description = '' ][, mixed $value = '' ]) : string

Parameters

  • $label : mixed = ‘’: (string) string to display on the left column
  • $description : mixed = ‘’: (string) string to display on the title attribute of the left column field
  • $value : mixed = ‘’: (string) string to display on the right column

Return values

string —

XHTML code

F_executeTest()

File: tce_functions_test.php line 847

F_executeTest(mixed $test_id) : true

Parameters

  • $test_id : mixed: (int) test ID.

Return values

true —

if user is authorized, false otherwise.

F_isRightTestlogUser()

File: tce_functions_test.php line 927

F_isRightTestlogUser(mixed $test_id, mixed $testlog_id) : bool

Parameters

  • $test_id : mixed: (int) test ID
  • $testlog_id : mixed: (int) test log ID

Return values

bool —

TRUE in case of success, FALSE otherwise

F_selectAnswers()

File: tce_functions_test.php line 964

F_selectAnswers(mixed $question_id[, mixed $isright = '' ][, mixed $ordering = false ][, mixed $limit = 0 ][, mixed $startindex = 0 ][, mixed $randorder = true ][, mixed $ordmode = 0 ]) : array<string|int, mixed>

Parameters

  • $question_id : mixed: (int) Question ID.
  • $isright : mixed = ‘’: (int) Value (0 = false, 1 = true), if non-empty checks for answer_isright value on WHERE clause.
  • $ordering : mixed = false: (int) Ordering type question (0 = false, 1 = true).
  • $limit : mixed = 0: (int) Maximum number of IDs to return.
  • $startindex : mixed = 0: (int) Array starting index (default = 0).
  • $randorder : mixed = true: (boolean) If true user random order.
  • $ordmode : mixed = 0: (int) Ordering mode: 0=position; 1=alphabetical; 2=ID.

Return values

array<string|int, mixed> —

id of selected answers

F_addLogAnswers()

File: tce_functions_test.php line 1055

F_addLogAnswers(mixed $testlog_id, mixed $answers_ids) : bool

Parameters

  • $testlog_id : mixed: (int) testlog ID
  • $answers_ids : mixed: (array) array of answer IDs to add

Return values

bool —

true in case of success, false otherwise

F_getFirstTestUser()

File: tce_functions_test.php line 1087

F_getFirstTestUser(mixed $test_id) : int

Parameters

  • $test_id : mixed: (int) test ID

Return values

int —

testuser ID

F_newTestLog()

File: tce_functions_test.php line 1119

F_newTestLog(mixed $testuser_id, mixed $question_id, mixed $score, mixed $order[, mixed $num_answers = 0 ]) : int

Parameters

  • $testuser_id : mixed: (int) ID of tce_tests_users
  • $question_id : mixed: (int) question ID
  • $score : mixed: (int) score for unanswered questions
  • $order : mixed: (int) question display order
  • $num_answers : mixed = 0: (int) number of alternative answers

Return values

int —

testlog ID

F_isTestOverLimits()

File: tce_functions_test.php line 1171

F_isTestOverLimits() : bool

Return values

bool —

true/false.

F_count_executed_tests()

File: tce_functions_test.php line 1225

F_count_executed_tests(mixed $startdate, mixed $enddate) : int

Parameters

  • $startdate : mixed: (string) Star date-time interval.
  • $enddate : mixed: (string) End date-time interval.

Return values

int —

number of executed tests.

F_updateTestuserStat()

File: tce_functions_test.php line 1249

F_updateTestuserStat(mixed $date) : mixed

Parameters

  • $date : mixed: (string) date-time when the test was generated.

F_createTest()

File: tce_functions_test.php line 1265

F_createTest(mixed $test_id, mixed $user_id) : bool

Parameters

  • $test_id : mixed: (int) test ID.
  • $user_id : mixed: (int) user ID.

Return values

bool —

TRUE in case of success, FALSE otherwise.

F_addQuestionAnswers()

File: tce_functions_test.php line 1623

F_addQuestionAnswers(mixed $testlog_id, mixed $question_id, mixed $question_type, mixed $num_answers, mixed $firsttest, mixed $testdata) : bool

Parameters

  • $testlog_id : mixed: (int) testlog ID.
  • $question_id : mixed: (int) question ID.
  • $question_type : mixed: (int) type of question.
  • $num_answers : mixed: (int) number of alternative answers to display.
  • $firsttest : mixed: (int) ID of first test testuser_id.
  • $testdata : mixed: (array) array of test data.

Return values

bool —

TRUE in case of success, FALSE otherwise.

F_updateQuestionLog()

File: tce_functions_test.php line 1741

F_updateQuestionLog(mixed $test_id, mixed $testlog_id[, mixed $answpos = [] ][, mixed $answer_text = '' ][, mixed $reaction_time = 0 ]) : bool

Parameters

  • $test_id : mixed: (int) test ID
  • $testlog_id : mixed: (int) test log ID
  • $answpos : mixed = []: (array) Array of answer positions
  • $answer_text : mixed = ‘’: (string) answer text
  • $reaction_time : mixed = 0: (int) reaction time in milliseconds

Return values

bool —

TRUE in case of success, FALSE otherwise

F_getAnswerIdFromPosition()

File: tce_functions_test.php line 2012

F_getAnswerIdFromPosition(mixed $testlog_id, mixed $answpos) : int

Parameters

  • $testlog_id : mixed: (int) Test Log ID
  • $answpos : mixed: (array) Answer positions (order in wich they are displayed)

Return values

int —

answer ID

F_questionForm()

File: tce_functions_test.php line 2051

F_questionForm(mixed $test_id, mixed $testlog_id, mixed $formname) : string

Parameters

  • $test_id : mixed: (int) test ID
  • $testlog_id : mixed: (int) test log ID
  • $formname : mixed: (string) form name (form ID)

Return values

string —

XHTML code

F_questionsMenu()

File: tce_functions_test.php line 2501

F_questionsMenu(mixed $testdata, mixed $testuser_id[, mixed $testlog_id = 0 ][, mixed $disable = false ]) : string

Parameters

  • $testdata : mixed: (array) test data
  • $testuser_id : mixed: (int) user’s test ID
  • $testlog_id : mixed = 0: (int) test log ID
  • $disable : mixed = false: (boolean) if TRUE disable the questions list.

Return values

string —

XHTML code

F_getNumOmittedQuestions()

File: tce_functions_test.php line 2693

F_getNumOmittedQuestions(mixed $test_id) : int

Parameters

  • $test_id : mixed: (int) test ID

Return values

int —

number

F_testComment()

File: tce_functions_test.php line 2717

F_testComment(mixed $test_id) : string

Parameters

  • $test_id : mixed: (int) test ID

Tags

  • since: 4.0.000 (2006-10-01)

Return values

string —

XHTML code

F_updateTestComment()

File: tce_functions_test.php line 2772

F_updateTestComment(mixed $test_id, mixed $testcomment) : string

Parameters

  • $test_id : mixed: (int) test ID
  • $testcomment : mixed: (string) user comment.

Tags

  • since: 4.0.000 (2006-10-01)

Return values

string —

XHTML code

F_testLoginForm()

File: tce_functions_test.php line 2814

F_testLoginForm(mixed $faction, mixed $fid, mixed $fmethod, mixed $fenctype, mixed $test_id) : XHTML

Parameters

  • $faction : mixed
  • $fid : mixed
  • $fmethod : mixed
  • $fenctype : mixed
  • $test_id : mixed

Return values

XHTML —

string for login form

F_getTestGroups()

File: tce_functions_test.php line 2872

F_getTestGroups(mixed $test_id) : string

Parameters

  • $test_id : mixed: (int) ID of the selected test

Return values

string —

containing a comma separated list fo group IDs.

F_getTestSSLCerts()

File: tce_functions_test.php line 2901

F_getTestSSLCerts(mixed $test_id) : string

Parameters

  • $test_id : mixed: (int) ID of the selected test

Return values

string —

containing a comma separated list SSL certificates IDs.