Sponsored Content
Top Forums Web Development Notes with Ravinder on Badging System Development Part II Post 303028209 by Neo on Wednesday 2nd of January 2019 06:15:53 AM
Old 01-02-2019
One more badge prototype done:... "posts in the past month"

Code:
$one_month_ago = time() - $month; 
$monthquery = "SELECT COUNT(postid) AS postcount from post where userid=".$uid ." and dateline > " .$one_month_ago; 
$monthposts = $vbulletin->db->query_first($monthquery); 
if ($monthposts['postcount'] >= 30) { 
    $color['facomment'] = 'black'; 
}  
elseif ($monthposts['postcount'] >= 15) { 
    $color['facomment'] = 'indigo'; 
} elseif ($monthposts['postcount'] >= 5) { 
    $color['facomment'] = 'blue'; 
} elseif ($monthposts['postcount'] >= 1) { 
    $color['facomment'] = 'limegreen'; 
} else { 
    $color['facomment'] = 'lightgray'; 
} 

$badgejs .= 'badge["facomment"] = "' . $color['facomment'] . '";'; 
$badgejs .= 'badge["facommentval"] = "' . number_format($monthposts['postcount']) . '";';

jQuery:

Code:
$('.fa-comment').css("color",badge["facomment"]);
$('.fa-comment').css("cursor","pointer").attr("title",  badge["facommentval"] + " Posts in the Last Month");
$('.fa-comment').closest('div').find('.fa-circle').css("color",badge["facomment"]);

 

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
Imager::Color::Float(3pm)				User Contributed Perl Documentation				 Imager::Color::Float(3pm)

NAME
Imager::Color::Float - Rough floating point sample color handling SYNOPSIS
$color = Imager::Color->new($red, $green, $blue); $color = Imager::Color->new($red, $green, $blue, $alpha); $color = Imager::Color->new("#C0C0FF"); # html color specification $color->set($red, $green, $blue); $color->set($red, $green, $blue, $alpha); $color->set("#C0C0FF"); # html color specification ($red, $green, $blue, $alpha) = $color->rgba(); @hsv = $color->hsv(); # not implemented but proposed $color->info(); DESCRIPTION
This module handles creating color objects used by Imager. The idea is that in the future this module will be able to handle color space calculations as well. A floating point Imager color consists of up to four components, each in the range 0.0 to 1.0. Unfortunately the meaning of the components can change depending on the type of image you're dealing with: o for 3 or 4 channel images the color components are red, green, blue, alpha. o for 1 or 2 channel images the color components are gray, alpha, with the other two components ignored. An alpha value of zero is fully transparent, an alpha value of 1.0 is fully opaque. METHODS
new This creates a color object to pass to functions that need a color argument. set This changes an already defined color. Note that this does not affect any places where the color has been used previously. rgba() This returns the red, green, blue and alpha channels of the color the object contains. info Calling info merely dumps the relevant color to the log. AUTHOR
Arnar M. Hrafnkelsson, addi@umich.edu And a great deal of help from others - see the "README" for a complete list. SEE ALSO
Imager(3), Imager::Color. http://imager.perl.org/ perl v5.14.2 2011-06-06 Imager::Color::Float(3pm)
All times are GMT -4. The time now is 01:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy