LimeSurvey API - Master branch

Participant extends LSActiveRecord
in package

This is the model class for table "{{participants}}".

The following are the available columns in table '{{participants}}':

Table of Contents

Properties

$allExtraAttributes  : array<string|int, mixed>
$bEncryption  : mixed
$blacklisted  : string
$blacklistSwitchButton  : string
$buttons  : string
$checkbox  : string
$columns  : array<string|int, mixed>
$countActiveSurveys  : int|string
$countActiveSurveys  : mixed
$created  : string
$created_by  : int
$email  : string
$extraCondition  : mixed
$firstname  : string
$id  : mixed
$language  : string
$lastname  : string
$modified  : string
$owner  : User
$owner_uid  : int
$ownersList  : string
$participant_id  : string
$participantAttributes  : array<string|int, ParticipantAttribute>
$shares  : array<string|int, ParticipantShare>
$surveylinks  : array<string|int, SurveyLink>
$sid  : int
$xssFilterAttributes  : array<string|int, string>

Methods

addSurveyFilter()  : mixed
Add Survey Filter
attributeLabels()  : array<string|int, mixed>
behaviors()  : array<string|int, mixed>
Lists the behaviors of this model
checkforDuplicate()  : string
The purpose of this function is to check for duplicate in participants
copyCPDBAttributesToTokens()  : array<string|int, mixed>
Copies central attributes/participants to an individual survey survey participants table
copyToCentral()  : array<string|int, mixed>
Copies token participants to the central participants table, and also copies token attribute values where applicable. It checks for matching entries using firstname/lastname/email combination.
decrypt()  : mixed
Decrypt values from database
decryptEncryptAttributes()  : mixed
Encrypt/decrypt values
decryptSingle()  : string
Decrypt single value
decryptSingleOld()  : string
Decrypt single value
deleteAllByAttributes()  : int
deleteParticipants()  : int
This function deletes the participant from the participants table, references in the survey_links table (but not in matching tokens tables) and then all the participants attributes.
deleteParticipantToken()  : int
Deletes CPDB participants identified by their participant ID from survey participants tables
deleteParticipantTokenAnswer()  : int
This function deletes the participant from the participants table, the participant from any tokens table they're in (using the survey_links table to find them), all responses in surveys they've been linked to, and then all the participants attributes.
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
filterParticipantIDs()  : array<string|int, int>
Filter an array of participants IDs according to permissions of the person being logged in
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
genUuid()  : string
Function for generation of unique id
getAllEncryptedAttributes()  : array<string|int, mixed>
getAllExtraAttributes()  : array<string|int, mixed>
getAllUsedLanguagesWithRealName()  : mixed
getBlacklistedParticipantIds()  : array<string|int, string>
Returns the list of blocklisted participant IDs
getBlacklistSwitchbutton()  : string
getButtons()  : string
Returns buttons for grid view
getCheckbox()  : string
getColumns()  : array<string|int, mixed>
getCountActiveSurveys()  : int|string
getCreatedFormatted()  : string
'created' field formatted; empty string if no timestamp in database
getDefaultEncryptionOptions()  : array<string|int, mixed>
Return Default Encryption Options
getLanguageOptions()  : mixed
Get Language Options.
getMaxId()  : false|int
Return the max value for a field
getMinId()  : false|int
Return the min value for a field
getOptionsForAttribute()  : array<string|int, mixed>
Get options for a drop-down attribute
getOwnerOptions()  : mixed
Get Owner Options
getOwnersList()  : string
getParticipantAttribute()  : string
getParticipants()  : array<string|int, mixed>
getParticipantsCount()  : int
Duplicated from getparticipants, only to have a count
getParticipantsCountWithoutLimit()  : string
Get the number of participants, no restrictions
getParticipantsEncryptionOptions()  : array<string|int, mixed>
decodes the tokenencryptionoptions to be used anywhere necessary
getParticipantShared()  : array<string|int, mixed>
This function is responsible for showing all the participant's shared by a particular user based on the user id
getParticipantSharedAll()  : array<string|int, mixed>
This function is responsible for showing all the participant's shared to the superadmin
getParticipantsOwner()  : array<string|int, Participant>
This function returns a list of participants who are either owned or shared with a specific user
getParticipantsOwnerCount()  : int
getParticipantsSearchMultiple()  : array<string|int, mixed>
Function builds a select query for searches through participants using the $condition field passed which is in the format "firstfield||sqloperator||value||booleanoperator||secondfield||sqloperator||value||booleanoperator||etc||etc||etc" for example: "firstname||equal||Jason||and||lastname||equal||Cleeland" will produce SQL along the lines of "WHERE firstname = 'Jason' AND lastname=='Cleeland'"
getParticipantsSearchMultipleCondition()  : CDbCriteria
Function builds a select query for searches through participants using the $condition field passed which is in the format "firstfield||sqloperator||value||booleanoperator||secondfield||sqloperator||value||booleanoperator||etc||etc||etc" for example: "firstname||equal||Jason||and||lastname||equal||Cleeland" will produce SQL along the lines of "WHERE firstname = 'Jason' AND lastname=='Cleeland'"
getParticipantsSharedCount()  : int
This function combines the shared participant and the central participant table and searches for any reference of owner id in the combined record of the two tables
getParticipantsWithoutLimit()  : array<string|int, Participant>
getSurveyCount()  : int
getSurveyId()  : int
Get current surveyId for other model/function
insertParticipant()  : string|Participant
This function is responsible for adding the participant to the database
insertParticipantCSV()  : void
isOwner()  : bool
Returns true if participant_id has ownership or shared rights over this participant false if not
isOwnerOrSuperAdmin()  : bool
Returns true if user is either owner of this participant or superadmin Used to decide is user can change owner of participant
model()  : Participant
permissionCheckedActionsArray()  : array<string|int, mixed>
Checks Permissions for given $aActions and returns them as array
primaryKey()  : string
Returns the primary key of this table
relations()  : mixed
rules()  : mixed
search()  : CActiveDataProvider
Retrieves a list of models based on the current search/filter conditions.
setEncryptedAttributeLabel()  : string
Function to show encryption symbol in gridview attribute header if value ois encrypted
tableName()  : mixed
updateAll()  : int
Updates records with the specified condition.
updateAttributeValueToken()  : bool|null
Updates or creates a field in the survey participants table with a value from the participant attributes table
updateRow()  : void
This function updates the data edited in the view
updateTokenAttributeValue()  : bool
Updates a field in the survey participants table with a value from the participant attributes table
userHasPermissionToEdit()  : bool
Returns true if logged in user has edit rights to this participant
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
checkColumnDuplicates()  : bool
Check for column duplicates from CPDB to token attributes Throws error message if an attribute already exists; otherwise false.
createColumnsInTokenTable()  : array<string|int, mixed>
Create new "fields"? in which table?
flattenErrorMessages()  : string
Takes result from model->getErrors() and creates a long string of all messages.
getParticipantsSelectCommand()  : CDbCommand
updateTokenFieldProperties()  : void
Update stuff? If automapping is enabled then update the token field properties with the mapped CPDB field ID TODO: What is this?
writeParticipantsToTokenTable()  : array<string|int, int>
Write participants as tokens or something

