Survey

Extends \LSActiveRecord

Class Survey

package

Default

Methods

__useTranslationForSurveymenu

__useTranslationForSurveymenu( &$entryData) 

Arguments

$entryData

_createSurveymenuArray

_createSurveymenuArray( $oSurveyMenuObjects) 

Arguments

$oSurveyMenuObjects

_getDefaultSurveyMenus

_getDefaultSurveyMenus( $position = '') 

Arguments

$position

_getSurveymenuSubmenus

_getSurveymenuSubmenus( $oParentSurveymenu) 

Arguments

$oParentSurveymenu

active

active() : mixed

Response

mixed

afterFindSurvey to fix and/or add some survey attribute - Fix template name to be sure template exist

afterFindSurvey() 

attributeLabels

attributeLabels() 
inheritdoc

Lists the behaviors of this model

behaviors() : array
inherited

Below is a list of all behaviors we register:

see \CTimestampBehavior \PluginEventBehavior

Response

array

Method to make an approximation on how long a survey will last Approx is 3 questions each minute.

calculateEstimatedTime() : double

Response

double

delete

delete(boolean $recursive = true) 
inheritdoc

With allow to delete all related models and data and test Permission.

Arguments

$recursive

boolean

deleteAllByAttributes

deleteAllByAttributes(array $attributes, string $condition = '', array $params = array()) : integer
inherited
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 {@link find()} for detailed explanation about $condition and $params.

Arguments

$attributes

array

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

parameters to be bound to an SQL statement.

Response

integer

number of rows affected by the execution.

Deletes a survey and all its data

deleteSurvey(integer $iSurveyID, boolean $recursive = true) : boolean
access

public

Arguments

$iSurveyID

integer

$recursive

boolean

Response

boolean

Expires a survey. If the object was invoked using find or new surveyId can be ommited.

expire(integer $surveyId = null) : boolean|null

Arguments

$surveyId

integer

Response

boolean|null

filterTemplateSave to fix some template name

filterTemplateSave(string $sTemplateName) : string

Arguments

$sTemplateName

string

Response

string

Finds all active records satisfying the specified condition but returns them as array

findAllAsArray(\CDbCriteria $condition = '', array $params = array()) : array
inherited

See \find() for detailed explanation about $condition and $params.

Arguments

$condition

\CDbCriteria

query condition or criteria.

$params

array

parameters to be bound to an SQL statement.

Response

array

list of active records satisfying the specified condition. An empty array is returned if none is found.

findByPk

findByPk( $pk,  $condition = '',  $params = array()) 
inheritdoc

. But use a static var because can be used a lot of time.

Arguments

$pk

$condition

$params

Fix invalid question in this survey

fixInvalidQuestions() 

getActiveWord

getActiveWord() : string

Response

string

Returns additional languages formatted into a string

getAdditionalLanguages() : array
access

public

Response

array

Returns all languages array

getAllLanguages() : array
access

public

Response

array

getAnonymizedResponses

getAnonymizedResponses() : string

Response

string

getbuttons

getbuttons() : string

Response

string

getCountFullAnswers

getCountFullAnswers() : integer|string

Response

integer|string

Get the coutn of questions that need input (skipping text-display etc.)

getCountInputQuestions() : integer

Response

integer

Get the coutn of questions that do not need input (skipping text-display etc.)

getCountNoInputQuestions() : integer

Response

integer

getCountPartialAnswers

getCountPartialAnswers() : integer

Response

integer

getCountTotalAnswers

getCountTotalAnswers() : integer

Response

integer

getCountTotalQuestions

getCountTotalQuestions() : integer

Response

integer

getCreationDate

getCreationDate() : string

Response

string

formatted date

The Survey languagesettings in currently active language. Falls back to the surveys' default language if the current language is not available.

getCurrentLanguageSettings() : \SurveyLanguageSetting

getDateFormatted

getDateFormatted(string $attribute) : string

