SurveyUseCaptcha
in package
Class for handling survey use captcha (some functions are old)
Tags
Table of Contents
Constants
- REGISTRATION_INHERIT = ['E', 'H', 'J', 'K', 'O', 'P', '1', '3', '6']
- REGISTRATION_NO = ['L', 'T', '2', '4', '5', 'C', 'X', 'S', 'N']
- REGISTRATION_YES = ['A', 'B', 'D', 'R', 'F', 'G', 'I', 'M', 'U']
- Code/Mapping for useCaptcha in registration
- SAVE_LOAD_INHERIT = ['E', 'F', 'I', 'K', 'T', 'U', '2', '3', '5']
- SAVE_LOAD_NO = ['M', 'O', '1', '4', '6', 'B', 'X', 'R', 'N']
- SAVE_LOAD_YES = ['A', 'C', 'D', 'S', 'G', 'H', 'J', 'L', 'P']
- Code/Mapping for useCaptcha in save and load
- SURVEY_ACCESS_INHERIT = ['E', 'G', 'I', 'J', 'L', 'M', '1', '2', '4']
- SURVEY_ACCESS_NO = ['P', 'U', '3', '5', '6', 'D', 'R', 'S', 'N']
- SURVEY_ACCESS_YES = ['A', 'B', 'C', 'X', 'F', 'H', 'K', 'O', 'T']
- Code/Mapping for useCaptcha in survey access
- USE_CAPTCHA = ['A', 'B', 'C', 'D', 'X', 'R', 'S', 'N', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'O', 'P', 'T', 'U', '1', '2', '3', '4', '5', '6']
- Code/Mapping for useCaptcha
Properties
Methods
- __construct() : mixed
- convertSurveyAccessToUseCaptcha() : string
- Saves the new value for survey access in db.
- convertUseCaptchaForDB() : string
- Convert from 3 values to 1 char for captcha usages
- convertUseCaptchaFromDB() : array<string|int, mixed>
- Converts useCaptcha from db to the real values Y/N for all three types (access, registration,saveAndLoad).
- mergeUseCaptchaValues() : string
- Resolves inherited components in $current by replacing any 'I' sub-value with the corresponding component decoded from $parent, then re-encodes to the packed one-character format.
- reCalculateUseCaptcha() : string
- Transforms the three values for useCaptcha into one.
Constants
REGISTRATION_INHERIT
public
mixed
REGISTRATION_INHERIT
= ['E', 'H', 'J', 'K', 'O', 'P', '1', '3', '6']
REGISTRATION_NO
public
mixed
REGISTRATION_NO
= ['L', 'T', '2', '4', '5', 'C', 'X', 'S', 'N']
REGISTRATION_YES
Code/Mapping for useCaptcha in registration
public
mixed
REGISTRATION_YES
= ['A', 'B', 'D', 'R', 'F', 'G', 'I', 'M', 'U']
SAVE_LOAD_INHERIT
public
mixed
SAVE_LOAD_INHERIT
= ['E', 'F', 'I', 'K', 'T', 'U', '2', '3', '5']
SAVE_LOAD_NO
public
mixed
SAVE_LOAD_NO
= ['M', 'O', '1', '4', '6', 'B', 'X', 'R', 'N']
SAVE_LOAD_YES
Code/Mapping for useCaptcha in save and load
public
mixed
SAVE_LOAD_YES
= ['A', 'C', 'D', 'S', 'G', 'H', 'J', 'L', 'P']
SURVEY_ACCESS_INHERIT
public
mixed
SURVEY_ACCESS_INHERIT
= ['E', 'G', 'I', 'J', 'L', 'M', '1', '2', '4']
SURVEY_ACCESS_NO
public
mixed
SURVEY_ACCESS_NO
= ['P', 'U', '3', '5', '6', 'D', 'R', 'S', 'N']
SURVEY_ACCESS_YES
Code/Mapping for useCaptcha in survey access
public
mixed
SURVEY_ACCESS_YES
= ['A', 'B', 'C', 'X', 'F', 'H', 'K', 'O', 'T']
USE_CAPTCHA
Code/Mapping for useCaptcha
public
mixed
USE_CAPTCHA
= ['A', 'B', 'C', 'D', 'X', 'R', 'S', 'N', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'O', 'P', 'T', 'U', '1', '2', '3', '4', '5', '6']
Properties
$survey
private
Survey
$survey
Methods
__construct()
public
__construct([mixed $surveyId = null ][, Survey|null $survey = null ]) : mixed
Parameters
- $surveyId : mixed = null
- $survey : Survey|null = null
convertSurveyAccessToUseCaptcha()
Saves the new value for survey access in db.
public
convertSurveyAccessToUseCaptcha( $value, $mode) : string
Parameters
- $value :
-
bool survey access
- $mode :
-
string mode of conversion can be 'surveyAccess', 'registration' or 'saveAndLoad'
Tags
Return values
stringconvertUseCaptchaForDB()
Convert from 3 values to 1 char for captcha usages
public
convertUseCaptchaForDB( $surveyAccess, $registration, $saveAndLoad) : string
'A' = All three captcha enabled 'B' = All but save and load 'C' = All but registration 'D' = All but survey access 'X' = Only survey access 'R' = Only registration 'S' = Only save and load
'E' = All inherited 'F' = Inherited save and load + survey access + registration 'G' = Inherited survey access + registration + save and load 'H' = Inherited registration + save and load + survey access 'I' = Inherited save and load + inherited survey access + registration 'J' = Inherited survey access + inherited registration + save and load 'K' = Inherited registration + inherited save and load + survey access
'L' = Inherited survey access + save and load 'M' = Inherited survey access + registration 'O' = Inherited registration + survey access '1' = Inherited survey access + inherited registration '2' = Inherited survey access + inherited save and load '3' = Inherited registration + inherited save and load '4' = Inherited survey access '5' = Inherited save and load '6' = Inherited registration
'N' = None
Parameters
Return values
string —One character that corresponds to captcha usage
convertUseCaptchaFromDB()
Converts useCaptcha from db to the real values Y/N for all three types (access, registration,saveAndLoad).
public
convertUseCaptchaFromDB(string $useCaptcha[, bool $showInherited = true ]) : array<string|int, mixed>
Parameters
- $useCaptcha : string
- $showInherited : bool = true
-
if set to true, then 'I' should be included. Otherwise, only Y/N should be returned as result.
Return values
array<string|int, mixed> —has the following structure ['surveyAccess'] ['registration'] ['saveAndLoad']
mergeUseCaptchaValues()
Resolves inherited components in $current by replacing any 'I' sub-value with the corresponding component decoded from $parent, then re-encodes to the packed one-character format.
public
mergeUseCaptchaValues(string $current, string $parent) : string
This method resolves inheritance one level up. Complete resolution requires recursion up the chain (e.g., via SurveysGroupsettings::getInstance()) or passing a fully-resolved $parent.
Parameters
- $current : string
-
Packed usecaptcha for the child level (may contain 'I' components)
- $parent : string
-
Packed usecaptcha from the parent level to inherit from
Return values
string —Packed usecaptcha
reCalculateUseCaptcha()
Transforms the three values for useCaptcha into one.
public
reCalculateUseCaptcha(array<string|int, mixed> $data) : string
Parameters
- $data : array<string|int, mixed>