Properties

$allExtraAttributes

public array<string|int, mixed> $allExtraAttributes

$blacklistSwitchButton

public string $blacklistSwitchButton

$countActiveSurveys

public int|string $countActiveSurveys

$countActiveSurveys

public mixed $countActiveSurveys

$created

public string $created

Date-time of creation

$modified

public string $modified

Date-time of modification

$participant_id

public string $participant_id

Primary Key

$xssFilterAttributes

protected array<string|int, string> $xssFilterAttributes = []

Array of attributes that should be XSS filtered on mass updates

Methods

addSurveyFilter()

Add Survey Filter

public addSurveyFilter( $conditions) : mixed
Parameters
$conditions :

attributeLabels()

public attributeLabels() : array<string|int, mixed>
Return values
array<string|int, mixed>

customized attribute labels (name=>label)

behaviors()

Lists the behaviors of this model

public behaviors() : array<string|int, mixed>

Below is a list of all behaviors we register:

Tags
see
PluginEventBehavior
see
CTimestampBehavior
Return values
array<string|int, mixed>

checkforDuplicate()

The purpose of this function is to check for duplicate in participants

public checkforDuplicate(string $fields[, string $output = "bool" ]) : string
Parameters
$fields : string
$output : string = "bool"
Return values
string

copyCPDBAttributesToTokens()