Arguments

$attribute

string

date attribute name

Response

string

formatted date

getExpiryDateFormatted

getExpiryDateFormatted() : string

Response

string

formatted date

getFullAnswers

getFullAnswers() : array|null

Response

array|null

Returns the value for the SurveyEdit GoogleAnalytics API-Key UseGlobal Setting

getGoogleanalyticsapikey() : string

Response

string

Returns the value for the SurveyEdit GoogleAnalytics API-Key UseGlobal Setting

getGoogleanalyticsapikeysetting() : string

Response

string

Gets number of groups inside a particular survey

getGroupsCount() 

Wheteher the survey reponses (data) table exists in DB

getHasResponsesTable() : boolean

Response

boolean

Wheteher the survey reponses timings exists in DB

getHasTimingsTable() : boolean

Response

boolean

Returns true in a survey participants table exists for survey

getHasTokensTable() : boolean

Response

boolean

getIsActive

getIsActive() : boolean

Response

boolean

getIsAllowEditAfterCompletion

getIsAllowEditAfterCompletion() : boolean

Response

boolean

getIsAllowPrev

getIsAllowPrev() : boolean

Response

boolean

getIsAllowRegister

getIsAllowRegister() : boolean

Response

boolean

getIsAllowSave

getIsAllowSave() : boolean

Response

boolean

getIsAnonymized

getIsAnonymized() : boolean

Response

boolean

getIsAssessments

getIsAssessments() : boolean

Response

boolean

getIsAutoRedirect

getIsAutoRedirect() : boolean

Response

boolean

getIsDateStamp

getIsDateStamp() : boolean

Response

boolean

getIsHtmlEmail

getIsHtmlEmail() : boolean

Response

boolean

getIsIpAddr

getIsIpAddr() : boolean

Response

boolean

getIsListPublic

getIsListPublic() : boolean

Response

boolean

getIsNoKeyboard

getIsNoKeyboard() : boolean

Response

boolean

getIsPrintAnswers

getIsPrintAnswers() : boolean

Response

boolean

getIsPublicGraphs

getIsPublicGraphs() : boolean

Response

boolean

getIsPublicStatistics

getIsPublicStatistics() : boolean

Response

boolean

getIsRefUrl

getIsRefUrl() : boolean

Response

boolean

getIsSaveTimings

getIsSaveTimings() : boolean

Response

boolean

getIsSendConfirmation

getIsSendConfirmation() : boolean

Response

boolean

getIsShowGroupInfo

getIsShowGroupInfo() : boolean

Response

boolean

getIsShowNoAnswer

getIsShowNoAnswer() : boolean

Response

boolean

getIsShowProgress

getIsShowProgress() : boolean

Response

boolean

getIsShowQnumCode

getIsShowQnumCode() : boolean

Response

boolean

getIsShowWelcome

getIsShowWelcome() : boolean

Response

boolean

getIsShowXQuestions

getIsShowXQuestions() : boolean

Response

boolean

getIsTokenAnswersPersistence

getIsTokenAnswersPersistence() : boolean

Response

boolean

getIsUseCookie

getIsUseCookie() : boolean

Response

boolean

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

getLanguageForSurveyTaking() : string

Response

string

the correct language

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.

getLocalizedTitle() 

Return the max value for a field

getMaxId(string $field = null, boolean $forceRefresh = false) : false|integer
inherited

This is a convenience method, that uses the primary key of the model to retrieve the highest value.

Throws
\Exception

Arguments

$field

string

The field that contains the Id, when null primary key is used if it is a single field

$forceRefresh

boolean

Don't use value from static cache but always requery the database

Response

false|integer

Return the min value for a field

getMinId(string $field = null, boolean $forceRefresh = false) : false|integer
inherited

This is a convenience method, that uses the primary key of the model to retrieve the highest value.

Throws
\Exception

Arguments

$field

string

