participantsaction

Extends \Survey_Common_Action

This is the main controller for Participants Panel

This controller contains common functions for survey related views.

Methods

Override runWithParams() implementation in CAction to help us parse requests with subactions.

runWithParams(array $params) 
inherited

Arguments

$params

array

URL Parameters

Renders template(s) wrapped in header and footer

_renderWrappedTemplate(string $sAction = '', string|array $aViewUrls = array(), array $aData = array()) 
inherited

Addition of parameters should be avoided if they can be added to $aData

NOTE FROM LOUIS : We want to remove this function, wich doesn't respect MVC pattern. The work it's doing should be handle by layout files, and subviews inside views. Eg : for route "admin/survey/sa/listquestiongroups/surveyid/282267" the Group controller should use a main layout (with admin menu bar as a widget), then render the list view, in wich the question group bar is called as a subview.

So for now, we try to evacuate all the renderWrappedTemplate logic (if statements, etc.) to subfunctions, then it will be easier to remove. Comments starting with //// indicate how it should work in the future

Arguments

$sAction

string

Current action, the folder to fetch views from

$aViewUrls

string|array

View url(s)

$aData

array

Data to be passed on. Optional.

AJAX switcher for modal calling

openModalParticipantPanel() : void

AJAX switcher for action calling

editValueParticipantPanel() : void

Export to csv using optional search/filter

csvExport(\type $search = null, $aAttributeIDs = null) : false|null
paran

mixed $mAttributeIDs Empty array for no attributes, or array of attribute IDs or null for all attributes

Arguments

$search

\type

CDCriteria?

$aAttributeIDs

Response

false|null

Returns a string with the number of participants available for export or 0

csvExportCount(\type $search = null) : string|int

Arguments

$search

\type

Response

string|int

Loads the view 'participantsPanel'

index() 

Loads the view 'displayParticipants' which contains the main grid

displayParticipants() 

Takes the delete call from the display participants and take appropriate action depending on the condition

deleteParticipant() : void

Method to open the participant edit/ new participant modal Requires 'participant_id' (int|null)

openEditParticipant() : void

?

openParticipantSurveys() 

Called by Ajax to open the share participant modal Used by both single share and massive action share

openParticipantShare() : void

Method to open the participant delete modal Requires 'participant_id' (int)

openDeleteParticipant() : void

Either update or create new participant

editParticipant() 

Update participant Outputs Ajax result

updateParticipant(array $aData, array $extraAttributes = array()) : void

Arguments

$aData

array

$extraAttributes

array

Add new participant to database

addParticipant(array $aData, array $extraAttributes = array()) : string

Arguments

$aData

array

$extraAttributes

array

Response

string

json

Loads the view 'importCSV'

importCSV() 

Show the drag-n-drop form for CSV attributes

attributeMapCSV() 

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.

uploadCSV() 

This function deletes the uploaded csv file if the import is cancelled

mapCSVcancelled() 

Exports participants as CSV - receiver function for the GUI

exporttocsv() : void

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

exporttocsvcount() 

Outputs the count of participants when using the export all button on the top

exporttocsvcountAll() 

Responsible to export all the participants in the central table

exporttocsvAll() 

Loads the view 'blacklistControl'

blacklistControl() : void

Stores the blacklist setting to the database

storeBlacklistValues() : void

AJAX Method to change the blacklist status of a participant Requires POST with 'participant_id' (varchar) and 'blacklist' (boolean)

changeblackliststatus() : \json-encoded

Response

\json-encoded

array with 'success' (boolean) and 'newValue' ('Y' || 'N')

Loads the view 'attributeControl'

attributeControl() : void

Echoes json

changeAttributeVisibility() : void

Method to open the editAttributeName Modal

openEditAttributeNames() 

Open modal to add participant(s) to survey

openAddToSurvey() : 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)

editAttributeName() : 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)

deleteLanguageFromAttribute() : void

Deletes a single Attribute via AJAX-call Requires POST 'attribute_id' (int) Echoes json-encoded array 'success' (boolean), successMessage (string)

deleteSingleAttribute() : void

Delete several attributes.

deleteAttributes() : void

Massive action, called by Ajax.

Takes the edit call from the share panel, which either edits or deletes the share information Basically takes the call on can_edit

editAttributeInfo() : void

Fetches the attributes of a participant to be displayed in the attribute subgrid

getAttribute_json() 

Responsible for showing the additional attribute for CPDB Edit attribute form

viewAttribute() : void

Responsible for saving the additional attribute. It iterates through all the new attributes added dynamically and iterates through them

saveAttribute() : void

Responsible for deleting the additional attribute values in case of drop down.

delAttributeValues() 

Responsible for editing the additional attributes values

editAttributevalue() 

Loads the view 'sharePanel'

sharePanel() : 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

getShareInfo_json() : void

Takes the edit call from the share panel, which either edits or deletes the share information Basically takes the call on can_edit

editShareInfo() 

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/getSurveyInfo_json/pid/[participant_id] Echoes json data containing linked survey information (Survey name, survey id, token_id and date_added)

getSurveyInfo_json() : void

Gets the ids of participants to be copied to the individual survey Needed in the Participant views of the individual surveys

getSearchIDs() 

Equal to getParticipants_json() but now with a search

getParticipantsResults_json() : void

getParticipants_json

getParticipants_json($search = null) 

Arguments

$search