Copies central attributes/participants to an individual survey survey participants table

public copyCPDBAttributesToTokens(int $surveyId, string $participantIds, array<string|int, mixed> $mappedAttributes, array<string|int, mixed> $newAttributes, array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$surveyId : int

The survey ID

$participantIds : string

Array containing the participant ids of the participants we are adding

$mappedAttributes : array<string|int, mixed>

An array containing a list of /mapped attributes in the form of "token_field_name" => "participant_attribute_id"

$newAttributes : array<string|int, mixed>

An array containing new attributes to create in the tokens table

$options : array<string|int, mixed>

Array with following options: overwriteauto - If true, overwrite automatically mapped data overwriteman - If true, overwrite manually mapped data overwritest - If true, overwrite standard fields (ie: names, email, participant_id, token) createautomap - If true, rename the fieldnames of automapped attributes so that in future they are automatically mapped

Return values
array<string|int, mixed>

copyToCentral()

Copies token participants to the central participants table, and also copies token attribute values where applicable. It checks for matching entries using firstname/lastname/email combination.

public copyToCentral(int $surveyid, array<string|int, mixed> $aAttributesToBeCreated, array<string|int, mixed> $aMapped[, bool $overwriteauto = false ][, bool $overwriteman = false ][, bool $createautomap = true ]) : array<string|int, mixed>

TODO: Most of this belongs in the participantsaction.php controller file, not here in the model file. Portions of this should be moved out at some stage.

Parameters
$surveyid : int

The id of the survey, used to find the appropriate tokens table

$aAttributesToBeCreated : array<string|int, mixed>

An array containing the names of token attributes that have to be created in the cpdb

$aMapped : array<string|int, mixed>

An array containing the names of token attributes that are to be mapped to an existing cpdb attribute

$overwriteauto : bool = false

If true, overwrites existing automatically mapped attribute values

$overwriteman : bool = false

If true, overwrites manually mapped attribute values (where token fieldname=attribute_n)

$createautomap : bool = true

If true, updates tokendescription field with new mapping

Return values
array<string|int, mixed>

An array contaning list of successful and list of failed ids

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
todo

This should also be moved to the behavior at some point. This method overrides the parent in order to raise PluginEvents for Bulk delete operations.

Filter Criteria are wrapped into a CDBCriteria instance so we have a single instance responsible for holding the filter criteria to be passed to the PluginEvent, this also enables us to pass the fully configured CDBCriteria instead of the original Parameters.

See for detailed explanation about $condition and $params.

Return values
int

number of rows affected by the execution.

deleteParticipants()

This function deletes the participant from the participants table, references in the survey_links table (but not in matching tokens tables) and then all the participants attributes.

public deleteParticipants(string $rows[, bool $bFilter = true ]) : int
Parameters
$rows : string

Participants ID separated by comma

$bFilter : bool = true
Return values
int

number of deleted participants

deleteParticipantToken()

Deletes CPDB participants identified by their participant ID from survey participants tables

public deleteParticipantToken(string $sParticipantsIDs) : int
Parameters
$sParticipantsIDs : string
Tags
throws
CException
Return values
int

Number of deleted participants

deleteParticipantTokenAnswer()

This function deletes the participant from the participants table, the participant from any tokens table they're in (using the survey_links table to find them), all responses in surveys they've been linked to, and then all the participants attributes.

public deleteParticipantTokenAnswer(string $sParticipantsIDs) : int
Parameters
$sParticipantsIDs : string
Tags
throws
CDbException
throws
CException
Return values
int

Number of deleted participants

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
PluginEvent

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

filterParticipantIDs()

Filter an array of participants IDs according to permissions of the person being logged in

public filterParticipantIDs(mixed $aParticipantIDs) : array<string|int, int>
Parameters
$aParticipantIDs : mixed
Return values
array<string|int, int>

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>

See for detailed explanation about $condition and $params.

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.

genUuid()

Function for generation of unique id

public static genUuid() : string
Return values
string

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.

getAllExtraAttributes()

public getAllExtraAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getAllUsedLanguagesWithRealName()

public getAllUsedLanguagesWithRealName() : mixed

getBlacklistedParticipantIds()

Returns the list of blocklisted participant IDs

public getBlacklistedParticipantIds() : array<string|int, string>
Return values
array<string|int, string>

getBlacklistSwitchbutton()

public getBlacklistSwitchbutton() : string
Return values
string

HTML

getButtons()

Returns buttons for grid view

public getButtons() : string
Return values
string

getCheckbox()

public getCheckbox() : string
Return values
string

html

getColumns()

public getColumns() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCountActiveSurveys()

public getCountActiveSurveys() : int|string
Return values
int|string

getCreatedFormatted()

'created' field formatted; empty string if no timestamp in database

public getCreatedFormatted() : string
Return values
string

getDefaultEncryptionOptions()

Return Default Encryption Options

public static getDefaultEncryptionOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLanguageOptions()

Get Language Options.

public getLanguageOptions() : 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
throws
Exception
Return values
false|int

getMinId()

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
throws
Exception
Return values
false|int

getOptionsForAttribute()

Get options for a drop-down attribute

public getOptionsForAttribute(string $attribute_id) : array<string|int, mixed>
Parameters
$attribute_id : string
Return values
array<string|int, mixed>

getOwnerOptions()

Get Owner Options

public getOwnerOptions() : mixed

getOwnersList()

public getOwnersList(int $selected) : string
Parameters
$selected : int

Owner id

Return values
string

HTML

getParticipantAttribute()

public getParticipantAttribute(string $attributeTextId[, mixed $attribute_id = false ]) : string
Parameters
$attributeTextId : string

E.g. ea_145

$attribute_id : mixed = false
Return values
string

getParticipants()

public getParticipants(int $page, int $limit, array<string|int, mixed> $attid[, string|null $order = null ][, CDbCriteria $search = null ][, int $userid = null ]) : array<string|int, mixed>
Parameters
$page : int
$limit : int
$attid : array<string|int, mixed>
$order : string|null = null
$search : CDbCriteria = null
$userid : int = null
Tags
throws
CException
Return values
array<string|int, mixed>

getParticipantsCount()

Duplicated from getparticipants, only to have a count

public getParticipantsCount(array<string|int, mixed> $attid[, CDbCriteria $search = null ][, int $userid = null ]) : int
Parameters
$attid : array<string|int, mixed>
$search : CDbCriteria = null
$userid : int = null
Return values
int

getParticipantsCountWithoutLimit()

Get the number of participants, no restrictions

public getParticipantsCountWithoutLimit() : string
Return values
string

getParticipantsEncryptionOptions()

decodes the tokenencryptionoptions to be used anywhere necessary

public static getParticipantsEncryptionOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getParticipantShared()

This function is responsible for showing all the participant's shared by a particular user based on the user id

public getParticipantShared(int $userid) : array<string|int, mixed>
Parameters
$userid : int
Return values
array<string|int, mixed>

getParticipantSharedAll()

This function is responsible for showing all the participant's shared to the superadmin

public getParticipantSharedAll() : array<string|int, mixed>
Return values
array<string|int, mixed>

getParticipantsOwner()

This function returns a list of participants who are either owned or shared with a specific user

public getParticipantsOwner(int $userid) : array<string|int, Participant>
Parameters
$userid : int

The ID of the user that we are listing participants for

Return values
array<string|int, Participant>

objects containing all the users

getParticipantsOwnerCount()

public getParticipantsOwnerCount(int $userid) : int
Parameters
$userid : int
Return values
int

getParticipantsSearchMultiple()

Function builds a select query for searches through participants using the $condition field passed which is in the format "firstfield||sqloperator||value||booleanoperator||secondfield||sqloperator||value||booleanoperator||etc||etc||etc" for example: "firstname||equal||Jason||and||lastname||equal||Cleeland" will produce SQL along the lines of "WHERE firstname = 'Jason' AND lastname=='Cleeland'"

public getParticipantsSearchMultiple(array<string|int, mixed> $condition, int $page, int $limit) : array<string|int, mixed>
Parameters
$condition : array<string|int, mixed>

an array containing the search string exploded using || so that "firstname||equal||jason" is $condition(1=>'firstname', 2=>'equal', 3=>'jason')

$page : int

Which page number to display

$limit : int

The limit/number of reords to return

Return values
array<string|int, mixed>

$output

getParticipantsSearchMultipleCondition()

Function builds a select query for searches through participants using the $condition field passed which is in the format "firstfield||sqloperator||value||booleanoperator||secondfield||sqloperator||value||booleanoperator||etc||etc||etc" for example: "firstname||equal||Jason||and||lastname||equal||Cleeland" will produce SQL along the lines of "WHERE firstname = 'Jason' AND lastname=='Cleeland'"

public getParticipantsSearchMultipleCondition(array<string|int, mixed> $condition) : CDbCriteria
Parameters
$condition : array<string|int, mixed>

an array containing the search string exploded using || so that "firstname||equal||jason" is $condition(1=>'firstname', 2=>'equal', 3=>'jason')

Return values
CDbCriteria

$output

getParticipantsSharedCount()

This function combines the shared participant and the central participant table and searches for any reference of owner id in the combined record of the two tables

public getParticipantsSharedCount(int $userid) : int
Parameters
$userid : int

The id of the owner

Return values
int

The number of participants owned by $userid who are shared

getSurveyCount()

public getSurveyCount(mixed $participant_id) : int
Parameters
$participant_id : mixed
Return values
int

getSurveyId()

Get current surveyId for other model/function

public getSurveyId() : int
Return values
int

insertParticipant()

This function is responsible for adding the participant to the database

public insertParticipant(array<string|int, mixed> $aData) : string|Participant
Parameters
$aData : array<string|int, mixed>

Participant data

Return values
string|Participant

Error message on failure, participant object on success

insertParticipantCSV()

public insertParticipantCSV(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

isOwner()

Returns true if participant_id has ownership or shared rights over this participant false if not

public isOwner(string $participant_id) : bool
Parameters
$participant_id : string
Return values
bool

isOwnerOrSuperAdmin()

Returns true if user is either owner of this participant or superadmin Used to decide is user can change owner of participant

public isOwnerOrSuperAdmin() : bool
Return values
bool

permissionCheckedActionsArray()

Checks Permissions for given $aActions and returns them as array

public permissionCheckedActionsArray(array<string|int, mixed> $aActions, array<string|int, mixed> $permissions) : array<string|int, mixed>
Parameters
$aActions : array<string|int, mixed>
$permissions : array<string|int, mixed>
Return values
array<string|int, mixed>

primaryKey()

Returns the primary key of this table

public primaryKey() : string
Tags
access

public

Return values
string

relations()

public relations() : mixed
Tags
inheritdoc

Retrieves a list of models based on the current search/filter conditions.

public search() : CActiveDataProvider
Return values
CActiveDataProvider

the data provider that can return the models based on the search/filter conditions.

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
throws
CException
Return values
string

tableName()

public tableName() : mixed
Tags
inheritdoc

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

updateAttributeValueToken()

Updates or creates a field in the survey participants table with a value from the participant attributes table

public updateAttributeValueToken(int $surveyId, int $participantId, int $participantAttributeId, int $tokenFieldname) : bool|null
Parameters
$surveyId : int

Survey ID number

$participantId : int

unique key for the participant

$participantAttributeId : int

the unique key for the participant_attribute table

$tokenFieldname : int

fieldname in the survey participants table

Return values
bool|null

true/false

updateRow()

This function updates the data edited in the view

public updateRow(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

updateTokenAttributeValue()

Updates a field in the survey participants table with a value from the participant attributes table

public updateTokenAttributeValue(int $surveyId, string $participantId, int $participantAttributeId, int $tokenFieldname) : bool
Parameters
$surveyId : int

Survey ID number

$participantId : string

unique key for the participant

$participantAttributeId : int

the unique key for the participant_attribute table

$tokenFieldname : int

fieldname in the survey participants table

Return values
bool

true/false

userHasPermissionToEdit()

Returns true if logged in user has edit rights to this participant

public userHasPermissionToEdit() : bool
Return values
bool

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
since
1.1.7
Return values
mixed

the AR objects populated with the query result

checkColumnDuplicates()

Check for column duplicates from CPDB to token attributes Throws error message if an attribute already exists; otherwise false.

private checkColumnDuplicates(int $surveyId, array<string|int, string> $newAttributes) : bool
Parameters
$surveyId : int
$newAttributes : array<string|int, string>

Array of CPDB attributes ids like ['42', '32', ...]

Tags
throws
CPDBException

with error message

Return values
bool

createColumnsInTokenTable()

Create new "fields"? in which table?

private createColumnsInTokenTable(int $surveyId, array<string|int, mixed> $newAttributes) : array<string|int, mixed>
Parameters
$surveyId : int
$newAttributes : array<string|int, mixed>
Return values
array<string|int, mixed>

[addedAttributes, addedAttributeIds]

flattenErrorMessages()

Takes result from model->getErrors() and creates a long string of all messages.

private flattenErrorMessages(array<string|int, mixed> $errors) : string
Parameters
$errors : array<string|int, mixed>
Return values
string

getParticipantsSelectCommand()

private getParticipantsSelectCommand(bool $count, array<string|int, mixed> $attid[, CDbCriteria $search = null ][, int $userid = null ][, int $page = null ][, int $limit = null ][, string|null $order = null ]) : CDbCommand
Parameters
$count : bool
$attid : array<string|int, mixed>
$search : CDbCriteria = null
$userid : int = null
$page : int = null
$limit : int = null
$order : string|null = null
Return values
CDbCommand

updateTokenFieldProperties()

Update stuff? If automapping is enabled then update the token field properties with the mapped CPDB field ID TODO: What is this?

private updateTokenFieldProperties(int $surveyId, array<string|int, mixed> $mappedAttributes) : void
Parameters
$surveyId : int
$mappedAttributes : array<string|int, mixed>

writeParticipantsToTokenTable()

Write participants as tokens or something

private writeParticipantsToTokenTable(int $surveyId, array<string|int, mixed> $participantIds, array<string|int, mixed> $mappedAttributes, array<string|int, mixed> $newAttributes, array<string|int, mixed> $addedAttributes, array<string|int, mixed> $addedAttributeIds, array<string|int, mixed> $options) : array<string|int, int>
Parameters
$surveyId : int
$participantIds : array<string|int, mixed>
$mappedAttributes : array<string|int, mixed>
$newAttributes : array<string|int, mixed>
$addedAttributes : array<string|int, mixed>

?? Result from createColumnsInTokenTable

$addedAttributeIds : array<string|int, mixed>

?? Result from createColumnsInTokenTable

$options : array<string|int, mixed>

As in calling function

Tags
throws
Exception
Return values
array<string|int, int>

(success, duplicate, blacklistSkipped)


        
On this page

Search results