The field that contains the Id, when null primary key is used if it is a single field

$forceRefresh

boolean

Don't use value from static cache but always requery the database

Response

false|integer

getPartialAnswers

getPartialAnswers() : array|null

Response

array|null

Get the DB criteria to get questions as ordered in survey

getQuestionOrderCriteria() : \CDbCriteria

Response

\CDbCriteria

getQuotableQuestions

getQuotableQuestions() : array<mixed,\Question>

Response

array<mixed,\Question>

Return the name of survey responses (the data) table name

getResponsesTableName() : string

Response

string

getRunning

getRunning() : string
todo

Document code, please.

Response

string

getsSurveyUrl

getsSurveyUrl() 

getStartDateFormatted

getStartDateFormatted() : string

Response

string

formatted date

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)

getState() : string

Code copied from getRunning below.

Response

string

  • 'inactive', 'expired', 'willRun', 'willExpire' or 'running'

Get surveymenu configuration This will be made bigger in future releases, but right now it only collects the default menu-entries

getSurveyMenus( $position = '') 

Arguments

$position

Get all surveys that has participant table

getSurveysWithTokenTable() : array<mixed,\Survey>
static

Response

array<mixed,\Survey>

getSurveyTemplateConfiguration

getSurveyTemplateConfiguration() 

Return the name of survey timigs table

getTimingsTableName() : string

Response

string

Returns the additional token attributes

getTokenAttributes() : array
access

public

Response

array

Return the name of survey tokens table

getTokensTableName() : string

Response

string

Returns true if this survey has any question of type $type.

hasQuestionType(string $type, boolean $includeSubquestions = false) : boolean
Throws
\CException

Arguments

$type

string

Question type, like 'L', 'T', etc.

$includeSubquestions

boolean

If true, will also check the types of subquestions.

Response

boolean

Set defaults

init() 
inheritdoc

Creates a new survey - with a random sid

insertNewSurvey(array $aData) : \Survey

Arguments

$aData

array

Array with fieldname=>fieldcontents data

Response

\Survey

model

model( $class = __CLASS__) : \Survey
static
inheritdoc

Arguments

$class

Response

\Survey

permission scope for this model Actually only test if user have minimal access to survey (read)

permission(integer $loginID) : \CActiveRecord
access

public

Arguments

$loginID

integer

Response

\CActiveRecord

primaryKey

primaryKey() 
inheritdoc

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

query(\CDbCriteria $criteria, boolean $all = false, boolean $asAR = true) : mixed
inherited

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.

since 1.1.7

Arguments

$criteria

\CDbCriteria

the query criteria

$all

boolean

whether to return all data

$asAR

boolean

Response

mixed

the AR objects populated with the query result

relations

relations() 
inheritdoc

findByPk uses a cache to store a result. Use this method to force clearing that cache.

resetCache() 

rules

rules() 
inheritdoc

Transcribe from 3 checkboxes to 1 char for captcha usages Uses variables from $_POST and transferred Surveyobject

saveTranscribeCaptchaOptions(\Survey $oSurvey) : string
static

'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 'N' = None

todo

Should really be saved as three fields in the database!

Arguments

$oSurvey

\Survey

Response

string

One character that corresponds to captcha usage

scopes

scopes() 
inheritdoc

Attribute renamed to questionindex in dbversion 169 Y maps to 1 otherwise 0;

setAllowjumps(string $value) 

Arguments

$value

string

setGoogleanalyticsapikeysetting

setGoogleanalyticsapikeysetting(string $value) 

Arguments

$value

string

tableName

tableName() 
inheritdoc

Transcribe from 3 checkboxes to 1 char for captcha usages Uses variables from $_POST

transcribeCaptchaOptions() : string
static

'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 'N' = None

todo

Should really be saved as three fields in the database!

Response

string

One character that corresponds to captcha usage

Properties

