Code Duplication    Length = 25-26 lines in 3 locations

main/inc/lib/exercise_show_functions.lib.php 3 locations

@@ 337-362 (lines=26) @@
334
			?>
335
		</td>
336
337
		<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
338
		<td width="20%">
339
			<?php
340
            if ($studentChoice) {
341
				if ($answerCorrect) {
342
                    $color = 'green';
343
					//echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>';
344
				} else {
345
                    $color = 'black';
346
                    //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>';
347
				}
348
				if ($hide_expected_answer) {
349
				    $color = '';
350
				}
351
                echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
352
			}
353
			?>
354
		</td>
355
			<?php
356
		    if ($ans==1) {
357
		        $comm = Event::get_comments($id,$questionId);
358
			}
359
		    ?>
360
		 <?php } else { ?>
361
			<td>&nbsp;</td>
362
		<?php } ?>
363
		</tr>
364
		<?php
365
	}
@@ 442-466 (lines=25) @@
439
			<?php echo $answer; ?>
440
        </td>
441
442
        <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
443
        <td width="20%">
444
            <?php
445
            $color = "black";
446
            if (isset($new_options[$studentChoice])) {
447
                if ($studentChoice == $answerCorrect) {
448
                    $color = "green";
449
                }
450
451
                if ($hide_expected_answer) {
452
				    $color = '';
453
				}
454
455
                echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
456
            }
457
            ?>
458
        </td>
459
            <?php
460
            if ($ans==1) {
461
                $comm = Event::get_comments($id, $questionId);
462
            }
463
            ?>
464
         <?php } else { ?>
465
            <td>&nbsp;</td>
466
        <?php } ?>
467
        </tr>
468
        <?php
469
    }
@@ 545-569 (lines=25) @@
542
            ?>
543
        </td>
544
545
        <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
546
        <td width="20%">
547
            <?php
548
            //@todo replace this harcoded value
549
            if ($studentChoice) {
550
                 $color = "black";
551
                if ($studentChoice == $answerCorrect) {
552
                    $color = "green";
553
                }
554
555
                if ($hide_expected_answer) {
556
                    $color = '';
557
                }
558
                echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
559
            }
560
            ?>
561
        </td>
562
            <?php
563
            if ($ans==1) {
564
                $comm = Event::get_comments($id,$questionId);
565
            }
566
            ?>
567
         <?php } else { ?>
568
            <td>&nbsp;</td>
569
        <?php } ?>
570
        </tr>
571
        <?php
572
    }