Condition
extends LSActiveRecord
in package
Class Condition
Table of Contents
Properties
- $bEncryption : mixed
- $cfieldname : string
- $cid : int
- $cqid : int
- $method : string
- $qid : int
- $questions : Question
- $scenario : int
- $value : string
- $xssFilterAttributes : array<string|int, string>
Methods
- behaviors() : array<string|int, mixed>
- Lists the behaviors of this model
- decrypt() : mixed
- Decrypt values from database
- decryptEncryptAttributes() : mixed
- Encrypt/decrypt values
- decryptSingle() : string
- Decrypt single value
- decryptSingleOld() : string
- Decrypt single value
- deleteAllByAttributes() : int
- deleteRecords() : int
- dispatchPluginModelEvent() : PluginEvent
- encrypt() : mixed
- Encrypt values
- encryptAttributeValues() : array<string|int, mixed>
- Attribute values are encrypted ( if needed )to be used for searching purposes
- encryptSave() : mixed
- Encrypt values before saving to the database
- encryptSingle() : mixed
- Enrypt single value
- findAllAsArray() : array<string|int, mixed>
- Finds all active records satisfying the specified condition but returns them as array
- findAllByAttributes() : array<string|int, static>
- Overriding of Yii's findAllByAttributes method to provide encrypted attribute value search
- findByAttributes() : static|null
- Overriding of Yii's findByAttributes method to provide encrypted attribute value search
- getAllCfieldnameWithDependenciesForOneSurvey() : mixed
- getAllEncryptedAttributes() : array<string|int, mixed>
- getConditionCount() : int
- getConditionCountToken() : int
- getConditions() : array<string|int, mixed>
- getConditionsQuestions() : mixed
- getConditionsToken() : CDbDataReader
- getMaxId() : false|int
- Return the max value for a field
- getMinId() : false|int
- Return the min value for a field
- getScenarios() : CDbDataReader
- getSomeConditions() : CDbDataReader
- insertRecords() : mixed
- model() : Condition
- primaryKey() : string
- Returns the primary key of this table
- relations() : array<string|int, mixed>
- Defines the relations for this model
- setEncryptedAttributeLabel() : string
- Function to show encryption symbol in gridview attribute header if value ois encrypted
- tableName() : string
- Returns the setting's table name to be used by the model
- updateAll() : int
- Updates records with the specified condition.
- updateCFieldName() : mixed
- Updates the group ID for all conditions
- query() : mixed
- Modified version that default to do the same as the original, but allows via a third parameter to retrieve the result as array instead of active records. This solves a joining problem. Usage via findAllAsArray method
Properties
$bEncryption
public
mixed
$bEncryption
= \false
$cfieldname
public
string
$cfieldname
Condition field-name as SGQA identifier
$cid
public
int
$cid
ID (primary key)
$cqid
public
int
$cqid
Question id (grouping question)
$method
public
string
$method
Logical operator see here
$qid
public
int
$qid
Question id (subquestion)
$questions
public
Question
$questions
$scenario
public
int
$scenario
Scenario number
$value
public
string
$value
Value to be compared against
$xssFilterAttributes
protected
array<string|int, string>
$xssFilterAttributes
= []
Array of attributes that should be XSS filtered on mass updates
Methods
behaviors()
Lists the behaviors of this model
public
behaviors() : array<string|int, mixed>
Below is a list of all behaviors we register:
Tags
Return values
array<string|int, mixed>decrypt()
Decrypt values from database
public
decrypt([mixed $value = '' ]) : mixed
Parameters
- $value : mixed = ''
decryptEncryptAttributes()
Encrypt/decrypt values
public
decryptEncryptAttributes([mixed $action = 'decrypt' ]) : mixed
Parameters
- $action : mixed = 'decrypt'
decryptSingle()
Decrypt single value
public
static decryptSingle([string $value = '' ]) : string
Parameters
- $value : string = ''
-
String value which needs to be decrypted
Return values
string —the decrypted string
decryptSingleOld()
Decrypt single value
public
static decryptSingleOld([string $value = '' ]) : string
Parameters
- $value : string = ''
-
String value which needs to be decrypted
Return values
string —the decrypted string
deleteAllByAttributes()
public
deleteAllByAttributes(array<string|int, mixed> $attributes[, string $condition = '' ][, array<string|int, mixed> $params = [] ]) : int
Parameters
- $attributes : array<string|int, mixed>
-
list of attribute values (indexed by attribute names) that the active records should match. An attribute value can be an array which will be used to generate an IN condition.
- $condition : string = ''
-
query condition or criteria.
- $params : array<string|int, mixed> = []
-
parameters to be bound to an SQL statement.
Tags
Return values
int —number of rows affected by the execution.
deleteRecords()
public
deleteRecords([bool|mixed $condition = false ]) : int
Parameters
- $condition : bool|mixed = false
Return values
intdispatchPluginModelEvent()
public
dispatchPluginModelEvent(string $sEventName, CDbCriteria $criteria = null, array<string|int, mixed> $eventParams = []) : PluginEvent
Parameters
- $sEventName : string
- $criteria = null : CDbCriteria
- $eventParams = [] : array<string|int, mixed>
Return values
PluginEventencrypt()
Encrypt values
public
encrypt() : mixed
encryptAttributeValues()
Attribute values are encrypted ( if needed )to be used for searching purposes
public
encryptAttributeValues([array<string|int, mixed> $attributes = null ][, mixed $bEncryptedOnly = false ][, mixed $bReplaceValues = true ]) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed> = null
-
list of attribute values (indexed by attribute names) that the active records should match. An attribute value can be an array which will be used to generate an IN condition.
- $bEncryptedOnly : mixed = false
- $bReplaceValues : mixed = true
Return values
array<string|int, mixed> —attributes array with encrypted atrribute values is returned
encryptSave()
Encrypt values before saving to the database
public
encryptSave([mixed $runValidation = false ]) : mixed
Parameters
- $runValidation : mixed = false
encryptSingle()
Enrypt single value
public
static encryptSingle([string $value = '' ]) : mixed
Parameters
- $value : string = ''
-
String value which needs to be encrypted
findAllAsArray()
Finds all active records satisfying the specified condition but returns them as array
public
findAllAsArray([mixed $condition = '' ][, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
- $condition : mixed = ''
-
query condition or criteria.
- $params : array<string|int, mixed> = []
-
parameters to be bound to an SQL statement.
Return values
array<string|int, mixed> —list of active records satisfying the specified condition. An empty array is returned if none is found.
findAllByAttributes()
Overriding of Yii's findAllByAttributes method to provide encrypted attribute value search
public
findAllByAttributes(array<string|int, mixed> $attributes[, mixed $condition = '' ][, array<string|int, mixed> $params = [] ]) : array<string|int, static>
Parameters
- $attributes : array<string|int, mixed>
-
list of attribute values (indexed by attribute names) that the active records should match. An attribute value can be an array which will be used to generate an IN condition.
- $condition : mixed = ''
-
query condition or criteria.
- $params : array<string|int, mixed> = []
-
parameters to be bound to an SQL statement.
Return values
array<string|int, static> —the records found. An empty array is returned if none is found.
findByAttributes()
Overriding of Yii's findByAttributes method to provide encrypted attribute value search
public
findByAttributes(array<string|int, mixed> $attributes[, mixed $condition = '' ][, array<string|int, mixed> $params = [] ]) : static|null
Parameters
- $attributes : array<string|int, mixed>
-
list of attribute values (indexed by attribute names) that the active record should match. An attribute value can be an array which will be used to generate an IN condition.
- $condition : mixed = ''
-
query condition or criteria.
- $params : array<string|int, mixed> = []
-
parameters to be bound to an SQL statement.
Return values
static|null —the record found. Null if none is found.
getAllCfieldnameWithDependenciesForOneSurvey()
public
getAllCfieldnameWithDependenciesForOneSurvey(int $sid) : mixed
Parameters
- $sid : int
getAllEncryptedAttributes()
public
getAllEncryptedAttributes(int $iSurveyId, string $sClassName) : array<string|int, mixed>
Parameters
- $iSurveyId : int
- $sClassName : string
Return values
array<string|int, mixed> —TODO: Should be split into seperate functions in the appropiate model or helper class TODO: Make an interface for records that support encryption.
getConditionCount()
public
getConditionCount(int $qid, string $language, Condition $scenarionr) : int
Parameters
- $qid : int
- $language : string
- $scenarionr : Condition
Return values
intgetConditionCountToken()
public
getConditionCountToken(int $qid, Condition $scenarionr) : int
Parameters
- $qid : int
- $scenarionr : Condition
Tags
Return values
intgetConditions()
public
getConditions(int $qid, $language, Condition $scenarionr) : array<string|int, mixed>
Parameters
- $qid : int
- $language :
- $scenarionr : Condition
Return values
array<string|int, mixed>getConditionsQuestions()
public
getConditionsQuestions(mixed $distinctrow, mixed $deqrow, mixed $scenariorow, mixed $surveyprintlang) : mixed
Parameters
- $distinctrow : mixed
- $deqrow : mixed
- $scenariorow : mixed
- $surveyprintlang : mixed
getConditionsToken()
public
getConditionsToken(int $qid, Condition $scenarionr) : CDbDataReader
Parameters
- $qid : int
- $scenarionr : Condition
Return values
CDbDataReadergetMaxId()
Return the max value for a field
public
getMaxId([string $field = null ][, bool $forceRefresh = false ]) : false|int
This is a convenience method, that uses the primary key of the model to retrieve the highest value.
Parameters
- $field : string = null
-
The field that contains the Id, when null primary key is used if it is a single field
- $forceRefresh : bool = false
-
Don't use value from static cache but always requery the database
Tags
Return values
false|intgetMinId()
Return the min value for a field
public
getMinId([string $field = null ][, bool $forceRefresh = false ]) : false|int
This is a convenience method, that uses the primary key of the model to retrieve the highest value.
Parameters
- $field : string = null
-
The field that contains the Id, when null primary key is used if it is a single field
- $forceRefresh : bool = false
-
Don't use value from static cache but always requery the database
Tags
Return values
false|intgetScenarios()
public
getScenarios(int $qid) : CDbDataReader
Parameters
- $qid : int
Return values
CDbDataReadergetSomeConditions()
public
getSomeConditions(array<string|int, mixed> $fields, mixed $condition, string $order, array<string|int, mixed> $group) : CDbDataReader
Parameters
- $fields : array<string|int, mixed>
- $condition : mixed
- $order : string
- $group : array<string|int, mixed>
Return values
CDbDataReaderinsertRecords()
public
insertRecords(mixed $data[, mixed $update = false ][, mixed $condition = false ]) : mixed
Parameters
- $data : mixed
- $update : mixed = false
- $condition : mixed = false
model()
public
static model([mixed $className = __CLASS__ ]) : Condition
Parameters
- $className : mixed = __CLASS__
Tags
Return values
ConditionprimaryKey()
Returns the primary key of this table
public
primaryKey() : string
Tags
Return values
stringrelations()
Defines the relations for this model
public
relations() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>setEncryptedAttributeLabel()
Function to show encryption symbol in gridview attribute header if value ois encrypted
public
setEncryptedAttributeLabel(int $surveyId, string $className, string $attributeName) : string
Parameters
- $surveyId : int
- $className : string
- $attributeName : string
Tags
Return values
stringtableName()
Returns the setting's table name to be used by the model
public
tableName() : string
Tags
Return values
stringupdateAll()
Updates records with the specified condition.
public
updateAll(array<string|int, mixed> $attributes[, mixed $condition = '' ][, array<string|int, mixed> $params = array() ]) : int
XSS filtering is enforced for attributes listed in model's $xssFilterAttributes property. See for detailed explanation about $condition and $params. Note, the attributes are not checked for safety and no validation is done.
Parameters
- $attributes : array<string|int, mixed>
-
list of attributes (name=>$value) to be updated
- $condition : mixed = ''
-
query condition or criteria.
- $params : array<string|int, mixed> = array()
-
parameters to be bound to an SQL statement.
Return values
int —the number of rows being updated
updateCFieldName()
Updates the group ID for all conditions
public
updateCFieldName(int $iSurveyID, int $iQuestionID, int $iOldGroupID, int $iNewGroupID) : mixed
Parameters
- $iSurveyID : int
- $iQuestionID : int
- $iOldGroupID : int
- $iNewGroupID : int
query()
Modified version that default to do the same as the original, but allows via a third parameter to retrieve the result as array instead of active records. This solves a joining problem. Usage via findAllAsArray method
protected
query(CDbCriteria $criteria[, bool $all = false ][, bool $asAR = true ]) : mixed
Performs the actual DB query and populates the AR objects with the query result. This method is mainly internally used by other AR query methods.
Parameters
- $criteria : CDbCriteria
-
the query criteria
- $all : bool = false
-
whether to return all data
- $asAR : bool = true
Tags
Return values
mixed —the AR objects populated with the query result