@@ -174,13 +174,13 @@ public function __construct($id = 0, $question = null, $context = null, $params
174174 $ this ->deleted = $ question ->deleted ;
175175 $ this ->extradata = $ question ->extradata ;
176176
177- $ this ->type_id = $ question ->type_id ;
178- $ this ->type = $ qtypes [$ this ->type_id ]->type ;
179- $ this ->responsetable = $ qtypes [$ this ->type_id ]->response_table ;
177+ $ this ->typeid = $ question ->typeid ;
178+ $ this ->type = $ qtypes [$ this ->typeid ]->type ;
179+ $ this ->responsetable = $ qtypes [$ this ->typeid ]->response_table ;
180180
181181 if (!empty ($ question ->choices )) {
182182 $ this ->choices = $ question ->choices ;
183- } else if ($ qtypes [$ this ->type_id ]->has_choices == 'y ' ) {
183+ } else if ($ qtypes [$ this ->typeid ]->has_choices == 'y ' ) {
184184 $ this ->get_choices ();
185185 }
186186 // Added for dependencies.
@@ -218,7 +218,7 @@ public static function question_builder($qtype, $qdata = null, $context = null)
218218 } else if (!empty ($ qdata ) && is_int ($ qdata )) {
219219 $ qid = $ qdata ;
220220 }
221- return new $ qclassname ($ qid , $ qdata , $ context , ['type_id ' => $ qtype ]);
221+ return new $ qclassname ($ qid , $ qdata , $ context , ['typeid ' => $ qtype ]);
222222 }
223223
224224 /**
@@ -648,8 +648,8 @@ public function update($questionrecord = null, $updatechoices = true) {
648648 $ questionrecord ->id = $ this ->id ;
649649 $ questionrecord ->surveyid = $ this ->surveyid ;
650650 $ questionrecord ->name = $ this ->name ;
651- $ questionrecord ->type_id = $ this ->type_id ;
652- $ questionrecord ->result_id = $ this ->result_id ;
651+ $ questionrecord ->typeid = $ this ->typeid ;
652+ $ questionrecord ->resultid = $ this ->resultid ;
653653 $ questionrecord ->length = $ this ->length ;
654654 $ questionrecord ->precise = $ this ->precise ;
655655 $ questionrecord ->position = $ this ->position ;
@@ -698,8 +698,8 @@ public function add($questionrecord, ?array $choicerecords = null, ?bool $calcpo
698698 }
699699
700700 // Make sure we add all necessary data.
701- if (!isset ($ questionrecord ->type_id ) || empty ($ questionrecord ->type_id )) {
702- $ questionrecord ->type_id = $ this ->type_id ;
701+ if (!isset ($ questionrecord ->typeid ) || empty ($ questionrecord ->typeid )) {
702+ $ questionrecord ->typeid = $ this ->typeid ;
703703 }
704704
705705 $ this ->qid = $ DB ->insert_record ('questionnaire_question ' , $ questionrecord );
@@ -990,7 +990,7 @@ public function questionstart_survey_display($qnum, $response = null) {
990990 $ pagetags ->fieldset = (object )['id ' => $ this ->id , 'class ' => $ displayclass ];
991991
992992 // Do not display the info box for the label question type.
993- if ($ this ->type_id != self ::QUESSECTIONTEXT ) {
993+ if ($ this ->typeid != self ::QUESSECTIONTEXT ) {
994994 if (!$ nonumbering ) {
995995 $ pagetags ->qnum = $ qnum ;
996996 }
@@ -1009,11 +1009,11 @@ public function questionstart_survey_display($qnum, $response = null) {
10091009 $ this ->content = '' ;
10101010 }
10111011 $ pagetags ->skippedclass = $ skippedclass ;
1012- if ($ this ->type_id == self ::QUESNUMERIC || $ this ->type_id == self ::QUESTEXT || $ this ->type_id == self ::QUESSLIDER ) {
1013- $ pagetags ->label = (object )['for ' => self ::qtypename ($ this ->type_id ) . $ this ->id ];
1014- } else if ($ this ->type_id == self ::QUESDROP ) {
1015- $ pagetags ->label = (object )['for ' => self ::qtypename ($ this ->type_id ) . $ this ->name ];
1016- } else if ($ this ->type_id == self ::QUESESSAY ) {
1012+ if ($ this ->typeid == self ::QUESNUMERIC || $ this ->typeid == self ::QUESTEXT || $ this ->typeid == self ::QUESSLIDER ) {
1013+ $ pagetags ->label = (object )['for ' => self ::qtypename ($ this ->typeid ) . $ this ->id ];
1014+ } else if ($ this ->typeid == self ::QUESDROP ) {
1015+ $ pagetags ->label = (object )['for ' => self ::qtypename ($ this ->typeid ) . $ this ->name ];
1016+ } else if ($ this ->typeid == self ::QUESESSAY ) {
10171017 $ pagetags ->label = (object )['for ' => 'q ' . $ this ->id ];
10181018 }
10191019 $ content = file_rewrite_pluginfile_urls (
@@ -1075,8 +1075,8 @@ public function edit_form(edit_question_form $form, questionnaire $questionnaire
10751075 $ mform ->setType ('qid ' , PARAM_INT );
10761076 $ mform ->addElement ('hidden ' , 'sid ' , 0 );
10771077 $ mform ->setType ('sid ' , PARAM_INT );
1078- $ mform ->addElement ('hidden ' , 'type_id ' , $ this ->type_id );
1079- $ mform ->setType ('type_id ' , PARAM_INT );
1078+ $ mform ->addElement ('hidden ' , 'typeid ' , $ this ->typeid );
1079+ $ mform ->setType ('typeid ' , PARAM_INT );
10801080 $ mform ->addElement ('hidden ' , 'action ' , 'question ' );
10811081 $ mform ->setType ('action ' , PARAM_ALPHA );
10821082
@@ -1099,9 +1099,9 @@ public function edit_form(edit_question_form $form, questionnaire $questionnaire
10991099 protected function form_header (\MoodleQuickForm $ mform , $ helpname = '' ) {
11001100 // Display different messages for new question creation and existing question modification.
11011101 if (isset ($ this ->qid ) && !empty ($ this ->qid )) {
1102- $ header = get_string ('editquestion ' , 'questionnaire ' , questionnaire_get_type ($ this ->type_id ));
1102+ $ header = get_string ('editquestion ' , 'questionnaire ' , questionnaire_get_type ($ this ->typeid ));
11031103 } else {
1104- $ header = get_string ('addnewquestion ' , 'questionnaire ' , questionnaire_get_type ($ this ->type_id ));
1104+ $ header = get_string ('addnewquestion ' , 'questionnaire ' , questionnaire_get_type ($ this ->typeid ));
11051105 }
11061106 if (empty ($ helpname )) {
11071107 $ helpname = $ this ->helpname ();
@@ -1450,7 +1450,7 @@ public function form_update($formdata, $questionnaire) {
14501450 $ formdata ->content
14511451 );
14521452
1453- $ fields = ['name ' , 'type_id ' , 'length ' , 'precise ' , 'required ' , 'content ' , 'extradata ' ];
1453+ $ fields = ['name ' , 'typeid ' , 'length ' , 'precise ' , 'required ' , 'content ' , 'extradata ' ];
14541454 $ questionrecord = new \stdClass ();
14551455 $ questionrecord ->id = $ formdata ->qid ;
14561456 foreach ($ fields as $ f ) {
@@ -1468,7 +1468,7 @@ public function form_update($formdata, $questionnaire) {
14681468 // Create new question:
14691469 // Need to update any image content after the question is created, so create then update the content.
14701470 $ formdata ->surveyid = $ formdata ->sid ;
1471- $ fields = ['surveyid ' , 'name ' , 'type_id ' , 'length ' , 'precise ' , 'required ' , 'position ' , 'extradata ' ];
1471+ $ fields = ['surveyid ' , 'name ' , 'typeid ' , 'length ' , 'precise ' , 'required ' , 'position ' , 'extradata ' ];
14721472 $ questionrecord = new \stdClass ();
14731473 foreach ($ fields as $ f ) {
14741474 if (isset ($ formdata ->$ f )) {
@@ -1704,7 +1704,7 @@ public function mobile_question_display($qnum, $autonum = false) {
17041704 $ mobiledata = (object )[
17051705 'id ' => $ this ->id ,
17061706 'name ' => $ this ->name ,
1707- 'type_id ' => $ this ->type_id ,
1707+ 'typeid ' => $ this ->typeid ,
17081708 'length ' => $ this ->length ,
17091709 'content ' => format_text (
17101710 file_rewrite_pluginfile_urls (
@@ -1768,7 +1768,7 @@ public function mobile_fieldkey($choiceid = 0) {
17681768 if ($ choiceid !== 0 ) {
17691769 $ choicefield = '_ ' . $ choiceid ;
17701770 }
1771- return 'response_ ' . $ this ->type_id . '_ ' . $ this ->id . $ choicefield ;
1771+ return 'response_ ' . $ this ->typeid . '_ ' . $ this ->id . $ choicefield ;
17721772 }
17731773
17741774 /**
0 commit comments