I have a doubt regarding this script
This is defined about a progress bar
public function progressBarStatus($number)
{
return ($number == 0) ? lang('NOTSTARTED') : '<div class="progress-bar ui-progressbar ui-widget ui-widget-content"><div class="inner-orange ui-corner-left" style="width:' . $number . '%;">' . $number . '% </div></div>';
}
See I want the progress bar to have orange colour only when score is below 70%
The code for determining score is
<td><?php echo $row->score;?>% <?php echo $content->progressBarStatus(intval($row->marks/$row->fullmarks*100));?> (<?php echo intval($row->marks);?>/<?php echo intval($row->fullmarks);?>)</td>
What changes should I make?
Now what's happening by default it is showing orange colour for all scores. The other colour is green what I want its there in lib.php. Just tell me How I should reframe the other code like using if else or something
Doubt regarding few lines of code. Please help.
Moderator: General Moderators
-
webbiesindia
- Forum Newbie
- Posts: 3
- Joined: Sun Jun 28, 2015 12:52 am
Re: Doubt regarding few lines of code. Please help.
Use an if statement to define the color for <70% and >=70%. Then use that color in the HTML.
Code: Select all
public function progressBarStatus($number)
{
if ($number < 70) {
$color = 'orange';
} else {
$color = 'green';
}
return ($number == 0) ? lang('NOTSTARTED') : '<div class="progress-bar ui-progressbar ui-widget ui-widget-content"><div class="inner-' . $color . ' ui-corner-left" style="width:' . $number . '%;">' . $number . '% </div></div>';
}-
webbiesindia
- Forum Newbie
- Posts: 3
- Joined: Sun Jun 28, 2015 12:52 am