php - how to track goal points? -


i having goal user needs hit , user passed goal want show different color. right have total goals needed having goals_needed * time_spent / day_length.

for example if goal 10, , user gets 11 points want show different color because passed goal. how result show passed goal ?

i thinking this

$color_performace = function($value, $goal) {     if($value < $goal)         return 'notenough';     elseif($value >$goal)         return 'awesome';     else         return 'enough'; }; 

and function

$total_goals_class = $color_performance($total_goals,round($goals_needed*$goal_multiplier)); 

it not clear after if want deal getting things on page change colour need output html & css.

so perhaps have like:

$color_performace = function($value, $goal) {     if($value < $goal)         return '<p style="color: red;">notenough</p>';     elseif($value >$goal)         return '<p style="color: green;">awesome</p>';     else         return '<p style="color: yellow;">enough</p>'; }; 

that quick , dirty example show concept, change use classes , have css set in main file somewhere, , use hex codes colours.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -