packages-com-tecnick-tcexam-shared

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

shared

Table of Contents

Packages

cfg

Classes

LatexRender

Constants

K_ALLOWED_ERROR_TAGS  = '<a><b><br><em><p><ol><ul><li><small><table><tr><th><td>'
HTML tags that are allowed in an error message.
K_EMAIL_RE_PATTERN  = '^([a-zA-Z0-9_\\.\\-\\+\\%]+)@([a-zA-Z0-9\\.\\-]+)$'

Functions

F_encodeOMRTestData()  : encoded
Encode OMR test data array as a string to be printed on QR-Code.
F_decodeOMRTestData()  : array<string|int, mixed>
Decode OMR test data string (read from QR-Code) as array.
F_decodeOMRTestDataQRCode()  : array<string|int, mixed>
Read QR-Code from OMR page and return Test data.
F_decodeOMRPage()  : array<string|int, mixed>
Decode a single OMR Page and return data array.
F_importOMRTestData()  : bool
Import user's test data from OMR.
F_altLogin()  : array<string|int, mixed>
Try various external Login Systems.
F_db_connect()  : MySQL
Open a connection to a MySQL Server and select a database.
F_db_close()  : bool
Closes the non-persistent connection to a database associated with the given connection resource.
F_db_error()  : string
Returns the text of the error message from previous database operation
F_db_query()  : false
Sends a query to the currently active database on the server that's associated with the specified link identifier.<br>
F_db_fetch_array()  : Returns
Fetch a result row as an associative and numeric array.
F_db_fetch_assoc()  : Returns
Fetch a result row as an associative array.
F_db_affected_rows()  : Number
Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.
F_db_num_rows()  : Number
Get number of rows in result.
F_db_insert_id()  : int
Get the ID generated from the previous INSERT operation
F_db_datetime_diff_seconds()  : SQL
Returns the SQL string to calculate the difference in seconds between to datetime fields.
F_escape_sql()  : string
Escape a string for insertion into a SQL text field (avoiding SQL injection).
F_db_connect()  : MySQL
Open a connection to a MySQL Server and select a database.
F_db_close()  : bool
Closes the non-persistent connection to a database associated with the given connection resource.
F_db_error()  : string
Returns the text of the error message from previous database operation
F_db_query()  : false
Sends a query to the currently active database on the server that's associated with the specified link identifier.<br>
F_db_fetch_array()  : Returns
Fetch a result row as an associative and numeric array.
F_db_fetch_assoc()  : Returns
Fetch a result row as an associative array.
F_db_affected_rows()  : Number
Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.
F_db_num_rows()  : Number
Get number of rows in result.
F_db_insert_id()  : int
Returns the auto generated id used in the last query.
F_db_datetime_diff_seconds()  : SQL
Returns the SQL string to calculate the difference in seconds between to datetime fields.
F_escape_sql()  : string
Escape a string for insertion into a SQL text field (avoiding SQL injection).
F_db_connect()  : Oracle
Open a connection to a Oracle Server and select a database.
F_db_close()  : bool
Closes the non-persistent connection to a database associated with the given connection resource.
F_db_error()  : string
Returns the text of the error message from previous database operation
F_db_query()  : false
Sends a query to the currently active database on the server that's associated with the specified link identifier.<br> NOTE: Convert MySQL RAND() function to Oracle RANDOM() on ORDER BY clause of selection queries.
F_db_fetch_array()  : Returns
Fetch a result row as an associative and numeric array.
F_db_fetch_assoc()  : Returns
Fetch a result row as an associative array.
F_db_affected_rows()  : Number
Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.
F_db_num_rows()  : Number
Get number of rows in result.
F_db_insert_id()  : int
Get the ID generated from the previous INSERT operation
F_db_datetime_diff_seconds()  : SQL
Returns the SQL string to calculate the difference in seconds between to datetime fields.
F_escape_sql()  : string
Escape a string for insertion into a SQL text field (avoiding SQL injection).
F_db_connect()  : PostgreSQL
Open a connection to a PostgreSQL Server and select a database.
F_db_close()  : bool
Closes the non-persistent connection to a database associated with the given connection resource.
F_db_error()  : string
Returns the text of the error message from previous database operation
F_db_query()  : false
Sends a query to the currently active database on the server that's associated with the specified link identifier.<br> NOTE: Convert MySQL RAND() function to PostgreSQL RANDOM() on ORDER BY clause of selection queries.
F_db_fetch_array()  : Returns
Fetch a result row as an associative and numeric array.
F_db_fetch_assoc()  : Returns
Fetch a result row as an associative array.
F_db_affected_rows()  : Number
Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.
F_db_num_rows()  : Number
Get number of rows in result.
F_db_insert_id()  : int
Get the ID generated from the previous INSERT operation
F_db_datetime_diff_seconds()  : SQL
Returns the SQL string to calculate the difference in seconds between to datetime fields.
F_escape_sql()  : string
Escape a string for insertion into a SQL text field (avoiding SQL injection).
F_loginForm()  : XHTML
Returns XHTML / CSS formatted string for login form.<br> The CSS classes used are: <ul> <li>div.login_form : container for login box</li> <li>div.login_form div.login_row : container for label + input field or button</li> <li>div.login_form div.login_row span.label : container for input label</li> <li>div.login_form div.login_row span.formw : container for input form</li> </ul>
F_login_form()  : mixed
Display login page.
F_logout_form()  : XHTML
Display logout form.
F_logout_page()  : mixed
Display logout page.
F_isAuthorizedUser()  : bool
Returns true if the current user is authorized to update and delete the selected database record.
F_getAuthorizedUsers()  : string
Returns a comma separated string of ID of the users that belong to the same groups.
F_syncUserGroups()  : mixed
Sync user groups with the ones specified on the configuration file for alternate authentication.
F_isSslCertificateValid()  : true
Check if the client has a valid SSL certificate.
F_getSSLCertificateHash()  : array<string|int, mixed>
Get the hash code of the specified SSL certificate
F_getSSLClientHash()  : string
Get the hash code for the client certificate
F_print_error()  : mixed
Handle error/warning/system messages.
F_display_db_error()  : mixed
Print the database error message.
F_error_handler()  : mixed
Custom PHP error handler function.
F_url_exists()  : Returns
Check if the URL exist.
F_file_exists()  : Returns
Wrapper for file_exists.
F_decode_form_fields()  : array<string|int, mixed>
Returns an array containing form fields.
F_check_required_fields()  : array<string|int, mixed>
Check Required Form Fields.<br> Returns a string containing a list of missing fields (comma separated).
F_check_fields_format()  : array<string|int, mixed>
Check fields format using regular expression comparisons.<br> Returns a string containing a list of wrong fields (comma separated).
F_check_form_fields()  : false
Check Form Fields.
F_stripslashes_formfields()  : mixed
Strip slashes from posted form fields.
F_close_button()  : XHTML
Returns XHTML code string to display a window close button
F_submit_button()  : XHTML
Returns XHTML code string to display Form Submit Button.
F_getCSRFTokenField()  : XHTML
Returns XHTML code string to display the CSRF token field.
getFormRowTextInput()  : string
Print input row form.
getFormRowTextBox()  : string
Print text box row form.
getFormRowSelectBox()  : string
Print select box row form.
getFormRowCheckBox()  : string
Print check box row form.
getFormRowFixedValue()  : string
Print fixed value row form.
getFormSmallVertSpace()  : string
Print empty form row.
getFormSmallDivSpace()  : string
Print empty form row.
getFormRowVertSpace()  : string
Print empty form row.
getFormRowVertDiv()  : string
Print form row with title.
getFormNoscriptSelect()  : string
Print form row with submit button when noscript is active.
getFormDescriptionLine()  : string
Print form row with label and description
getFormUploadFile()  : string
Print input row form to upluad a file.
F_count_rows()  : number
Count rows of the given table.
F_empty_to_null()  : string
Prepare field value for SQL query.<br> Returns the quoted string if not empty, NULL otherwise.
F_zero_to_null()  : string
Prepare field value for SQL query.<br> Returns the num if different from zero, NULL otherwise.
F_getBoolean()  : bool
Returns boolean value from string or integer.<br> This function is needed to get the right boolean value from boolean field returned by PostgreSQL query.
F_check_unique()  : bool
Check if specified fields are unique on table.
unhtmlentities()  : converted
Reverse function for htmlentities.
F_compact_string()  : converted
Remove the following characters: <ul> <li>"\t" (ASCII 9 (0x09)), a tab.</li> <li>"\n" (ASCII 10 (0x0A)), a new line (line feed)</li> <li>"\r" (ASCII 13 (0x0D)), a carriage return</li> <li>"\0" (ASCII 0 (0x00)), the NUL-byte</li> <li>"\x0B" (ASCII 11 (0x0B)), a vertical tab</li> </ul>
F_replace_angulars()  : converted
Replace angular parenthesis with html equivalents (html entities).
F_substr_utf8()  : substring
Performs a multi-byte safe substr() operation based on number of characters.
F_text_to_xml()  : converted
Escape some special characters (&lt; &gt; &amp;).
F_xml_to_text()  : converted
Unescape some special characters (&lt; &gt; &amp;).
F_text_to_tsv()  : converted
Escape some special characters for TSV output.
F_tsv_to_text()  : converted
Unescape some special characters from TSV format.
showRequiredField()  : html
Return a string containing an HTML acronym for required/not required fields.
utrim()  : string
Strip whitespace (or other characters) from the beginning and end of an UTF-8 string and replace the "\xA0" with normal space.
getNormalizedIP()  : string
Convert all IP addresses to IPv6 expanded notation.
getIpAsInt()  : int
Converts a string containing an IP address into its integer value.
getIpAsString()  : int
Converts a string containing an IP address into its integer value and return string representation.
F_formatFloat()  : formatted
Format a percentage number.
F_formatPercentage()  : formatted
Format a percentage number.
F_formatPdfPercentage()  : string
format a percentage number
F_formatXMLPercentage()  : string
format a percentage number for XML
F_getUTCoffset()  : int
Returns the UTC time offset in seconds
F_db_getUTCoffset()  : string
Returns the UTC time offset yo be used with CONVERT_TZ function
getDataXML()  : string
Get data array in XML format.
getDataTSVHeader()  : string
Get data headers (keys) in TSV header (tab separated text values).
getDataTSV()  : string
Get data in TSV format (tab separated text values).
F_html_to_TSV()  : string
Convert HTML code to TSV string.
F_select_table_header_element()  : table
Display table header element with order link.
getContrastColor()  : string
Get a black or white color that maximize contrast.
F_isURL()  : bool
Returns true if the string is an URL.
F_utf8_normalizer()  : normalized
Normalize the UTF-8 input string.
bcdechex()  : string
Convert an long integer number to a Hexadecimal representation
F_html_to_text()  : text
Convert HTML code to Text string.
F_menu_link()  : mixed
Returns a menu element link wit subitems.
F_menu_isChildActive()  : mixed
Returns true if the menu item has an active child, false otherwise.
F_getRandomOTPkey()  : Base32
Return a random One Time Password Secret Key (Base32 encoded).
F_decodeBase32()  : Decoded
Decode a Base32 encoded string.
F_getOTP()  : OTP
Get a One Time Password for the specified secret key.
F_show_page_navigator()  : mixed
Display Pages navigation index.
F_session_open()  : bool
Open session.
F_session_close()  : bool
Close session.<br> Call garbage collector function to remove expired sessions.
F_session_read()  : string
Get session data.
F_session_write()  : resource
Insert or Update session.
F_session_destroy()  : resource
Deletes the specific session.
F_session_gc()  : int
Garbage collector.<br> Deletes expired sessions.<br> NOTE: while time() function returns a 32 bit integer, it works fine until year 2038.
F_session_string_to_array()  : array<string|int, mixed>
Convert encoded session string data to array.
getClientFingerprint()  : string
Generate a client fingerprint (unique ID for the client browser)
getNewSessionID()  : string
Generate and return a new session ID.
getPasswordHash()  : string
Hash password for Database storing.
checkPassword()  : bool
Verifies that a password matches a hash
getPlainCSRFToken()  : string
Generate unencoded CSRF token string
checkCSRFToken()  : bool
Check the CSRF token
F_getCSRFToken()  : string
Generate CSRF token
F_decode_tcecode()  : string
Returns XHTML code from text marked-up with TCExam Code Tags
F_latex_callback()  : string
Callback function for preg_replace_callback (LaTeX replacement).
F_mathml_callback()  : string
Callback function for preg_replace_callback (MathML replacement).
F_objects_callback()  : string
Callback function for preg_replace_callback.
F_objects_replacement()  : string
Returns the xhtml code needed to display the object by MIME type.
F_remove_tcecode()  : string
Returns specified string without tcecode mark-up tags
F_tcecodeToLine()  : mixed
Converts tcecode text to a single XHTML string removing some objects.
F_tcecodeToTitle()  : mixed
Converts tcecode text to simple string for XHTML title attribute.
F_substrHTML()  : mixed
Return a substring of XHTML code while making sure no html tags are chopped.
F_getUserTests()  : string
Returns an XHTML table of user's tests.
F_repeatTest()  : mixed
Mark previous test attempts as repeated.
F_isValidIP()  : true
Check if user's IP is valid over test IP range
F_isValidSSLCert()  : true
Check if user's IP is valid over test IP range
F_isValidTestUser()  : true
Check if user is authorized to execute the specified test
F_terminateUserTest()  : mixed
Terminate user's test<br>
F_countUserTest()  : retried
Count the number times of retries.<br>
F_checkTestStatus()  : array<string|int, mixed>
Check and returns specific test status for the specified user.<br>
F_testInfoLink()  : mixed
Returns XHTML link to open test info popup.
F_printTestInfo()  : string
Returns an XHTML string containing specified test information.
F_getTestData()  : array<string|int, mixed>
Returns the test data.
F_getUserData()  : array<string|int, mixed>
Returns user data.
F_getTestPassword()  : string
Returns the test password.
F_getTestName()  : string
Returns the test name.
F_getTestDuration()  : int
Returns the test duration time in seconds.
F_getTestStartTime()  : int
Returns the user's test start time in seconds since UNIX epoch (1970-01-01 00:00:00).
F_twoColRow()  : string
Return a formatted XHTML row to display 2 columns data.<br> See CSS classes:<ul> <li>div.row span.label</li> <li>div.row span.formw</li> </ul>
F_executeTest()  : true
Returns true if the current user is authorized to execute the selected test.<br> Generates the test if it's not already generated.
F_isRightTestlogUser()  : bool
Checks if the current user is the right testlog_id owner.<br> This function is used for security reasons.
F_selectAnswers()  : array<string|int, mixed>
Return an array containing answer_id field of selected answers.<br>
F_addLogAnswers()  : bool
Add specified answers on tce_tests_logs_answer table.
F_getFirstTestUser()  : int
Returns the ID of the tce_tests_users table corresponding to a complete test of $test_id type.
F_newTestLog()  : int
Creates a new tce_tests_logs table entry and returns inserted ID.
F_isTestOverLimits()  : bool
Returns false if the number of executed tests is under the limits, true otherwise.
F_count_executed_tests()  : int
Returns the number of executed tests on the specified time interval.
F_updateTestuserStat()  : mixed
Track generated tests.
F_createTest()  : bool
Create user's test and returns TRUE on success.
F_addQuestionAnswers()  : bool
Add answers to selected question.
F_updateQuestionLog()  : bool
Updates question log data (register user's answers and calculate scores).
F_getAnswerIdFromPosition()  : int
Returns the answer ID from position
F_questionForm()  : string
Returns a formatted XHTML form code to handle the specified question.<br> Form fields names are: answer_text, answer_id<br> CSS classes:<ul> <li>div.tcecontentbox</li> <li>div.rowl</li> <li>textarea.answertext</li> </ul>
F_questionsMenu()  : string
Returns a questions menu and navigator buttons.
F_getNumOmittedQuestions()  : int
Returns the number of omitted questions (unanswered + undisplayed).
F_testComment()  : string
Display a textarea for user's comment.<br>
F_updateTestComment()  : string
Updates user's test comment.<br>
F_testLoginForm()  : XHTML
Returns XHTML / CSS formatted page string to insert the test password.<br> The CSS classes used are: <ul> <li>div.login_form : container for login box</li> <li>div.login_form div.login_row : container for label + input field or button</li> <li>div.login_form div.login_row span.label : container for input label</li> <li>div.login_form div.login_row span.formw : container for input form</li> </ul>
F_getTestGroups()  : string
Get a comma separated list of valid group IDs for the selected test.
F_getTestSSLCerts()  : string
Get a comma separated list of valid SSL certificates IDs for the selected test.
F_getUserTestStat()  : mixed
Returns statistic array for the test-user
F_getUserTestTotals()  : mixed
Returns test-user totals
F_getTestStat()  : mixed
Returns statistic array for the selected test.
F_getRawTestStat()  : mixed
Returns raw statistic array for the selected test.
F_normalizeTestStatAverages()  : mixed
Calculate average values from TestStat array
F_printTestStat()  : mixed
Returns test stats as HTML table
F_printTestResultStat()  : mixed
Returns test stats as HTML table
F_printUserTestStat()  : mixed
Returns user test stats as HTML table
F_getAllUsersTestStat()  : mixed
Returns users statistic array for the selected test.
F_lockUserTest()  : mixed
Lock the user's test.<br>
F_getTestIDResults()  : string
Returns a comma separated string of test IDs with test_results_to_users enabled
F_getTestIDReports()  : string
Returns a comma separated string of test IDs with test_results_to_users enabled
F_getTestIDs()  : string
Returns a comma separated string of test IDs with test_results_to_users enabled
F_send_user_reg_email()  : mixed
Send a registration verification email to user.

Constants

K_ALLOWED_ERROR_TAGS

HTML tags that are allowed in an error message.

public mixed K_ALLOWED_ERROR_TAGS = '<a><b><br><em><p><ol><ul><li><small><table><tr><th><td>'

K_EMAIL_RE_PATTERN

public mixed K_EMAIL_RE_PATTERN = '^([a-zA-Z0-9_\\.\\-\\+\\%]+)@([a-zA-Z0-9\\.\\-]+)$'

Functions

F_encodeOMRTestData()

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

F_encodeOMRTestData( $data) : encoded
Parameters
$data :

(array) array to be encoded

Return values
encoded

string.

F_decodeOMRTestData()

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

F_decodeOMRTestData( $str) : array<string|int, mixed>
Parameters
$str :

(string) string to be decoded.

Return values
array<string|int, mixed>

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

F_decodeOMRTestDataQRCode()

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

F_decodeOMRTestDataQRCode( $image) : array<string|int, mixed>

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

Parameters
$image :

(string) image file to be decoded (scanned OMR page).

Return values
array<string|int, mixed>

with test data or false in case o error

F_decodeOMRPage()

Decode a single OMR Page and return data array.

F_decodeOMRPage( $image) : array<string|int, mixed>

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

Parameters
$image :

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

Return values
array<string|int, mixed>

of answers data or false in case of error.

F_importOMRTestData()

Import user's test data from OMR.

F_importOMRTestData( $user_id,  $date,  $omr_testdata,  $omr_answers[,  $overwrite = false ]) : bool
Parameters
$user_id :

(int) user ID.

$date :

(string) date-time field.

$omr_testdata :

(array) Array containing test data.

$omr_answers :

(array) Array containing test answers (from OMR).

$overwrite : = false

(boolean) If true overwrites the previous answers on non-repeatable tests.

Return values
bool

TRUE in case of success, FALSE otherwise.

F_altLogin()

Try various external Login Systems.

F_altLogin() : array<string|int, mixed>

(SSL, HTTP-BASIC, CAS, SHIBBOLETH, RADIUS, LDAP, CUSTOM)

Tags
since
2012-06-05
Return values
array<string|int, mixed>

of user's data for successful login, false otherwise

F_db_connect()

Open a connection to a MySQL Server and select a database.

F_db_connect([ $host = 'localhost' ][,  $port = '3306' ][,  $username = 'root' ][,  $password = '' ][,  $database = '' ]) : MySQL
Parameters
$host : = 'localhost'

(string) database server host name.

$port : = '3306'

(string) database connection port

$username : = 'root'

(string) Name of the user that owns the server process.

$password : = ''

(string) Password of the user that owns the server process.

$database : = ''

(string) Database name.

Return values
MySQL

link identifier on success, or FALSE on failure.

F_db_close()

Closes the non-persistent connection to a database associated with the given connection resource.

F_db_close( $link_identifier) : bool
Parameters
$link_identifier :

(resource) database link identifier.

Return values
bool

TRUE on success or FALSE on failure

F_db_error()

Returns the text of the error message from previous database operation

F_db_error([mixed $link_identifier = null ]) : string
Parameters
$link_identifier : mixed = null
Return values
string

error message.

F_db_query()

Sends a query to the currently active database on the server that's associated with the specified link identifier.<br>

F_db_query( $query,  $link_identifier) : false
Parameters
$query :

(string) The query tosend. The query string should not end with a semicolon.

$link_identifier :

(resource) database link identifier.

Return values
false

in case of error, TRUE or resource-identifier in case of success.

F_db_fetch_array()

Fetch a result row as an associative and numeric array.

F_db_fetch_array( $result) : Returns

Note: This function sets NULL fields to PHP NULL value.

Parameters
$result :

(resource) result resource to the query result.

Return values
Returns

an array that corresponds to the fetched row, or FALSE if there are no more rows.

F_db_fetch_assoc()

Fetch a result row as an associative array.

F_db_fetch_assoc( $result) : Returns

Note: This function sets NULL fields to PHP NULL value.

Parameters
$result :

(resource) result resource to the query result.

Return values
Returns

an array that corresponds to the fetched row, or FALSE if there are no more rows.

F_db_affected_rows()

Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.

F_db_affected_rows( $link_identifier,  $result) : Number
Parameters
$link_identifier :

(resource) database link identifier.

$result :

(resource) result resource to the query result [UNUSED].

Return values
Number

of rows.

F_db_num_rows()

Get number of rows in result.

F_db_num_rows( $result) : Number
Parameters
$result :

(resource) result resource to the query result.

Return values
Number

of affected rows.

F_db_insert_id()

Get the ID generated from the previous INSERT operation

F_db_insert_id( $link_identifier[,  $tablename = '' ][,  $fieldname = '' ]) : int
Parameters
$link_identifier :

(resource) database link identifier.

$tablename : = ''

(string) Table name.

$fieldname : = ''

(string) Field name (column name).

Return values
int

ID generated from the last INSERT operation.

F_db_datetime_diff_seconds()

Returns the SQL string to calculate the difference in seconds between to datetime fields.

F_db_datetime_diff_seconds(mixed $start_date_field, mixed $end_date_field) : SQL
Parameters
$start_date_field : mixed
$end_date_field : mixed
Return values
SQL

query string

F_escape_sql()

Escape a string for insertion into a SQL text field (avoiding SQL injection).

F_escape_sql( $link_identifier,  $str[,  $stripslashes = true ]) : string
Parameters
$link_identifier :

(resource) database link identifier.

$str :

(string) The string that is to be escaped.

$stripslashes : = true

(boolean) if true strip slashes from string

Tags
since
5.0.005

2007-12-05

Return values
string

Returns the escaped string, or FALSE on error.

F_db_connect()

Open a connection to a MySQL Server and select a database.

F_db_connect([ $host = 'localhost' ][,  $port = '3306' ][,  $username = 'root' ][,  $password = '' ][,  $database = '' ]) : MySQL
Parameters
$host : = 'localhost'

(string) database server host name.

$port : = '3306'

(string) database connection port

$username : = 'root'

(string) Name of the user that owns the server process.

$password : = ''

(string) Password of the user that owns the server process.

$database : = ''

(string) Database name.

Return values
MySQL

link identifier on success, or FALSE on failure.

F_db_close()

Closes the non-persistent connection to a database associated with the given connection resource.

F_db_close( $link_identifier) : bool
Parameters
$link_identifier :

(resource) database link identifier.

Return values
bool

TRUE on success or FALSE on failure

F_db_error()

Returns the text of the error message from previous database operation

F_db_error([mixed $link_identifier = null ]) : string
Parameters
$link_identifier : mixed = null
Return values
string

error message.

F_db_query()

Sends a query to the currently active database on the server that's associated with the specified link identifier.<br>

F_db_query( $query,  $link_identifier) : false
Parameters
$query :

(string) The query tosend. The query string should not end with a semicolon.

$link_identifier :

(resource) database link identifier.

Return values
false

in case of error, TRUE or resource-identifier in case of success.

F_db_fetch_array()

Fetch a result row as an associative and numeric array.

F_db_fetch_array( $result) : Returns

Note: This function sets NULL fields to PHP NULL value.

Parameters
$result :

(resource) result resource to the query result.

Return values
Returns

an array that corresponds to the fetched row, or FALSE if there are no more rows.

F_db_fetch_assoc()

Fetch a result row as an associative array.

F_db_fetch_assoc( $result) : Returns

Note: This function sets NULL fields to PHP NULL value.

Parameters
$result :

(resource) result resource to the query result.

Return values
Returns

an array that corresponds to the fetched row, or FALSE if there are no more rows.

F_db_affected_rows()

Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.

F_db_affected_rows( $link_identifier,  $result) : Number
Parameters
$link_identifier :

(resource) database link identifier.

$result :

(resource) result resource to the query result [UNUSED].

Return values
Number

of rows.

F_db_num_rows()

Get number of rows in result.

F_db_num_rows( $result) : Number
Parameters
$result :

(resource) result resource to the query result.

Return values
Number

of affected rows.

F_db_insert_id()

Returns the auto generated id used in the last query.

F_db_insert_id( $link_identifier[,  $tablename = '' ][,  $fieldname = '' ]) : int
Parameters
$link_identifier :

(resource) database link identifier.

$tablename : = ''

(string) Table name. (unused here but required for other DAL).

$fieldname : = ''

(string) Field name (column name). (unused here but required for other DAL).

Return values
int

ID generated from the last INSERT operation.

F_db_datetime_diff_seconds()

Returns the SQL string to calculate the difference in seconds between to datetime fields.

F_db_datetime_diff_seconds(mixed $start_date_field, mixed $end_date_field) : SQL
Parameters
$start_date_field : mixed
$end_date_field : mixed
Return values
SQL

query string

F_escape_sql()

Escape a string for insertion into a SQL text field (avoiding SQL injection).

F_escape_sql( $link_identifier,  $str[,  $stripslashes = true ]) : string
Parameters
$link_identifier :

(resource) database link identifier.

$str :

(string) The string that is to be escaped.

$stripslashes : = true

(boolean) if true strip slashes from string

Tags
since
5.0.005

2007-12-05

Return values
string

Returns the escaped string, or FALSE on error.

F_db_connect()

Open a connection to a Oracle Server and select a database.

F_db_connect([ $host = 'localhost' ][,  $port = '1521' ][,  $username = 'root' ][,  $password = '' ][,  $database = '' ]) : Oracle

If a second call is made to this function with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned.

Parameters
$host : = 'localhost'

(string) database server host name.

$port : = '1521'

(string) database connection port

$username : = 'root'

(string) Name of the user that owns the server process.

$password : = ''

(string) Password of the user that owns the server process.

$database : = ''

(string) Database name.

Return values
Oracle

link identifier on success, or FALSE on failure.

F_db_close()

Closes the non-persistent connection to a database associated with the given connection resource.

F_db_close( $link_identifier) : bool
Parameters
$link_identifier :

(resource) database link identifier.

Return values
bool

TRUE on success or FALSE on failure

F_db_error()

Returns the text of the error message from previous database operation

F_db_error([mixed $link_identifier = null ]) : string
Parameters
$link_identifier : mixed = null
Return values
string

error message.

F_db_query()

Sends a query to the currently active database on the server that's associated with the specified link identifier.<br> NOTE: Convert MySQL RAND() function to Oracle RANDOM() on ORDER BY clause of selection queries.

F_db_query( $query,  $link_identifier) : false
Parameters
$query :

(string) The query tosend. The query string should not end with a semicolon.

$link_identifier :

(resource) database link identifier.

Return values
false

in case of error, TRUE or resource-identifier in case of success.

F_db_fetch_array()

Fetch a result row as an associative and numeric array.

F_db_fetch_array( $result) : Returns

Note: This function sets NULL fields to PHP NULL value.

Parameters
$result :

(resource) result resource to the query result.

Return values
Returns

an array that corresponds to the fetched row, or FALSE if there are no more rows.

F_db_fetch_assoc()

Fetch a result row as an associative array.

F_db_fetch_assoc( $result) : Returns

Note: This function sets NULL fields to PHP NULL value.

Parameters
$result :

(resource) result resource to the query result.

Return values
Returns

an array that corresponds to the fetched row, or FALSE if there are no more rows.

F_db_affected_rows()

Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.

F_db_affected_rows( $link_identifier,  $result) : Number
Parameters
$link_identifier :

(resource) database link identifier [UNUSED].

$result :

(resource) result resource to the query result.

Return values
Number

of rows.

F_db_num_rows()

Get number of rows in result.

F_db_num_rows( $result) : Number
Parameters
$result :

(resource) result resource to the query result.

Return values
Number

of affected rows.

F_db_insert_id()

Get the ID generated from the previous INSERT operation

F_db_insert_id( $link_identifier[,  $tablename = '' ][,  $fieldname = '' ]) : int
Parameters
$link_identifier :

(resource) database link identifier.

$tablename : = ''

(string) Table name.

$fieldname : = ''

(string) Field name (column name).

Return values
int

ID generated from the last INSERT operation.

F_db_datetime_diff_seconds()

Returns the SQL string to calculate the difference in seconds between to datetime fields.

F_db_datetime_diff_seconds(mixed $start_date_field, mixed $end_date_field) : SQL
Parameters
$start_date_field : mixed
$end_date_field : mixed
Return values
SQL

query string

F_escape_sql()

Escape a string for insertion into a SQL text field (avoiding SQL injection).

F_escape_sql( $link_identifier,  $str[,  $stripslashes = true ]) : string
Parameters
$link_identifier :

(resource) database link identifier.

$str :

(string) The string that is to be escaped.

$stripslashes : = true

(boolean) if true strip slashes from string

Tags
since
5.0.005

2007-12-05

Return values
string

Returns the escaped string, or FALSE on error.

F_db_connect()

Open a connection to a PostgreSQL Server and select a database.

F_db_connect([ $host = 'localhost' ][,  $port = '5432' ][,  $username = 'postgres' ][,  $password = '' ][,  $database = 'template1' ]) : PostgreSQL

If a second call is made to this function with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned.

Parameters
$host : = 'localhost'

(string) database server host name.

$port : = '5432'

(string) database connection port

$username : = 'postgres'

(string) Name of the user that owns the server process.

$password : = ''

(string) Password of the user that owns the server process.

$database : = 'template1'

(string) Database name.

Return values
PostgreSQL

link identifier on success, or FALSE on failure.

F_db_close()

Closes the non-persistent connection to a database associated with the given connection resource.

F_db_close( $link_identifier) : bool
Parameters
$link_identifier :

(resource) database link identifier.

Return values
bool

TRUE on success or FALSE on failure

F_db_error()

Returns the text of the error message from previous database operation

F_db_error([mixed $link_identifier = null ]) : string
Parameters
$link_identifier : mixed = null
Return values
string

error message.

F_db_query()

Sends a query to the currently active database on the server that's associated with the specified link identifier.<br> NOTE: Convert MySQL RAND() function to PostgreSQL RANDOM() on ORDER BY clause of selection queries.

F_db_query( $query,  $link_identifier) : false
Parameters
$query :

(string) The query tosend. The query string should not end with a semicolon.

$link_identifier :

(resource) database link identifier.

Return values
false

in case of error, TRUE or resource-identifier in case of success.

F_db_fetch_array()

Fetch a result row as an associative and numeric array.

F_db_fetch_array( $result) : Returns

Note: This function sets NULL fields to PHP NULL value.

Parameters
$result :

(resource) result resource to the query result.

Return values
Returns

an array that corresponds to the fetched row, or FALSE if there are no more rows.

F_db_fetch_assoc()

Fetch a result row as an associative array.

F_db_fetch_assoc( $result) : Returns

Note: This function sets NULL fields to PHP NULL value.

Parameters
$result :

(resource) result resource to the query result.

Return values
Returns

an array that corresponds to the fetched row, or FALSE if there are no more rows.

F_db_affected_rows()

Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.

F_db_affected_rows( $link_identifier,  $result) : Number
Parameters
$link_identifier :

(resource) database link identifier [UNUSED].

$result :

(resource) result resource to the query result.

Return values
Number

of rows.

F_db_num_rows()

Get number of rows in result.

F_db_num_rows( $result) : Number
Parameters
$result :

(resource) result resource to the query result.

Return values
Number

of affected rows.

F_db_insert_id()

Get the ID generated from the previous INSERT operation

F_db_insert_id( $link_identifier[,  $tablename = '' ][,  $fieldname = '' ]) : int
Parameters
$link_identifier :

(resource) database link identifier.

$tablename : = ''

(string) Table name.

$fieldname : = ''

(string) Field name (column name).

Return values
int

ID generated from the last INSERT operation.

F_db_datetime_diff_seconds()

Returns the SQL string to calculate the difference in seconds between to datetime fields.

F_db_datetime_diff_seconds(mixed $start_date_field, mixed $end_date_field) : SQL
Parameters
$start_date_field : mixed
$end_date_field : mixed
Return values
SQL

query string

F_escape_sql()

Escape a string for insertion into a SQL text field (avoiding SQL injection).

F_escape_sql( $link_identifier,  $str[,  $stripslashes = true ]) : string
Parameters
$link_identifier :

(resource) database link identifier.

$str :

(string) The string that is to be escaped.

$stripslashes : = true

(boolean) if true strip slashes from string

Tags
since
5.0.005

2007-12-05

Return values
string

Returns the escaped string, or FALSE on error.

F_loginForm()

Returns XHTML / CSS formatted string for login form.<br> The CSS classes used are: <ul> <li>div.login_form : container for login box</li> <li>div.login_form div.login_row : container for label + input field or button</li> <li>div.login_form div.login_row span.label : container for input label</li> <li>div.login_form div.login_row span.formw : container for input form</li> </ul>

F_loginForm(mixed $faction, mixed $fid, mixed $fmethod, mixed $fenctype, mixed $username) : XHTML
Parameters
$faction : mixed
$fid : mixed
$fmethod : mixed
$fenctype : mixed
$username : mixed
Return values
XHTML

string for login form

F_isAuthorizedUser()

Returns true if the current user is authorized to update and delete the selected database record.

F_isAuthorizedUser( $table,  $field_id_name,  $value_id,  $field_user_id) : bool
Parameters
$table :

(string) table to be modified

$field_id_name :

(string) name of the main ID field of the table

$value_id :

(int) value of the ID field of the table

$field_user_id :

(string) name of the foreign key to to user_id

Tags
author

Nicola Asuni

since
2006-03-11
Return values
bool

true if the user is authorized, false otherwise

F_getAuthorizedUsers()

Returns a comma separated string of ID of the users that belong to the same groups.

F_getAuthorizedUsers( $user_id) : string
Parameters
$user_id :

(int) user ID

Tags
author

Nicola Asuni

since
2006-03-11
Return values
string

F_syncUserGroups()

Sync user groups with the ones specified on the configuration file for alternate authentication.

F_syncUserGroups( $usrid,  $grpids) : mixed
Parameters
$usrid :

(int) ID of the user to update.

$grpids :

(mixed) Group ID or comma separated list of group IDs (0=all available groups).

Tags
author

Nicola Asuni

since
2012-09-11

F_isSslCertificateValid()

Check if the client has a valid SSL certificate.

F_isSslCertificateValid() : true
Tags
author

Nicola Asuni

since
2013-03-26
Return values
true

if the client has a valid SSL certificate, false otherwise.

F_getSSLCertificateHash()

Get the hash code of the specified SSL certificate

F_getSSLCertificateHash(string $cert[, bool $pkcs12 = false ]) : array<string|int, mixed>
Parameters
$cert : string

String containing the certificate data.

$pkcs12 : bool = false

Set this variable to true if the certificate is in PKCS12 format.

Tags
author

Nicola Asuni

since
2013-07-01
Return values
array<string|int, mixed>

containing the hash code and the validity end date in unix epoch.

F_getSSLClientHash()

Get the hash code for the client certificate

F_getSSLClientHash() : string
Tags
author

Nicola Asuni

since
2013-07-01
Return values
string

containing the hash code.

F_print_error()

Handle error/warning/system messages.

F_print_error([ $messagetype = 'MESSAGE' ][,  $messagetoprint = '' ][,  $exit = false ]) : mixed

Print a message

Parameters
$messagetype : = 'MESSAGE'

(string) Type of message: 0=no message, message; warning; error.

$messagetoprint : = ''

(string) message to print.

$exit : = false

(bool) if true output a message and terminate the current script [default = false].

F_display_db_error()

Print the database error message.

F_display_db_error([ $exit = true ]) : mixed
Parameters
$exit : = true

(bool) if true output a message and terminate the current script [default = true].

F_error_handler()

Custom PHP error handler function.

F_error_handler( $errno,  $errstr,  $errfile,  $errline) : mixed
Parameters
$errno :

(int) The first parameter, errno, contains the level of the error raised, as an integer.

$errstr :

(string) The second parameter, errstr, contains the error message, as a string.

$errfile :

(string) The third parameter is optional, errfile, which contains the filename that the error was raised in, as a string.

$errline :

(int) The fourth parameter is optional, errline, which contains the line number the error was raised at, as an integer.

F_url_exists()

Check if the URL exist.

F_url_exists(mixed $url) : Returns
Parameters
$url : mixed
Return values
Returns

TRUE if the URL exists; FALSE otherwise.

F_file_exists()

Wrapper for file_exists.

F_file_exists(mixed $filename) : Returns

Checks whether a file or directory exists. Only allows some protocols and local files.

Parameters
$filename : mixed
Return values
Returns

TRUE if the file or directory specified by filename exists; FALSE otherwise.

F_decode_form_fields()

Returns an array containing form fields.

F_decode_form_fields() : array<string|int, mixed>
Return values
array<string|int, mixed>

containing form fields

F_check_required_fields()

Check Required Form Fields.<br> Returns a string containing a list of missing fields (comma separated).

F_check_required_fields( $formfields) : array<string|int, mixed>
Parameters
$formfields :

(string) input array containing form fields

Return values
array<string|int, mixed>

containing a list of missing fields (if any)

F_check_fields_format()

Check fields format using regular expression comparisons.<br> Returns a string containing a list of wrong fields (comma separated).

F_check_fields_format( $formfields) : array<string|int, mixed>

NOTE: to check a field create a new hidden field with the same name starting with 'x_'

An example powerful regular expression for email check is: ^([a-zA-Z0-9_.-]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-zA-Z0-9-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$

Parameters
$formfields :

(string) input array containing form fields

Return values
array<string|int, mixed>

containing a list of wrongfields (if any)

F_check_form_fields()

Check Form Fields.

F_check_form_fields() : false

see: F_check_required_fields, F_check_fields_format

Return values
false

in case of error, true otherwise

F_stripslashes_formfields()

Strip slashes from posted form fields.

F_stripslashes_formfields() : mixed

F_close_button()

Returns XHTML code string to display a window close button

F_close_button([ $onclick = '' ]) : XHTML
Parameters
$onclick : = ''

(string) additional javascript code to execute before closing the window.

Return values
XHTML

code string

F_submit_button()

Returns XHTML code string to display Form Submit Button.

F_submit_button( $name,  $value[,  $title = '' ][,  $extra = '' ]) : XHTML
Parameters
$name :

(string) button name

$value :

(string) label for button

$title : = ''

(string) button title, default=''

$extra : = ''

(string) optional extra fields to add to the input tag, default=''

Return values
XHTML

code string

F_getCSRFTokenField()

Returns XHTML code string to display the CSRF token field.

F_getCSRFTokenField() : XHTML
Return values
XHTML

code string

getFormRowTextInput()

Print input row form.

getFormRowTextInput( $field_name,  $name[,  $description = '' ][,  $tip = '' ][,  $value = '' ][,  $format = '' ][,  $maxlen = 255 ][,  $date = false ][,  $datetime = false ][,  $password = false ][,  $prefix = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$tip : = ''

(string) Help to be displayed on the right of the input field.

$value : = ''

(string) Initial value.

$format : = ''

(string) Regular expression to check the format of the field.

$maxlen : = 255

(int) Maximum input lenght.

$date : = false

(boolean) True if the field is a date input.

$datetime : = false

(boolean) True if the field is a date-time input.

$password : = false

(boolean) True if the field is a password.

$prefix : = ''

(string) code to be displayed after label.

Return values
string

getFormRowTextBox()

Print text box row form.

getFormRowTextBox( $field_name,  $name[,  $description = '' ][,  $value = '' ][,  $disabled = false ][,  $prefix = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$value : = ''

(string) Initial value.

$disabled : = false

(boolean) If true disable the field.

$prefix : = ''

(string) code to be displayed after label.

Return values
string

getFormRowSelectBox()

Print select box row form.

getFormRowSelectBox( $field_name,  $name[,  $description = '' ][,  $tip = '' ][,  $value = '' ][,  $items = [] ][,  $prefix = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$tip : = ''

(string) Help to be displayed on the right of the input field.

$value : = ''

(string) Initial value.

$items : = []

(array) array of items to print key => value.

$prefix : = ''

(string) code to be displayed after label.

Return values
string

getFormRowCheckBox()

Print check box row form.

getFormRowCheckBox( $field_name,  $name[,  $description = '' ][,  $tip = '' ][,  $value = '' ][,  $selected = false ][,  $disabled = false ][,  $prefix = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$tip : = ''

(string) Help to be displayed on the right of the input field.

$value : = ''

(string) Initial value.

$selected : = false

(boolean) set to true if selected.

$disabled : = false

(boolean) set to true to disable the field

$prefix : = ''

(string) code to be displayed after label.

Return values
string

getFormRowFixedValue()

Print fixed value row form.

getFormRowFixedValue( $field_name,  $name[,  $description = '' ][,  $tip = '' ][,  $value = '' ][,  $currency = false ][,  $prefix = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$tip : = ''

(string) Help to be displayed on the right of the input field.

$value : = ''

(string) Initial value.

$currency : = false

(boolean) if true the value is a curency number.

$prefix : = ''

(string) code to be displayed after label.

Return values
string

getFormSmallVertSpace()

Print empty form row.

getFormSmallVertSpace() : string
Return values
string

getFormSmallDivSpace()

Print empty form row.

getFormSmallDivSpace() : string
Return values
string

getFormRowVertSpace()

Print empty form row.

getFormRowVertSpace() : string
Return values
string

getFormRowVertDiv()

Print form row with title.

getFormRowVertDiv([ $title = '' ]) : string
Parameters
$title : = ''

(string) Title to be printed.

Return values
string

getFormNoscriptSelect()

Print form row with submit button when noscript is active.

getFormNoscriptSelect([ $name = 'selectrecord' ]) : string
Parameters
$name : = 'selectrecord'

(string) Name of the input form field.

Return values
string

getFormDescriptionLine()

Print form row with label and description

getFormDescriptionLine( $name[,  $description = '' ][,  $value = '' ]) : string
Parameters
$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$value : = ''

(string) Initial value.

Return values
string

getFormUploadFile()

Print input row form to upluad a file.

getFormUploadFile( $field_name,  $field_id,  $name[,  $description = '' ][,  $onchange = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$field_id :

(string) ID of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$onchange : = ''

(string) Javascript code to execute at onchange event.

Return values
string

F_count_rows()

Count rows of the given table.

F_count_rows( $dbtable[,  $where = '' ]) : number
Parameters
$dbtable :

(string) database table name

$where : = ''

(string) optional where SQL clause (including the WHERE keyword).

Return values
number

of rows

F_empty_to_null()

Prepare field value for SQL query.<br> Returns the quoted string if not empty, NULL otherwise.

F_empty_to_null( $str) : string
Parameters
$str :

(string) string to check.

Return values
string

$str quoted if not empty, NULL otherwise

F_zero_to_null()

Prepare field value for SQL query.<br> Returns the num if different from zero, NULL otherwise.

F_zero_to_null( $num) : string
Parameters
$num :

(string) string to check.

Return values
string

$num if != 0, NULL otherwise

F_getBoolean()

Returns boolean value from string or integer.<br> This function is needed to get the right boolean value from boolean field returned by PostgreSQL query.

F_getBoolean( $str) : bool
Parameters
$str :

(string) string to check.

Return values
bool

value.

F_check_unique()

Check if specified fields are unique on table.

F_check_unique( $table,  $where[,  $fieldname = false ][,  $fieldid = false ]) : bool
Parameters
$table :

(string) table name

$where :

(string) SQL where clause

$fieldname : = false

(mixed) name of table column to check

$fieldid : = false

(mixed) ID of table row to check

Return values
bool

true if unique, false otherwise

unhtmlentities()

Reverse function for htmlentities.

unhtmlentities( $text_to_convert[,  $preserve_tagsign = false ]) : converted
Parameters
$text_to_convert :

(string) input string to convert

$preserve_tagsign : = false

(boolean) if true preserve <> symbols, default=FALSE

Return values
converted

string

F_compact_string()

Remove the following characters: <ul> <li>"\t" (ASCII 9 (0x09)), a tab.</li> <li>"\n" (ASCII 10 (0x0A)), a new line (line feed)</li> <li>"\r" (ASCII 13 (0x0D)), a carriage return</li> <li>"\0" (ASCII 0 (0x00)), the NUL-byte</li> <li>"\x0B" (ASCII 11 (0x0B)), a vertical tab</li> </ul>

F_compact_string( $string[,  $dquotes = false ]) : converted
Parameters
$string :

(string) input string to convert

$dquotes : = false

(boolean) If true add slash in fron of double quotes;

Return values
converted

string

F_replace_angulars()

Replace angular parenthesis with html equivalents (html entities).

F_replace_angulars( $str) : converted
Parameters
$str :

(string) input string to convert

Return values
converted

string

F_substr_utf8()

Performs a multi-byte safe substr() operation based on number of characters.

F_substr_utf8( $str,  $start,  $length) : substring
Parameters
$str :

(string) input string

$start :

(int) substring start index

$length :

(int) substring max lenght

Return values
substring

F_text_to_xml()

Escape some special characters (&lt; &gt; &amp;).

F_text_to_xml( $str) : converted
Parameters
$str :

(string) input string to convert

Return values
converted

string

F_xml_to_text()

Unescape some special characters (&lt; &gt; &amp;).

F_xml_to_text( $str) : converted
Parameters
$str :

(string) input string to convert

Return values
converted

string

F_text_to_tsv()

Escape some special characters for TSV output.

F_text_to_tsv( $str) : converted
Parameters
$str :

(string) input string to convert

Return values
converted

string

F_tsv_to_text()

Unescape some special characters from TSV format.

F_tsv_to_text( $str) : converted
Parameters
$str :

(string) input string to convert

Return values
converted

string

showRequiredField()

Return a string containing an HTML acronym for required/not required fields.

showRequiredField([ $mode = 1 ]) : html
Parameters
$mode : = 1

(int) field mode: 1=not required; 2=required.

Return values
html

string

utrim()

Strip whitespace (or other characters) from the beginning and end of an UTF-8 string and replace the "\xA0" with normal space.

utrim( $txt) : string
Parameters
$txt :

(string) The string that will be trimmed.

Return values
string

The trimmed string.

getNormalizedIP()

Convert all IP addresses to IPv6 expanded notation.

getNormalizedIP( $ip) : string
Parameters
$ip :

(string) IP address to normalize.

Tags
since
7.1.000

(2009-02-13)

Return values
string

IPv6 address in expanded notation or false in case of invalid input.

getIpAsInt()

Converts a string containing an IP address into its integer value.

getIpAsInt( $ip) : int
Parameters
$ip :

(string) IP address to convert.

Tags
since
7.1.000

(2009-02-13)

Return values
int

IP address as integer number.

getIpAsString()

Converts a string containing an IP address into its integer value and return string representation.

getIpAsString( $ip) : int
Parameters
$ip :

(string) IP address to convert.

Tags
since
9.0.033

(2009-11-03)

Return values
int

IP address as string.

F_formatFloat()

Format a percentage number.

F_formatFloat( $num) : formatted
Parameters
$num :

(float) number to be formatted

Return values
formatted

string

F_formatPercentage()

Format a percentage number.

F_formatPercentage( $num[,  $ratio = true ]) : formatted
Parameters
$num :

(float) Number to be formatted.

$ratio : = true

(boolean) Set to true if the number is a ratio between 0 and 1, false if is a percentage number between 0 an 100.

Return values
formatted

string

F_formatPdfPercentage()

format a percentage number

F_formatPdfPercentage( $num[,  $ratio = true ]) : string
Parameters
$num :

(float) number to be formatted

$ratio : = true

(boolean) Set to true if the number is a ratio between 0 and 1, false if is a percentage number between 0 an 100.

Return values
string

F_formatXMLPercentage()

format a percentage number for XML

F_formatXMLPercentage( $num[,  $ratio = true ]) : string
Parameters
$num :

(float) number to be formatted

$ratio : = true

(boolean) Set to true if the number is a ratio between 0 and 1, false if is a percentage number between 0 an 100.

Return values
string

F_getUTCoffset()

Returns the UTC time offset in seconds

F_getUTCoffset( $timezone) : int
Parameters
$timezone :

(string) current user timezone

Return values
int

UTC time offset in seconds

F_db_getUTCoffset()

Returns the UTC time offset yo be used with CONVERT_TZ function

F_db_getUTCoffset( $timezone) : string
Parameters
$timezone :

(string) current user timezone

Return values
string

UTC time offset (+HH:mm)

getDataXML()

Get data array in XML format.

getDataXML( $data[,  $level = 1 ]) : string
Parameters
$data :

(array) Array of data (key => value).

$level : = 1

(int) Indentation level.

Return values
string

XML data

getDataTSVHeader()

Get data headers (keys) in TSV header (tab separated text values).

getDataTSVHeader( $data[,  $prefix = '' ]) : string
Parameters
$data :

(array) Array of data (key => value).

$prefix : = ''

(string) Prefix to add to keys.

Return values
string

data

getDataTSV()

Get data in TSV format (tab separated text values).

getDataTSV( $data) : string
Parameters
$data :

(array) Array of data.

Return values
string

XML data

F_html_to_TSV()

Convert HTML code to TSV string.

F_html_to_TSV( $str) : string
Parameters
$str :

(string) HTML string to convert.

Return values
string

TSV

F_select_table_header_element()

Display table header element with order link.

F_select_table_header_element( $order_field,  $orderdir,  $title,  $name[,  $current_order_field = '' ][,  $filter = '' ]) : table
Parameters
$order_field :

(string) name of table field

$orderdir :

(string) order direction

$title :

title (string) field of anchor link

$name :

column (string) name

$current_order_field : = ''

(string) current order field name

$filter : = ''

(string) additional parameters to pass on URL

Return values
table

header element string

getContrastColor()

Get a black or white color that maximize contrast.

getContrastColor( $color) : string
Parameters
$color :

(string) color in HEX format.

Return values
string

Color.

F_isURL()

Returns true if the string is an URL.

F_isURL( $str) : bool
Parameters
$str :

(string) String to check.

Return values
bool

true or false.

F_utf8_normalizer()

Normalize the UTF-8 input string.

F_utf8_normalizer( $str[,  $mode = 'NONE' ]) : normalized

Modes greater than 0 requires php5-intl module. Please edit this function to implement your custom normalization method.

Parameters
$str :

(string) UTF-8 string to normalize.

$mode : = 'NONE'

(int) Normalization type: NONE=None; C=Normalization Form C (NFC) - Canonical Decomposition followed by Canonical Composition; D=Normalization Form D (NFD) - Canonical Decomposition; KC=Normalization Form KC (NFKC) - Compatibility Decomposition, followed by Canonical Composition; KD=Normalization Form KD (NFKD) - Compatibility Decomposition; CUSTOM=Custom normalization using user defined function 'user_utf8_custom_normalizer'.

Return values
normalized

string using the specified algorithm.

bcdechex()

Convert an long integer number to a Hexadecimal representation

bcdechex(string|int $dec) : string
Parameters
$dec : string|int

Decimal number to convert.

Tags
author

Nicola Asuni

since
2013-07-02
Return values
string

containing the HEX representation in uppercase.

F_html_to_text()

Convert HTML code to Text string.

F_html_to_text( $str[,  $preserve_newlines = false ][,  $display_links = false ]) : text
Parameters
$str :

(string) HTML code string to convert.

$preserve_newlines : = false

(boolean) If true convert newline characters to HTML line breaks.

$display_links : = false

(boolean) If true gives a textual representation of links and images.

Return values
text

string

Returns a menu element link wit subitems.

F_menu_link( $link,  $data[,  $level = 0 ]) : mixed

If the link refers to the current page, only the name will be returned.

Parameters
$link :

(string) URL

$data :

(array) link data

$level : = 0

(int) item level

F_menu_isChildActive()

Returns true if the menu item has an active child, false otherwise.

F_menu_isChildActive( $data) : mixed
Parameters
$data :

(array) link data

F_getRandomOTPkey()

Return a random One Time Password Secret Key (Base32 encoded).

F_getRandomOTPkey() : Base32
Return values
Base32

encoded key.

F_decodeBase32()

Decode a Base32 encoded string.

F_decodeBase32( $code) : Decoded
Parameters
$code :

(string) Base32 code to be decoded.

Return values
Decoded

key.

F_getOTP()

Get a One Time Password for the specified secret key.

F_getOTP( $otpkey[,  $mtime = 0 ]) : OTP
Parameters
$otpkey :

(string) One Time Password secret key.

$mtime : = 0

(int) Reference time in microseconds.

Return values
OTP

F_show_page_navigator()

Display Pages navigation index.

F_show_page_navigator( $script_name,  $sql,  $firstrow,  $rowsperpage,  $param_array) : mixed
Parameters
$script_name :

(string) url of the calling page

$sql :

(string) sql used to select records

$firstrow :

(int) first row number

$rowsperpage :

(int) number of max rows per page

$param_array :

(string) parameters to pass on url via GET

Return values
mixed

the number of pages in case of success, FALSE otherwise

F_session_open()

Open session.

F_session_open( $save_path,  $session_name) : bool
Parameters
$save_path :

(string) path were to store session data

$session_name :

(string) name of session

Return values
bool

always TRUE

F_session_close()

Close session.<br> Call garbage collector function to remove expired sessions.

F_session_close() : bool
Return values
bool

always TRUE

F_session_read()

Get session data.

F_session_read( $key) : string
Parameters
$key :

(string) session ID.

Return values
string

session data.

F_session_write()

Insert or Update session.

F_session_write( $key,  $val) : resource
Parameters
$key :

(string) session ID.

$val :

(string) session data.

Return values
resource

database query result.

F_session_destroy()

Deletes the specific session.

F_session_destroy( $key) : resource
Parameters
$key :

(string) session ID of session to destroy.

Return values
resource

database query result.

F_session_gc()

Garbage collector.<br> Deletes expired sessions.<br> NOTE: while time() function returns a 32 bit integer, it works fine until year 2038.

F_session_gc() : int
Return values
int

number of deleted sessions.

F_session_string_to_array()

Convert encoded session string data to array.

F_session_string_to_array( $sd) : array<string|int, mixed>
Parameters
$sd :

(string) input data string

Tags
author

Nicola Asuni

since
2001-10-18
Return values
array<string|int, mixed>

getClientFingerprint()

Generate a client fingerprint (unique ID for the client browser)

getClientFingerprint() : string
Tags
author

Nicola Asuni

since
2010-10-04
Return values
string

client ID

getNewSessionID()

Generate and return a new session ID.

getNewSessionID() : string
Tags
author

Nicola Asuni

since
2010-10-04
Return values
string

PHPSESSID

getPasswordHash()

Hash password for Database storing.

getPasswordHash( $password) : string
Parameters
$password :

(string) Password to hash.

Return values
string

password hash

checkPassword()

Verifies that a password matches a hash

checkPassword( $password,  $hash) : bool
Parameters
$password :

(string) The password to verify

$hash :

(string) Password hash

Return values
bool

getPlainCSRFToken()

Generate unencoded CSRF token string

getPlainCSRFToken() : string
Return values
string

checkCSRFToken()

Check the CSRF token

checkCSRFToken( $token) : bool
Parameters
$token :

(string) tocken to check

Return values
bool

F_decode_tcecode()

Returns XHTML code from text marked-up with TCExam Code Tags

F_decode_tcecode( $text_to_decode) : string
Parameters
$text_to_decode :

(string) text to convert

Return values
string

XHTML code

F_latex_callback()

Callback function for preg_replace_callback (LaTeX replacement).

F_latex_callback( $matches) : string

Returns replacement image for LaTeX code.

Parameters
$matches :

(string) array containing matches: $matches[0] is the complete match, $matches[1] the match for the first subpattern enclosed in '(...)' (the LaTeX code)

Return values
string

replacement HTML code string to include the equivalent LaTeX image.

F_mathml_callback()

Callback function for preg_replace_callback (MathML replacement).

F_mathml_callback( $matches) : string

Returns replacement code for MathML code.

Parameters
$matches :

(string) array containing matches: $matches[0] is the complete match, $matches[1] the match for the first subpattern enclosed in '(...)' (the MathML code)

Return values
string

MathML code.

F_objects_callback()

Callback function for preg_replace_callback.

F_objects_callback( $matches) : string

Returns replacement code by MIME type.

Parameters
$matches :

(string) array containing matches: $matches[0] is the complete match, $matches[1] the match for the first subpattern enclosed in '(...)' and so on

Return values
string

replacement string by file extension

F_objects_replacement()

Returns the xhtml code needed to display the object by MIME type.

F_objects_replacement( $name,  $extension[,  $width = 0 ][,  $height = 0 ][,  $alt = '' ][,  &$maxwidth = 0 ][,  &$maxheight = 0 ]) : string
Parameters
$name :

(string) object path excluded extension

$extension :

(string) object extension (e.g.: gif, jpg, swf, ...)

$width : = 0

(int) object width

$height : = 0

(int) object height

$alt : = ''

(string) alternative content

$maxwidth : = 0

(int) object max or default width

$maxheight : = 0

(int) object max or default height

Return values
string

replacement string

F_remove_tcecode()

Returns specified string without tcecode mark-up tags

F_remove_tcecode( $str) : string
Parameters
$str :

(string) text to process

Return values
string

without tcecode markup tags

F_tcecodeToLine()

Converts tcecode text to a single XHTML string removing some objects.

F_tcecodeToLine( $str) : mixed
Parameters
$str :

(string) text to process return string

F_tcecodeToTitle()

Converts tcecode text to simple string for XHTML title attribute.

F_tcecodeToTitle( $str) : mixed
Parameters
$str :

(string) text to process return string

F_substrHTML()

Return a substring of XHTML code while making sure no html tags are chopped.

F_substrHTML( $htmltext[,  $min_length = 100 ][,  $offset_length = 20 ]) : mixed

It also prevents chopping while a tag is still open. this function is based on a public-domain script posted on www.php.net by fox@conskript.server and mr@bbp.biz

Parameters
$htmltext :

(string)

$min_length : = 100

(int) (default=100) the approximate length you want the concatenated text to be

$offset_length : = 20

(int) (default=20) the max variation in how long the text can be

F_getUserTests()

Returns an XHTML table of user's tests.

F_getUserTests() : string
Return values
string

containing an XHTML table of user's tests.

F_repeatTest()

Mark previous test attempts as repeated.

F_repeatTest( $test_id) : mixed
Parameters
$test_id :

(int) Test ID

F_isValidIP()

Check if user's IP is valid over test IP range

F_isValidIP( $user_ip,  $test_ips) : true
Parameters
$user_ip :

(int) user's IP address in expanded IPv6 format.

$test_ips :

(int) 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
true

if IP is valid, false otherwise

F_isValidSSLCert()

Check if user's IP is valid over test IP range

F_isValidSSLCert( $test_id) : true
Parameters
$test_id :

(int) Test ID

Return values
true

if the client certifiate is valid, false otherwise

F_isValidTestUser()

Check if user is authorized to execute the specified test

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

(int) ID of the selected test

$user_ip :

(int) user's IP address.

$test_ip :

(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()

Terminate user's test<br>

F_terminateUserTest( $test_id) : mixed
Parameters
$test_id :

(int) test ID

Tags
since
4.0.000

(2006-09-27)

F_countUserTest()

Count the number times of retries.<br>

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

(int) user ID

$test_id :

(int) test ID

Return values
retried

times

F_checkTestStatus()

Check and returns specific test status for the specified user.<br>

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

(int) user ID

$test_id :

(int) test ID

$duration :

(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;

Returns XHTML link to open test info popup.

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

(int) test ID

$link_name : = ''

(string) link caption return XHTML code

F_printTestInfo()

Returns an XHTML string containing specified test information.

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

(int) test ID

$showip : = false

(boolean) if true display enabled users' IP range

Return values
string

containing an XHTML code

F_getTestData()

Returns the test data.

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

(int) test ID.

Return values
array<string|int, mixed>

containing test data.

F_getUserData()

Returns user data.

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

(int) User ID.

Return values
array<string|int, mixed>

containing test data.

F_getTestPassword()

Returns the test password.

F_getTestPassword( $test_id) : string
Parameters
$test_id :

(int) test ID.

Return values
string

test password or empty string in case of error.

F_getTestName()

Returns the test name.

F_getTestName( $test_id) : string
Parameters
$test_id :

(int) test ID.

Return values
string

test name or empty string in case of error.

F_getTestDuration()

Returns the test duration time in seconds.

F_getTestDuration( $test_id) : int
Parameters
$test_id :

(int) test ID

Return values
int

test duration time in seconds

F_getTestStartTime()

Returns the user's test start time in seconds since UNIX epoch (1970-01-01 00:00:00).

F_getTestStartTime( $testuser_id) : int
Parameters
$testuser_id :

(int) user's test ID

Return values
int

start time in seconds

F_twoColRow()

Return a formatted XHTML row to display 2 columns data.<br> See CSS classes:<ul> <li>div.row span.label</li> <li>div.row span.formw</li> </ul>

F_twoColRow([ $label = "" ][,  $description = "" ][,  $value = "" ]) : string
Parameters
$label : = ""

(string) string to display on the left column

$description : = ""

(string) string to display on the title attribute of the left column field

$value : = ""

(string) string to display on the right column

Return values
string

XHTML code

F_executeTest()

Returns true if the current user is authorized to execute the selected test.<br> Generates the test if it's not already generated.

F_executeTest( $test_id) : true
Parameters
$test_id :

(int) test ID.

Return values
true

if user is authorized, false otherwise.

F_isRightTestlogUser()

Checks if the current user is the right testlog_id owner.<br> This function is used for security reasons.

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

(int) test ID

$testlog_id :

(int) test log ID

Return values
bool

TRUE in case of success, FALSE otherwise

F_selectAnswers()

Return an array containing answer_id field of selected answers.<br>

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

(int) Question ID.

$isright : = ''

(int) Value (0 = false, 1 = true), if non-empty checks for answer_isright value on WHERE clause.

$ordering : = false

(int) Ordering type question (0 = false, 1 = true).

$limit : = 0

(int) Maximum number of IDs to return.

$startindex : = 0

(int) Array starting index (default = 0).

$randorder : = true

(boolean) If true user random order.

$ordmode : = 0

(int) Ordering mode: 0=position; 1=alphabetical; 2=ID.

Return values
array<string|int, mixed>

id of selected answers

F_addLogAnswers()

Add specified answers on tce_tests_logs_answer table.

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

(int) testlog ID

$answers_ids :

(array) array of answer IDs to add

Return values
bool

true in case of success, false otherwise

F_getFirstTestUser()

Returns the ID of the tce_tests_users table corresponding to a complete test of $test_id type.

F_getFirstTestUser( $test_id) : int
Parameters
$test_id :

(int) test ID

Return values
int

testuser ID

F_newTestLog()

Creates a new tce_tests_logs table entry and returns inserted ID.

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

(int) ID of tce_tests_users

$question_id :

(int) question ID

$score :

(int) score for unanswered questions

$order :

(int) question display order

$num_answers : = 0

(int) number of alternative answers

Return values
int

testlog ID

F_isTestOverLimits()

Returns false if the number of executed tests is under the limits, true otherwise.

F_isTestOverLimits() : bool
Return values
bool

true/false.

F_count_executed_tests()

Returns the number of executed tests on the specified time interval.

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

(string) Star date-time interval.

$enddate :

(string) End date-time interval.

Return values
int

number of executed tests.

F_updateTestuserStat()

Track generated tests.

F_updateTestuserStat( $date) : mixed
Parameters
$date :

(string) date-time when the test was generated.

F_createTest()

Create user's test and returns TRUE on success.

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

(int) test ID.

$user_id :

(int) user ID.

Return values
bool

TRUE in case of success, FALSE otherwise.

F_addQuestionAnswers()

Add answers to selected question.

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

(int) testlog ID.

$question_id :

(int) question ID.

$question_type :

(int) type of question.

$num_answers :

(int) number of alternative answers to display.

$firsttest :

(int) ID of first test testuser_id.

$testdata :

(array) array of test data.

Return values
bool

TRUE in case of success, FALSE otherwise.

F_updateQuestionLog()

Updates question log data (register user's answers and calculate scores).

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

(int) test ID

$testlog_id :

(int) test log ID

$answpos : = []

(array) Array of answer positions

$answer_text : = ''

(string) answer text

$reaction_time : = 0

(int) reaction time in milliseconds

Return values
bool

TRUE in case of success, FALSE otherwise

F_getAnswerIdFromPosition()

Returns the answer ID from position

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

(int) Test Log ID

$answpos :

(array) Answer positions (order in wich they are displayed)

Return values
int

answer ID

F_questionForm()

Returns a formatted XHTML form code to handle the specified question.<br> Form fields names are: answer_text, answer_id<br> CSS classes:<ul> <li>div.tcecontentbox</li> <li>div.rowl</li> <li>textarea.answertext</li> </ul>

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

(int) test ID

$testlog_id :

(int) test log ID

$formname :

(string) form name (form ID)

Return values
string

XHTML code

F_questionsMenu()

Returns a questions menu and navigator buttons.

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

(array) test data

$testuser_id :

(int) user's test ID

$testlog_id : = 0

(int) test log ID

$disable : = false

(boolean) if TRUE disable the questions list.

Return values
string

XHTML code

F_getNumOmittedQuestions()

Returns the number of omitted questions (unanswered + undisplayed).

F_getNumOmittedQuestions( $test_id) : int
Parameters
$test_id :

(int) test ID

Return values
int

number

F_testComment()

Display a textarea for user's comment.<br>

F_testComment( $test_id) : string
Parameters
$test_id :

(int) test ID

Tags
since
4.0.000

(2006-10-01)

Return values
string

XHTML code

F_updateTestComment()

Updates user's test comment.<br>

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

(int) test ID

$testcomment :

(string) user comment.

Tags
since
4.0.000

(2006-10-01)

Return values
string

XHTML code

F_testLoginForm()

Returns XHTML / CSS formatted page string to insert the test password.<br> The CSS classes used are: <ul> <li>div.login_form : container for login box</li> <li>div.login_form div.login_row : container for label + input field or button</li> <li>div.login_form div.login_row span.label : container for input label</li> <li>div.login_form div.login_row span.formw : container for input form</li> </ul>

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()

Get a comma separated list of valid group IDs for the selected test.

F_getTestGroups( $test_id) : string
Parameters
$test_id :

(int) ID of the selected test

Return values
string

containing a comma separated list fo group IDs.

F_getTestSSLCerts()

Get a comma separated list of valid SSL certificates IDs for the selected test.

F_getTestSSLCerts( $test_id) : string
Parameters
$test_id :

(int) ID of the selected test

Return values
string

containing a comma separated list SSL certificates IDs.

F_getUserTestStat()

Returns statistic array for the test-user

F_getUserTestStat( $test_id[,  $user_id = 0 ][,  $testuser_id = 0 ][,  $pubmode = false ]) : mixed
Parameters
$test_id :

(int) test ID.

$user_id : = 0

(int) user ID - if greater than zero, filter stats for the specified user.

$testuser_id : = 0

(int) test-user ID - if greater than zero, filter stats for the specified test-user.

$pubmode : = false

(boolean) If true filter the results for the public interface. return $data array containing test-user statistics.

F_getUserTestTotals()

Returns test-user totals

F_getUserTestTotals( $test_id[,  $user_id = 0 ][,  $testuser_id = 0 ][,  $pubmode = false ]) : mixed
Parameters
$test_id :

(int) test ID.

$user_id : = 0

(int) user ID - if greater than zero, filter stats for the specified user.

$testuser_id : = 0

(int) test-user ID - if greater than zero, filter stats for the specified test-user.

$pubmode : = false

(boolean) If true filter the results for the public interface. return $data array containing test-user statistics.

F_getTestStat()

Returns statistic array for the selected test.

F_getTestStat( $test_id[,  $group_id = 0 ][,  $user_id = 0 ][,  $startdate = 0 ][,  $enddate = 0 ][,  $testuser_id = 0 ][,  $pubmode = false ]) : mixed
Parameters
$test_id :

(int) test ID.

$group_id : = 0

(int) group ID - if greater than zero, filter stats for the specified user group.

$user_id : = 0

(int) user ID - if greater than zero, filter stats for the specified user.

$startdate : = 0

(int) start date ID - if greater than zero, filter stats for the specified starting date

$enddate : = 0

(int) end date ID - if greater than zero, filter stats for the specified ending date

$testuser_id : = 0

(int) test-user ID - if greater than zero, filter stats for the specified test-user.

$pubmode : = false

(boolean) If true filter the results for the public interface. return $data array containing test statistics.

F_getRawTestStat()

Returns raw statistic array for the selected test.

F_getRawTestStat( $test_id[,  $group_id = 0 ][,  $user_id = 0 ][,  $startdate = 0 ][,  $enddate = 0 ][,  $testuser_id = 0 ][,  $data = [] ][,  $pubmode = false ]) : mixed
Parameters
$test_id :

(int) test ID.

$group_id : = 0

(int) group ID - if greater than zero, filter stats for the specified user group.

$user_id : = 0

(int) user ID - if greater than zero, filter stats for the specified user.

$startdate : = 0

(int) start date ID - if greater than zero, filter stats for the specified starting date

$enddate : = 0

(int) end date ID - if greater than zero, filter stats for the specified ending date

$testuser_id : = 0

(int) test-user ID - if greater than zero, filter stats for the specified test-user.

$data : = []

(array) Array of existing data to be merged with the current one.

$pubmode : = false

(boolean) If true filter the results for the public interface. return $data array containing test statistics.

F_normalizeTestStatAverages()

Calculate average values from TestStat array

F_normalizeTestStatAverages( $data) : mixed
Parameters
$data :

(array) Raw data array. return $data (array) Processed array.

F_printTestStat()

Returns test stats as HTML table

F_printTestStat( $test_id[,  $group_id = 0 ][,  $user_id = 0 ][,  $startdate = 0 ][,  $enddate = 0 ][,  $testuser_id = 0 ][,  $ts = [] ][,  $display_mode = 2 ][,  $pubmode = false ]) : mixed
Parameters
$test_id :

(int) test ID.

$group_id : = 0

(int) group ID - if greater than zero, filter stats for the specified user group.

$user_id : = 0

(int) user ID - if greater than zero, filter stats for the specified user.

$startdate : = 0

(int) start date ID - if greater than zero, filter stats for the specified starting date

$enddate : = 0

(int) end date ID - if greater than zero, filter stats for the specified ending date

$testuser_id : = 0

(int) test-user ID - if greater than zero, filter stats for the specified test-user.

$ts : = []

(array) array of stats to print (leave empty to automatically generate new data).

$display_mode : = 2

display (int) mode: 0 = disabled; 1 = minimum; 2 = module; 3 = subject; 4 = question; 5 = answer.

$pubmode : = false

(boolean) If true filter the results for the public interface. return $data string containing HTML table.

F_printTestResultStat()

Returns test stats as HTML table

F_printTestResultStat( $data,  $nextorderdir,  $order_field,  $filter[,  $pubmode = false ][,  $stats = 1 ]) : mixed
Parameters
$data :

(array) Array containing test statistics.

$nextorderdir :

(int) next order direction.

$order_field :

(string) order fields.

$filter :

(string) filter string for URLs.

$pubmode : = false

(boolean) If true filter the results for the public interface.

$stats : = 1

(int) 2 = full stats; 1 = user stats; 0 = disabled stats; return HTML table string.

F_printUserTestStat()

Returns user test stats as HTML table

F_printUserTestStat( $testuser_id) : mixed
Parameters
$testuser_id :

(int) test-user ID - if greater than zero, filter stats for the specified test-user. return $data string containing HTML table.

F_getAllUsersTestStat()

Returns users statistic array for the selected test.

F_getAllUsersTestStat( $test_id[,  $group_id = 0 ][,  $user_id = 0 ][,  $startdate = 0 ][,  $enddate = 0 ][,  $full_order_field = 'total_score' ][,  $pubmode = false ][,  $stats = 2 ]) : mixed
Parameters
$test_id :

(int) test ID.

$group_id : = 0

(int) group ID - if greater than zero, filter stats for the specified user group.

$user_id : = 0

(int) user ID - if greater than zero, filter stats for the specified user.

$startdate : = 0

(string) start date ID - if greater than zero, filter stats for the specified starting date

$enddate : = 0

(string) end date ID - if greater than zero, filter stats for the specified ending date

$full_order_field : = 'total_score'

(string) Ordering fields for SQL query.

$pubmode : = false

(boolean) If true filter the results for the public interface.

$stats : = 2

(int) 2 = full stats; 1 = user stats; 0 = disabled stats; return $data array containing test statistics.

F_lockUserTest()

Lock the user's test.<br>

F_lockUserTest( $test_id,  $user_id) : mixed
Parameters
$test_id :

(int) test ID

$user_id :

(int) user ID

F_getTestIDResults()

Returns a comma separated string of test IDs with test_results_to_users enabled

F_getTestIDResults( $test_id, mixed $user_id) : string
Parameters
$test_id :

(int) Test ID.

$user_id : mixed
Return values
string

F_getTestIDReports()

Returns a comma separated string of test IDs with test_results_to_users enabled

F_getTestIDReports( $test_id, mixed $user_id) : string
Parameters
$test_id :

(int) Test ID.

$user_id : mixed
Return values
string

F_getTestIDs()

Returns a comma separated string of test IDs with test_results_to_users enabled

F_getTestIDs( $test_id, mixed $user_id[, mixed $filter = 'test_results_to_users' ]) : string
Parameters
$test_id :

(int) Test ID.

$user_id : mixed
$filter : mixed = 'test_results_to_users'
Return values
string

F_send_user_reg_email()

Send a registration verification email to user.

F_send_user_reg_email( $user_id,  $user_email,  $user_verifycode) : mixed
Parameters
$user_id :

(int) User ID

$user_email :

(string) User email

$user_verifycode :

(string) user verification code

On this page
 

© 2004-2024 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy