DataEntry
extends SurveyCommonAction
in package
dataentry
Tags
Table of Contents
Methods
- __construct() : mixed
- Dataentry Constructor
- delete() : void
- dataentry::delete() delete dataentry
- editdata() : void
- dataentry::editdata() Edit dataentry.
- import() : void
- dataentry::import() Function responsible to import responses from old survey table(s).
- index() : void
- insert() : mixed
- dataentry::insert() insert new dataentry
- iteratesurvey() : void
- Iterate Survey Method.
- questionbar() : mixed
- Shows admin menu for question
- 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.
- surveybar() : mixed
- Shows admin menu for surveys
- update() : void
- dataentry::update() update dataentry
- view() : void
- dataentry::view() view a dataentry
- vvimport() : void
- Function responsible for importing responses from file (.csv)
- beforeSideMenuRender() : string
- Returns content from event beforeSideMenuRender
- fetchExtraMenus() : array<string|int, ExtraMenu>
- Get extra menus from plugins that are using event beforeAdminMenuRender
- filterImportedResources() : array<string|int, mixed>
- getQidColumn() : CDbColumnSchema
- Takes a table schema and finds the field for some question id.
- isCompatible() : bool
- Compares 2 table schema to see if they are compatible.
- 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() : void
- 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
- tableList() : array<string|int, mixed>
- Takes a list of tablenames and creates a nice key value array.
- 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.
- arrayFilterHelp() : string
- This is a duplicate of the array_filter_help function in printablesurvey.php TODO: Why is this duplicated? Use just one solution.
- getEncodingsArray() : array<string|int, mixed>
- Returns Encoding Array.
- getLastAnswerByTokenOrAnonymousSurvey() : string
- Returns the last answer for token or anonymous survey.
- getToken() : null|Token
- Returns an Token.
- handleFileUpload() : void
- Handles file upload Method.
- moveUploadedFile() : void|string
- Move uploaded files Method.
- returnAccessCodeIsNotValidOrAlreadyInUseErrorMessage() : string
- Returns Error Message if access code is not valid or already in use.
- returnAlreadyRecordedAnswerForAccessCodeErrorMessage() : string
- Returns Error Message if access code is already recorded.
- returnClosedAccessSurveyErrorMessage() : string
- Returns Error Message if the survey only supports closed access.
- returnErrorMessageIfLastAnswerForTokenIsNotPrivacyProtected() : string
- Returns Error Message if LastAnswerForToken is not Privacy Protected. Appends it to the given ErrorMessage.
- returnErrorMessageIfLastAnswerForTokenIsPrivacyProtected() : string
- Returns Error Message if Last Answer for Token is Privacy Protected.
- showUploadForm() : void
- Show upload form Method.
Methods
__construct()
Dataentry Constructor
public
__construct(mixed $controller, mixed $id) : mixed
Parameters
- $controller : mixed
- $id : mixed
Tags
delete()
dataentry::delete() delete dataentry
public
delete() : void
editdata()
dataentry::editdata() Edit dataentry.
public
editdata(string $subaction, int $id, int $surveyid) : void
Parameters
- $subaction : string
-
Given Subaction
- $id : int
-
Given ID
- $surveyid : int
-
Given Survey ID
Return values
void —TODO: This function has to be smaller. Create subfunctions for this or move it to another place!
import()
dataentry::import() Function responsible to import responses from old survey table(s).
public
import(int $surveyid) : void
Parameters
- $surveyid : int
-
Given Survey ID
index()
public
index() : void
insert()
dataentry::insert() insert new dataentry
public
insert() : mixed
iteratesurvey()
Iterate Survey Method.
public
iteratesurvey(int $surveyid) : void
Parameters
- $surveyid : int
-
Given Survey ID
questionbar()
Shows admin menu for question
public
questionbar(array<string|int, mixed> $aData) : mixed
Parameters
- $aData : array<string|int, mixed>
Tags
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(array<string|int, mixed> $params) : bool
Parameters
- $params : array<string|int, mixed>
-
URL Parameters
Return values
boolsurveybar()
Shows admin menu for surveys
public
surveybar(array<string|int, mixed> $aData) : mixed
Parameters
- $aData : array<string|int, mixed>
Tags
update()
dataentry::update() update dataentry
public
update() : void
Return values
void —TODO: Make it smaller.
view()
dataentry::view() view a dataentry
public
view(int $surveyid) : void
Parameters
- $surveyid : int
-
Given Survey ID
Return values
void —TODO: Make it smaller!
vvimport()
Function responsible for importing responses from file (.csv)
public
vvimport() : void
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
stringfetchExtraMenus()
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>getQidColumn()
Takes a table schema and finds the field for some question id.
protected
getQidColumn(CDbTableSchema $schema, string $qid) : CDbColumnSchema
Parameters
- $schema : CDbTableSchema
-
Given Schema
- $qid : string
-
Given Question ID
Return values
CDbColumnSchemaisCompatible()
Compares 2 table schema to see if they are compatible.
protected
isCompatible(CDbTableSchema $base, CDbTableSchema $old[, bool $checkColumnTypes = true ]) : bool
Parameters
- $base : CDbTableSchema
-
Given Base Database Schema
- $old : CDbTableSchema
-
Given Old Database Schema
- $checkColumnTypes : bool = true
-
Checks Column Types
Return values
boollistquestiongroups()
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 = 'dataentry' ][, string|array<string|int, mixed> $aViewUrls = array() ][, array<string|int, mixed> $aData = array() ][, bool|string $sRenderFile = false ]) : void
Parameters
- $sAction : string = 'dataentry'
-
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 : bool|string = false
-
Boolean value if file will be rendered.
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
tableList()
Takes a list of tablenames and creates a nice key value array.
protected
tableList(array<string|int, mixed> $tables) : array<string|int, mixed>
Parameters
- $tables : array<string|int, mixed>
-
Given Tables
Return values
array<string|int, mixed>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
arrayFilterHelp()
This is a duplicate of the array_filter_help function in printablesurvey.php TODO: Why is this duplicated? Use just one solution.
private
arrayFilterHelp(array<string|int, mixed> $qidattributes, string $surveyprintlang, int $surveyid) : string
Parameters
- $qidattributes : array<string|int, mixed>
-
Given Attributes
- $surveyprintlang : string
-
Given Language
- $surveyid : int
-
Given Survey ID
Return values
stringgetEncodingsArray()
Returns Encoding Array.
private
getEncodingsArray() : array<string|int, mixed>
Return values
array<string|int, mixed>getLastAnswerByTokenOrAnonymousSurvey()
Returns the last answer for token or anonymous survey.
private
getLastAnswerByTokenOrAnonymousSurvey(Survey $survey[, Token $token = null ]) : string
Parameters
Return values
stringgetToken()
Returns an Token.
private
getToken(int $id, string $token) : null|Token
Parameters
- $id : int
-
Survey ID
- $token : string
-
Token (Post Request Data)
Return values
null|TokenhandleFileUpload()
Handles file upload Method.
private
handleFileUpload(int $iSurveyId, array<string|int, mixed> $aData) : void
Parameters
- $iSurveyId : int
-
Given Survey ID
- $aData : array<string|int, mixed>
-
Given Data
moveUploadedFile()
Move uploaded files Method.
private
moveUploadedFile(array<string|int, mixed> $aData) : void|string
Parameters
- $aData : array<string|int, mixed>
-
Given Data
Return values
void|stringreturnAccessCodeIsNotValidOrAlreadyInUseErrorMessage()
Returns Error Message if access code is not valid or already in use.
private
returnAccessCodeIsNotValidOrAlreadyInUseErrorMessage() : string
Return values
stringreturnAlreadyRecordedAnswerForAccessCodeErrorMessage()
Returns Error Message if access code is already recorded.
private
returnAlreadyRecordedAnswerForAccessCodeErrorMessage() : string
Return values
stringreturnClosedAccessSurveyErrorMessage()
Returns Error Message if the survey only supports closed access.
private
returnClosedAccessSurveyErrorMessage() : string
Return values
stringreturnErrorMessageIfLastAnswerForTokenIsNotPrivacyProtected()
Returns Error Message if LastAnswerForToken is not Privacy Protected. Appends it to the given ErrorMessage.
private
returnErrorMessageIfLastAnswerForTokenIsNotPrivacyProtected(string $lastAnswer, int $id, string $errorMessage) : string
Parameters
- $lastAnswer : string
-
Last Answer for Token
- $id : int
-
Survey ID
- $errorMessage : string
-
Error Message
Return values
stringreturnErrorMessageIfLastAnswerForTokenIsPrivacyProtected()
Returns Error Message if Last Answer for Token is Privacy Protected.
private
returnErrorMessageIfLastAnswerForTokenIsPrivacyProtected(string $errorMessage) : string
Parameters
- $errorMessage : string
-
Error Message
Return values
stringshowUploadForm()
Show upload form Method.
private
showUploadForm(array<string|int, string> $aEncodings, int $surveyid, array<string|int, mixed> $aData) : void
Parameters
- $aEncodings : array<string|int, string>
-
Given Encoding
- $surveyid : int
-
Given Survey ID
- $aData : array<string|int, mixed>
-
Given Data