@@ -44,17 +44,30 @@ function renderQuestion( $question ) {
4444 function renderNoteQuestion ( $ question ) {
4545 echo "<label><h3 class= \"inputLabel noteQuestion \"> " . $ question ->QuestionText . ( $ question ->Answers ->EventBookingAnswer ->Price > 0 ? " <i class= \"priceLabel \">( " . convertToMoney ( $ question ->Answers ->EventBookingAnswer ->Price ) . ")</i> " : "" ) . "</h3> " ;
4646 echo "<div class= \"inputHolder \"> " ;
47- echo "<textarea name= \"question_ " . $ question ->Answers ->EventBookingAnswer ->AnswerID . "_note \" data-type= \"note \" onchange= \"eduBookingView.UpdatePrice(); \" data-price= \"" . $ question ->Answers ->EventBookingAnswer ->Price . "\" resizable= \"resizable \" class= \"questionNoteField \" rows= \"3 \"> " . $ question ->Answers ->EventBookingAnswer ->DefaultAnswerText . "</textarea> " ;
47+ echo "<textarea name= \"question_ " . $ question ->Answers ->EventBookingAnswer ->AnswerID . "_note \" data-type= \"note \" onchange= \"eduBookingView.UpdatePrice(); \" data-price= \"" . $ question ->Answers ->EventBookingAnswer ->Price . "\"" . ( $ question -> Mandatory ? " required= \" required \"" : "" ) . " resizable= \"resizable \" class= \"questionNoteField \" rows= \"3 \"> " . $ question ->Answers ->EventBookingAnswer ->DefaultAnswerText . "</textarea> " ;
4848 echo "</div></label> " ;
4949 }
5050
5151// QuestionTypeID 2
5252 function renderCheckBoxQuestion ( $ question ) {
5353 echo "<h3 class= \"inputLabel checkBoxQuestion \"> " . $ question ->QuestionText . "</h3> " ;
54- foreach ( $ question ->Answers ->EventBookingAnswer as $ q ) {
54+ if ( is_array ( $ question ->Answers ->EventBookingAnswer ) ) {
55+ foreach ( $ question ->Answers ->EventBookingAnswer as $ q ) {
56+ echo "<label> " ;
57+ echo "<div class= \"inputHolder \"> " ;
58+ echo "<input type= \"checkbox \" class= \"questionCheck \" data-type= \"check \" data-price= \"" . $ q ->Price . "\" onchange= \"eduBookingView.UpdatePrice(); \" name= \"question_ " . $ question ->QuestionID . "_check \"" . ( $ q ->DefaultAlternative == 1 ? " checked= \"checked \"" : "" ) . "" . ( $ question ->Mandatory ? " required= \"required \"" : "" ) . " value= \"" . $ q ->AnswerID . "\" /> " ;
59+ echo $ q ->AnswerText ;
60+ if ( $ q ->Price > 0 ) {
61+ echo " <i class= \"priceLabel \">( " . convertToMoney ( $ q ->Price ) . ")</i> " ;
62+ }
63+ echo "</div> " ;
64+ echo "</label> " ;
65+ }
66+ } else if ( is_object ( $ question ->Answers ->EventBookingAnswer ) ) {
67+ $ q = $ question ->Answers ->EventBookingAnswer ;
5568 echo "<label> " ;
5669 echo "<div class= \"inputHolder \"> " ;
57- echo "<input type= \"checkbox \" class= \"questionCheck \" data-type= \"check \" data-price= \"" . $ q ->Price . "\" onchange= \"eduBookingView.UpdatePrice(); \" name= \"question_ " . $ question ->QuestionID . "_check \"" . ( $ q ->DefaultAlternative == 1 ? " checked= \"checked \"" : "" ) . " value= \"" . $ q ->AnswerID . "\" /> " ;
70+ echo "<input type= \"checkbox \" class= \"questionCheck \" data-type= \"check \" data-price= \"" . $ q ->Price . "\" onchange= \"eduBookingView.UpdatePrice(); \"" . ( $ question -> Mandatory ? " required= \" required \"" : "" ) . " name= \"question_ " . $ question ->QuestionID . "_check \"" . ( $ q ->DefaultAlternative == 1 ? " checked= \"checked \"" : "" ) . " value= \"" . $ q ->AnswerID . "\" /> " ;
5871 echo $ q ->AnswerText ;
5972 if ( $ q ->Price > 0 ) {
6073 echo " <i class= \"priceLabel \">( " . convertToMoney ( $ q ->Price ) . ")</i> " ;
@@ -71,9 +84,9 @@ function renderDateQuestion( $question ) {
7184 echo $ question ->QuestionText . ( $ question ->Answers ->EventBookingAnswer ->Price > 0 ? " <i class= \"priceLabel \">( " . convertToMoney ( $ question ->Answers ->EventBookingAnswer ->Price ) . ")</i> " : "" );
7285 echo "</div> " ;
7386 echo "<div class= \"inputHolder \"> " ;
74- echo "<input type= \"date \" class= \"questionDate \" data-type= \"date \" onchange= \"eduBookingView.UpdatePrice(); \" data-price= \"" . $ question ->Answers ->EventBookingAnswer ->Price . "\" name= \"question_ " . $ question ->Answers ->EventBookingAnswer ->AnswerID . "_date \" /> " ;
87+ echo "<input type= \"date \" class= \"questionDate \" data-type= \"date \" onchange= \"eduBookingView.UpdatePrice(); \" data-price= \"" . $ question ->Answers ->EventBookingAnswer ->Price . "\"" . ( $ question -> Mandatory ? " required= \" required \"" : "" ) . " name= \"question_ " . $ question ->Answers ->EventBookingAnswer ->AnswerID . "_date \" /> " ;
7588 if ( $ question ->Time == 1 ) {
76- echo "<input type= \"time \" onchange= \"eduBookingView.UpdatePrice(); \" class= \"questionTime \" name= \"question_ " . $ question ->Answers ->EventBookingAnswer ->AnswerID . "_time \" /> " ;
89+ echo "<input type= \"time \" onchange= \"eduBookingView.UpdatePrice(); \" class= \"questionTime \"" . ( $ question -> Mandatory ? " required= \" required \"" : "" ) . " name= \"question_ " . $ question ->Answers ->EventBookingAnswer ->AnswerID . "_time \" /> " ;
7790 }
7891 echo "</div> " ;
7992 echo "</label> " ;
@@ -86,8 +99,18 @@ function renderDropListQuestion( $question ) {
8699 echo $ question ->QuestionText ;
87100 echo "</div> " ;
88101 echo "<div class= \"inputHolder \"> " ;
89- echo "<select class= \"questionDropdown \" onchange= \"eduBookingView.UpdatePrice(); \" name= \"question_ " . $ question ->QuestionID . "_dropdown \"> " ;
90- foreach ( $ question ->Answers ->EventBookingAnswer as $ q ) {
102+ echo "<select class= \"questionDropdown \" onchange= \"eduBookingView.UpdatePrice(); \"" . ( $ question ->Mandatory ? " required= \"required \"" : "" ) . " name= \"question_ " . $ question ->QuestionID . "_dropdown \"> " ;
103+ if ( is_array ( $ question ->Answers ->EventBookingAnswer ) ) {
104+ foreach ( $ question ->Answers ->EventBookingAnswer as $ q ) {
105+ echo "<option value= \"" . $ q ->AnswerID . "\"" . ( $ q ->DefaultAlternative == 1 ? " selected= \"selected \"" : "" ) . " data-type= \"dropdown \" data-price= \"" . $ q ->Price . "\"> " ;
106+ echo $ q ->AnswerText ;
107+ if ( $ q ->Price > 0 ) {
108+ echo " ( " . convertToMoney ( $ q ->Price ) . ") " ;
109+ }
110+ echo "</option> " ;
111+ }
112+ } else if ( is_object ( $ question ->Answers ->EventBookingAnswer ) ) {
113+ $ q = $ question ->Answers ->EventBookingAnswer ;
91114 echo "<option value= \"" . $ q ->AnswerID . "\"" . ( $ q ->DefaultAlternative == 1 ? " selected= \"selected \"" : "" ) . " data-type= \"dropdown \" data-price= \"" . $ q ->Price . "\"> " ;
92115 echo $ q ->AnswerText ;
93116 if ( $ q ->Price > 0 ) {
@@ -106,7 +129,7 @@ function renderNumberQuestion( $question ) {
106129 echo $ question ->QuestionText ;
107130 echo "</div> " ;
108131 echo "<div class= \"inputHolder \"> " ;
109- echo "<input type= \"number \" class= \"questionText \" onchange= \"eduBookingView.UpdatePrice(); \" data-price= \"" . $ question ->Answers ->EventBookingAnswer ->Price . "\" min= \"0 \" data-type= \"number \" name= \"question_ " . $ question ->Answers ->EventBookingAnswer ->AnswerID . "_number \" placeholder= \"" . edu__ ( "Quantity " ) . "\" /> " ;
132+ echo "<input type= \"number \" class= \"questionText \" onchange= \"eduBookingView.UpdatePrice(); \"" . ( $ question -> Mandatory ? " required= \" required \"" : "" ) . " data-price= \"" . $ question ->Answers ->EventBookingAnswer ->Price . "\" min= \"0 \" data-type= \"number \" name= \"question_ " . $ question ->Answers ->EventBookingAnswer ->AnswerID . "_number \" placeholder= \"" . edu__ ( "Quantity " ) . "\" /> " ;
110133 if ( $ question ->Answers ->EventBookingAnswer ->Price > 0 ) {
111134 echo " <i class= \"priceLabel \">( " . sprintf ( edu__ ( '%1$s / pcs ' ), convertToMoney ( $ question ->Answers ->EventBookingAnswer ->Price ) ) . ")</i> " ;
112135 }
@@ -127,10 +150,23 @@ function renderInfoText( $question ) {
127150 function renderRadioQuestion ( $ question , $ display ) {
128151 echo "<h3 class= \"inputLabel radioQuestion \"> " . $ question ->QuestionText . "</h3> " ;
129152 if ( $ display == 'vertical ' ) {
130- foreach ( $ question ->Answers ->EventBookingAnswer as $ q ) {
153+ if ( is_array ( $ question ->Answers ->EventBookingAnswer ) ) {
154+ foreach ( $ question ->Answers ->EventBookingAnswer as $ q ) {
155+ echo "<label class= \"questionRadioVertical \"> " ;
156+ echo "<div class= \"inputHolder \"> " ;
157+ echo "<input type= \"radio \" class= \"questionRadio \" data-type= \"radio \"" . ( $ question ->Mandatory ? " required= \"required \"" : "" ) . " data-price= \"" . $ q ->Price . "\" name= \"question_ " . $ question ->QuestionID . "_radio \" value= \"" . $ q ->AnswerID . "\" /> " ;
158+ echo $ q ->AnswerText ;
159+ if ( $ q ->Price > 0 ) {
160+ echo " <i class= \"priceLabel \">( " . convertToMoney ( $ q ->Price ) . ")</i> " ;
161+ }
162+ echo "</div> " ;
163+ echo "</label> " ;
164+ }
165+ } else if ( is_object ( $ question ->Answers ->EventBookingAnswer ) ) {
166+ $ q = $ question ->Answers ->EventBookingAnswer ;
131167 echo "<label class= \"questionRadioVertical \"> " ;
132168 echo "<div class= \"inputHolder \"> " ;
133- echo "<input type= \"radio \" class= \"questionRadio \" data-type= \"radio \" data-price= \"" . $ q ->Price . "\" name= \"question_ " . $ question ->QuestionID . "_radio \" value= \"" . $ q ->AnswerID . "\" /> " ;
169+ echo "<input type= \"radio \" class= \"questionRadio \" data-type= \"radio \"" . ( $ question -> Mandatory ? " required= \" required \"" : "" ) . " data-price= \"" . $ q ->Price . "\" name= \"question_ " . $ question ->QuestionID . "_radio \" value= \"" . $ q ->AnswerID . "\" /> " ;
134170 echo $ q ->AnswerText ;
135171 if ( $ q ->Price > 0 ) {
136172 echo " <i class= \"priceLabel \">( " . convertToMoney ( $ q ->Price ) . ")</i> " ;
@@ -139,10 +175,23 @@ function renderRadioQuestion( $question, $display ) {
139175 echo "</label> " ;
140176 }
141177 } else if ( $ display == 'horizontal ' ) {
142- foreach ( $ question ->Answers ->EventBookingAnswer as $ q ) {
178+ if ( is_array ( $ question ->Answers ->EventBookingAnswer ) ) {
179+ foreach ( $ question ->Answers ->EventBookingAnswer as $ q ) {
180+ echo "<label class= \"questionRadioHorizontal \"> " ;
181+ echo "<div class= \"inputHolder \"> " ;
182+ echo "<input type= \"radio \" class= \"questionRadio \" data-type= \"radio \"" . ( $ question ->Mandatory ? " required= \"required \"" : "" ) . " data-price= \"" . $ q ->Price . "\" name= \"question_ " . $ question ->QuestionID . "_radio \" value= \"" . $ q ->AnswerID . "\" /> " ;
183+ echo $ q ->AnswerText ;
184+ if ( $ q ->Price > 0 ) {
185+ echo " <i class= \"priceLabel \">( " . convertToMoney ( $ q ->Price ) . ")</i> " ;
186+ }
187+ echo "</div> " ;
188+ echo "</label> " ;
189+ }
190+ } else if ( is_object ( $ question ->Answers ->EventBookingAnswer ) ) {
191+ $ q = $ question ->Answers ->EventBookingAnswer ;
143192 echo "<label class= \"questionRadioHorizontal \"> " ;
144193 echo "<div class= \"inputHolder \"> " ;
145- echo "<input type= \"radio \" class= \"questionRadio \" data-type= \"radio \" data-price= \"" . $ q ->Price . "\" name= \"question_ " . $ question ->QuestionID . "_radio \" value= \"" . $ q ->AnswerID . "\" /> " ;
194+ echo "<input type= \"radio \" class= \"questionRadio \" data-type= \"radio \"" . ( $ question -> Mandatory ? " required= \" required \"" : "" ) . " data-price= \"" . $ q ->Price . "\" name= \"question_ " . $ question ->QuestionID . "_radio \" value= \"" . $ q ->AnswerID . "\" /> " ;
146195 echo $ q ->AnswerText ;
147196 if ( $ q ->Price > 0 ) {
148197 echo " <i class= \"priceLabel \">( " . convertToMoney ( $ q ->Price ) . ")</i> " ;
@@ -162,7 +211,7 @@ function renderTextQuestion( $question ) {
162211 echo $ question ->QuestionText . ( $ question ->Answers ->EventBookingAnswer ->Price > 0 ? " <i class= \"priceLabel \">( " . convertToMoney ( $ question ->Answers ->EventBookingAnswer ->Price ) . ")</i> " : "" );
163212 echo "</div> " ;
164213 echo "<div class= \"inputHolder \"> " ;
165- echo "<input type= \"text \" data-price= \"" . $ question ->Answers ->EventBookingAnswer ->Price . "\" onchange= \"eduBookingView.UpdatePrice(); \" data-type= \"text \" class= \"questionText \" name= \"question_ " . $ question ->Answers ->EventBookingAnswer ->AnswerID . "_text \" /> " ;
214+ echo "<input type= \"text \" data-price= \"" . $ question ->Answers ->EventBookingAnswer ->Price . "\"" . ( $ question -> Mandatory ? " required= \" required \"" : "" ) . " onchange= \"eduBookingView.UpdatePrice(); \" data-type= \"text \" class= \"questionText \" name= \"question_ " . $ question ->Answers ->EventBookingAnswer ->AnswerID . "_text \" /> " ;
166215 echo "</div> " ;
167216 echo "</label> " ;
168217 }
0 commit comments