Sponsored Content
Top Forums Web Development Notes with Ravinder on Badging System Development Part II Post 303028188 by Neo on Tuesday 1st of January 2019 12:33:19 PM
Old 01-01-2019
Hey Ravinder,

I installed your code with a Font Awesome clock for now .... something is wrong with your fancy query... it gives 35 for everyone I tried, LOL

Code:
<?php
$query = "SELECT TIME_TO_SEC(TIMEDIFF(NOW(), FROM_UNIXTIME('jointime')))/(3600*24) AS 'join_time' FROM user WHERE userid =" . $uid; 
$results = $db->query_first_slave($query); 
if ($time_inactive < $year) { 
    if ($results['join_time'] > 0 && $results['join_time'] < 1) { 
        $color['fajoin_time'] = 'orangered'; 
    } elseif ($results['join_time'] < 2 && $results['join_time'] >= 1) { 
        $color['fajoin_time'] = 'darkorange'; 
    } elseif ($results['join_time'] < 3 && $results['join_time'] >= 2) { 
        $color['fajoin_time'] = 'lightgray'; 
    } elseif ($results['join_time'] < 4 && $results['join_time'] >= 3) { 
        $color['fajoin_time'] = 'limegreen'; 
    } elseif ($results['join_time'] < 5 && $results['join_time'] >= 4) { 
        $color['fajoin_time'] = 'blue'; 
    } elseif ($results['join_time'] < 10 && $results['join_time'] >= 5) { 
        $color['fajoin_time'] = 'indigo'; 
    } elseif ($results['join_time'] >= 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($results['join_time']) . '";'; 
}

jQuery:

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

 

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
Font::TTF::Coverage(3)					User Contributed Perl Documentation				    Font::TTF::Coverage(3)

NAME
Font::TTF::Coverage - Opentype coverage and class definition objects DESCRIPTION
Coverage tables and class definition objects are virtually identical concepts in OpenType. Their difference comes purely in their storage. Therefore we can say that a coverage table is a class definition in which the class definition for each glyph is the corresponding index in the coverage table. The resulting data structure is that a Coverage table has the following fields: cover A boolean to indicate whether this table is a coverage table (TRUE) or a class definition (FALSE) val A hash of glyph ids against values (either coverage index or class value) fmt The storage format used is given here, but is recalculated when the table is written out. count A count of the elements in a coverage table for use with add. Each subsequent addition is added with the current count and increments the count. METHODS
new($isCover [, vals]) Creates a new coverage table or class definition table, depending upon the value of $isCover. if $isCover then vals may be a list of glyphs to include in order. If no $isCover, then vals is a hash of glyphs against class values. read($fh) Reads the coverage/class table from the given file handle out($fh, $state) Writes the coverage/class table to the given file handle. If $state is 1 then the output string is returned rather than being output to a filehandle. $c->add($glyphid[, $class]) Adds a glyph id to the coverage table incrementing the count so that each subsequent addition has the next sequential number. Returns the index number of the glyphid added $c->signature Returns a vector of all the glyph ids covered by this coverage table or class @map=$c->sort Sorts the coverage table so that indexes are in ascending order of glyphid. Returns a map such that $map[$new_index]=$old_index. $c->out_xml($context) Outputs this coverage/class in XML AUTHOR
Martin Hosken Martin_Hosken@sil.org. See Font::TTF::Font for copyright and licensing. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 15: '=item' outside of any '=over' Around line 34: You forgot a '=back' before '=head1' perl v5.16.3 2011-10-13 Font::TTF::Coverage(3)
All times are GMT -4. The time now is 02:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy