Sponsored Content
Top Forums Web Development Notes with Ravinder on Badging System Development Part II Post 303028195 by RavinderSingh13 on Tuesday 1st of January 2019 07:38:04 PM
Old 01-01-2019
Quote:
Originally Posted by Neo
Hey Ravinder,
I already fixed and rearranged your code and it is working now:
Code:
$time_join = time() - $modaluser['joindate'];
$years_a_member = $time_join / $year;
if ($time_inactive < $year) { 
    if ($years_a_member > 0 && $time_inactive < 1) { 
        $color['fajoin_time'] = 'orangered'; 
    } elseif ($years_a_member < 2 && $years_a_member  >= 1) { 
        $color['fajoin_time'] = 'darkorange'; 
    } elseif ($years_a_member < 3 && $years_a_member  >= 2) { 
        $color['fajoin_time'] = 'lightgray'; 
    } elseif ($years_a_member < 4 && $years_a_member  >= 3) { 
        $color['fajoin_time'] = 'limegreen'; 
    } elseif ($years_a_member < 5 && $years_a_member  >= 4) { 
        $color['fajoin_time'] = 'blue'; 
    } elseif ($years_a_member < 10 && $years_a_member >= 5) { 
        $color['fajoin_time'] = 'indigo'; 
    } elseif ($years_a_member >= 10) { 
        $color['fajoin_time'] = 'black'; 
    } else { 
        $color['fajoin_time'] = 'red'; 
    } 
} else { 
    $color['fajoin_time'] = 'red'; 
} 

$badgejs .= 'badge["fajoin_time"] = "' . $color['fajoin_time'] . '";';   
$badgejs .= 'badge["fajoin_timeval"] = "' . number_format($years_a_member) . '";';

jQuery:

Code:
$('.fa-clock').css("color",badge["fajoin_time"]);
$('.fa-clock').css("cursor","pointer").attr("title",  badge["fajoin_timeval"] + " Years Active at UNIX.COM");
$('.fa-clock').closest('div').find('.fa-circle').css("color",badge["fajoin_time"]);

This is a great badge you came up with. I really like it. Very useful too. Only 11 more to go for this phase of rapid prototype development!
Thanks for trying on this (you were close!) . ... I look forward to your next badge!
What is the next, great, Ravinder Singh idea for a badge?
Thanks a TON Neo for fixing it. Thanks for appreciation on badge it boosted me up now. Will let you/all know once I get another thought of badge Smilie

Thanks,
R. Singh
 

3 More Discussions You Might Find Interesting

1. What is on Your Mind?

New Badging System - Badges Prototype Beta 1 (Badges Only)

Today I mapped out the new badging system using FA icons, Beta 1 in no particular order except a 6 x 8 grid: https://www.unix.com/members/1-albums215-picture991.png The prototype HTML code for this layout: <style> .fa-badge-grid { font-size: 1.5em; } .row { ... (38 Replies)
Discussion started by: Neo
38 Replies

2. What is on Your Mind?

Status of Badging System - Beta 1

Dear All, Here is the current status of the badging system: The Beta 1 phase of the new badging system is close to completion. 42 prototype badges have been "allocated" 6 prototype badge slots are held in reserve The "alert you have new badges" prototype is running and is currently... (4 Replies)
Discussion started by: Neo
4 Replies

3. What is on Your Mind?

Badging System: UNIX.COM Bug Hunter Badge (New)

I have moved the bug badge out of reserve and into the main stream. Basically, I will assign a color level like the others, based on who has made a good actionable bug report for UNIX.COM. "Good" means screenshots, links, and even details from web dev tools our the HTML source code. So far,... (0 Replies)
Discussion started by: Neo
0 Replies
Color::Library::Color(3pm)				User Contributed Perl Documentation				Color::Library::Color(3pm)

NAME
Color::Library::Color - Color entry for a Color::Library color dictionary METHODS
$id = $color->id Returns the id of the color A color id is in the format of <dictionary_id:color_name>, e.g. svg:aliceblue x11:bisque2 nbs-iscc-f:chromeyellow.66 vaccc:darkspringyellow $name = $color->name Returns the name of the color, e.g. aliceblue bisque2 chromeyellow darkspringyellow $title = $color->title Returns the title of the color, e.g. aliceblue bisque2 chrome yellow Dark Spring-Yellow $dictionary = $color->dictionary Returns the Color::Library::Dictionary object that the color belongs to $hex = $color->hex Returns the hex value of the color, e.g. ff08ff eed5b7 eaa221 669900 Note that $hex does NOT include the leading #, for that use $color->html, $color->css, or $color->svg $html = $color->html $css = $color->css $svg = $color->svg Returns the hex value of the color with a leading #, suitable for use in HTML, CSS, or SVG documents, e.g. #ff08ff #eed5b7 #eaa221 #669900 $value = $color->value Returns the numeric value of the color, e.g. 15792383 15652279 15376929 6723840 ($r, $g, $b) = $color->rgb Returns r, g, and b values of the color as a 3 element list (list context), e.g. (240, 248, 255) $rgb = $color->rgb Returns r, g, and b values of the color in a 3 element array (scalar context), e.g. [ 240, 248, 255 ] $color = Color::Library::Color->new( id => $id, name => $name, title => $title, value => $value ) $color = Color::Library::Color->new( { id => $id, name => $name, title => $title, value => $value } ) $color = Color::Library::Color->new( [[ $id, $name, $title, $rgb, $hex, $value ]] ) Returns a new Color::Library::Color object representing the specified color You probably don't want/need to call this yourself FUNCTIONS $hex = Color::Library::Color::rgb2hex( $rgb ) $hex = Color::Library::Color::rgb2hex( $r, $g, $b ) Converts an rgb value to its hex representation $value = Color::Library::Color::rgb2value( $rgb ) $value = Color::Library::Color::rgb2value( $r, $g, $b ) Converts an rgb value to its numeric representation $rgb = Color::Library::Color::value2rgb( $value ) ($r, $g, $b) = Color::Library::Color::value2rgb( $value ) Converts a numeric color value to its rgb representation ($r, $g, $b) = Color::Library::Color::parse_rgb_color( $hex ) ($r, $g, $b) = Color::Library::Color::parse_rgb_color( $value ) Makes a best effort to convert a hex or numeric color value to its rgb representation perl v5.14.2 2011-12-07 Color::Library::Color(3pm)
All times are GMT -4. The time now is 04:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy