TokenDynamic
extends LSActiveRecord
in package
Class TokenDynamic
Table of Contents
Properties
- $bEncryption : mixed
- $blacklisted : string
- $completed : string
- $custom_attributes : array<string|int, mixed>
- $email : string
- $emailstatus : string
- $emailstatus : string
- $firstname : string
- $language : string
- $lastname : string
- $mpid : int
- $participant_id : string
- $remindercount : int
- $remindersent : string
- $responses : array<string|int, SurveyDynamic>
- $sent : string
- $standardCols : array<string|int, mixed>
- $standardColsForGrid : array<string|int, mixed>
- $survey : Survey
- $tid : int
- $token : string
- $usesleft : int
- $validfrom : string
- $validuntil : string
- $sid : int
- $xssFilterAttributes : array<string|int, string>
Methods
- beforeSave() : mixed
- behaviors() : array<string|int, mixed>
- Lists the behaviors of this model
- canBeEmailed() : mixed
- canBeUsed() : bool
- Returns true if the token can be used
- checkColumns() : mixed
- Checks to make sure that all required columns exist in this tokens table (some older tokens tables dont' get udated properly)
- countAllAndCompleted() : mixed
- createToken() : string
- Creates and inserts token for a specific token record and returns the token string created
- createTokens() : array<string|int, int>
- Creates tokens for all token records that have empty token fields and returns the number of tokens created
- 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
- deleteToken() : 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
- findUninvited() : array<string|int, CActiveRecord>
- findUninvitedIDs() : array<string|int, mixed>|CDbDataReader
- getActions() : array<string|int, mixed>
- Return the buttons columns
- getAllEncryptedAttributes() : array<string|int, mixed>
- getAttributesForGrid() : array<string|int, mixed>
- getbuttons() : string
- getCompletedFormated() : string
- getCustom_attributes() : array<string|int, mixed>
- getEmailFormated() : string
- getEmailStatus() : mixed
- getEmailstatusFormated() : string
- getHasResponses() : mixed
- getMaxId() : false|int
- Return the max value for a field
- getMinId() : false|int
- Return the min value for a field
- getRemindersentFormated() : string
- getSentFormated() : string
- getStandardCols() : array<string|int, string>
- getStandardColsForGrid() : array<string|int, mixed>
- getSurveyId() : int
- Get current surveyId for other model/function
- getValidfromFormated() : string
- getValiduntilFormated() : string
- insertParticipant() : bool|int
- insertToken() : int
- model() : TokenDynamic
- primaryKey() : mixed
- relations() : mixed
- rules() : mixed
- search() : CActiveDataProvider
- selectEmptyTokens() : array<string|int, mixed>
- Retrieve an array of records with an empty token, in the result is just the id (tid)
- setEncryptedAttributeLabel() : string
- Function to show encryption symbol in gridview attribute header if value ois encrypted
- sid() : void
- Sets the survey ID for the next model
- tableName() : mixed
- updateAll() : int
- Updates records with the specified condition.
- updateEmailStatus() : int
- updateToken() : int
- 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
- getYesNoDateFormated() : string
Properties
$bEncryption
public
mixed
$bEncryption
= \false
$blacklisted
public
string
$blacklisted
$completed
public
string
$completed
$custom_attributes
public
array<string|int, mixed>
$custom_attributes
public
string
$email
$emailstatus
public
string
$emailstatus
$emailstatus
public
string
$emailstatus
Default value for email status
$firstname
public
string
$firstname
$language
public
string
$language
$lastname
public
string
$lastname
$mpid
public
int
$mpid
//TODO Describe me!
$participant_id
public
string
$participant_id
$remindercount
public
int
$remindercount
$remindersent
public
string
$remindersent
$responses
public
array<string|int, SurveyDynamic>
$responses
$sent
public
string
$sent
$standardCols
public
array<string|int, mixed>
$standardCols
$standardColsForGrid
public
array<string|int, mixed>
$standardColsForGrid
$survey
public
Survey
$survey
$tid
public
int
$tid
$token
public
string
$token
$usesleft
public
int
$usesleft
$validfrom
public
string
$validfrom
$validuntil
public
string
$validuntil
$sid
protected
static int
$sid
= 0
$xssFilterAttributes
protected
array<string|int, string>
$xssFilterAttributes
= []
Array of attributes that should be XSS filtered on mass updates
Methods
beforeSave()
public
beforeSave() : mixed
Tags
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>canBeEmailed()
public
canBeEmailed() : mixed
canBeUsed()
Returns true if the token can be used
public
canBeUsed() : bool
Return values
boolcheckColumns()
Checks to make sure that all required columns exist in this tokens table (some older tokens tables dont' get udated properly)
public
checkColumns() : mixed
This method should be moved to db update for 2.05 version so it runs only once per survey participants table / backup survey participants table
countAllAndCompleted()
public
static countAllAndCompleted(int $sid) : mixed
Parameters
- $sid : int
-
Survey ID
createToken()
Creates and inserts token for a specific token record and returns the token string created
public
createToken(int $iTokenID) : string
Parameters
- $iTokenID : int
Return values
string —token string
createTokens()
Creates tokens for all token records that have empty token fields and returns the number of tokens created
public
createTokens(int $iSurveyID) : array<string|int, int>
Parameters
- $iSurveyID : int
Return values
array<string|int, int> —( int number of created tokens, int number to be created tokens)
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(array<string|int, int> $iTokenIds) : int
Parameters
- $iTokenIds : array<string|int, int>
Return values
int —the number of rows deleted
deleteToken()
public
deleteToken(int $tokenid) : int
Parameters
- $tokenid : int
Return values
int —the number of rows deleted
dispatchPluginModelEvent()
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.
findUninvited()
public
findUninvited([array<string|int, int>|bool $aTokenIds = false ][, int $iMaxEmails = 0 ][, bool $bEmail = true ][, string $SQLemailstatuscondition = '' ][, string $SQLremindercountcondition = '' ][, string $SQLreminderdelaycondition = '' ]) : array<string|int, CActiveRecord>
Parameters
- $aTokenIds : array<string|int, int>|bool = false
- $iMaxEmails : int = 0
- $bEmail : bool = true
- $SQLemailstatuscondition : string = ''
- $SQLremindercountcondition : string = ''
- $SQLreminderdelaycondition : string = ''
Return values
array<string|int, CActiveRecord>findUninvitedIDs()
public
findUninvitedIDs([array<string|int, int>|bool $aTokenIds = false ][, int $iMaxEmails = 0 ][, bool $bEmail = true ][, string $SQLemailstatuscondition = '' ][, string $SQLremindercountcondition = '' ][, string $SQLreminderdelaycondition = '' ]) : array<string|int, mixed>|CDbDataReader
Parameters
- $aTokenIds : array<string|int, int>|bool = false
- $iMaxEmails : int = 0
- $bEmail : bool = true
- $SQLemailstatuscondition : string = ''
- $SQLremindercountcondition : string = ''
- $SQLreminderdelaycondition : string = ''
Return values
array<string|int, mixed>|CDbDataReadergetActions()
Return the buttons columns
public
getActions() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>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.
getAttributesForGrid()
public
getAttributesForGrid() : array<string|int, mixed>
Return values
array<string|int, mixed>getbuttons()
public
getbuttons() : string
Tags
Return values
stringgetCompletedFormated()
public
getCompletedFormated() : string
Return values
stringgetCustom_attributes()
public
getCustom_attributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getEmailFormated()
public
getEmailFormated() : string
Return values
stringgetEmailStatus()
public
getEmailStatus(string $token) : mixed
Parameters
- $token : string
getEmailstatusFormated()
public
getEmailstatusFormated() : string
Return values
stringgetHasResponses()
public
getHasResponses(mixed $sToken) : mixed
Parameters
- $sToken : mixed
getMaxId()
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|intgetRemindersentFormated()
public
getRemindersentFormated() : string
Return values
stringgetSentFormated()
public
getSentFormated() : string
Return values
stringgetStandardCols()
public
getStandardCols() : array<string|int, string>
Return values
array<string|int, string>getStandardColsForGrid()
public
getStandardColsForGrid() : array<string|int, mixed>
Return values
array<string|int, mixed>getSurveyId()
Get current surveyId for other model/function
public
getSurveyId() : int
Return values
intgetValidfromFormated()
public
getValidfromFormated() : string
Return values
stringgetValiduntilFormated()
public
getValiduntilFormated() : string
Return values
stringinsertParticipant()
public
insertParticipant( $data) : bool|int
Parameters
Return values
bool|intinsertToken()
public
insertToken(int $iSurveyID, array<string|int, mixed> $data) : int
Parameters
- $iSurveyID : int
- $data : array<string|int, mixed>
Return values
intmodel()
public
static model([string|null $sid = null ]) : TokenDynamic
Parameters
- $sid : string|null = null
Tags
Return values
TokenDynamicprimaryKey()
public
primaryKey() : mixed
Tags
relations()
public
relations() : mixed
Tags
rules()
public
rules() : mixed
Tags
search()
public
search() : CActiveDataProvider
Return values
CActiveDataProviderselectEmptyTokens()
Retrieve an array of records with an empty token, in the result is just the id (tid)
public
selectEmptyTokens(int $iSurveyID) : array<string|int, mixed>
Parameters
- $iSurveyID : int
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
stringsid()
Sets the survey ID for the next model
public
static sid(int $sid) : void
Parameters
- $sid : int
Tags
tableName()
public
tableName() : mixed
Tags
updateAll()
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
updateEmailStatus()
public
updateEmailStatus(string $token, string $status) : int
Parameters
- $token : string
- $status : string
Return values
intupdateToken()
public
updateToken(int $tid, string $newToken) : int
Parameters
- $tid : int
- $newToken : string
Return values
intquery()
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
getYesNoDateFormated()
private
getYesNoDateFormated(string $field) : string
Parameters
- $field : string