This is a static cache, it lasts only during the active request. If you ever need to clear it, like on activation of a survey when in the same request a row is read, saved and read again you can use resetCache() method.

findByPkCache : array
var

Type(s)

array

searched_value

searched_value : 

Type(s)

showsurveypolicynotice

showsurveypolicynotice : 

Type(s)

sSurveyUrl

sSurveyUrl : 

Type(s)

sid

sid : integer

Survey ID

Type(s)

integer

owner_id

owner_id : integer

Type(s)

integer

gsid

gsid : integer

Survey ID

Type(s)

integer

admin

admin : string

Survey Admin's full name

Type(s)

string

active

active : string

Whether survey is acive or not (Y/N)

Type(s)

string

expires

expires : string

Expiry date (YYYY-MM-DD hh:mm:ss)

Type(s)

string

startdate

startdate : string

Survey Start date (YYYY-MM-DD hh:mm:ss)

Type(s)

string

adminemail

adminemail : string

Survey administrator email address

Type(s)

string

anonymized

anonymized : string

Whether survey is anonymized or not (Y/N)

Type(s)

string

faxto

faxto : string

Type(s)

string

format

format : string

A : All in one, G : Group by group, Q : question by question

Type(s)

string

savetimings

savetimings : string

Whether survey timings are saved (Y/N)

Type(s)

string

template

template : string

Template name

Type(s)

string

language

language : string

Survey base language

Type(s)

string

additional_languages

additional_languages : string

Survey additional languages delimited by space ' '

Type(s)

string

datestamp

datestamp : string

Whether respondents' datestamps will be saved (Y/N)

Type(s)

string

usecookie

usecookie : string

Are cookies used to prevent repeated participation (Y/N)

Type(s)

string

allowregister

allowregister : string

Allow public registration (Y/N)

Type(s)

string

allowsave

allowsave : string

Is participant allowed save and resume later (Y/N)

Type(s)

string

autonumber_start

autonumber_start : integer

Type(s)

integer

tokenlength

tokenlength : integer

Token length: MIN:5 MAX:36

Type(s)

integer

autoredirect

autoredirect : string

Automatically load URL when survey complete: (Y/N)

Type(s)

string

allowprev

allowprev : string

Allow backwards navigation (Y/N)

Type(s)

string

printanswers

printanswers : string

Participants may print answers: (Y/N)

Type(s)

string

ipaddr

ipaddr : string

Whether Participants IP address will be saved: (Y/N)

Type(s)

string

refurl

refurl : string

Save referrer URL: (Y/N)

Type(s)

string

datecreated

datecreated : string

Date survey was created (YYYY-MM-DD hh:mm:ss)

Type(s)

string

publicstatistics

publicstatistics : string

Public statistics: (Y/N)

Type(s)

string

publicgraphs

publicgraphs : string

Show graphs in public statistics: (Y/N)

Type(s)

string

listpublic

listpublic : string

List survey publicly: (Y/N)

Type(s)

string

htmlemail

htmlemail : string

Use HTML format for token emails: (Y/N)

Type(s)

string

sendconfirmation

sendconfirmation : string

Send confirmation emails:(Y/N)

Type(s)

string

tokenanswerspersistence

tokenanswerspersistence : string

Enable token-based response persistence: (Y/N)

Type(s)

string

assessments

assessments : string

Enable assessment mode: (Y/N)

Type(s)

string

usecaptcha

usecaptcha : string

Type(s)

string

usetokens

usetokens : string

Type(s)

string

bounce_email

bounce_email : string

Bounce email address

Type(s)

string

attributedescriptions

attributedescriptions : string

Type(s)

string

emailresponseto

emailresponseto : string

e-mail address to send detailed admin notification email to

Type(s)

string

emailnotificationto

emailnotificationto : string

Email address to send basic admin notification email to

Type(s)

string

showxquestions

showxquestions : string

Show "There are X questions in this survey": (Y/N)

Type(s)

string

showgroupinfo

