utils.php

Functions

permission_unit()

permission_unit(integer $area_id) : \HTML

Check permissions to access to the Unit If an user doesn't have access, he has a form to input the code

Parameters

integer $area_id

the ID of the Unit

Returns

\HTML —

Form to input the code

toChars()

toChars(string $number) : string

Convert number to char

Parameters

string $number

Returns

string

monitor_insert_result()

monitor_insert_result(integer $area_id, integer $question_id, integer $question_pos, integer $answer_id, integer $answer_pos, integer $finish) : string

Write statistics It writes all steps of unit except "next"

Parameters

integer $area_id

the ID of the Unit

integer $question_id

the ID of Question

integer $question_pos

the Position of Question

integer $answer_id

the ID of Answer

integer $answer_pos

the Position of Answer

integer $finish

the Finish step of Questions

Returns

string —

the finish code for identification user in statisctic and to get access to next Unit

generateCode()

generateCode(integer $length) : string

Generate a random code;

Parameters

integer $length

code

Returns

string —

a random code

crypt_key()

crypt_key(string $input, string $key, boolean $decode) : string

Crypt a key

Parameters

string $input

a code

string $key

a key for code

boolean $decode

trigger to encrypt and decrypt the code

Returns

string —

a encrypted or a decrypted code

lang_getfrombrowser()

lang_getfrombrowser(array $allowed_languages, string $default_language, null $lang_variable, boolean $strict_mode) : string

Browswer language detection, refer to Christian Seiler http://.de.selfhtml.org/ detect browser language

Parameters

array $allowed_languages

allowed languages

string $default_language

default language

null $lang_variable

language variable

boolean $strict_mode

strict mode

Returns

string —

a current language;

validate_email()

validate_email(string $email) : integer

Function to Validate Email addresses

Parameters

string $email

Email

Returns

integer —

true or false

interview_print_questions()

interview_print_questions(integer $area_id, integer $question_id, integer $hide_answers)

Outputs question table on the right side of the interview_edit.php page.

Parameters

integer $area_id

the ID of the Unit

integer $question_id

the ID of Question

integer $hide_answers

hide question

interview_print_answers()

interview_print_answers(integer $area_id, integer $question_id)

Prints out the Answers on the left side of the interview_edit.php page.

Parameters

integer $area_id

the ID of the Unit

integer $question_id

the ID of Question

purge_carry_forward_temp()

purge_carry_forward_temp()

Clean the table carry_forward_temp in the database

allowed_languages()

allowed_languages() : array

Return allowed languages

Returns

array —

list of languages