Seems to be a method to show the uploadsummary

summaryview() 
TODO

investigate this more

Responsible for setting the session variables for attribute map page redirect

setSession() 
todo

Use user session?

Used?

Stores the shared participant information in participant_shares

shareParticipants() : void

Stores the shared participant information in participant_shares for ONE participant

shareParticipant() : void

Deletes *all* shares for this participant

rejectShareParticipant() : void

Deletes a single participant share Called by Ajax; echoes success/error

deleteSingleParticipantShare(string $participantId, int $shareUid) : void

Arguments

$participantId

string

$shareUid

int

Deletes several ParticipantShare NOT the same as rejectShareParticipant

deleteMultipleParticipantShare() : void

changeSharedEditableStatus

changeSharedEditableStatus() : void

Responsible for copying the participant from tokens to the central Database

addToCentral() 

TODO: Most of the work for this function is in the participants model file but it doesn't belong there.

Responsible for adding the participant to the specified survey with attribute mapping Used when mapping CPDB participants to survey tokens with attributes.

addToTokenattmap() : void

Called when user clicks "Continue" in that form.

Echoes a result message witch will be displayed as a bootstrap modal

Show form for attribute mapping while copying participants from CPDB to token's table

attributeMap() 

This function is responsible for attribute mapping while copying participants from tokens to CPDB

attributeMapToken() 

Return array of automatic mappings, pairing token attributes with CPDB attributes

getAutomaticallyMappedAttributes(array $tokenAttributes, array $CPDBAttributes) : array

Arguments

$tokenAttributes

array

$CPDBAttributes

array

Response

array

If user has no permission, redirect and show error message.

checkPermission(string $permission) : void

Arguments

$permission

string

Like 'import' or 'export, etc

__construct

__construct($controller = null, $id = null) 
inherited

Arguments

$controller

$id

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.

_addPseudoParams(array $params) : array
inherited

This is also used while rendering wrapped template {@link Survey_Common_Action::_renderWrappedTemplate()}

Arguments

$params

array

Parameters to parse and populate

Response

array

Populated parameters

Action classes require them to have a run method. We reroute it to index if called.

run() 
inherited

Routes the action into correct subaction

route(string $sa, string[] $get_vars) : void
inherited
access

protected

Arguments

$sa

string

$get_vars

string[]

Display the update notification

_updatenotification() 
inherited

Display notifications

_notifications() 
inherited

Survey summary

_nsurveysummary($aData) 
inherited

Arguments

$aData

Header

_showHeaders($aData) 
inherited

Arguments

$aData

_showadminmenu() function returns html text for the administration button bar

_showadminmenu($aData) : string
inherited
access

public

global

string $homedir

string $scriptname

string $surveyid

string $setfont

string $imageurl

int $surveyid

Arguments

$aData

Response

string

$adminmenu

_titlebar

_titlebar($aData) 
inherited

Arguments

$aData

_tokenbar

_tokenbar($aData) 
inherited

Arguments

$aData

Render the save/cancel bar for Organize question groups/questions

_organizequestionbar(array $aData) 
inherited
since 2014-09-30
author

Olle Haerstedt

Arguments

$aData

array

Shows admin menu for question

_questionbar($aData) 
inherited

Arguments

$aData

Show admin menu for question group view

_nquestiongroupbar(array $aData) 
inherited

Arguments

$aData

array

?

_fullpagebar

_fullpagebar($aData) 
inherited

Arguments

$aData

Shows admin menu for surveys

_surveybar($aData) 
inherited

Arguments

$aData

Show side menu for survey view

_surveysidemenu(array $aData) 
inherited

Arguments

$aData

array

all the needed data

Render the quick-menu that is shown when side-menu is hidden.

renderQuickmenu(array $aData) : string
inherited

Only show home-icon for now.

Add support for plugin to attach icon elements using event afterQuickMenuLoad

todo

Make quick-menu user configurable

Arguments

$aData

array

Response

string

listquestion groups

_listquestiongroups($aData) 
inherited

Arguments

$aData

_listquestions

_listquestions($aData) 
inherited

Arguments

$aData

Show survey summary

_surveysummary($aData) 
inherited

Arguments

$aData

Browse Menu Bar

_browsemenubar($aData) 
inherited

Arguments

$aData

Load menu bar of user group controller.

_userGroupBar($aData) : void
inherited

Arguments

$aData

This function will register a script file, and will choose if it should use the asset manager or not

registerScriptFile(string $cPATH, string $sFile) 
inherited

Arguments

$cPATH

string

: the CONSTANT name of the path of the script file (need to be converted in url if asset manager is not used)

$sFile

string

: the file to publish

This function will register a script file, and will choose if it should use the asset manager or not

registerCssFile(string $sPath, string $sFile) 
inherited

Arguments

$sPath

string

: the type the path of the css file to publish ( public, template, etc)

$sFile

string

: the file to publish

_filterImportedResources

_filterImportedResources(string $extractdir, string $destdir) 
inherited

Arguments

$extractdir

string

$destdir

string

Creates a temporary directory

_tempdir(string $dir, string $prefix = '', int $mode = 448) : string
inherited
access

protected

Arguments

$dir

string

$prefix

string

$mode

int

Response

string

Get extra menus from plugins that are using event beforeAdminMenuRender

fetchExtraMenus(array $aData) : \array<ExtraMenu>
inherited

Arguments

$aData

array

Response

\array