Procedural File: tce_functions_test.php
Source Location: /shared/code/tce_functions_test.php
Page Details:
Functions to handle test generation, status and user access.
Tags:
F_addLogAnswers [line 610]
boolean F_addLogAnswers(
int $testlog_id, array $answers_ids)
|
|
Add specified answers on tce_tests_logs_answer table.
Tags:
Parameters
int |
$testlog_id |
testlog ID |
array |
$answers_ids |
array of answer IDs to add |
F_addQuestionAnswers [line 920]
boolean F_addQuestionAnswers(
int $testlog_id, int $question_id, int $question_type, $num_answers, int $firsttest, array $testdata, int $tsubset_answers)
|
|
Add answers to selected question.
Tags:
Parameters
int |
$testlog_id |
testlog ID. |
int |
$question_id |
question ID. |
int |
$question_type |
type of question. |
int |
$tsubset_answers |
number of alternative answers to display. |
int |
$firsttest |
ID of first test testuser_id. |
array |
$testdata |
array of test data. |
|
$num_answers |
|
F_checkTestStatus [line 225]
test F_checkTestStatus(
int $user_id, int $test_id, int $duration)
|
|
Check and returns specific test status for the specified user.
Tags:
Parameters
int |
$user_id |
user ID |
int |
$test_id |
test ID |
int |
$duration |
test duration in seconds |
F_createTest [line 707]
boolean F_createTest(
int $test_id, int $user_id)
|
|
Create user's test and returns TRUE on success.
Tags:
Parameters
int |
$test_id |
test ID. |
int |
$user_id |
user ID. |
F_executeTest [line 480]
true F_executeTest(
int $test_id)
|
|
Returns true if the current user is authorized to execute the selected test. Generates the test if it's not already generated.
Tags:
Parameters
F_getFirstTestUser [line 641]
int F_getFirstTestUser(
int $test_id)
|
|
Returns the ID of the tce_tests_users table corresponding to a complete test of $test_id type.
Tags:
Parameters
F_getTestData [line 384]
array F_getTestData(
int $test_id)
|
|
Returns the test data.
Tags:
Parameters
F_getTestDuration [line 417]
int F_getTestDuration(
int $test_id)
|
|
Returns the test duration time in seconds.
Tags:
Parameters
F_getTestName [line 406]
string F_getTestName(
int $test_id)
|
|
Returns the test name.
Tags:
Parameters
F_getTestStartTime [line 429]
int F_getTestStartTime(
int $testuser_id)
|
|
Returns the user's test start time in seconds since UNIX epoch (1970-01-01 00:00:00).
Tags:
Parameters
int |
$testuser_id |
user's test ID |
F_getUserTests [line 57]
Returns an XHTML unordered list of user's enabled tests.
Tags:
F_isRightTestlogUser [line 529]
boolean F_isRightTestlogUser(
int $test_id, int $testlog_id)
|
|
Checks if the current user is the right testlog_id owner. This function is used for security reasons.
Tags:
Parameters
int |
$test_id |
test ID |
int |
$testlog_id |
test log ID |
F_isValidIP [line 129]
true F_isValidIP(
int $user_ip, int $test_ip)
|
|
Check if user's IP is valid over test IP range
Tags:
Parameters
int |
$user_ip |
user's IP address. |
int |
$test_ip |
test IP valid addresses. Various IP addresses may be separated using comma character. The asterisk character may be used to indicate "any number". |
F_isValidTestUser [line 180]
true F_isValidTestUser(
int $test_id, int $user_ip, int $test_ip)
|
|
Check if user is authorized to execute the specified test
Tags:
Parameters
int |
$test_id |
ID of the selected test |
int |
$user_ip |
user's IP address. |
int |
$test_ip |
test IP valid addresses. Various IP addresses may be separated using comma character. The asterisk character may be used to indicate "any number". |
F_newTestLog [line 670]
int F_newTestLog(
int $testuser_id, int $question_id, int $score, int $order, [ $num_answers = 0])
|
|
Creates a new tce_tests_logs table entry and returns inserted ID.
Tags:
Parameters
int |
$testuser_id |
ID of tce_tests_users |
int |
$question_id |
question ID |
int |
$score |
score for unanswered questions |
int |
$order |
question display order |
|
$num_answers |
|
F_printTestInfo [line 336]
string F_printTestInfo(
int $test_id, [boolean $showip = false])
|
|
Returns an XHTML string containing specified test information.
Tags:
Parameters
int |
$test_id |
test ID |
boolean |
$showip |
if true display enabled users' IP range |
F_questionForm [line 1204]
string F_questionForm(
int $test_id, int $testlog_id, string $formname)
|
|
Returns a formatted XHTML form code to handle the specified question. Form fields names are: answer_text, answer_id CSS classes: - div.tcecontentbox
- div.rowl
- textarea.answertext
Tags:
Parameters
int |
$test_id |
test ID |
int |
$testlog_id |
test log ID |
string |
$formname |
form name (form ID) |
F_questionsMenu [line 1472]
string F_questionsMenu(
array $testdata, int $testuser_id, [ $testlog_id = 0], [boolean $disable = false])
|
|
Return a formatted XHTML ordered list containing test questions menu.
Tags:
Parameters
array |
$testdata |
test data |
int |
$testuser_id |
user's test ID |
boolean |
$disable |
if TRUE disable the questions list. |
|
$testlog_id |
|
F_selectAnswers [line 564]
array F_selectAnswers(
int $question_id, [int $isright = ''], [int $ordering = false], [int $limit = 0], [int $startindex = 0], [boolean $randorder = true], boolean $checktype)
|
|
Return an array containing answer_id field of selected answers.
Tags:
Parameters
int |
$question_id |
question ID |
boolean |
$checktype |
if true checks for answer_isright value on WHERE clause |
int |
$isright |
value (0 = false, 1 = true), if non-empty checks for answer_isright value on WHERE clause |
int |
$ordering |
ordering type question (0 = false, 1 = true) |
int |
$limit |
maximum number of IDs to return |
int |
$startindex |
array starting index (default = 0) |
boolean |
$randorder |
if true user random order |
F_terminateUserTest [line 204]
void F_terminateUserTest(
int $test_id)
|
|
Terminate user's test
Tags:
Parameters
F_testComment [line 1583]
string F_testComment(
int $test_id)
|
|
Display a textarea for user's comment.
Tags:
Parameters
F_testInfoLink [line 310]
void F_testInfoLink(
int $test_id, [string $link_name = ''])
|
|
Returns XHTML link to open test info popup.
Tags:
Parameters
int |
$test_id |
test ID |
string |
$link_name |
link caption return XHTML code |
F_twoColRow [line 459]
string F_twoColRow(
[string $label = ""], [string $description = ""], [string $value = ""])
|
|
Return a formatted XHTML row to display 2 columns data. See CSS classes: - div.row span.label
- div.row span.formw
Tags:
Parameters
string |
$label |
string to display on the left column |
string |
$description |
string to display on the title attribute of the left column field |
string |
$value |
string to display on the right column |
F_updateQuestionLog [line 995]
boolean F_updateQuestionLog(
int $test_id, int $testlog_id, [array $answer_id = 0], [string $answer_text = ''], [int $reaction_time = 0])
|
|
Updates question log data (register user's answers).
Tags:
Parameters
int |
$test_id |
test ID |
int |
$testlog_id |
test log ID |
array |
$answer_id |
answer_id form field value |
string |
$answer_text |
answer text |
int |
$reaction_time |
reaction time in milliseconds |
F_updateTestComment [line 1619]
string F_updateTestComment(
int $test_id, $testcomment, string $comment)
|
|
Updates user's test comment.
Tags:
Parameters
int |
$test_id |
test ID |
string |
$comment |
user's comment. |
|
$testcomment |
|
|
|