ParticipantsAction
extends SurveyCommonAction
in package
This is the main controller for Participants Panel
Table of Contents
Methods
- __construct() : mixed
- addParticipant() : string
- Add new participant to database
- addToCentral() : mixed
- Responsible for copying the participant from tokens to the central Database
- addToTokenattmap() : void
- Responsible for adding the participant to the specified survey with attribute mapping Used when mapping CPDB participants to survey tokens with attributes.
- attributeControl() : void
- Loads the view 'attributeControl'
- attributeMap() : mixed
- Show form for attribute mapping while copying participants from CPDB to token's table
- attributeMapCSV() : mixed
- Show the drag-n-drop form for CSV attributes
- attributeMapToken() : mixed
- This function is responsible for attribute mapping while copying participants from tokens to CPDB
- batchEdit() : mixed
- blacklistControl() : void
- Loads the view 'blacklistControl'
- changeAttributeEncrypted() : void
- Echoes json
- changeAttributeVisibility() : void
- Echoes json
- changeblackliststatus() : void
- AJAX Method to change the blocklist status of a participant Requires POST with 'participant_id' (varchar) and 'blacklist' (boolean) Echos JSON-encoded array with 'success' (boolean) and 'newValue' ('Y' || 'N')
- changeSharedEditableStatus() : void
- delAttributeValues() : mixed
- Responsible for deleting the additional attribute values in case of drop down.
- deleteAttributes() : void
- Delete several attributes.
- deleteLanguageFromAttribute() : void
- Deletes a translation from an Attribute, if it has at least one translation Requires POST 'attribute_id' (int), 'lang' (string) [language-code] Echoes 'success' (boolean), 'successMessage' (string|null), 'errorMessage' (string|null)
- deleteMultipleParticipantShare() : void
- Deletes several ParticipantShare NOT the same as rejectShareParticipant
- deleteParticipant() : void
- Takes the delete call from the display participants and take appropriate action depending on the condition
- deleteSingleAttribute() : void
- Deletes a single Attribute via AJAX-call Requires POST 'attribute_id' (int) Echoes json-encoded array 'success' (boolean), successMessage (string)
- deleteSingleParticipantShare() : void
- Deletes a single participant share Called by Ajax; echoes success/error
- displayParticipants() : mixed
- Loads the view 'displayParticipants' which contains the main grid
- editAttributeInfo() : void
- Takes the edit call from the share panel, which either edits or deletes the share information Basically takes the call on can_edit
- editAttributeName() : void
- Method to edit a global Attribute Requires POST 'ParticipantAttributeName' (array), 'ParticipantAttributeNameLanguages' (array), 'ParticipantAttributeNamesDropdown' (array|null), 'oper' (string) ['edit'|'new'] Echoes json-encoded array 'success' (array), 'successMessage' (string)
- editAttributevalue() : mixed
- Responsible for editing the additional attributes values
- editParticipant() : mixed
- Either update or create new participant
- editShareInfo() : mixed
- Takes the edit call from the share panel, which either edits or deletes the share information Basically takes the call on can_edit
- editValueParticipantPanel() : void
- AJAX switcher for action calling
- exporttocsv() : void
- Exports participants as CSV - receiver function for the GUI
- exporttocsvAll() : mixed
- Responsible to export all the participants in the central table
- exporttocsvcount() : mixed
- Returns the count of the participants in the CSV and show it in the title of the modal box This is to give the user the hint to see the number of participants he is exporting
- exporttocsvcountAll() : mixed
- Outputs the count of participants when using the export all button on the top
- getAttributeJson() : mixed
- Fetches the attributes of a participant to be displayed in the attribute subgrid
- getParticipantsJson() : mixed
- getParticipantsResultsJson() : void
- Equal to getParticipantsJson() but now with a search
- getSearchIDs() : mixed
- Gets the ids of participants to be copied to the individual survey Needed in the Participant views of the individual surveys
- getShareInfoJson() : void
- Sends the shared participant info to the share panel using JSON encoding Called after the share panel grid is loaded Returns the json depending on the user logged in by checking it from the session
- getSurveyInfoJson() : void
- Receives an ajax call containing the participant id in the fourth segment of the url Supplies list of survey links - surveys of which this participant is on the tokens table URL: [localurl]/limesurvey/admin/participants/getSurveyInfoJson/pid/[participant_id] Echoes json data containing linked survey information (Survey name, survey ID, token_id and date_added)
- importCSV() : mixed
- Loads the view 'importCSV'
- index() : void
- index() : mixed
- Loads the view 'participantsPanel' Central Participants database summary action
- mapCSVcancelled() : mixed
- This function deletes the uploaded csv file if the import is cancelled
- openAddToSurvey() : void
- Open modal to add participant(s) to survey
- openDeleteParticipant() : void
- Method to open the participant delete modal Requires 'participant_id' (int)
- openEditAttributeNames() : mixed
- Method to open the editAttributeName Modal
- openEditParticipant() : void
- Method to open the participant edit/ new participant modal Requires 'participant_id' (int|null)
- openModalParticipantPanel() : void
- AJAX switcher for modal calling
- openParticipantShare() : void
- Called by Ajax to open the share participant modal Used by both single share and massive action share
- openParticipantSurveys() : mixed
- ?
- questionbar() : mixed
- Shows admin menu for question
- rejectShareParticipant() : void
- Deletes *all* shares for this participant
- renderInternal() : mixed
- run() : mixed
- Action classes require them to have a run method. We reroute it to index if called.
- runWithParams() : bool
- Override runWithParams() implementation in CAction to help us parse requests with subactions.
- saveAttribute() : void
- Responsible for saving the additional attribute. It iterates through all the new attributes added dynamically and iterates through them
- setAjaxHelper() : void
- setSession() : mixed
- Responsible for setting the session variables for attribute map page redirect
- sharePanel() : void
- Loads the view 'sharePanel'
- shareParticipant() : void
- Stores the shared participant information in participant_shares for ONE participant *
- shareParticipants() : void
- Stores the shared participant information in participant_shares
- storeBlacklistValues() : void
- Stores the blocklist setting to the database
- summaryview() : mixed
- Seems to be a method to show the uploadsummary
- surveybar() : mixed
- Shows admin menu for surveys
- updateParticipant() : void
- Update participant Outputs Ajax result
- uploadCSV() : mixed
- Uploads the file to the server and process it for valid enteries and import them into database Also creates attributes from the mapping drag-n-drop form.
- beforeSideMenuRender() : string
- Returns content from event beforeSideMenuRender
- csvExportCount() : string|int
- Returns a string with the number of participants available for export or 0
- fetchExtraMenus() : array<string|int, ExtraMenu>
- Get extra menus from plugins that are using event beforeAdminMenuRender
- filterImportedResources() : array<string|int, mixed>
- listquestiongroups() : mixed
- REFACTORED in LayoutHelper
- listquestions() : mixed
- REFACTORED in LayoutHelper
- notifications() : mixed
- Display notifications
- nsurveysummary() : mixed
- REFACTORED in LayoutHelper
- organizequestionbar() : mixed
- Render the save/cancel bar for Organize question groups/questions
- renderCentralContents() : string
- Rendering the subviews and views of renderWrappedTemplate
- renderJSON() : void
- Method to render an array as a json document
- renderQuickmenu() : string
- Render the quick-menu that is shown when side-menu is hidden.
- renderWrappedTemplate() : mixed
- Renders template(s) wrapped in header and footer
- requirePostRequest() : mixed
- Validates that the request method is POST.
- route() : mixed
- Routes the action into correct subaction
- showadminmenu() : string
- showadminmenu() function returns html text for the administration button bar
- showHeaders() : mixed
- Header
- surveysidemenu() : mixed
- Show side menu for survey view
- titlebar() : mixed
- REFACTORED in LayoutHelper.php
- updatenotification() : mixed
- Display the update notification
- addPseudoParams() : array<string|int, mixed>
- Some functions have different parameters, which are just an alias of the usual parameters we're getting in the url. This function just populates those variables so that we don't end up in an error.
- checkPermission() : void
- If user has no permission, redirect and show error message.
- csvExport() : false|null
- Export to csv using optional search/filter
- getAutomaticallyMappedAttributes() : array<string|int, mixed>
- Return array of automatic mappings, pairing token attributes with CPDB attributes
- getTopBarComponents() : array<string|int, mixed>
- Returns the topbar config which then needs to be added into $aData['topbar'] in action functions
Methods
__construct()
public
__construct([mixed $controller = null ][, mixed $id = null ]) : mixed
Parameters
- $controller : mixed = null
- $id : mixed = null
addParticipant()
Add new participant to database
public
addParticipant(array<string|int, mixed> $aData[, array<string|int, mixed> $extraAttributes = array() ]) : string
Parameters
- $aData : array<string|int, mixed>
- $extraAttributes : array<string|int, mixed> = array()
Return values
string —json
addToCentral()
Responsible for copying the participant from tokens to the central Database
public
addToCentral() : mixed
TODO: Most of the work for this function is in the participants model file but it doesn't belong there.
addToTokenattmap()
Responsible for adding the participant to the specified survey with attribute mapping Used when mapping CPDB participants to survey tokens with attributes.
public
addToTokenattmap() : void
Called when user clicks "Continue" in that form.
Echoes a result message witch will be displayed as a bootstrap modal
attributeControl()
Loads the view 'attributeControl'
public
attributeControl() : void
attributeMap()
Show form for attribute mapping while copying participants from CPDB to token's table
public
attributeMap() : mixed
attributeMapCSV()
Show the drag-n-drop form for CSV attributes
public
attributeMapCSV() : mixed
attributeMapToken()
This function is responsible for attribute mapping while copying participants from tokens to CPDB
public
attributeMapToken() : mixed
batchEdit()
public
batchEdit() : mixed
blacklistControl()
Loads the view 'blacklistControl'
public
blacklistControl() : void
changeAttributeEncrypted()
Echoes json
public
changeAttributeEncrypted() : void
changeAttributeVisibility()
Echoes json
public
changeAttributeVisibility() : void
changeblackliststatus()
AJAX Method to change the blocklist status of a participant Requires POST with 'participant_id' (varchar) and 'blacklist' (boolean) Echos JSON-encoded array with 'success' (boolean) and 'newValue' ('Y' || 'N')
public
changeblackliststatus() : void
changeSharedEditableStatus()
public
changeSharedEditableStatus() : void
delAttributeValues()
Responsible for deleting the additional attribute values in case of drop down.
public
delAttributeValues() : mixed
deleteAttributes()
Delete several attributes.
public
deleteAttributes() : void
Massive action, called by Ajax.
deleteLanguageFromAttribute()
Deletes a translation from an Attribute, if it has at least one translation Requires POST 'attribute_id' (int), 'lang' (string) [language-code] Echoes 'success' (boolean), 'successMessage' (string|null), 'errorMessage' (string|null)
public
deleteLanguageFromAttribute() : void
deleteMultipleParticipantShare()
Deletes several ParticipantShare NOT the same as rejectShareParticipant
public
deleteMultipleParticipantShare() : void
deleteParticipant()
Takes the delete call from the display participants and take appropriate action depending on the condition
public
deleteParticipant() : void
deleteSingleAttribute()
Deletes a single Attribute via AJAX-call Requires POST 'attribute_id' (int) Echoes json-encoded array 'success' (boolean), successMessage (string)
public
deleteSingleAttribute() : void
deleteSingleParticipantShare()
Deletes a single participant share Called by Ajax; echoes success/error
public
deleteSingleParticipantShare([string $participantId = null ][, int $shareUid = null ]) : void
Parameters
- $participantId : string = null
- $shareUid : int = null
displayParticipants()
Loads the view 'displayParticipants' which contains the main grid
public
displayParticipants() : mixed
editAttributeInfo()
Takes the edit call from the share panel, which either edits or deletes the share information Basically takes the call on can_edit
public
editAttributeInfo() : void
editAttributeName()
Method to edit a global Attribute Requires POST 'ParticipantAttributeName' (array), 'ParticipantAttributeNameLanguages' (array), 'ParticipantAttributeNamesDropdown' (array|null), 'oper' (string) ['edit'|'new'] Echoes json-encoded array 'success' (array), 'successMessage' (string)
public
editAttributeName() : void
editAttributevalue()
Responsible for editing the additional attributes values
public
editAttributevalue() : mixed
editParticipant()
Either update or create new participant
public
editParticipant() : mixed
editShareInfo()
Takes the edit call from the share panel, which either edits or deletes the share information Basically takes the call on can_edit
public
editShareInfo() : mixed
editValueParticipantPanel()
AJAX switcher for action calling
public
editValueParticipantPanel() : void
exporttocsv()
Exports participants as CSV - receiver function for the GUI
public
exporttocsv() : void
exporttocsvAll()
Responsible to export all the participants in the central table
public
exporttocsvAll() : mixed
exporttocsvcount()
Returns the count of the participants in the CSV and show it in the title of the modal box This is to give the user the hint to see the number of participants he is exporting
public
exporttocsvcount() : mixed
exporttocsvcountAll()
Outputs the count of participants when using the export all button on the top
public
exporttocsvcountAll() : mixed
getAttributeJson()
Fetches the attributes of a participant to be displayed in the attribute subgrid
public
getAttributeJson() : mixed
Tags
getParticipantsJson()
public
getParticipantsJson([CDbCriteria $search = null ]) : mixed
Parameters
- $search : CDbCriteria = null
getParticipantsResultsJson()
Equal to getParticipantsJson() but now with a search
public
getParticipantsResultsJson() : void
Tags
getSearchIDs()
Gets the ids of participants to be copied to the individual survey Needed in the Participant views of the individual surveys
public
getSearchIDs() : mixed
getShareInfoJson()
Sends the shared participant info to the share panel using JSON encoding Called after the share panel grid is loaded Returns the json depending on the user logged in by checking it from the session
public
getShareInfoJson() : void
Tags
getSurveyInfoJson()
Receives an ajax call containing the participant id in the fourth segment of the url Supplies list of survey links - surveys of which this participant is on the tokens table URL: [localurl]/limesurvey/admin/participants/getSurveyInfoJson/pid/[participant_id] Echoes json data containing linked survey information (Survey name, survey ID, token_id and date_added)
public
getSurveyInfoJson() : void
Tags
importCSV()
Loads the view 'importCSV'
public
importCSV() : mixed
index()
public
index() : void
index()
Loads the view 'participantsPanel' Central Participants database summary action
public
index() : mixed
mapCSVcancelled()
This function deletes the uploaded csv file if the import is cancelled
public
mapCSVcancelled() : mixed
openAddToSurvey()
Open modal to add participant(s) to survey
public
openAddToSurvey() : void
openDeleteParticipant()
Method to open the participant delete modal Requires 'participant_id' (int)
public
openDeleteParticipant() : void
openEditAttributeNames()
Method to open the editAttributeName Modal
public
openEditAttributeNames() : mixed
openEditParticipant()
Method to open the participant edit/ new participant modal Requires 'participant_id' (int|null)
public
openEditParticipant() : void
openModalParticipantPanel()
AJAX switcher for modal calling
public
openModalParticipantPanel() : void
openParticipantShare()
Called by Ajax to open the share participant modal Used by both single share and massive action share
public
openParticipantShare() : void
openParticipantSurveys()
?
public
openParticipantSurveys() : mixed
questionbar()
Shows admin menu for question
public
questionbar(array<string|int, mixed> $aData) : mixed
Parameters
- $aData : array<string|int, mixed>
Tags
rejectShareParticipant()
Deletes *all* shares for this participant
public
rejectShareParticipant() : void
renderInternal()
public
renderInternal(string $_viewFile_[, mixed $_data_ = null ][, mixed $_return_ = false ]) : mixed
Parameters
- $_viewFile_ : string
- $_data_ : mixed = null
- $_return_ : mixed = false
Tags
run()
Action classes require them to have a run method. We reroute it to index if called.
public
run() : mixed
runWithParams()
Override runWithParams() implementation in CAction to help us parse requests with subactions.
public
runWithParams(mixed $params) : bool
Parameters
- $params : mixed
-
URL Parameters
Return values
boolsaveAttribute()
Responsible for saving the additional attribute. It iterates through all the new attributes added dynamically and iterates through them
public
saveAttribute() : void
setAjaxHelper()
public
setAjaxHelper(AjaxHelper $ajaxHelper) : void
Parameters
- $ajaxHelper : AjaxHelper
setSession()
Responsible for setting the session variables for attribute map page redirect
public
setSession() : mixed
Tags
sharePanel()
Loads the view 'sharePanel'
public
sharePanel() : void
Tags
shareParticipant()
Stores the shared participant information in participant_shares for ONE participant *
public
shareParticipant() : void
Tags
shareParticipants()
Stores the shared participant information in participant_shares
public
shareParticipants() : void
Tags
storeBlacklistValues()
Stores the blocklist setting to the database
public
storeBlacklistValues() : void
summaryview()
Seems to be a method to show the uploadsummary
public
summaryview() : mixed
Tags
surveybar()
Shows admin menu for surveys
public
surveybar(array<string|int, mixed> $aData) : mixed
Parameters
- $aData : array<string|int, mixed>
Tags
updateParticipant()
Update participant Outputs Ajax result
public
updateParticipant(array<string|int, mixed> $aData[, array<string|int, mixed> $extraAttributes = array() ]) : void
Parameters
- $aData : array<string|int, mixed>
- $extraAttributes : array<string|int, mixed> = array()
uploadCSV()
Uploads the file to the server and process it for valid enteries and import them into database Also creates attributes from the mapping drag-n-drop form.
public
uploadCSV() : mixed
beforeSideMenuRender()
Returns content from event beforeSideMenuRender
protected
beforeSideMenuRender(array<string|int, mixed> $aData) : string
REFACTORED in LayoutHelper
Parameters
- $aData : array<string|int, mixed>
Return values
stringcsvExportCount()
Returns a string with the number of participants available for export or 0
protected
csvExportCount([CDbCriteria $search = null ]) : string|int
Parameters
- $search : CDbCriteria = null
Return values
string|intfetchExtraMenus()
Get extra menus from plugins that are using event beforeAdminMenuRender
protected
fetchExtraMenus(array<string|int, mixed> $aData) : array<string|int, ExtraMenu>
Parameters
- $aData : array<string|int, mixed>
Return values
array<string|int, ExtraMenu>filterImportedResources()
protected
filterImportedResources(string $extractdir, string $destdir) : array<string|int, mixed>
Parameters
- $extractdir : string
- $destdir : string
Tags
Return values
array<string|int, mixed>listquestiongroups()
REFACTORED in LayoutHelper
protected
listquestiongroups(array<string|int, mixed> $aData) : mixed
listquestion groups
Parameters
- $aData : array<string|int, mixed>
listquestions()
REFACTORED in LayoutHelper
protected
listquestions( $aData) : mixed
Parameters
Tags
notifications()
Display notifications
protected
notifications() : mixed
- REFACTORED (in LayoutHelper.php)
nsurveysummary()
REFACTORED in LayoutHelper
protected
nsurveysummary(array<string|int, mixed> $aData) : mixed
Survey summary
Parameters
- $aData : array<string|int, mixed>
organizequestionbar()
Render the save/cancel bar for Organize question groups/questions
protected
organizequestionbar(array<string|int, mixed> $aData) : mixed
REFACTORED in LayoutHelper
Parameters
- $aData : array<string|int, mixed>
Tags
renderCentralContents()
Rendering the subviews and views of renderWrappedTemplate
protected
renderCentralContents(string $sAction, array<string|int, mixed>|string $aViewUrls[, array<string|int, mixed> $aData = [] ]) : string
Parameters
- $sAction : string
- $aViewUrls : array<string|int, mixed>|string
- $aData : array<string|int, mixed> = []
Return values
stringrenderJSON()
Method to render an array as a json document
protected
renderJSON(array<string|int, mixed> $aData[, mixed $success = true ]) : void
REFACTORED in LSBaseController (this one called by a lot of actions in different controllers)
Parameters
- $aData : array<string|int, mixed>
- $success : mixed = true
renderQuickmenu()
Render the quick-menu that is shown when side-menu is hidden.
protected
renderQuickmenu(array<string|int, mixed> $aData) : string
REFACTORED in LayoutHelper
Only show home-icon for now.
Add support for plugin to attach icon elements using event afterQuickMenuLoad
Parameters
- $aData : array<string|int, mixed>
Tags
Return values
stringrenderWrappedTemplate()
Renders template(s) wrapped in header and footer
protected
renderWrappedTemplate([string $sAction = 'participants' ][, string|array<string|int, mixed> $aViewUrls = array() ][, array<string|int, mixed> $aData = array() ][, mixed $sRenderFile = false ]) : mixed
Parameters
- $sAction : string = 'participants'
-
Current action, the folder to fetch views from
- $aViewUrls : string|array<string|int, mixed> = array()
-
View url(s)
- $aData : array<string|int, mixed> = array()
-
Data to be passed on. Optional.
- $sRenderFile : mixed = false
-
File to be rendered as a layout. Optional.
requirePostRequest()
Validates that the request method is POST.
protected
requirePostRequest() : mixed
This is intended to be used on subactions. When possible (eg. when refactoring a SurveyCommonAction into an actual controller), use 'postOnly' filter instead.
Tags
route()
Routes the action into correct subaction
protected
route(string $sa, array<string|int, string> $get_vars) : mixed
Parameters
- $sa : string
- $get_vars : array<string|int, string>
Tags
showadminmenu()
showadminmenu() function returns html text for the administration button bar
protected
showadminmenu( $aData) : string
REFACTORED (in LayoutHelper.php)
Parameters
Tags
Return values
stringshowHeaders()
Header
protected
showHeaders(array<string|int, mixed> $aData[, mixed $sendHTTPHeader = true ]) : mixed
- REFACTORED (in LayoutHelper.php)
Parameters
- $aData : array<string|int, mixed>
- $sendHTTPHeader : mixed = true
surveysidemenu()
Show side menu for survey view
protected
surveysidemenu(array<string|int, mixed> $aData) : mixed
REFACTORED in LayoutHelper.php
Parameters
- $aData : array<string|int, mixed>
-
all the needed data
titlebar()
REFACTORED in LayoutHelper.php
protected
titlebar( $aData) : mixed
Parameters
Tags
updatenotification()
Display the update notification
protected
updatenotification() : mixed
REFACTORED (in LayoutHelper.php)
Tags
addPseudoParams()
Some functions have different parameters, which are just an alias of the usual parameters we're getting in the url. This function just populates those variables so that we don't end up in an error.
private
addPseudoParams(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
-
Parameters to parse and populate
Tags
Return values
array<string|int, mixed> —Populated parameters
checkPermission()
If user has no permission, redirect and show error message.
private
checkPermission(string $permission) : void
Parameters
- $permission : string
-
Like 'import' or 'export, etc
csvExport()
Export to csv using optional search/filter
private
csvExport([CDbCriteria $search = null ][, mixed $aAttributeIDs = null ]) : false|null
Parameters
- $search : CDbCriteria = null
- $aAttributeIDs : mixed = null
Tags
Return values
false|nullgetAutomaticallyMappedAttributes()
Return array of automatic mappings, pairing token attributes with CPDB attributes
private
getAutomaticallyMappedAttributes(array<string|int, mixed> $tokenAttributes, array<string|int, mixed> $CPDBAttributes) : array<string|int, mixed>
Parameters
- $tokenAttributes : array<string|int, mixed>
- $CPDBAttributes : array<string|int, mixed>
Return values
array<string|int, mixed>getTopBarComponents()
Returns the topbar config which then needs to be added into $aData['topbar'] in action functions
private
getTopBarComponents( $title, $ownsAddParticipantsButton, $ownsAddAttributeButton) : array<string|int, mixed>