Skip to content

Commit

Permalink
Evarisk#1893 [Control] add: progress bar of different colors
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-charles committed Oct 28, 2024
1 parent b448e50 commit 7e65956
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion view/control/control_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,18 @@
<div class="progress-info">
<span class="badge badge-info" style="margin-right: 10px;"><?php print $answerCounter . '/' . $questionCounter; ?></span>
<div class="progress-bar" style="margin-right: 10px;">
<div class="progress progress-bar-success" style="width:<?php print ($questionCounter > 0 ? ($answerCounter / $questionCounter) * 100 : 0) . '%'; ?>;" title="<?php print($questionCounter > 0 ? $answerCounter . '/' . $questionCounter : 0); ?>"></div>
<?php
$percentage = ($answerCounter / $questionCounter) * 100;
if ($percentage == 0) {
print ('<div class="progress progress-bar-danger" style="width: 0%;" title="' . ($questionCounter > 0 ? $answerCounter . '/' . $questionCounter : 0) . '"></div>');
}
if ($percentage > 0 && $percentage < 100) {
print ('<div class="progress progress-bar-warning" style="width:' . ($questionCounter > 0 ? ($answerCounter / $questionCounter) * 100 : 0) . '%;" title="' . ($questionCounter > 0 ? $answerCounter . '/' . $questionCounter : 0) . '"></div>');
}
if ($percentage == 100) {
print ('<div class="progress progress-bar-success" style="width: 100%;" title="' . ($questionCounter > 0 ? $answerCounter . '/' . $questionCounter : 0) . '"></div>');
}
?>
</div>
<?php if ($answerCounter != $questionCounter) {
print $user->conf->DIGIQUALI_SHOW_ONLY_QUESTIONS_WITH_NO_ANSWER ? img_picto($langs->trans('Enabled'), 'switch_on', 'class="show-only-questions-with-no-answer marginrightonly"') : img_picto($langs->trans('Disabled'), 'switch_off', 'class="show-only-questions-with-no-answer marginrightonly"');
Expand Down

0 comments on commit 7e65956

Please sign in to comment.