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

NAME
Font::TTF::XMLparse - provides support for XML parsing. Requires Expat module XML::Parser::Expat SYNOPSIS
use Font::TTF::Font; use Font::TTF::XMLparse; $f = Font::TTF::Font->new; read_xml($f, $ARGV[0]); $f->out($ARGV[1]); DESCRIPTION
This module contains the support routines for parsing XML and generating the Truetype font structures as a result. The module has been separated from the rest of the package in order to reduce the dependency that this would bring, of the whole package on XML::Parser. This way, people without the XML::Parser can still use the rest of the package. The package interacts with another package through the use of a context containing and element 'receiver' which is an object which can possibly receive one of the following messages: XML_start This message is called when an open tag occurs. It is called with the context, tag name and the attributes. The return value has no meaning. XML_end This messages is called when a close tag occurs. It is called with the context, tag name and attributes (held over from when the tag was opened). There are 3 possible return values from such a message: undef This is the default return value indicating that default processing should occur in which either the current element on the tree, or the text of this element should be stored in the parent object. $context This magic value marks that the element should be deleted from the parent. Nothing is stored in the parent. (This rather than '' is used to allow 0 returns.) anything Anything else is taken as the element content to be stored in the parent. In addition, the context hash passed to these messages contains the following keys: xml This is the expat xml object. The context is also available as $context->{'xml'}{' mycontext'}. But that is a long winded way of not saying much! font This is the base object that was passed in for XML parsing. receiver This holds the current receiver of parsing events. It may be set in associated application to adjust which objects should receive messages when. It is also stored in the parsing stack to ensure that where an object changes it during XML_start, that that same object that received XML_start will receive the corresponding XML_end stack This is the parsing stack, used internally to hold the current receiver and attributes for each element open, as a complete hierarchy back to the root element. tree This element contains the storage tree corresponding to the parent of each element in the stack. The default action is to push undef onto this stack during XML_start and then to resolve this, either in the associated application (by changing $context->{'tree'}[-1]) or during XML_end of a child element, by which time we know whether we are dealing with an array or a hash or what. text Character processing is to insert all the characters into the text element of the context for available use later. METHODS
POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 58: =back doesn't take any parameters, but you said =back 4 Around line 60: =back doesn't take any parameters, but you said =back 4 Around line 101: =back doesn't take any parameters, but you said =back 4 perl v5.16.3 2011-10-13 Font::TTF::XMLparse(3)
All times are GMT -4. The time now is 07:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy