SurveyCondition
in package
Tags
Table of Contents
Constants
- X = 'X'
Properties
- $iSurveyID : int
- $language : string
- $processedSurveys : mixed
- $tokenFieldsAndNames : array<string|int, mixed>
- $tokenTableExists : bool
- $app : LSYii_Application
- $permission : Permission
- $survey : Survey
Methods
- __construct() : mixed
- Constructor
- conditionScript() : void
- conditionScript action
- copyConditions() : void
- copyConditions action
- deleteAllConditions() : void
- deleteAllConditions action
- deleteAllConditionsOfSurvey() : void
- deleteAllConditionsOfSurvey cation
- deleteCondition() : void
- deleteCondition action
- deleteScenario() : void
- deleteScenario action
- getAllScenarios() : mixed
- Gets all scenarios based on question id
- getCidsOfQid() : array<string|int, int>
- Finds the condition ids by the question's id they belong to
- getConditionText() : string
- Gets the condition text based on a qid
- getFieldName() : string
- Gets the field's name by sid, gid, qid and title
- getQIDFromFieldName() : string
- Gets the question's id from the field's name
- getScenariosAndConditionsOfQuestion() : array<string|int, mixed>
- Retrieves scenarios and conditions of question
- getSurveyIsAnonymized() : bool
- Determines whether the survey is anonymized
- getSurveyTable() : string
- Gets the survey table by name and id
- index() : array<string|int, mixed>
- index action. This is a composite action, a legacy code from its original implementation that calls the action and displays the results
- initialize() : array<string|int, mixed>
- Initializing the service based on a received array that contains: - iSurveyID
- insertCondition() : array<string|int, mixed>
- insertCondition action
- renumberScenarios() : void
- renumberScenarios action
- resetSurveyLogic() : void
- resetSurveyLogic action
- setISurveyID() : static
- Sets the iSurveyID member of this object
- updateCondition() : void
- updateCondition action
- updateScenario() : void
- updateScenario action
- getAttributeName() : string
- Returns the attribute name based on extracted token attributes
- getCAnswersAndCQuestions() : array<string|int, mixed>
- Gets C answers and C questions based on an array of rows
- getHiddenFields() : string
- Returns hidden fields for rows
- getPostQuestionList() : array<string|int, mixed>
- Gets the post question list based on question id and question rows
- getPostRows() : array<int, array{gid: mixed, mandatory: mixed, other: mixed, qid: mixed, question: mixed, sid: mixed, title: mixed, type: mixed}>
- Gets the post rows from the question list
- getQCount() : int
- Returns the question count of an array received as parameter
- getQuestionList() : array<string|int, mixed>
- Gets a question list by question id and rows
- getQuestionNavOptions() : string
- Gets question navigation options
- getQuestionRows() : array<string|int, mixed>
- Gets the question rows based on the value of the $iSurveyID data-member
- getQuestionTitleAndText() : array<string|int, mixed>
- Returns question title and text based on qid
- getQuickAddConditionForm() : string
- Returns the quick add condition form for the group and question based on the received arguments
- getTheseRows() : array<int, array{gid: mixed, mandatory: mixed, other: mixed, qid: mixed, question: mixed, sid: mixed, title: mixed, type: mixed}>
- Gets rows from the question list
- renderFormAux() : string
- Helper function to render form.
Constants
X
protected
mixed
X
= 'X'
Properties
$iSurveyID
protected
int
$iSurveyID
$language
protected
string
$language
$processedSurveys
protected
mixed
$processedSurveys
= []
$tokenFieldsAndNames
protected
array<string|int, mixed>
$tokenFieldsAndNames
$tokenTableExists
protected
bool
$tokenTableExists
$app
private
LSYii_Application
$app
$permission
private
Permission
$permission
$survey
private
Survey
$survey
Methods
__construct()
Constructor
public
__construct(LSYii_Application $app, Permission $permission, Survey $survey) : mixed
Parameters
- $app : LSYii_Application
- $permission : Permission
- $survey : Survey
conditionScript()
conditionScript action
public
conditionScript(int $qid, string $script) : void
Parameters
- $qid : int
-
the question id
- $script : string
-
the custom script to be stored
copyConditions()
copyConditions action
public
copyConditions(array<string|int, int> $copyconditionsfrom, array<string|int, mixed> $copyconditionsto, object $app) : void
Parameters
- $copyconditionsfrom : array<string|int, int>
-
an int array containing the condition ids to be copied
- $copyconditionsto : array<string|int, mixed>
- $app : object
-
the app object
Tags
deleteAllConditions()
deleteAllConditions action
public
deleteAllConditions(int $qid, $app) : void
Parameters
deleteAllConditionsOfSurvey()
deleteAllConditionsOfSurvey cation
public
deleteAllConditionsOfSurvey(int $sid, object $app) : void
Parameters
- $sid : int
-
the survey id
- $app : object
-
the app object
deleteCondition()
deleteCondition action
public
deleteCondition(int $qid, int $p_cid) : void
Parameters
- $qid : int
-
question id
- $p_cid : int
-
condition id
deleteScenario()
deleteScenario action
public
deleteScenario(int $qid, int $p_scenario) : void
Parameters
- $qid : int
-
the question id
- $p_scenario : int
-
the scenario id
getAllScenarios()
Gets all scenarios based on question id
public
getAllScenarios(int $qid) : mixed
Parameters
- $qid : int
getCidsOfQid()
Finds the condition ids by the question's id they belong to
public
getCidsOfQid(int $qid) : array<string|int, int>
Parameters
- $qid : int
-
the question id
Return values
array<string|int, int>getConditionText()
Gets the condition text based on a qid
public
getConditionText(Question $question) : string
Parameters
- $question : Question
Return values
stringgetFieldName()
Gets the field's name by sid, gid, qid and title
public
getFieldName(int $sid, int $gid, int $qid[, string $title = '' ]) : string
Parameters
- $sid : int
- $gid : int
- $qid : int
- $title : string = ''
Return values
stringgetQIDFromFieldName()
Gets the question's id from the field's name
public
getQIDFromFieldName(string $copyc) : string
Parameters
- $copyc : string
Return values
stringgetScenariosAndConditionsOfQuestion()
Retrieves scenarios and conditions of question
public
getScenariosAndConditionsOfQuestion(int $qid) : array<string|int, mixed>
Parameters
- $qid : int
-
the question id
Return values
array<string|int, mixed> —generates an array of the format of [ { "scid": 1, "conditions": [ { "cid": 1, "qid": 2, "cqid": 1, "cfieldname": "the fieldname taken from the database", "method": "the method", "value": "the value", }, //... ] } //... ]
getSurveyIsAnonymized()
Determines whether the survey is anonymized
public
getSurveyIsAnonymized([int $iSurveyID = 0 ]) : bool
Parameters
- $iSurveyID : int = 0
-
the survey id
Return values
bool —whether the survey is anonymized
getSurveyTable()
Gets the survey table by name and id
public
getSurveyTable(string $name, int $id) : string
Parameters
- $name : string
- $id : int
Return values
stringindex()
index action. This is a composite action, a legacy code from its original implementation that calls the action and displays the results
public
index(array<string|int, mixed> $args, array<string|int, mixed> $aData, string $subaction, string $method, int $gid, int $qid, string $imageurl, mixed $extraGetParams, object $caller) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed>
-
arguments
- $aData : array<string|int, mixed>
-
data to be passed to template
- $subaction : string
-
the subaction to be executed
- $method : string
-
the method to be performed
- $gid : int
-
the group id
- $qid : int
-
the question id
- $imageurl : string
-
the image's url
- $extraGetParams : mixed
-
legacy parameter, I don't know what it represents
- $caller : object
-
the object using the service
Tags
Return values
array<string|int, mixed>initialize()
Initializing the service based on a received array that contains: - iSurveyID
public
initialize(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
Return values
array<string|int, mixed>insertCondition()
insertCondition action
public
insertCondition(array<string|int, mixed> $args, string $editSourceTab, string $editTargetTab, object $app, string $ConditionConst, string $prevQuestionSGQA, string $tokenAttr, string $ConditionRegexp[, array<string|int, mixed> $tempcids = [] ]) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed>
-
the arguments
- $editSourceTab : string
-
the source tab
- $editTargetTab : string
-
the target tab
- $app : object
-
the app object
- $ConditionConst : string
-
the constant value of the question to match
- $prevQuestionSGQA : string
-
the previous question's descriptor, such as @453614X608X15982@
- $tokenAttr : string
-
the token placeholder, such as {TOKEN:FIRSTNAME}
- $ConditionRegexp : string
-
the regular expression to match
- $tempcids : array<string|int, mixed> = []
-
the list of cids to be replaced with actual ids
Tags
Return values
array<string|int, mixed>renumberScenarios()
renumberScenarios action
public
renumberScenarios(int $qid, object $app) : void
Parameters
- $qid : int
-
the question id
- $app : object
-
the app object
resetSurveyLogic()
resetSurveyLogic action
public
resetSurveyLogic() : void
setISurveyID()
Sets the iSurveyID member of this object
public
setISurveyID(int $iSurveyID) : static
Parameters
- $iSurveyID : int
Return values
staticupdateCondition()
updateCondition action
public
updateCondition(array<string|int, mixed> $args, string $editTargetTab, object $app, string $ConditionConst, string $prevQuestionSGQA, string $tokenAttr, string $ConditionRegexp[, string $editSourceTab = "#SRCPREVQUEST" ]) : void
Parameters
- $args : array<string|int, mixed>
-
the arguments
- $editTargetTab : string
-
the target tab
- $app : object
-
the application object
- $ConditionConst : string
-
the constant value the response is supposed to be equal to
- $prevQuestionSGQA : string
-
the previous question's descriptor, such as @453614X608X15982@
- $tokenAttr : string
-
the token placeholder, such as {TOKEN:FIRSTNAME}
- $ConditionRegexp : string
-
the regular expression to match
- $editSourceTab : string = "#SRCPREVQUEST"
-
the source tab
Tags
updateScenario()
updateScenario action
public
updateScenario(int $p_newscenarionum, int $qid, int $p_scenario, object $app) : void
Parameters
- $p_newscenarionum : int
-
the new scenario number
- $qid : int
-
the question id
- $p_scenario : int
-
the old scenario number
- $app : object
-
the app object
getAttributeName()
Returns the attribute name based on extracted token attributes
protected
getAttributeName(array<string|int, mixed> $extractedTokenAttr) : string
Parameters
- $extractedTokenAttr : array<string|int, mixed>
-
an array of extracted token attributes
Return values
string —returns the attribute name
getCAnswersAndCQuestions()
Gets C answers and C questions based on an array of rows
protected
getCAnswersAndCQuestions(array<string|int, mixed> $theserows) : array<string|int, mixed>
Parameters
- $theserows : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getHiddenFields()
Returns hidden fields for rows
protected
getHiddenFields(array<string|int, mixed> $rows, string $leftOperandType, string $rightOperandType) : string
Parameters
- $rows : array<string|int, mixed>
-
an array of rows
- $leftOperandType : string
-
the type of the left-hand operand
- $rightOperandType : string
-
the type of the right-hand operand
Return values
string —the html
getPostQuestionList()
Gets the post question list based on question id and question rows
protected
getPostQuestionList(int $qid, array<string|int, mixed> $qrows) : array<string|int, mixed>
Parameters
- $qid : int
-
the question id
- $qrows : array<string|int, mixed>
-
the question rows
Return values
array<string|int, mixed> —the post question list
getPostRows()
Gets the post rows from the question list
protected
getPostRows(array<string|int, mixed> $postquestionlist) : array<int, array{gid: mixed, mandatory: mixed, other: mixed, qid: mixed, question: mixed, sid: mixed, title: mixed, type: mixed}>
Parameters
- $postquestionlist : array<string|int, mixed>
Return values
array<int, array{gid: mixed, mandatory: mixed, other: mixed, qid: mixed, question: mixed, sid: mixed, title: mixed, type: mixed}>getQCount()
Returns the question count of an array received as parameter
protected
getQCount(array<string|int, mixed> $cquestions) : int
Parameters
- $cquestions : array<string|int, mixed>
Return values
intgetQuestionList()
Gets a question list by question id and rows
protected
getQuestionList(int $qid, array<string|int, mixed> $qrows) : array<string|int, mixed>
Parameters
- $qid : int
-
the question id
- $qrows : array<string|int, mixed>
-
the question rows
Return values
array<string|int, mixed>getQuestionNavOptions()
Gets question navigation options
protected
getQuestionNavOptions(int $gid, int $qid, array<string|int, mixed> $theserows, array<string|int, mixed> $postrows, array<string|int, mixed> $args, object $caller) : string
Parameters
- $gid : int
-
the group id
- $qid : int
-
the question id
- $theserows : array<string|int, mixed>
-
question rows
- $postrows : array<string|int, mixed>
-
question post rows
- $args : array<string|int, mixed>
-
further arguments
- $caller : object
-
the object that uses the service
Tags
Return values
string —the nav options
getQuestionRows()
Gets the question rows based on the value of the $iSurveyID data-member
protected
getQuestionRows() : array<string|int, mixed>
Return values
array<string|int, mixed>getQuestionTitleAndText()
Returns question title and text based on qid
protected
getQuestionTitleAndText(int $qid) : array<string|int, mixed>
Parameters
- $qid : int
Return values
array<string|int, mixed>getQuickAddConditionForm()
Returns the quick add condition form for the group and question based on the received arguments
protected
getQuickAddConditionForm(int $gid, int $qid, array<string|int, mixed> $args, object $caller) : string
Parameters
- $gid : int
-
the group id
- $qid : int
-
the question id
- $args : array<string|int, mixed>
-
further arguments
- $caller : object
-
the object that uses the service
Tags
Return values
string —the form's HTML
getTheseRows()
Gets rows from the question list
protected
getTheseRows(array<string|int, mixed> $questionlist) : array<int, array{gid: mixed, mandatory: mixed, other: mixed, qid: mixed, question: mixed, sid: mixed, title: mixed, type: mixed}>
Parameters
- $questionlist : array<string|int, mixed>
Return values
array<int, array{gid: mixed, mandatory: mixed, other: mixed, qid: mixed, question: mixed, sid: mixed, title: mixed, type: mixed}>renderFormAux()
Helper function to render form.
protected
renderFormAux(Question $question) : string
Used by create and edit actions.
Parameters
- $question : Question
-
Question