com-tecnick-tcexam-shared
[ class tree: com-tecnick-tcexam-shared ] [ index: com-tecnick-tcexam-shared ] [ all elements ]

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:

author:  Nicola Asuni
copyright:  Copyright © 2004-2009, Nicola Asuni - Tecnick.com S.r.l. - ITALY - www.tecnick.com - info@tecnick.com
link:  www.tecnick.com
since:  2004-05-28
license:  GNU General Public License








F_addLogAnswers [line 610]

boolean F_addLogAnswers( int $testlog_id, array $answers_ids)

Add specified answers on tce_tests_logs_answer table.



Tags:

return:  true in case of success, false otherwise


Parameters

int   $testlog_id   testlog ID
array   $answers_ids   array of answer IDs to add
[ Top ]



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:

return:  TRUE in case of success, FALSE otherwise.


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  
[ Top ]



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:

return:  status:
  • 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);


Parameters

int   $user_id   user ID
int   $test_id   test ID
int   $duration   test duration in seconds
[ Top ]



F_createTest [line 707]

boolean F_createTest( int $test_id, int $user_id)

Create user's test and returns TRUE on success.



Tags:

return:  TRUE in case of success, FALSE otherwise.


Parameters

int   $test_id   test ID.
int   $user_id   user ID.
[ Top ]



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:

return:  if user is authorized, false otherwise.
usedby:  tce_test_execute.php


Parameters

int   $test_id   test ID.
[ Top ]



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:

return:  testuser ID


Parameters

int   $test_id   test ID
[ Top ]



F_getTestData [line 384]

array F_getTestData( int $test_id)

Returns the test data.



Tags:

return:  containing test data.


Parameters

int   $test_id   test ID.
[ Top ]



F_getTestDuration [line 417]

int F_getTestDuration( int $test_id)

Returns the test duration time in seconds.



Tags:

return:  test duration time in seconds


Parameters

int   $test_id   test ID
[ Top ]



F_getTestName [line 406]

string F_getTestName( int $test_id)

Returns the test name.



Tags:

return:  test name or empty string in case of error.


Parameters

int   $test_id   test ID.
[ Top ]



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:

return:  start time in seconds


Parameters

int   $testuser_id   user's test ID
[ Top ]



F_getUserTests [line 57]

string F_getUserTests( )

Returns an XHTML unordered list of user's enabled tests.



Tags:

return:  containing an XHTML unordered list


[ Top ]



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:

return:  TRUE in case of success, FALSE otherwise


Parameters

int   $test_id   test ID
int   $testlog_id   test log ID
[ Top ]



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:

return:  if IP is valid, false otherwise


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".
[ Top ]



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:

return:  if is user is authorized, false otherwise


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".
[ Top ]



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:

return:  testlog ID


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  
[ Top ]



F_printTestInfo [line 336]

string F_printTestInfo( int $test_id, [boolean $showip = false])

Returns an XHTML string containing specified test information.



Tags:

return:  containing an XHTML code
usedby:  tce_popup_test_info.php
usedby:  tce_popup_test_info.php


Parameters

int   $test_id   test ID
boolean   $showip   if true display enabled users' IP range
[ Top ]



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:

return:  XHTML code


Parameters

int   $test_id   test ID
int   $testlog_id   test log ID
string   $formname   form name (form ID)
[ Top ]



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:

return:  XHTML code


Parameters

array   $testdata   test data
int   $testuser_id   user's test ID
boolean   $disable   if TRUE disable the questions list.
   $testlog_id  
[ Top ]



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:

return:  id of selected answers


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
[ Top ]



F_terminateUserTest [line 204]

void F_terminateUserTest( int $test_id)

Terminate user's test




Tags:

since:  4.0.000 (2006-09-27)


Parameters

int   $test_id   test ID
[ Top ]



F_testComment [line 1583]

string F_testComment( int $test_id)

Display a textarea for user's comment.




Tags:

return:  XHTML code
since:  4.0.000 (2006-10-01)


Parameters

int   $test_id   test ID
[ Top ]



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
[ Top ]



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:

return:  XHTML code


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
[ Top ]



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:

return:  TRUE in case of success, FALSE otherwise


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
[ Top ]



F_updateTestComment [line 1619]

string F_updateTestComment( int $test_id, $testcomment, string $comment)

Updates user's test comment.




Tags:

return:  XHTML code
since:  4.0.000 (2006-10-01)


Parameters

int   $test_id   test ID
string   $comment   user's comment.
   $testcomment  
[ Top ]



Documentation generated on Thu, 05 Feb 2009 12:44:40 +0100 by phpDocumentor 1.4.1