showgroupinfo : string

Show group name and/or group description: (Y/N)

Type(s)

string

shownoanswer

shownoanswer : string

Show "No answer": (Y/N)

Type(s)

string

showqnumcode

showqnumcode : string

Show question number and/or code: (Y/N)

Type(s)

string

bouncetime

bouncetime : integer

Type(s)

integer

bounceprocessing

bounceprocessing : string

Type(s)

string

bounceaccounttype

bounceaccounttype : string

Type(s)

string

bounceaccounthost

bounceaccounthost : string

Type(s)

string

bounceaccountpass

bounceaccountpass : string

Type(s)

string

bounceaccountencryption

bounceaccountencryption : string

Type(s)

string

bounceaccountuser

bounceaccountuser : string

Type(s)

string

showwelcome

showwelcome : string

Show welcome screen: (Y/N)

Type(s)

string

showprogress

showprogress : string

how progress bar: (Y/N)

Type(s)

string

questionindex

questionindex : integer

Show question index / allow jumping (0: diabled; 1: Incremental; 2: Full)

Type(s)

integer

navigationdelay

navigationdelay : integer

Navigation delay (seconds)

Type(s)

integer

nokeyboard

nokeyboard : string

Show on-screen keyboard: (Y/N)

Type(s)

string

alloweditaftercompletion

alloweditaftercompletion : string

Allow multiple responses or update responses with one token: (Y/N)

Type(s)

string

googleanalyticsstyle

googleanalyticsstyle : string

Google Analytics style: (0: off; 1:Default; 2:Survey-SID/Group)

Type(s)

string

googleanalyticsapikey

googleanalyticsapikey : string

Google Analytics Tracking ID

Type(s)

string

permissions

permissions : array<mixed,\Permission>

Type(s)

array<mixed,\Permission>

languagesettings

languagesettings : array<mixed,\SurveyLanguageSetting>

Type(s)

array<mixed,\SurveyLanguageSetting>

owner

owner : \User

Type(s)

\User

groups

groups : array<mixed,\QuestionGroup>

Type(s)

array<mixed,\QuestionGroup>

quotas

quotas : array<mixed,\Quota>

Type(s)

array<mixed,\Quota>

quotableQuestions

quotableQuestions : array<mixed,\Question>

Type(s)

array<mixed,\Question>

fullAnswers

fullAnswers : array

Type(s)

array

partialAnswers

partialAnswers : array

Type(s)

array

countFullAnswers

countFullAnswers : integer

Full-answers count

Type(s)

integer

countPartialAnswers

countPartialAnswers : integer

Full-answers count

Type(s)

integer

countTotalAnswers

countTotalAnswers : integer

Total-answers count

Type(s)

integer

groupsCount

groupsCount : integer

Number of groups in a survey (in base language)

Type(s)

integer

surveyinfo

surveyinfo : array

Type(s)

array

currentLanguageSettings

currentLanguageSettings : \SurveyLanguageSetting

Survey languagesettings in currently active language

Type(s)

\SurveyLanguageSetting

allLanguages

allLanguages : array<mixed,string>

Type(s)

array<mixed,string>

additionalLanguages

additionalLanguages : array<mixed,string>

Additional survey languages

Type(s)

array<mixed,string>

tokenAttributes

tokenAttributes : array

Additional token attribute names

Type(s)

array

creationDate

creationDate : string

Creation date formatted according to user format

Type(s)

string

startDateFormatted

startDateFormatted : string

Start date formatted according to user format

Type(s)

string

expiryDateFormatted

expiryDateFormatted : string

Expiry date formatted according to user format

Type(s)

string

tokensTableName

tokensTableName : string

Name of survey tokens table

Type(s)

string

responsesTableName

responsesTableName : string

Name of survey resonses table

Type(s)

string

timingsTableName

timingsTableName : string

Name of survey timings table

Type(s)

string

hasTokensTable

