SurveyAdministrationController
extends LSBaseController
in package
Class SurveyAdministrationController
Table of Contents
Properties
- $aData : array<string|int, mixed>
- $navData : array<string|int, mixed>
- This array contains the survey / group / question id used by the menu widget.
- $sTemplate : null
- $userId : int
Methods
- __construct() : mixed
- SurveyAdministrationController constructor.
- accessRules() : array<string|int, mixed>
- It's import to have the accessRules set (security issue).
- actionActivate() : void
- This action activates the survey with selected options.
- actionActivateSurvey() : void
- This action renders the view for survey activation where the user can preselect some options like "ipanonymize" etc.
- actionApplythemeoptions() : void
- Apply current theme options for imported survey theme
- actionBoxList() : string|false
- Retrieves and renders a list of surveys with optional active status filter for the box widget Ajax.
- actionChangeFormat() : void
- Called via ajax request from survey summary quick action "Show questions group by group".
- actionChangeMultipleSurveyGroup() : void
- Change survey group for multiple survey at once.
- actionChangeMultipleTheme() : void
- Massive action in ListSurveysWidget ... Ajax request
- actionCopy() : void
- Function responsible to copy a survey.
- actionCreateSurvey() : void
- New create survey process with default values.
- actionDatetimesettings() : void
- Ajaxrequest returning 'session['dateformat']' and some other parameters to the frontend
- actionDeactivate() : void
- Function responsible to deactivate a survey.
- actionDelete() : string
- Function responsible to delete a survey.
- actionDeleteMultiple() : void
- Delete multiple survey
- actionDeleteUrlParam() : void
- Method to delete URL Params (Panel Integration)
- actionExpire() : void
- Expires the survey.
- actionExpireMultipleSurveys() : void
- Action to set expiry date to multiple surveys.
- actionFakebrowser() : void
- todo: what is this? why do we need it? (it'S just an js-script alert window rendert here ...)
- actionFixNumbering() : array<string|int, mixed>|false|string|array<string|int, string>|null
- fixes the numbering of questions This can happen if question 1 have subquestion code 1 and have question 11 in same survey and group (then same SGQA).
- actionGetAjaxMenuArray() : string|array<string|int, string>
- Ajaxified get MenuItems with containing questions
- actionGetAjaxQuestionGroupArray() : string|array<string|int, string>
- AjaxRequest get questionGroup with containing questions
- actionGetAjaxSurveyList() : void
- Returns a JSON list of surveys the current user has read permission on, filtered by an optional search term. Used by Select2 AJAX in the copy survey modal.
- actionGetCurrentEditorValues() : void
- Function to call current Editor Values by Ajax
- actionGetDataSecTextSettings() : void
- Collect the data necessary for the data security settings and return a JSON document
- actionGetDateFormatOptions() : JSON
- Method to call current date information by ajax
- actionGetTokenTopBar() : string
- Returns JSON Data for Token Top Bar.
- actionGetUrlParamsJSON() : void
- actionImport() : mixed
- Import an uploaded survey file, create the survey if valid, and render the import summary view.
- actionImportsurveyresources() : void
- Function responsible to import survey resources from a '.zip' file.
- actionInsert() : string
- Saves the new survey after the creation screen is submitted
- actionListsurveys() : void
- List Surveys.
- actionNewSurvey() : void
- This function prepares the classic view for a new survey
- actionOrganize() : void
- Load ordering of question group screen.
- actionPurge() : void
- Remove files not deleted properly.
- actionRegenerateQuestionCodes() : void
- Regeerates the question code Automatically renumbers the "question codes" so that they follow a methodical numbering method.
- actionRenderItemsSelected() : void
- Render selected items for massive action
- actionRendersidemenulink() : void
- New system of rendering content Based on yii submenu rendering
- actionSaveDataSecTextData() : void
- Method to store data edited in the data security text editor component
- actionSaveTextData() : JSON
- Method to store data edited in the text editor component
- actionSaveUrlParam() : mixed
- Method to save URL Params (Panel Integration)
- actionToggleQuickAction() : string
- Toggles Quick action
- actionUpdateAccessMode() : mixed
- AJAX action to update survey access mode
- actionUploadimagefile() : json
- Upload an image in directory
- actionView() : void
- Load complete view of survey properties and actions specified by $iSurveyID
- changeTemplate() : mixed
- Update the theme of a survey
- createAbsoluteUrl() : string
- Returns an absolute URL based on the given controller and action information.
- filters() : array<string|int, string>
- Set filters for all actions
- getSurveyAndSidemenueDirectionURL() : string
- This method will return the url for the current survey and set the direction for the sidemenue.
- loadHelper() : void
- Loads a helper
- loadLibrary() : void
- Loads a library
- run() : void
- Checks for action specific authorization and then executes an action
- _checkInstallation() : void
- Check that installation was already done by looking for config.php Will redirect to the installer script if not exists.
- beforeRender() : bool
- Prepare controller state before rendering a view.
- customInit() : mixed
- generalTabEditSurvey() : mixed
- Returns Data for Tab General Edit Survey.
- getDataSecurityEditData() : array<string|int, mixed>
- Returns Date for Data Security Edit.
- getTextEditData() : array<string|int, mixed>
- Returns data for text edit.
- loadPageStates() : array<string|int, mixed>
- Loads page states from a hidden input.
- pluginTabSurvey() : array<string|int, mixed>
- Returns Data for Plugin tab.
- renderJSON() : void
- Method to render an array as a json document (this one called by a lot of actions in different controllers)
- sessionControl() : void
- Load and set session vars
- tabNotificationDataManagement() : array<string|int, mixed>
- Returns the data for Tab Notification and Data Management.
- tabPanelIntegration() : array<string|int, mixed>
- Returns the data for Tab Panel Integration.
- tabPresentationNavigation() : array<string|int, mixed>
- Returns data for tab Presentation navigation.
- tabPublicationAccess() : array<string|int, mixed>
- Returns the data for Tab Publication Access control.
- tabResourceManagement() : array<string|int, mixed>
- Returns data for Tab Resourves.
- tabTokens() : array<string|int, mixed>
- Returns the data for Tab Tokens.
- createSampleGroup() : int
- This private function creates a sample group
- createSampleQuestion() : int
- This private function creates a sample question
- createSampleSubquestion() : void
- Creates a sample subquestion for a parent question in a survey
- generalTabNewSurvey() : array<string|int, mixed>
- Load "General" tab of new survey screen.
- getGeneralTemplateData() : array<string|int, mixed>
- Returns Data for general template.
- getOrgdata() : array<string|int, mixed>
- Get the new question organization from the post data.
- getPostParamsForCopySurvey() : CopySurveyOptions
- Reads POST parameters from the copy survey form and builds a CopySurveyOptions container.
- getSurveyIdFromGetRequest() : int
- Try to get the get-parameter from request.
- resetExpressionManager() : void
- Reset expression manager values
- showReorderForm() : array<string|int, mixed>
- Show the form for Organize question groups/questions
- surveysummary() : mixed
- Adds some other important adata variables for frontend
Properties
$aData
public
array<string|int, mixed>
$aData
= []
import for all new controllers/actions (REFACTORING) to pass data before rendering the content
$navData
This array contains the survey / group / question id used by the menu widget.
public
array<string|int, mixed>
$navData
= array()
$sTemplate
public
null
$sTemplate
= \null
this is needed for the preview rendering inside the questioneditor
$userId
protected
int
$userId
= 0
userId of the logged in user
Methods
__construct()
SurveyAdministrationController constructor.
public
__construct( $id[, null $module = null ]) : mixed
Parameters
Tags
accessRules()
It's import to have the accessRules set (security issue).
public
accessRules() : array<string|int, mixed>
Only logged in users should have access to actions. All other permissions should be checked in the action itself.
Return values
array<string|int, mixed>actionActivate()
This action activates the survey with selected options.
public
actionActivate() : void
actionActivateSurvey()
This action renders the view for survey activation where the user can preselect some options like "ipanonymize" etc.
public
actionActivateSurvey() : void
It is also possible to switch between the "open access mode" and the "close-access-mode" before the survey is activated. The action also checks if it is even possible to activate the survey (see checkGroup() and checkQuestions() for more information).
actionApplythemeoptions()
Apply current theme options for imported survey theme
public
actionApplythemeoptions([int $surveyid = 0 ]) : void
Parameters
- $surveyid : int = 0
actionBoxList()
Retrieves and renders a list of surveys with optional active status filter for the box widget Ajax.
public
actionBoxList() : string|false
Tags
Return values
string|false —Rendered partial view if surveys are found, otherwise false.
actionChangeFormat()
Called via ajax request from survey summary quick action "Show questions group by group".
public
actionChangeFormat(int $iSurveyID, string $format) : void
Parameters
- $iSurveyID : int
-
Given Survey ID
- $format : string
-
Given Format
actionChangeMultipleSurveyGroup()
Change survey group for multiple survey at once.
public
actionChangeMultipleSurveyGroup() : void
Called from survey list massive actions
Tags
actionChangeMultipleTheme()
Massive action in ListSurveysWidget ... Ajax request
public
actionChangeMultipleTheme() : void
Tags
actionCopy()
Function responsible to copy a survey.
public
actionCopy() : void
Tags
actionCreateSurvey()
New create survey process with default values.
public
actionCreateSurvey() : void
Includes to open new question editor (in cloud) when editor is activated by user.
actionDatetimesettings()
Ajaxrequest returning 'session['dateformat']' and some other parameters to the frontend
public
actionDatetimesettings() : void
Tags
actionDeactivate()
Function responsible to deactivate a survey.
public
actionDeactivate() : void
Tags
actionDelete()
Function responsible to delete a survey.
public
actionDelete() : string
Return values
stringactionDeleteMultiple()
Delete multiple survey
public
actionDeleteMultiple() : void
Tags
actionDeleteUrlParam()
Method to delete URL Params (Panel Integration)
public
actionDeleteUrlParam() : void
Tags
actionExpire()
Expires the survey.
public
actionExpire() : void
actionExpireMultipleSurveys()
Action to set expiry date to multiple surveys.
public
actionExpireMultipleSurveys() : void
(ajax request)
Tags
actionFakebrowser()
todo: what is this? why do we need it? (it'S just an js-script alert window rendert here ...)
public
actionFakebrowser() : void
Tags
actionFixNumbering()
fixes the numbering of questions This can happen if question 1 have subquestion code 1 and have question 11 in same survey and group (then same SGQA).
public
actionFixNumbering() : array<string|int, mixed>|false|string|array<string|int, string>|null
Tags
Return values
array<string|int, mixed>|false|string|array<string|int, string>|nullactionGetAjaxMenuArray()
Ajaxified get MenuItems with containing questions
public
actionGetAjaxMenuArray(int $surveyid[, string $position = '' ]) : string|array<string|int, string>
Parameters
- $surveyid : int
-
Given Survey ID
- $position : string = ''
-
Given Position
Tags
Return values
string|array<string|int, string>actionGetAjaxQuestionGroupArray()
AjaxRequest get questionGroup with containing questions
public
actionGetAjaxQuestionGroupArray(int $surveyid) : string|array<string|int, string>
Parameters
- $surveyid : int
-
Given Survey ID
Tags
Return values
string|array<string|int, string>actionGetAjaxSurveyList()
Returns a JSON list of surveys the current user has read permission on, filtered by an optional search term. Used by Select2 AJAX in the copy survey modal.
public
actionGetAjaxSurveyList() : void
Reuses Survey::search() so that the filtering logic (SID, title, admin, owner, survey group) and permission scoping stay consistent with the main survey list grid.
Note: The permission scope filters by read only. The actual copy action (actionCopy) additionally checks surveycontent.export permission server-side.
actionGetCurrentEditorValues()
Function to call current Editor Values by Ajax
public
actionGetCurrentEditorValues(int $sid) : void
Parameters
- $sid : int
-
Given Survey ID
is still used in sidemenu Text elements (see vue.js ajaxcall)
Tags
actionGetDataSecTextSettings()
Collect the data necessary for the data security settings and return a JSON document
public
actionGetDataSecTextSettings([int|null $sid = null ]) : void
Parameters
- $sid : int|null = null
-
Survey ID
Tags
actionGetDateFormatOptions()
Method to call current date information by ajax
public
actionGetDateFormatOptions() : JSON
Tags
Return values
JSON —| string
actionGetTokenTopBar()
Returns JSON Data for Token Top Bar.
public
actionGetTokenTopBar(int $sid) : string
Parameters
- $sid : int
-
Given Survey ID
Tags
Return values
stringactionGetUrlParamsJSON()
public
actionGetUrlParamsJSON(int $surveyid) : void
Parameters
- $surveyid : int
-
Given Survey ID.
Tags
actionImport()
Import an uploaded survey file, create the survey if valid, and render the import summary view.
public
actionImport() : mixed
Validates upload permissions and file type/size, moves the uploaded file to a temporary location, calls importSurveyFile(...) (passing the "translinksfields" flag and optional "surveysgroup" request parameter), translates import results into view data (including links to the new survey and theme-apply action), resets the expression manager for the newly created survey (if any), cleans up the temporary file, and renders the importSurvey_view with import results or error information.
actionImportsurveyresources()
Function responsible to import survey resources from a '.zip' file.
public
actionImportsurveyresources() : void
Tags
actionInsert()
Saves the new survey after the creation screen is submitted
public
actionInsert() : string
Tags
Return values
stringactionListsurveys()
List Surveys.
public
actionListsurveys() : void
actionNewSurvey()
This function prepares the classic view for a new survey
public
actionNewSurvey() : void
actionOrganize()
Load ordering of question group screen.
public
actionOrganize() : void
questiongroup::organize()
Tags
actionPurge()
Remove files not deleted properly.
public
actionPurge(int $purge_sid) : void
Purge is only available for surveys that were already deleted but for some reason left files behind.
Parameters
- $purge_sid : int
-
Given ID
actionRegenerateQuestionCodes()
Regeerates the question code Automatically renumbers the "question codes" so that they follow a methodical numbering method.
public
actionRegenerateQuestionCodes() : void
actionRenderItemsSelected()
Render selected items for massive action
public
actionRenderItemsSelected() : void
actionRendersidemenulink()
New system of rendering content Based on yii submenu rendering
public
actionRendersidemenulink(int $surveyid, string $subaction) : void
Parameters
- $surveyid : int
-
Given Survey ID
- $subaction : string
-
Given subaction (subaction decides which view to render)
Tags
actionSaveDataSecTextData()
Method to store data edited in the data security text editor component
public
actionSaveDataSecTextData(int $sid) : void
Parameters
- $sid : int
-
Survey ID
Tags
actionSaveTextData()
Method to store data edited in the text editor component
public
actionSaveTextData(mixed $sid) : JSON
integer $sid Survey ID
Parameters
- $sid : mixed
Tags
Return values
JSON —| string
actionSaveUrlParam()
Method to save URL Params (Panel Integration)
public
actionSaveUrlParam() : mixed
Tags
actionToggleQuickAction()
Toggles Quick action
public
actionToggleQuickAction() : string
Tags
Return values
string —| null
actionUpdateAccessMode()
AJAX action to update survey access mode
public
actionUpdateAccessMode() : mixed
actionUploadimagefile()
Upload an image in directory
public
actionUploadimagefile() : json
Tags
Return values
json —|string
actionView()
Load complete view of survey properties and actions specified by $iSurveyID
public
actionView() : void
Tags
changeTemplate()
Update the theme of a survey
public
changeTemplate(int $iSurveyID, string $template[, array<string|int, mixed> $aResults = null ][, bool $bReturn = false ]) : mixed
Parameters
- $iSurveyID : int
-
Survey ID
- $template : string
-
The survey theme name
- $aResults : array<string|int, mixed> = null
-
If the method is called from changeMultipleTheme(), it will update its array of results
- $bReturn : bool = false
-
Should the method update and return aResults
Tags
Return values
mixed —null or array
createAbsoluteUrl()
Returns an absolute URL based on the given controller and action information.
public
createAbsoluteUrl(string $route[, array<string|int, mixed> $params = array() ][, string $schema = '' ][, string $ampersand = '&' ]) : string
The functionality was moved to \LSYii_Application::createPublicUrl, to be safe the function remains here.
Parameters
- $route : string
-
the URL route. This should be in the format of 'ControllerID/ActionID'.
- $params : array<string|int, mixed> = array()
-
additional GET parameters (name=>value). Both the name and value will be URL-encoded.
- $schema : string = ''
-
schema to use (e.g. http, https). If empty, the schema used for the current request will be used.
- $ampersand : string = '&'
-
the token separating name-value pairs in the URL.
Return values
string —the constructed URL
filters()
Set filters for all actions
public
filters() : array<string|int, string>
Return values
array<string|int, string>getSurveyAndSidemenueDirectionURL()
This method will return the url for the current survey and set the direction for the sidemenue.
public
getSurveyAndSidemenueDirectionURL(int $sid, int $gid, int $qid, string $landOnSideMenuTab) : string
Parameters
- $sid : int
-
Given Survey ID
- $gid : int
-
Given Group ID
- $qid : int
-
Given Question ID
- $landOnSideMenuTab : string
-
Given SideMenuTab
Return values
stringloadHelper()
Loads a helper
public
loadHelper(string $helper) : void
Parameters
- $helper : string
Tags
loadLibrary()
Loads a library
public
loadLibrary(string $library) : void
Parameters
- $library : string
Tags
run()
Checks for action specific authorization and then executes an action
public
run(string $action) : void
TODO: check the dbupdate mechanism, do we really want to check db update before every action??
Parameters
- $action : string
Tags
_checkInstallation()
Check that installation was already done by looking for config.php Will redirect to the installer script if not exists.
protected
_checkInstallation() : void
Tags
beforeRender()
Prepare controller state before rendering a view.
protected
beforeRender(string $view) : bool
Sets the controller layout based on whether a survey context is present, initializes the LimeExpressionManager for the current survey when applicable, and registers editor-related client scripts unless the request is an Ajax request.
Parameters
- $view : string
-
The view name about to be rendered.
Return values
bool —True to continue with rendering, false to abort.
customInit()
protected
customInit() : mixed
generalTabEditSurvey()
Returns Data for Tab General Edit Survey.
protected
generalTabEditSurvey(Survey $survey) : mixed
survey::_generalTabEditSurvey() Load "General" tab of edit survey screen.
Parameters
- $survey : Survey
-
Given Survey
getDataSecurityEditData()
Returns Date for Data Security Edit.
protected
getDataSecurityEditData(Survey $survey) : array<string|int, mixed>
tab_edit_view_datasecurity editDataSecurityLocalSettings_view
Parameters
- $survey : Survey
-
Given Survey
Return values
array<string|int, mixed>getTextEditData()
Returns data for text edit.
protected
getTextEditData(Survey $survey) : array<string|int, mixed>
BE CAREFUL (this function is not called directly, but by call_user_func_array and the name of function in db .. )
Parameters
- $survey : Survey
-
Given Survey.
Return values
array<string|int, mixed>loadPageStates()
Loads page states from a hidden input.
protected
loadPageStates() : array<string|int, mixed>
Return values
array<string|int, mixed> —the loaded page states
pluginTabSurvey()
Returns Data for Plugin tab.
protected
pluginTabSurvey(Survey $survey) : array<string|int, mixed>
survey::_pluginTabSurvey() Load "Simple Plugin" page in specific survey.
Parameters
- $survey : Survey
-
Given Survey
Tags
Return values
array<string|int, mixed> —This method is called via call_user_func in self::rendersidemenulink()
renderJSON()
Method to render an array as a json document (this one called by a lot of actions in different controllers)
protected
renderJSON(array<string|int, mixed> $aData[, mixed $success = true ]) : void
Parameters
- $aData : array<string|int, mixed>
- $success : mixed = true
sessionControl()
Load and set session vars
protected
sessionControl() : void
todo REFACTORING see comments in method
Tags
tabNotificationDataManagement()
Returns the data for Tab Notification and Data Management.
protected
tabNotificationDataManagement(mixed $survey) : array<string|int, mixed>
survey::_tabNotificationDataManagement() Load "Notification & data management" tab.
Parameters
- $survey : mixed
-
?
Return values
array<string|int, mixed>tabPanelIntegration()
Returns the data for Tab Panel Integration.
protected
tabPanelIntegration(Survey $survey[, string|null $sLang = null ]) : array<string|int, mixed>
Parameters
- $survey : Survey
-
Given Survey
- $sLang : string|null = null
-
Given Language
Return values
array<string|int, mixed>tabPresentationNavigation()
Returns data for tab Presentation navigation.
protected
tabPresentationNavigation(mixed $survey) : array<string|int, mixed>
survey::_tabPresentationNavigation() Load "Presentation & navigation" tab.
Parameters
- $survey : mixed
-
?
Return values
array<string|int, mixed>tabPublicationAccess()
Returns the data for Tab Publication Access control.
protected
tabPublicationAccess(Survey $survey) : array<string|int, mixed>
survey::_tabPublicationAccess() Load "Publication * access control" tab.
Parameters
- $survey : Survey
-
Given Survey
Return values
array<string|int, mixed>tabResourceManagement()
Returns data for Tab Resourves.
protected
tabResourceManagement(Survey $survey) : array<string|int, mixed>
survey::_tabResourceManagement() Load "Resources" tab.
Parameters
- $survey : Survey
-
Given Survey
Tags
Return values
array<string|int, mixed>tabTokens()
Returns the data for Tab Tokens.
protected
tabTokens(mixed $survey) : array<string|int, mixed>
survey::_tabTokens() Load "Tokens" tab.
Parameters
- $survey : mixed
-
?
Return values
array<string|int, mixed>createSampleGroup()
This private function creates a sample group
private
createSampleGroup(int $iSurveyID) : int
Parameters
- $iSurveyID : int
-
The survey ID that the sample group will belong to
Return values
intcreateSampleQuestion()
This private function creates a sample question
private
createSampleQuestion(int $iSurveyID, int $iGroupID) : int
Parameters
- $iSurveyID : int
-
The survey ID that the sample question will belong to
- $iGroupID : int
-
The group ID that the sample question will belong to
Return values
intcreateSampleSubquestion()
Creates a sample subquestion for a parent question in a survey
private
createSampleSubquestion(int $number, int $surveyId, int $groupId, int $questionId, string $language, string $text) : void
This method creates a new subquestion with the specified parameters and saves it to the database. It also creates the corresponding localization entry for the subquestion.
Parameters
- $number : int
-
The sequence number for the subquestion, used for ordering and title generation
- $surveyId : int
-
The ID of the survey to which this subquestion belongs
- $groupId : int
-
The ID of the question group to which this subquestion belongs
- $questionId : int
-
The ID of the parent question to which this subquestion is attached
- $language : string
-
The language code for the subquestion's text
- $text : string
-
The actual text content of the subquestion
generalTabNewSurvey()
Load "General" tab of new survey screen.
private
generalTabNewSurvey() : array<string|int, mixed>
survey::_generalTabNewSurvey()
Return values
array<string|int, mixed>getGeneralTemplateData()
Returns Data for general template.
private
getGeneralTemplateData(int $iSurveyID) : array<string|int, mixed>
Parameters
- $iSurveyID : int
-
Given Survey ID
Return values
array<string|int, mixed>getOrgdata()
Get the new question organization from the post data.
private
getOrgdata() : array<string|int, mixed>
This function replaces parse_str, since parse_str is bound by max_input_vars.
Return values
array<string|int, mixed>getPostParamsForCopySurvey()
Reads POST parameters from the copy survey form and builds a CopySurveyOptions container.
private
getPostParamsForCopySurvey(CHttpRequest $request) : CopySurveyOptions
Handles all checkbox options (resources, quotas, permissions, etc.) and the optional custom title.
Parameters
- $request : CHttpRequest
Return values
CopySurveyOptionsgetSurveyIdFromGetRequest()
Try to get the get-parameter from request.
private
getSurveyIdFromGetRequest() : int
At the moment there are three namings for a survey ID: 'sid' 'surveyid' 'iSurveyID'
Returns the id as integer or null if not exists any of them.
Tags
Return values
int —| null
resetExpressionManager()
Reset expression manager values
private
resetExpressionManager(Survey $oSurvey, array<string|int, mixed> $aGrouplist) : void
Parameters
- $oSurvey : Survey
- $aGrouplist : array<string|int, mixed>
showReorderForm()
Show the form for Organize question groups/questions
private
showReorderForm(int $iSurveyID) : array<string|int, mixed>
Parameters
- $iSurveyID : int
-
Given Survey ID
Tags
Return values
array<string|int, mixed>surveysummary()
Adds some other important adata variables for frontend
private
surveysummary(array<string|int, mixed> &$aData) : mixed
this function came from Layouthelper
Parameters
- $aData : array<string|int, mixed>
-
pointer to array (this array will be changed here!!)