Survey
extends LSActiveRecord
in package
implements
PermissionInterface
Uses
PermissionTrait
Class Survey
Table of Contents
Interfaces
Properties
- $active : string
- $additional_languages : string
- $additionalLanguages : array<string|int, string>
- $admin : string
- $adminemail : string
- $allLanguages : array<string|int, string>
- $alloweditaftercompletion : string
- $allowprev : string
- $allowregister : string
- $allowsave : string
- $allQuestions : array<string|int, Question>
- $anonymized : string
- $aOptions : mixed
- $assessments : string
- $attributedescriptions : string
- $autonumber_start : int
- $autoredirect : string
- $baseQuestions : array<string|int, Question>
- $bEncryption : mixed
- $bounce_email : string
- $bounceaccountencryption : string
- $bounceaccounthost : string
- $bounceaccountpass : string
- $bounceaccounttype : string
- $bounceaccountuser : string
- $bounceprocessing : string
- $bouncetime : int
- $bShowRealOptionValues : mixed
- $countFullAnswers : int
- $countInputQuestions : int
- $countNoInputQuestions : int
- $countPartialAnswers : int
- $countTotalAnswers : int
- $countTotalQuestions : int
- $creationDate : string
- $currentLanguageSettings : SurveyLanguageSetting
- $datecreated : string
- $datestamp : string
- $defaultlanguage : SurveyLanguageSetting
- $emailnotificationto : string
- $emailresponseto : string
- $expires : string|null
- $expiryDateFormatted : string
- $format : string
- $googleanalyticsapikey : string
- $googleanalyticsapikeysetting : string
- $googleanalyticsstyle : string
- $groups : array<string|int, QuestionGroup>
- $groupsCount : int
- $gsid : int
- $hasResponsesTable : bool
- $hasTimingsTable : bool
- $hasTokensTable : bool
- $htmlemail : string
- $ipaddr : string
- $ipanonymize : string
- $isActive : bool
- $isAllowEditAfterCompletion : bool
- $isAllowPrev : bool
- $isAllowRegister : bool
- $isAllowSave : bool
- $isAnonymized : bool
- $isAssessments : bool
- $isAutoRedirect : bool
- $isDateExpired : bool
- $isDateStamp : bool
- $isHtmlEmail : bool
- $isIpAddr : bool
- $isIpAnonymize : bool
- $isListPublic : bool
- $isNoKeyboard : bool
- $isPrintAnswers : bool
- $isPublicGraphs : bool
- $isPublicStatistics : bool
- $isRefUrl : bool
- $isSaveTimings : bool
- $isSendConfirmation : bool
- $isShowGroupInfo : bool
- $isShowNoAnswer : bool
- $isShowProgress : bool
- $isShowQnumCode : bool
- $isShowWelcome : bool
- $isShowXQuestions : bool
- $isTokenAnswersPersistence : bool
- $isUseCookie : bool
- $language : string
- $languagesettings : array<string|int, SurveyLanguageSetting>
- $listpublic : string
- $navigationdelay : int
- $nokeyboard : string
- $oOptionLabels : mixed
- $oOptions : mixed
- $owner : User
- $owner_id : int
- $permissions : array<string|int, Permission>
- $printanswers : string
- $publicgraphs : string
- $publicstatistics : string
- $questionindex : int
- $quotableQuestions : array<string|int, Question>
- $quotas : array<string|int, Quota>
- $refurl : string
- $responsesTableName : string
- $savetimings : string
- $searched_value : mixed
- $sendconfirmation : string
- $showgroupinfo : string
- $showInherited : mixed
- $shownoanswer : string
- $showprogress : string
- $showqnumcode : string
- $showsurveypolicynotice : bool
- $showsurveypolicynotice : mixed
- $showwelcome : string
- $showxquestions : string
- $sid : int
- $startdate : string|null
- $startDateFormatted : string
- $surveygroup : SurveysGroups
- $surveyinfo : array<string|int, mixed>
- $template : string
- $timingsTableName : string
- $tokenanswerspersistence : string
- $tokenAttributes : array<string|int, mixed>
- $tokenencryptionoptions : string
- $tokenlength : int
- $tokensTableName : string
- $usecaptcha : string
- $usecookie : string
- $usetokens : string
- $findByPkCache : array<string|int, mixed>
- $xssFilterAttributes : array<string|int, string>
- $sSurveyUrl : mixed
Methods
- active() : mixed
- afterFindSurvey() : mixed
- afterFindSurvey to fix and/or add some survey attribute - event afterFindSurvey (for all attributes) - Fix template name to be sure template exist - setOptions for inherited value
- attributeLabels() : mixed
- behaviors() : array<string|int, mixed>
- Lists the behaviors of this model
- calculateEstimatedTime() : float
- Method to make an approximation on how long a survey will last Approx is 3 questions each minute.
- checkExpireAfterStart() : mixed
- Validates the Expiration Date is not lower than the Start Date
- decrypt() : mixed
- Decrypt values from database
- decryptEncryptAttributes() : mixed
- Encrypt/decrypt values
- decryptSingle() : string
- Decrypt single value
- decryptSingleOld() : string
- Decrypt single value
- delete() : mixed
- deleteAllByAttributes() : int
- deleteSurvey() : bool
- Deletes a survey and all its data
- 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
- expire() : bool|null
- Expires a survey. If the object was invoked using find or new surveyId can be ommited.
- filterTemplateSave() : string
- filterTemplateSave to fix some template name
- 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
- findAllPublic() : mixed
- findByAttributes() : static|null
- Overriding of Yii's findByAttributes method to provide encrypted attribute value search
- findByPk() : mixed
- findQuestionByType() : Question
- fixInvalidQuestions() : mixed
- Fix invalid question in this survey Delete question that don't exist in primary language
- getActiveWord() : string
- getAdditionalLanguages() : array<string|int, mixed>
- Returns additional languages formatted into a string
- getAliasForLanguage() : string|null
- Returns the survey alias for the specified language.
- getAllEncryptedAttributes() : array<string|int, mixed>
- getAllLanguages() : array<string|int, mixed>
- Returns all languages array
- getAllQuestions() : array<string|int, Question>
- getAnonymizedResponses() : string
- getBaseQuestions() : array<string|int, Question>
- getButtons() : string
- Returns buttons for gridview.
- getCountFullAnswers() : int|string
- getCountInputQuestions() : int
- Get the coutn of questions that need input (skipping text-display etc.)
- getCountNoInputQuestions() : int
- Get the coutn of questions that do not need input (skipping text-display etc.)
- getCountPartialAnswers() : int
- getCountTotalAnswers() : int
- getCountTotalQuestions() : int
- getCPDBMappings() : array<string|int, mixed>
- This function returns any valid mappings from the survey participants tables to the CPDB in the form of an array [<cpdb_attribute_id>=><participant_table_attribute_name>]
- getCreationDate() : string
- getCurrentLanguageSettings() : SurveyLanguageSetting
- The Survey languagesettings in currently active language. Falls back to the surveys' default language if the current language is not available.
- getDecodedAttributedescriptions() : array<string|int, mixed>
- decodes the attributedescriptions to be used anywhere necessary
- getExpiryDateFormatted() : string
- getGoogleanalyticsapikey() : string
- Returns the value for the SurveyEdit GoogleAnalytics API-Key UseGlobal Setting
- getGoogleanalyticsapikeysetting() : string
- Returns the value for the SurveyEdit GoogleAnalytics API-Key UseGlobal Setting
- getGroupsCount() : mixed
- Gets number of groups inside a particular survey
- getHasResponsesTable() : bool
- Wheteher the survey responses (data) table exists in DB
- getHasTimingsTable() : bool
- Wheteher the survey responses timings exists in DB
- getHasTokensTable() : bool
- Returns true in a survey participants table exists for survey
- getIsActive() : bool
- getIsAllowEditAfterCompletion() : bool
- getIsAllowPrev() : bool
- getIsAllowRegister() : bool
- getIsAllowSave() : bool
- getIsAnonymized() : bool
- getIsAssessments() : bool
- getIsAutoRedirect() : bool
- getIsDateExpired() : bool
- getIsDateStamp() : bool
- getIsHtmlEmail() : bool
- getIsIpAddr() : bool
- getIsIpAnonymize() : bool
- getIsListPublic() : bool
- getIsNoKeyboard() : bool
- getIsPrintAnswers() : bool
- getIsPublicGraphs() : bool
- getIsPublicStatistics() : bool
- getIsRefUrl() : bool
- getIsSaveTimings() : bool
- getIsSendConfirmation() : bool
- getIsShowGroupInfo() : bool
- getIsShowNoAnswer() : bool
- getIsShowProgress() : bool
- getIsShowQnumCode() : bool
- getIsShowWelcome() : bool
- getIsShowXQuestions() : bool
- getIsTokenAnswersPersistence() : bool
- getIsUseCookie() : bool
- getLanguageForSurveyTaking() : string
- Return the language of the current survey It can be: - the selected language by user via the language selector (POST then Session) - the selected language via URL (GET then Session) - the survey default language
- getLocalizedTitle() : mixed
- Returns the title of the survey. Uses the current language and falls back to the surveys' default language if the current language is not available.
- getMaxId() : false|int
- Return the max value for a field
- getMinId() : false|int
- Return the min value for a field
- getMinimalPermissionRead() : null|string
- getOwnerId() : int
- Get the owner id of this Survey Used for Permission
- getOwnerUserName() : string
- getPermissionData() : array<string|int, mixed>
- Get Permission data for Survey
- getQuotableQuestions() : array<string|int, Question>
- getResponsesTableName() : string
- Return the name of survey responses (the data) table name
- getRunning() : string
- Returns the status of the survey, including and icon and wrapped by a link to the survey
- getsSurveyUrl() : mixed
- TODO: Not used anywhere. Deprecate it?
- getStartDateFormatted() : string
- getState() : string
- Get state of survey, which can be one of five: 1. Not active 2. Expired 3. Will expire in the future (running now) 3. Will run in future 4. Running now (no expiration date)
- getSurveyMenus() : array<string|int, mixed>
- Get surveymenu configuration from table surveymenu and prepares
- getSurveysWithTokenTable() : array<string|int, Survey>
- Get all surveys that has participant table
- getSurveyTemplateConfiguration() : TemplateConfiguration
- Returns Survey Template Configuration.
- getSurveyUrl() : string
- Returns the survey URL with the specified params.
- getTemplateEffectiveName() : string
- Returns the name of the template to be used for the survey.
- getTimingsTableName() : string
- Return the name of survey timigs table
- getTokenAttributes() : array<string|int, mixed>
- Returns the additional token attributes
- getTokenEncryptionOptions() : array<string|int, mixed>
- decodes the tokenencryptionoptions to be used anywhere necessary
- getTokensTableName() : string
- Return the name of survey tokens table
- hasPermission() : bool
- hasQuestionType() : bool
- Returns true if this survey has any question of type $type.
- init() : mixed
- Set defaults
- insertNewSurvey() : Survey
- Creates a new survey - with a random sid
- model() : Survey
- permission() : CActiveRecord
- permission scope for this model Actually only test if user have minimal access to survey (read)
- primaryKey() : mixed
- relations() : mixed
- replacePolicyLink() : string
- Get the final label for survey ID
- resetCache() : void
- findByPk uses a cache to store a result. Use this method to force clearing that cache.
- rules() : mixed
- saveTranscribeCaptchaOptions() : string
- Transcribe from 3 checkboxes to 1 char for captcha usages Uses variables from $_POST and transferred Surveyobject
- scopes() : mixed
- search() : CActiveDataProvider
- Search
- setAllowjumps() : mixed
- Attribute renamed to questionindex in dbversion 169 Y maps to 1 otherwise 0;
- setEncryptedAttributeLabel() : string
- Function to show encryption symbol in gridview attribute header if value ois encrypted
- setGoogleanalyticsapikeysetting() : void
- Sets Google Analytics API Key Setting.
- setOptions() : mixed
- setOptionsFromDatabase() : mixed
- setToInherit() : mixed
- setTokenEncryptionOptions() : mixed
- tableName() : mixed
- updateAll() : int
- Updates records with the specified condition.
- getPermissionCriteria() : CDbCriteria
- Get criteria from Permission
- 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
- getDateFormatted() : string
- getQuestionOrderCriteria() : CDbCriteria
- Get the DB criteria to get questions as ordered in survey
- getSurveyQuestionsCriteria() : mixed
- setAttributeDefaults() : mixed
- shiftedDateTime() : DateTime|null
- Get a dateime DB and return DateTime or null adjusted
Properties
$active
public
string
$active
Whether survey is acive or not (Y/N)
$additional_languages
public
string
$additional_languages
Survey additional languages delimited by space ' '
$additionalLanguages
public
array<string|int, string>
$additionalLanguages
Additional survey languages
$admin
public
string
$admin
Survey Admin's full name
$adminemail
public
string
$adminemail
Survey administrator email address
$allLanguages
public
array<string|int, string>
$allLanguages
$alloweditaftercompletion
public
string
$alloweditaftercompletion
Allow multiple responses or update responses with one token: (Y/N)
$allowprev
public
string
$allowprev
Allow backwards navigation (Y/N)
$allowregister
public
string
$allowregister
Allow public registration (Y/N)
$allowsave
public
string
$allowsave
Is participant allowed save and resume later (Y/N)
$allQuestions
public
array<string|int, Question>
$allQuestions
All survey questions including subquestions
$anonymized
public
string
$anonymized
Whether survey is anonymized or not (Y/N)
$aOptions
public
mixed
$aOptions
= array()
$assessments
public
string
$assessments
Enable assessment mode: (Y/N)
$attributedescriptions
public
string
$attributedescriptions
$autonumber_start
public
int
$autonumber_start
$autoredirect
public
string
$autoredirect
Automatically load URL when survey complete: (Y/N)
$baseQuestions
public
array<string|int, Question>
$baseQuestions
Survey questions NOT including subquestions
$bEncryption
public
mixed
$bEncryption
= \false
$bounce_email
public
string
$bounce_email
Bounce email address
$bounceaccountencryption
public
string
$bounceaccountencryption
$bounceaccounthost
public
string
$bounceaccounthost
$bounceaccountpass
public
string
$bounceaccountpass
$bounceaccounttype
public
string
$bounceaccounttype
$bounceaccountuser
public
string
$bounceaccountuser
$bounceprocessing
public
string
$bounceprocessing
$bouncetime
public
int
$bouncetime
$bShowRealOptionValues
public
mixed
$bShowRealOptionValues
= \true
$countFullAnswers
public
int
$countFullAnswers
Full-answers count
$countInputQuestions
public
int
$countInputQuestions
Count of questions that need input (skipping text-display etc.)
$countNoInputQuestions
public
int
$countNoInputQuestions
Count of questions that DO NOT need input (skipping text-display etc.)
All Y/N columns in the model can be accessed as boolean values:
$countPartialAnswers
public
int
$countPartialAnswers
Full-answers count
$countTotalAnswers
public
int
$countTotalAnswers
Total-answers count
$countTotalQuestions
public
int
$countTotalQuestions
Count of questions (in that language, without subquestions)
$creationDate
public
string
$creationDate
Creation date formatted according to user format
$currentLanguageSettings
public
SurveyLanguageSetting
$currentLanguageSettings
Survey languagesettings in currently active language
$datecreated
public
string
$datecreated
Date survey was created as SQL datetime (YYYY-MM-DD hh:mm:ss)
$datestamp
public
string
$datestamp
Whether respondents' datestamps will be saved (Y/N)
$defaultlanguage
public
SurveyLanguageSetting
$defaultlanguage
$emailnotificationto
public
string
$emailnotificationto
Email address to send basic admin notification email to
$emailresponseto
public
string
$emailresponseto
e-mail address to send detailed admin notification email to
$expires
public
string|null
$expires
Expiry date as SQL datetime (YYYY-MM-DD hh:mm:ss)
$expiryDateFormatted
public
string
$expiryDateFormatted
Expiry date formatted according to user format
$format
public
string
$format
A : All in one, G : Group by group, Q : question by question, I : inherit value from survey group
$googleanalyticsapikey
public
string
$googleanalyticsapikey
Google Analytics Tracking ID
$googleanalyticsapikeysetting
public
string
$googleanalyticsapikeysetting
Returns the value for the SurveyEdit GoogleAnalytics API-Key UseGlobal Setting
$googleanalyticsstyle
public
string
$googleanalyticsstyle
Google Analytics style: (0: off; 1:Default; 2:Survey-SID/Group)
$groups
public
array<string|int, QuestionGroup>
$groups
$groupsCount
public
int
$groupsCount
Number of groups in a survey (in base language)
$gsid
public
int
$gsid
survey group id, from which this survey belongs to and inherits values from when set to 'I'
$hasResponsesTable
public
bool
$hasResponsesTable
Wheteher the survey responses (data) table exists in DB
$hasTimingsTable
public
bool
$hasTimingsTable
Wheteher the survey timings table exists in DB
$hasTokensTable
public
bool
$hasTokensTable
Whether survey has a tokens table or not
$htmlemail
public
string
$htmlemail
Use HTML format for token emails: (Y/N)
$ipaddr
public
string
$ipaddr
Whether Participants IP address will be saved: (Y/N)
$ipanonymize
public
string
$ipanonymize
Whether id addresses should be anonymized (Y/N)
$isActive
public
bool
$isActive
Whether Survey is active
$isAllowEditAfterCompletion
public
bool
$isAllowEditAfterCompletion
Allow multiple responses or update responses with one token
$isAllowPrev
public
bool
$isAllowPrev
Allow backwards navigation
$isAllowRegister
public
bool
$isAllowRegister
Allow public registration
$isAllowSave
public
bool
$isAllowSave
Is participant allowed save and resume later
$isAnonymized
public
bool
$isAnonymized
Whether survey is anonymized or not
$isAssessments
public
bool
$isAssessments
Enable assessment mode
$isAutoRedirect
public
bool
$isAutoRedirect
Automatically load URL when survey complete
$isDateExpired
public
bool
$isDateExpired
Whether survey is expired depending on the current time and survey configuration status
$isDateStamp
public
bool
$isDateStamp
Whether respondents' datestamps will be saved
$isHtmlEmail
public
bool
$isHtmlEmail
Use HTML format for token emails
$isIpAddr
public
bool
$isIpAddr
Whether Participants IP address will be saved
$isIpAnonymize
public
bool
$isIpAnonymize
Whether Participants IP address will be saved
$isListPublic
public
bool
$isListPublic
List survey publicly
$isNoKeyboard
public
bool
$isNoKeyboard
Show on-screen keyboard
$isPrintAnswers
public
bool
$isPrintAnswers
Participants may print answers
$isPublicGraphs
public
bool
$isPublicGraphs
Show graphs in public statistics
$isPublicStatistics
public
bool
$isPublicStatistics
Public statistics
$isRefUrl
public
bool
$isRefUrl
Save referrer URL
$isSaveTimings
public
bool
$isSaveTimings
Whether survey timings are saved
$isSendConfirmation
public
bool
$isSendConfirmation
Send confirmation emails
$isShowGroupInfo
public
bool
$isShowGroupInfo
Show group name and/or group description
$isShowNoAnswer
public
bool
$isShowNoAnswer
Show "No answer"
$isShowProgress
public
bool
$isShowProgress
how progress bar
$isShowQnumCode
public
bool
$isShowQnumCode
Show question number and/or code
$isShowWelcome
public
bool
$isShowWelcome
Show welcome screen
$isShowXQuestions
public
bool
$isShowXQuestions
Show "There are X questions in this survey"
$isTokenAnswersPersistence
public
bool
$isTokenAnswersPersistence
Enable token-based response persistence
$isUseCookie
public
bool
$isUseCookie
Are cookies used to prevent repeated participation
$language
public
string
$language
Survey base language
$languagesettings
public
array<string|int, SurveyLanguageSetting>
$languagesettings
$listpublic
public
string
$listpublic
List survey publicly: (Y/N)
$navigationdelay
public
int
$navigationdelay
Navigation delay (seconds) (It shows the number of seconds before the previous, next, and submit buttons are enabled. If none is specified, the option will use the default value, which is "0" (seconds))
$nokeyboard
public
string
$nokeyboard
Show on-screen keyboard: (Y/N)
$oOptionLabels
public
mixed
$oOptionLabels
$oOptions
public
mixed
$oOptions
$owner
public
User
$owner
$owner_id
public
int
$owner_id
$permissions
public
array<string|int, Permission>
$permissions
$printanswers
public
string
$printanswers
Participants may print answers: (Y/N)
$publicgraphs
public
string
$publicgraphs
Show graphs in public statistics: (Y/N)
$publicstatistics
public
string
$publicstatistics
Public statistics: (Y/N)
$questionindex
public
int
$questionindex
Show question index / allow jumping (0: diabled; 1: Incremental; 2: Full)
$quotableQuestions
public
array<string|int, Question>
$quotableQuestions
$quotas
public
array<string|int, Quota>
$quotas
$refurl
public
string
$refurl
Save referrer URL: (Y/N)
$responsesTableName
public
string
$responsesTableName
Name of survey resonses table
$savetimings
public
string
$savetimings
Whether survey timings are saved (Y/N)
$searched_value
public
mixed
$searched_value
$sendconfirmation
public
string
$sendconfirmation
Send confirmation emails:(Y/N)
$showgroupinfo
public
string
$showgroupinfo
Show group name and/or group description: (Y/N)
$showInherited
public
mixed
$showInherited
= 1
$shownoanswer
public
string
$shownoanswer
Show "No answer": (Y/N)
$showprogress
public
string
$showprogress
how progress bar: (Y/N)
$showqnumcode
public
string
$showqnumcode
Show question number and/or code: (Y/N)
$showsurveypolicynotice
public
bool
$showsurveypolicynotice
Show the security notice
$showsurveypolicynotice
public
mixed
$showsurveypolicynotice
= 0
$showwelcome
public
string
$showwelcome
Show welcome screen: (Y/N)
$showxquestions
public
string
$showxquestions
Show "There are X questions in this survey": (Y/N)
$sid
public
int
$sid
Survey ID
$startdate
public
string|null
$startdate
Survey Start date as SQL datetime (YYYY-MM-DD hh:mm:ss)
$startDateFormatted
public
string
$startDateFormatted
Start date formatted according to user format
$surveygroup
public
SurveysGroups
$surveygroup
$surveyinfo
public
array<string|int, mixed>
$surveyinfo
$template
public
string
$template
Template name
$timingsTableName
public
string
$timingsTableName
Name of survey timings table
$tokenanswerspersistence
public
string
$tokenanswerspersistence
Enable token-based response persistence: (Y/N)
$tokenAttributes
public
array<string|int, mixed>
$tokenAttributes
Additional token attribute names
$tokenencryptionoptions
public
string
$tokenencryptionoptions
Token encryption options
$tokenlength
public
int
$tokenlength
Token length: MIN:5 MAX:36
$tokensTableName
public
string
$tokensTableName
Name of survey tokens table
$usecaptcha
public
string
$usecaptcha
$usecookie
public
string
$usecookie
Are cookies used to prevent repeated participation (Y/N)
$usetokens
public
string
$usetokens
$findByPkCache
protected
static array<string|int, mixed>
$findByPkCache
= []
$xssFilterAttributes
protected
array<string|int, string>
$xssFilterAttributes
= []
Array of attributes that should be XSS filtered on mass updates
$sSurveyUrl
private
mixed
$sSurveyUrl
Methods
active()
public
active() : mixed
afterFindSurvey()
afterFindSurvey to fix and/or add some survey attribute - event afterFindSurvey (for all attributes) - Fix template name to be sure template exist - setOptions for inherited value
public
afterFindSurvey() : mixed
attributeLabels()
public
attributeLabels() : 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>calculateEstimatedTime()
Method to make an approximation on how long a survey will last Approx is 3 questions each minute.
public
calculateEstimatedTime() : float
Tags
Return values
floatcheckExpireAfterStart()
Validates the Expiration Date is not lower than the Start Date
public
checkExpireAfterStart(mixed $attributes, mixed $params) : mixed
Parameters
- $attributes : mixed
- $params : 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
delete()
public
delete([bool $recursive = true ]) : mixed
Parameters
- $recursive : bool = true
Tags
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.
deleteSurvey()
Deletes a survey and all its data
public
deleteSurvey(int $iSurveyID[, bool $recursive = true ]) : bool
Parameters
- $iSurveyID : int
- $recursive : bool = true
Tags
Return values
booldispatchPluginModelEvent()
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
expire()
Expires a survey. If the object was invoked using find or new surveyId can be ommited.
public
expire([int $surveyId = null ]) : bool|null
Parameters
- $surveyId : int = null
-
Survey ID
Return values
bool|nullfilterTemplateSave()
filterTemplateSave to fix some template name
public
filterTemplateSave(string $sTemplateName) : string
Parameters
- $sTemplateName : string
Return values
stringfindAllAsArray()
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.
findAllPublic()
public
findAllPublic() : mixed
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.
findByPk()
public
findByPk(mixed $pk[, mixed $condition = '' ][, mixed $params = array() ]) : mixed
Parameters
- $pk : mixed
- $condition : mixed = ''
- $params : mixed = array()
Tags
findQuestionByType()
public
findQuestionByType(string $type[, bool $includeSubquestions = false ]) : Question
Parameters
- $type : string
-
Question->type
- $includeSubquestions : bool = false
Return values
QuestionfixInvalidQuestions()
Fix invalid question in this survey Delete question that don't exist in primary language
public
fixInvalidQuestions() : mixed
getActiveWord()
public
getActiveWord() : string
Return values
stringgetAdditionalLanguages()
Returns additional languages formatted into a string
public
getAdditionalLanguages() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getAliasForLanguage()
Returns the survey alias for the specified language.
public
getAliasForLanguage([string|null $language = null ]) : string|null
Parameters
- $language : string|null = null
Return values
string|nullgetAllEncryptedAttributes()
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.
getAllLanguages()
Returns all languages array
public
getAllLanguages() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getAllQuestions()
public
getAllQuestions() : array<string|int, Question>
Return values
array<string|int, Question>getAnonymizedResponses()
public
getAnonymizedResponses() : string
Return values
stringgetBaseQuestions()
public
getBaseQuestions() : array<string|int, Question>
Return values
array<string|int, Question>getButtons()
Returns buttons for gridview.
public
getButtons() : string
Tags
Return values
stringgetCountFullAnswers()
public
getCountFullAnswers() : int|string
Return values
int|stringgetCountInputQuestions()
Get the coutn of questions that need input (skipping text-display etc.)
public
getCountInputQuestions() : int
Return values
intgetCountNoInputQuestions()
Get the coutn of questions that do not need input (skipping text-display etc.)
public
getCountNoInputQuestions() : int
Return values
intgetCountPartialAnswers()
public
getCountPartialAnswers() : int
Return values
intgetCountTotalAnswers()
public
getCountTotalAnswers() : int
Return values
intgetCountTotalQuestions()
public
getCountTotalQuestions() : int
Return values
intgetCPDBMappings()
This function returns any valid mappings from the survey participants tables to the CPDB in the form of an array [<cpdb_attribute_id>=><participant_table_attribute_name>]
public
getCPDBMappings() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of mappings
getCreationDate()
public
getCreationDate() : string
Return values
string —formatted date
getCurrentLanguageSettings()
The Survey languagesettings in currently active language. Falls back to the surveys' default language if the current language is not available.
public
getCurrentLanguageSettings() : SurveyLanguageSetting
Return values
SurveyLanguageSettinggetDecodedAttributedescriptions()
decodes the attributedescriptions to be used anywhere necessary
public
getDecodedAttributedescriptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getExpiryDateFormatted()
public
getExpiryDateFormatted() : string
Return values
string —formatted date
getGoogleanalyticsapikey()
Returns the value for the SurveyEdit GoogleAnalytics API-Key UseGlobal Setting
public
getGoogleanalyticsapikey() : string
Return values
stringgetGoogleanalyticsapikeysetting()
Returns the value for the SurveyEdit GoogleAnalytics API-Key UseGlobal Setting
public
getGoogleanalyticsapikeysetting() : string
Return values
stringgetGroupsCount()
Gets number of groups inside a particular survey
public
getGroupsCount() : mixed
getHasResponsesTable()
Wheteher the survey responses (data) table exists in DB
public
getHasResponsesTable() : bool
Return values
boolgetHasTimingsTable()
Wheteher the survey responses timings exists in DB
public
getHasTimingsTable() : bool
Return values
boolgetHasTokensTable()
Returns true in a survey participants table exists for survey
public
getHasTokensTable() : bool
Return values
boolgetIsActive()
public
getIsActive() : bool
Return values
boolgetIsAllowEditAfterCompletion()
public
getIsAllowEditAfterCompletion() : bool
Return values
boolgetIsAllowPrev()
public
getIsAllowPrev() : bool
Return values
boolgetIsAllowRegister()
public
getIsAllowRegister() : bool
Return values
boolgetIsAllowSave()
public
getIsAllowSave() : bool
Return values
boolgetIsAnonymized()
public
getIsAnonymized() : bool
Return values
boolgetIsAssessments()
public
getIsAssessments() : bool
Return values
boolgetIsAutoRedirect()
public
getIsAutoRedirect() : bool
Return values
boolgetIsDateExpired()
public
getIsDateExpired() : bool
Tags
Return values
boolgetIsDateStamp()
public
getIsDateStamp() : bool
Return values
boolgetIsHtmlEmail()
public
getIsHtmlEmail() : bool
Return values
boolgetIsIpAddr()
public
getIsIpAddr() : bool
Return values
boolgetIsIpAnonymize()
public
getIsIpAnonymize() : bool
Return values
boolgetIsListPublic()
public
getIsListPublic() : bool
Return values
boolgetIsNoKeyboard()
public
getIsNoKeyboard() : bool
Return values
boolgetIsPrintAnswers()
public
getIsPrintAnswers() : bool
Return values
boolgetIsPublicGraphs()
public
getIsPublicGraphs() : bool
Return values
boolgetIsPublicStatistics()
public
getIsPublicStatistics() : bool
Return values
boolgetIsRefUrl()
public
getIsRefUrl() : bool
Return values
boolgetIsSaveTimings()
public
getIsSaveTimings() : bool
Return values
boolgetIsSendConfirmation()
public
getIsSendConfirmation() : bool
Return values
boolgetIsShowGroupInfo()
public
getIsShowGroupInfo() : bool
Return values
boolgetIsShowNoAnswer()
public
getIsShowNoAnswer() : bool
Return values
boolgetIsShowProgress()
public
getIsShowProgress() : bool
Return values
boolgetIsShowQnumCode()
public
getIsShowQnumCode() : bool
Return values
boolgetIsShowWelcome()
public
getIsShowWelcome() : bool
Return values
boolgetIsShowXQuestions()
public
getIsShowXQuestions() : bool
Return values
boolgetIsTokenAnswersPersistence()
public
getIsTokenAnswersPersistence() : bool
Return values
boolgetIsUseCookie()
public
getIsUseCookie() : bool
Return values
boolgetLanguageForSurveyTaking()
Return the language of the current survey It can be: - the selected language by user via the language selector (POST then Session) - the selected language via URL (GET then Session) - the survey default language
public
getLanguageForSurveyTaking() : string
Return values
string —the correct language
getLocalizedTitle()
Returns the title of the survey. Uses the current language and falls back to the surveys' default language if the current language is not available.
public
getLocalizedTitle() : 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|intgetMinimalPermissionRead()
public
static getMinimalPermissionRead() : null|string
Tags
Return values
null|stringgetOwnerId()
Get the owner id of this Survey Used for Permission
public
getOwnerId() : int
Return values
intgetOwnerUserName()
public
getOwnerUserName() : string
Return values
stringgetPermissionData()
Get Permission data for Survey
public
static getPermissionData() : array<string|int, mixed>
Return values
array<string|int, mixed>getQuotableQuestions()
public
getQuotableQuestions() : array<string|int, Question>
Return values
array<string|int, Question>getResponsesTableName()
Return the name of survey responses (the data) table name
public
getResponsesTableName() : string
Return values
stringgetRunning()
Returns the status of the survey, including and icon and wrapped by a link to the survey
public
getRunning() : string
Tags
Return values
stringgetsSurveyUrl()
TODO: Not used anywhere. Deprecate it?
public
getsSurveyUrl() : mixed
getStartDateFormatted()
public
getStartDateFormatted() : string
Return values
string —formatted date
getState()
Get state of survey, which can be one of five: 1. Not active 2. Expired 3. Will expire in the future (running now) 3. Will run in future 4. Running now (no expiration date)
public
getState() : string
Code copied from getRunning below.
Return values
string —- 'inactive', 'expired', 'willRun', 'willExpire' or 'running'
getSurveyMenus()
Get surveymenu configuration from table surveymenu and prepares
public
getSurveyMenus([string $position = '' ]) : array<string|int, mixed>
Parameters
- $position : string = ''
-
Position
Tags
Return values
array<string|int, mixed>getSurveysWithTokenTable()
Get all surveys that has participant table
public
static getSurveysWithTokenTable() : array<string|int, Survey>
Return values
array<string|int, Survey>getSurveyTemplateConfiguration()
Returns Survey Template Configuration.
public
getSurveyTemplateConfiguration() : TemplateConfiguration
Return values
TemplateConfigurationgetSurveyUrl()
Returns the survey URL with the specified params.
public
getSurveyUrl([string|null $language = null ][, array<string|int, mixed>|string|mixed $params = [] ][, bool $preferShortUrl = true ]) : string
If $preferShortUrl is true (default), and an alias is available, it returns the short version of the URL.
Parameters
- $language : string|null = null
- $params : array<string|int, mixed>|string|mixed = []
-
Optional parameters to include in the URL.
- $preferShortUrl : bool = true
-
If true, tries to return the short URL instead of the traditional one.
Return values
stringgetTemplateEffectiveName()
Returns the name of the template to be used for the survey.
public
getTemplateEffectiveName() : string
It resolves inheritance from group and from default settings.
Tags
Return values
stringgetTimingsTableName()
Return the name of survey timigs table
public
getTimingsTableName() : string
Return values
stringgetTokenAttributes()
Returns the additional token attributes
public
getTokenAttributes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getTokenEncryptionOptions()
decodes the tokenencryptionoptions to be used anywhere necessary
public
getTokenEncryptionOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getTokensTableName()
Return the name of survey tokens table
public
getTokensTableName() : string
Return values
stringhasPermission()
public
hasPermission(mixed $sPermission[, mixed $sCRUD = 'read' ][, mixed $iUserID = null ]) : bool
Parameters
- $sPermission : mixed
- $sCRUD : mixed = 'read'
- $iUserID : mixed = null
Tags
Return values
boolhasQuestionType()
Returns true if this survey has any question of type $type.
public
hasQuestionType(string $type[, bool $includeSubquestions = false ]) : bool
Parameters
- $type : string
-
Question type, like 'L', 'T', etc.
- $includeSubquestions : bool = false
-
If true, will also check the types of subquestions.
Tags
Return values
boolinit()
Set defaults
public
init() : mixed
Tags
insertNewSurvey()
Creates a new survey - with a random sid
public
insertNewSurvey(array<string|int, mixed> $aData) : Survey
Parameters
- $aData : array<string|int, mixed>
-
Array with fieldname=>fieldcontents data
Return values
Surveymodel()
public
static model([mixed $className = __CLASS__ ]) : Survey
Parameters
- $className : mixed = __CLASS__
Tags
Return values
Surveypermission()
permission scope for this model Actually only test if user have minimal access to survey (read)
public
permission(int $loginID) : CActiveRecord
Parameters
- $loginID : int
Tags
Return values
CActiveRecordprimaryKey()
public
primaryKey() : mixed
Tags
relations()
public
relations() : mixed
Tags
replacePolicyLink()
Get the final label for survey ID
public
static replacePolicyLink(string $dataSecurityNoticeLabel, int $surveyId) : string
Parameters
- $dataSecurityNoticeLabel : string
-
current label
- $surveyId : int
-
unused
Return values
stringresetCache()
findByPk uses a cache to store a result. Use this method to force clearing that cache.
public
resetCache() : void
rules()
public
rules() : mixed
Tags
saveTranscribeCaptchaOptions()
Transcribe from 3 checkboxes to 1 char for captcha usages Uses variables from $_POST and transferred Surveyobject
public
static saveTranscribeCaptchaOptions([Survey $oSurvey = null ]) : 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
- $oSurvey : Survey = null
Tags
Return values
string —One character that corresponds to captcha usage
scopes()
public
scopes() : mixed
Tags
search()
Search
public
search([array<string|int, mixed> $options = [] ]) : CActiveDataProvider
$options = [ 'pageSize' => 10, 'currentPage' => 1 ];
Parameters
- $options : array<string|int, mixed> = []
Return values
CActiveDataProvidersetAllowjumps()
Attribute renamed to questionindex in dbversion 169 Y maps to 1 otherwise 0;
public
setAllowjumps(string $value) : mixed
Parameters
- $value : string
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
stringsetGoogleanalyticsapikeysetting()
Sets Google Analytics API Key Setting.
public
setGoogleanalyticsapikeysetting(string $value) : void
Parameters
- $value : string
-
Google Analytics Key
setOptions()
public
setOptions([mixed $gsid = 1 ]) : mixed
Parameters
- $gsid : mixed = 1
setOptionsFromDatabase()
public
setOptionsFromDatabase() : mixed
setToInherit()
public
setToInherit() : mixed
setTokenEncryptionOptions()
public
setTokenEncryptionOptions(mixed $options) : mixed
Parameters
- $options : mixed
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
getPermissionCriteria()
Get criteria from Permission
protected
static getPermissionCriteria([ $userid = null ]) : CDbCriteria
Parameters
Tags
Return values
CDbCriteriaquery()
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
getDateFormatted()
private
getDateFormatted(string $attribute) : string
Parameters
- $attribute : string
-
date attribute name
Return values
string —formatted date
getQuestionOrderCriteria()
Get the DB criteria to get questions as ordered in survey
private
getQuestionOrderCriteria() : CDbCriteria
Return values
CDbCriteriagetSurveyQuestionsCriteria()
private
getSurveyQuestionsCriteria() : mixed
setAttributeDefaults()
private
setAttributeDefaults() : mixed
shiftedDateTime()
Get a dateime DB and return DateTime or null adjusted
private
static shiftedDateTime(mixed $datetime) : DateTime|null
Parameters
- $datetime : mixed