hasTokensTable : boolean

Whether survey has a tokens table or not

Type(s)

boolean

hasResponsesTable

hasResponsesTable : boolean

Wheteher the survey reponses (data) table exists in DB

Type(s)

boolean

hasTimingsTable

hasTimingsTable : boolean

Wheteher the survey timings table exists in DB

Type(s)

boolean

googleanalyticsapikeysetting

googleanalyticsapikeysetting : string

Returns the value for the SurveyEdit GoogleAnalytics API-Key UseGlobal Setting

Type(s)

string

countTotalQuestions

countTotalQuestions : integer

Count of questions (in that language, without subquestions)

Type(s)

integer

countInputQuestions

countInputQuestions : integer

Count of questions that need input (skipping text-display etc.)

Type(s)

integer

countNoInputQuestions

countNoInputQuestions : integer

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:

Type(s)

integer

isActive

isActive : boolean

Whether Survey is active

Type(s)

boolean

isAnonymized

isAnonymized : boolean

Whether survey is anonymized or not

Type(s)

boolean

isSaveTimings

isSaveTimings : boolean

Whether survey timings are saved

Type(s)

boolean

isDateStamp

isDateStamp : boolean

Whether respondents' datestamps will be saved

Type(s)

boolean

isUseCookie

isUseCookie : boolean

Are cookies used to prevent repeated participation

Type(s)

boolean

isAllowRegister

isAllowRegister : boolean

Allow public registration

Type(s)

boolean

isAllowSave

isAllowSave : boolean

Is participant allowed save and resume later

Type(s)

boolean

isAutoRedirect

isAutoRedirect : boolean

Automatically load URL when survey complete

Type(s)

boolean

isAllowPrev

isAllowPrev : boolean

Allow backwards navigation

Type(s)

boolean

isPrintAnswers

isPrintAnswers : boolean

Participants may print answers

Type(s)

boolean

isIpAddr

isIpAddr : boolean

Whether Participants IP address will be saved

Type(s)

boolean

isRefUrl

isRefUrl : boolean

Save referrer URL

Type(s)

boolean

isPublicStatistics

isPublicStatistics : boolean

Public statistics

Type(s)

boolean

isPublicGraphs

isPublicGraphs : boolean

Show graphs in public statistics

Type(s)

boolean

isListPublic

isListPublic : boolean

List survey publicly

Type(s)

boolean

isHtmlEmail

isHtmlEmail : boolean

Use HTML format for token emails

Type(s)

boolean

isSendConfirmation

isSendConfirmation : boolean

Send confirmation emails

Type(s)

boolean

isTokenAnswersPersistence

isTokenAnswersPersistence : boolean

Enable token-based response persistence

Type(s)

boolean

isAssessments

isAssessments : boolean

Enable assessment mode

Type(s)

boolean

isShowXQuestions

isShowXQuestions : boolean

Show "There are X questions in this survey"

Type(s)

boolean

isShowGroupInfo

isShowGroupInfo : boolean

Show group name and/or group description

Type(s)

boolean

isShowNoAnswer

isShowNoAnswer : boolean

Show "No answer"

Type(s)

boolean

isShowQnumCode

isShowQnumCode : boolean

Show question number and/or code

Type(s)

boolean

isShowWelcome

isShowWelcome : boolean

Show welcome screen

Type(s)

boolean

isShowProgress

isShowProgress : boolean

how progress bar

Type(s)

boolean

showsurveypolicynotice

showsurveypolicynotice : boolean

Show the security notice

Type(s)

boolean

isNoKeyboard

isNoKeyboard : boolean

Show on-screen keyboard

Type(s)

boolean

isAllowEditAfterCompletion

isAllowEditAfterCompletion : boolean

Allow multiple responses or update responses with one token

Type(s)

boolean

defaultlanguage

defaultlanguage : \SurveyLanguageSetting

Type(s)

\SurveyLanguageSetting