Creates the question output form for the learner.
217 {
218 $orientation = $this->object->orientation;
219 $template_file = "tpl.il_svy_out_sc.html";
220 if ($compress_view && $orientation == 1) {
221 $template_file = "tpl.il_svy_out_sc_comp.html";
222 $orientation = 3;
223 }
224 $template =
new ilTemplate($template_file,
true,
true,
"Modules/SurveyQuestionPool");
226 $template->setCurrentBlock("material");
228 $template->parseCurrentBlock();
229 }
230 switch ($orientation) {
231 case 0:
232
233 for (
$i = 0;
$i < $this->
object->categories->getCategoryCount();
$i++) {
234 $cat = $this->
object->categories->getCategory(
$i);
235
236 $debug_scale = ($cat->scale) ? ($cat->scale - 1) :
$i;
237 $this->log->debug("Vertical orientation - Original scale = " . $cat->scale . " If(scale) scale -1 else i. The new scale value is = " . $debug_scale);
238
239 if ($cat->other) {
240 $template->setCurrentBlock("other_row");
241 if (strlen($cat->title)) {
242 $template->setVariable("OTHER_LABEL", $cat->title);
243 }
244 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) :
$i);
245 $template->setVariable("QUESTION_ID", $this->object->getId());
246 if (is_array($working_data)) {
247 foreach ($working_data as $value) {
248 if (strlen($value["value"])) {
249 if ($value["value"] == $cat->scale - 1) {
250 if (strlen($value['textanswer'])) {
252 }
253 if (!$value['uncheck']) {
254 $template->setVariable("CHECKED_SC", " checked=\"checked\"");
255 }
256 }
257 }
258 }
259 }
260 $template->parseCurrentBlock();
261 } else {
262 $template->setCurrentBlock("row");
263 if ($cat->neutral) {
264 $template->setVariable('ROWCLASS', ' class="neutral"');
265 }
267 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) :
$i);
268 $template->setVariable("QUESTION_ID", $this->object->getId());
269 if (is_array($working_data)) {
270 foreach ($working_data as $value) {
271 if (strcmp($value["value"], "") != 0) {
272 if ($value["value"] == $cat->scale - 1) {
273 if (!$value['uncheck']) {
274 $template->setVariable("CHECKED_SC", " checked=\"checked\"");
275 }
276 }
277 }
278 }
279 }
280 $template->parseCurrentBlock();
281 }
282 $template->touchBlock('outer_row');
283 }
284 break;
285 case 1:
286
287 for (
$i = 0;
$i < $this->
object->categories->getCategoryCount();
$i++) {
288 $cat = $this->
object->categories->getCategory(
$i);
289
290 $debug_scale = ($cat->scale) ? ($cat->scale - 1) :
$i;
291 $this->log->debug("Horizontal orientation - Original NEUTRAL scale = " . $cat->scale . " If(scale) scale -1 else i. The new scale value is = " . $debug_scale);
292
293 $template->setCurrentBlock("radio_col");
294 if ($cat->neutral) {
295 $template->setVariable('COLCLASS', ' neutral');
296 }
297 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) :
$i);
298 $template->setVariable("QUESTION_ID", $this->object->getId());
299 if (is_array($working_data)) {
300 foreach ($working_data as $value) {
301 if (strcmp($value["value"], "") != 0) {
302 if ($value["value"] == $cat->scale - 1) {
303 if (!$value['uncheck']) {
304 $template->setVariable("CHECKED_SC", " checked=\"checked\"");
305 }
306 }
307 }
308 }
309 }
310 $template->parseCurrentBlock();
311 }
312 for (
$i = 0;
$i < $this->
object->categories->getCategoryCount();
$i++) {
313 $cat = $this->
object->categories->getCategory(
$i);
314
315 $debug_scale = ($cat->scale) ? ($cat->scale - 1) :
$i;
316 $this->log->debug("Horizontal orientation - Original scale = " . $cat->scale . " If(scale) scale -1 else i. The new scale value is = " . $debug_scale);
317
318 if ($cat->other) {
319 $template->setCurrentBlock("text_other_col");
320 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) :
$i);
321 $template->setVariable("QUESTION_ID", $this->object->getId());
322 if (strlen($cat->title)) {
323 $template->setVariable("OTHER_LABEL", $cat->title);
324 }
325 if (is_array($working_data)) {
326 foreach ($working_data as $value) {
327 if (strlen($value["value"])) {
328 if ($value["value"] == $cat->scale - 1 && strlen($value['textanswer'])) {
330 }
331 }
332 }
333 }
334 $template->parseCurrentBlock();
335 } else {
336 $template->setCurrentBlock("text_col");
337 if ($cat->neutral) {
338 $template->setVariable('COLCLASS', ' neutral');
339 }
340 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) :
$i);
342 $template->setVariable("QUESTION_ID", $this->object->getId());
343 $template->parseCurrentBlock();
344 }
345 $template->touchBlock('text_outer_col');
346 }
347 break;
348 case 2:
349
350 for (
$i = 0;
$i < $this->
object->categories->getCategoryCount();
$i++) {
351 $cat = $this->
object->categories->getCategory(
$i);
352
353 $debug_scale = ($cat->scale) ? ($cat->scale - 1) :
$i;
354 $this->log->debug("Combobox - Original scale = " . $cat->scale . " If(scale) scale -1 else i. The new scale value is = " . $debug_scale);
355
356 $template->setCurrentBlock("comborow");
357 $template->setVariable("TEXT_SC", $cat->title);
358 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) :
$i);
359 if (is_array($working_data)) {
360 if (strcmp($working_data[0]["value"], "") != 0) {
361 if ($working_data[0]["value"] == $cat->scale - 1) {
362 $template->setVariable("SELECTED_SC", " selected=\"selected\"");
363 }
364 }
365 }
366 $template->parseCurrentBlock();
367 }
368 $template->setCurrentBlock("combooutput");
369 $template->setVariable("QUESTION_ID", $this->object->getId());
370 $template->setVariable("SELECT_OPTION", $this->lng->txt("select_option"));
371 $template->setVariable("TEXT_SELECTION", $this->lng->txt("selection"));
372 $template->parseCurrentBlock();
373 break;
374 case 3:
375
376 for (
$i = 0;
$i < $this->
object->categories->getCategoryCount();
$i++) {
377 $cat = $this->
object->categories->getCategory(
$i);
378
379 $debug_scale = ($cat->scale) ? ($cat->scale - 1) :
$i;
380 $this->log->debug("Horizontal orientation (compressed) - Original NEUTRAL scale = " . $cat->scale . " If(scale) scale -1 else i. The new scale value is = " . $debug_scale);
381
382 if ($cat->other) {
383 $template->setCurrentBlock("other");
384 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) :
$i);
385 $template->setVariable("OTHER_Q_ID", $this->object->getId());
386 if (is_array($working_data)) {
387 foreach ($working_data as $value) {
388 if (strlen($value["value"])) {
389 if ($value["value"] == $cat->scale - 1 && strlen($value['textanswer'])) {
391 }
392 }
393 }
394 }
395 $template->parseCurrentBlock();
396 }
397
398
399 $template->setCurrentBlock("radio_col");
400 if ($cat->neutral) {
401 $template->setVariable('COLCLASS', ' neutral');
402 }
403 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) :
$i);
404 $template->setVariable("QUESTION_ID", $this->object->getId());
405 if (is_array($working_data)) {
406 foreach ($working_data as $value) {
407 if (strcmp($value["value"], "") != 0) {
408 if ($value["value"] == $cat->scale - 1) {
409 if (!$value['uncheck']) {
410 $template->setVariable("CHECKED_SC", " checked=\"checked\"");
411 }
412 }
413 }
414 }
415 }
416 $template->parseCurrentBlock();
417 }
418 $perc = round(70 / $this->object->categories->getCategoryCount(), 2);
419 for (
$i = 0;
$i < $this->
object->categories->getCategoryCount();
$i++) {
420 $cat = $this->
object->categories->getCategory(
$i);
421
422 $debug_scale = ($cat->scale) ? ($cat->scale - 1) :
$i;
423 $this->log->debug("Horizontal orientation - Original scale = " . $cat->scale . " If(scale) scale -1 else i. The new scale value is = " . $debug_scale);
424
425 $template->setCurrentBlock("text_col");
426 if ($cat->neutral) {
427 $template->setVariable('COLCLASS', ' neutral');
428 }
429 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) :
$i);
431 $template->setVariable("PERC", $perc);
432 $template->setVariable("QUESTION_ID", $this->object->getId());
433 $template->parseCurrentBlock();
434 }
435 break;
436 }
437 if ($question_title) {
438 $template->setVariable("QUESTION_TITLE", $this->object->getTitle());
439 }
440 $template->setCurrentBlock("question_data");
441 if (strcmp($error_message, "") != 0) {
442 $template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
443 }
444 if ($show_questiontext) {
446 }
447 $template->parseCurrentBlock();
448 return $template->get();
449 }
getMaterialOutput()
Creates the HTML output of the question material(s)