participantsaction

Extends \Survey_Common_Action

This is the main controller for Participants Panel

This controller contains common functions for survey related views.

package

Default

Methods

__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 Survey_Common_Action::_renderWrappedTemplate()

Throws
\CHttpException

Arguments

$params

array

Parameters to parse and populate

Response

array

Populated parameters

Browse Menu Bar

_browsemenubar(array $aData) 
inherited

Arguments

$aData

array

_filterImportedResources

_filterImportedResources(string $extractdir, string $destdir) : array
inherited

Arguments

$extractdir

string

$destdir

string

Response

array

_fullpagebar

_fullpagebar( $aData) 
inherited

Arguments

$aData

listquestion groups

_listquestiongroups(array $aData) 
inherited

Arguments

$aData

array

_listquestions

_listquestions( $aData) 
inherited

Arguments

$aData

Display notifications

_notifications() 
inherited

Show admin menu for question group view

_nquestiongroupbar(array $aData) 
inherited

Arguments

$aData

array

?

Survey summary

_nsurveysummary(array $aData) 
inherited

Arguments

$aData

array

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(array $aData) 
inherited

Arguments

$aData

array

Renders template(s) wrapped in header and footer

_renderWrappedTemplate(string $sAction = '', array|string $aViewUrls = array(), array $aData = array(), string|boolean $sRenderFile = false) 
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

array|string

View url(s)

$aData

array

Data to be passed on. Optional.

$sRenderFile

string|boolean

File to be rendered as a layout. Optional.

_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

Header

_showHeaders(array $aData,  $sendHTTPHeader = true) 
inherited

Arguments

$aData

array

$sendHTTPHeader

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

Show survey summary

_surveysummary(array $aData) 
inherited

Arguments

$aData

array

Creates a temporary directory

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

protected

Arguments

$dir

string

$prefix

string

$mode

integer

Response

string

_titlebar

_titlebar( $aData) 
inherited

Arguments

$aData

_tokenbar

_tokenbar( $aData) 
inherited

Arguments

$aData

Display the update notification

_updatenotification() 
inherited

Load menu bar of user group controller.

_userGroupBar(array $aData) : void
inherited

Arguments

$aData

array

Add new participant to database

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

Arguments

$aData

array

$extraAttributes

array

Response

string

json

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

Loads the view 'attributeControl'

attributeControl() : void

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

attributeMap() 

Show the drag-n-drop form for CSV attributes

attributeMapCSV() 

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

attributeMapToken() 

Returns content from event beforeSideMenuRender

beforeSideMenuRender(array $aData) : string
inherited

Arguments

$aData

array

Response

string

Loads the view 'blacklistControl'

blacklistControl() : void

Echoes json

changeAttributeVisibility() : void

AJAX Method to change the blacklist status of a participant Requires POST with 'participant_id' (varchar) and 'blacklist' (boolean) Echos JSON-encoded array with 'success' (boolean) and 'newValue' ('Y' || 'N')

changeblackliststatus() : void

changeSharedEditableStatus

changeSharedEditableStatus() : void

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

checkPermission(string $permission) : void

Arguments

$permission

string

Like 'import' or 'export, etc

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|integer

Arguments

$search

\type

Response

string|integer

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

delAttributeValues() 

Delete several attributes.

deleteAttributes() : void

Massive action, called by Ajax.

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 several ParticipantShare NOT the same as rejectShareParticipant

deleteMultipleParticipantShare() : void

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

deleteParticipant() : void

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

deleteSingleAttribute() : void

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

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

Arguments

$participantId

string

$shareUid

integer

Loads the view 'displayParticipants' which contains the main grid

displayParticipants() 

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

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

Responsible for editing the additional attributes values

editAttributevalue() 

Either update or create new participant

editParticipant() 

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

editShareInfo() 

AJAX switcher for action calling

editValueParticipantPanel() : void

Exports participants as CSV - receiver function for the GUI

exporttocsv() : void

Responsible to export all the participants in the central table

exporttocsvAll() 

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

Get extra menus from plugins that are using event beforeAdminMenuRender

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

Arguments

$aData

array

Response

\array

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

getAttribute_json() 

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

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

Arguments

$tokenAttributes

array

$CPDBAttributes

array

Response

array

getParticipants_json

getParticipants_json(\CDbCriteria $search = null) 

Arguments

$search

\CDbCriteria

Equal to getParticipants_json() but now with a search

getParticipantsResults_json() : void

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

getSearchIDs() 

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

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

Loads the view 'importCSV'

importCSV() 

index

index() : void
inherited

Loads the view 'participantsPanel'

index() 

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

mapCSVcancelled() 

Open modal to add participant(s) to survey

openAddToSurvey() : void

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

openDeleteParticipant() : void

Method to open the editAttributeName Modal

openEditAttributeNames() 

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

openEditParticipant() : void

AJAX switcher for modal calling

openModalParticipantPanel() : void

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

openParticipantShare() : void

?

openParticipantSurveys() 

Deletes *all* shares for this participant

rejectShareParticipant() : void

Rendering the subviews and views of _renderWrappedTemplate

renderCentralContents(string $sAction, array|string $aViewUrls, array $aData = array()) : string
inherited

Arguments

$sAction

string

$aViewUrls

array|string

$aData

array

Response

string

renderInternal

renderInternal(string $_viewFile_,  $_data_ = null,  $_return_ = false) 
inherited
inheritdoc

Arguments

$_viewFile_

string

$_data_

$_return_

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

Routes the action into correct subaction

route(string $sa, array<mixed,string> $get_vars) : mixed
inherited
access

protected

Arguments

$sa

string

$get_vars

array<mixed,string>

Response

mixed

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

run() 
inherited

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

runWithParams(array $params) : boolean
inherited

Arguments

$params

array

URL Parameters

Response

boolean

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

saveAttribute() : void

Responsible for setting the session variables for attribute map page redirect

setSession() 
todo

Use user session?

Used?

Loads the view 'sharePanel'

sharePanel() : void

Stores the shared participant information in participant_shares for ONE participant

shareParticipant() : void

Stores the shared participant information in participant_shares

shareParticipants() : void

Stores the blacklist setting to the database

storeBlacklistValues() : void

Seems to be a method to show the uploadsummary

summaryview() 
TODO

investigate this more

Update participant Outputs Ajax result

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

Arguments

$aData

array

$extraAttributes

array

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

Responsible for showing the additional attribute for CPDB Edit attribute form

viewAttribute() : void