GetResultAnswerArray
CForm::GetResultAnswerArray( int FORM_ID, array &arrColumns, array &arrAnswers, array &arrAnswersVarname=array(), array arFilter=array(), );
The method returns arrays containing information on the web form [link=90284#question]questions[/link], and both [link=90284#field]fields[/link] and [link=90284#answer]answers to questions[/link]. Non-static method.
Method parameters
Parameter | Description | Available from version |
---|---|---|
form_id | Web form ID. | Deleted from 3.3.10 |
columns | Parameter passes the array, describing the web form questions and fields that are:
Array ( [140] => Array ( [ID] => 140 [FORM_ID] => 4 [TIMESTAMP_X] => 19.05.2005 11:42:04 [ACTIVE] => Y [TITLE] => Full name [TITLE_TYPE] => html [SID] => VS_NAME [C_SORT] => 100 [ADDITIONAL] => N [REQUIRED] => Y [IN_FILTER] => Y [IN_RESULTS_TABLE] => N [IN_EXCEL_TABLE] => N [FIELD_TYPE] => [IMAGE_ID] => [COMMENTS] => [FILTER_TITLE] => [RESULTS_TABLE_TITLE] => ) [144] => Array ( [ID] => 144 [FORM_ID] => 4 [TIMESTAMP_X] => 11.11.2004 18:11:21 [ACTIVE] => Y [TITLE] => Areas of interest? [TITLE_TYPE] => text [SID] => VS_INTEREST [C_SORT] => 500 [ADDITIONAL] => N [REQUIRED] => N [IN_FILTER] => Y [IN_RESULTS_TABLE] => Y [IN_EXCEL_TABLE] => Y [FIELD_TYPE] => [IMAGE_ID] => [COMMENTS] => [FILTER_TITLE] => [RESULTS_TABLE_TITLE] => ) ... ) |
|
answers | Contains array with answers to questions of the web from, as well as web form values. Keys to this array are:
Array ( [186] => Array ( [140] => Array ( [586] => Array ( [RESULT_ID] => 186 [FIELD_ID] => 140 [SID] => VS_NAME [TITLE] => Full name [TITLE_TYPE] => html [FILTER_TITLE] => [RESULTS_TABLE_TITLE] => [ANSWER_ID] => 586 [ANSWER_TEXT] => [MESSAGE] => [ANSWER_VALUE] => [VALUE] => [USER_TEXT] => John Smith [USER_DATE] => [USER_FILE_ID] => [USER_FILE_NAME] => [USER_FILE_IS_IMAGE] => [USER_FILE_HASH] => [USER_FILE_SUFFIX] => [USER_FILE_SIZE] => [FIELD_TYPE] => text [FIELD_WIDTH] => 50 [FIELD_HEIGHT] => 0 [FIELD_PARAM] => ) ) [144] => Array ( [594] => Array ( [RESULT_ID] => 186 [FIELD_ID] => 144 [SID] => VS_INTEREST [TITLE] => Areas of interest? [TITLE_TYPE] => text [FILTER_TITLE] => [RESULTS_TABLE_TITLE] => [ANSWER_ID] => 594 [ANSWER_TEXT] => foreign languages [MESSAGE] => foreign languages [ANSWER_VALUE] => 4 [VALUE] => 4 [USER_TEXT] => [USER_DATE] => [USER_FILE_ID] => [USER_FILE_NAME] => [USER_FILE_IS_IMAGE] => [USER_FILE_HASH] => [USER_FILE_SUFFIX] => [USER_FILE_SIZE] => [FIELD_TYPE] => checkbox [FIELD_WIDTH] => 0 [FIELD_HEIGHT] => 0 [FIELD_PARAM] => ) [595] => Array ( [RESULT_ID] => 186 [FIELD_ID] => 144 [SID] => VS_INTEREST [TITLE] => Areas of interest? [TITLE_TYPE] => text [FILTER_TITLE] => [RESULTS_TABLE_TITLE] => [ANSWER_ID] => 595 [ANSWER_TEXT] => programming [MESSAGE] => programming [ANSWER_VALUE] => 5 [VALUE] => 5 [USER_TEXT] => [USER_DATE] => [USER_FILE_ID] => [USER_FILE_NAME] => [USER_FILE_IS_IMAGE] => [USER_FILE_HASH] => [USER_FILE_SUFFIX] => [USER_FILE_SIZE] => [FIELD_TYPE] => checkbox [FIELD_WIDTH] => 0 [FIELD_HEIGHT] => 0 [FIELD_PARAM] => SELECTED class=inputcheckbox ) ) ... ) ... ) |
|
answers2 | Parameter contains references to the array, which basically is the same as the 'answers' array, but has slightly different structure.
Example: Array ( [186] => Array ( [VS_NAME] => Array ( [0] => Array ( [RESULT_ID] => 186 [FIELD_ID] => 140 [SID] => VS_NAME [TITLE] => Full name [TITLE_TYPE] => html [FILTER_TITLE] => [RESULTS_TABLE_TITLE] => [ANSWER_ID] => 586 [ANSWER_TEXT] => [MESSAGE] => [ANSWER_VALUE] => [VALUE] => [USER_TEXT] => John Smith [USER_DATE] => [USER_FILE_ID] => [USER_FILE_NAME] => [USER_FILE_IS_IMAGE] => [USER_FILE_HASH] => [USER_FILE_SUFFIX] => [USER_FILE_SIZE] => [FIELD_TYPE] => text [FIELD_WIDTH] => 50 [FIELD_HEIGHT] => 0 [FIELD_PARAM] => ) ) [VS_INTEREST] => Array ( [0] => Array ( [RESULT_ID] => 186 [FIELD_ID] => 144 [SID] => VS_INTEREST [TITLE] => Areas of interest? [TITLE_TYPE] => text [FILTER_TITLE] => [RESULTS_TABLE_TITLE] => [ANSWER_ID] => 594 [ANSWER_TEXT] => foreign languages [MESSAGE] => foreign languages [ANSWER_VALUE] => 4 [VALUE] => 4 [USER_TEXT] => [USER_DATE] => [USER_FILE_ID] => [USER_FILE_NAME] => [USER_FILE_IS_IMAGE] => [USER_FILE_HASH] => [USER_FILE_SUFFIX] => [USER_FILE_SIZE] => [FIELD_TYPE] => checkbox [FIELD_WIDTH] => 0 [FIELD_HEIGHT] => 0 [FIELD_PARAM] => ) [1] => Array ( [RESULT_ID] => 186 [FIELD_ID] => 144 [SID] => VS_INTEREST [TITLE] => Areas of interest? [TITLE_TYPE] => text [FILTER_TITLE] => [RESULTS_TABLE_TITLE] => [ANSWER_ID] => 595 [ANSWER_TEXT] => programming [MESSAGE] => programming [ANSWER_VALUE] => 5 [VALUE] => 5 [USER_TEXT] => [USER_DATE] => [USER_FILE_ID] => [USER_FILE_NAME] => [USER_FILE_IS_IMAGE] => [USER_FILE_HASH] => [USER_FILE_SUFFIX] => [USER_FILE_SIZE] => [FIELD_TYPE] => checkbox [FIELD_WIDTH] => 0 [FIELD_HEIGHT] => 0 [FIELD_PARAM] => SELECTED class=inputcheckbox ) ) ... ) ... ) |
|
filter | Array to filter selected values. Optional parameter. The following array keys are possible:
|
|
arrAnswersVarname | 3.3.10. Deleted from version 4.0.4 | |
web_form_id | Web form ID. | 3.3.10 |
arrAnswersSID | 4.0.4 |
See Also
- [link=90369]CFormResult::GetDataByID[/link]
- [link=90333]CFormField::GetList[/link]
- [link=90326]CFormAnswer::GetList[/link]
Examples of use
// get data by the result ID=145 CForm::GetResultAnswerArray($FORM_ID, $arrColumns, $arrAnswers, $arrAnswersVarname, array("RESULT_ID" => "145")); echo "<pre>"; echo "arrColumns:"; print_r($arrColumns); echo "arrAnswers:"; print_r($arrAnswers); echo "arrAnswersVarname:"; print_r($arrAnswersVarname); echo "</pre>";
© «Bitrix24», 2001-2024