Sponsored Content
Top Forums Web Development Notes with Ravinder on Badging System Development Part II Post 303028303 by Neo on Friday 4th of January 2019 12:04:37 AM
Old 01-04-2019
Note, I'm jumping on a plane in a few hours, so I don't have time to check this properly, but I'm thinking:

Code:
<?php
$day = 60 * 60 * 24;
$dayago = time() - $day;
$incrementseq = "UPDATE user SET lastdayactive = (UNIX_TIMESTAMP()/(60*60*24)), daysinsequence =  daysinsequence +1 WHERE userid =" . $uid;
$selectday = "SELECT lastdayactive AS lastactive FROM user WHERE userid =" . $uid;
$resetday = "UPDATE user SET lastdayactive = (UNIX_TIMESTAMP()/(60*60*24)), daysinsequence =  1 WHERE userid =" . $uid;

$day = $vbulletin->db->query_first($selectday);

if ($day['lastactive'] > $dayago && $day['lastactive'] <= $dayago * 2) {
    $status = $vbulletin->db->query_write($incrementseq);
} elseif ($day['lastactive'] > $dayago * 2) {
    $status = $vbulletin->db->query_write($resetday);
}

$getseq = "SELECT daysinsequence AS daysactive FROM user WHERE userid =" . $uid;
$days = $vbulletin->db->query_first($getseq);
if ($days['daysactive'] > 14) {
    $color['fahistory'] == 'black';
} elseif ($days['daysactive'] > 7) {
    $color['fahistory'] == 'indigo';
} elseif ($days['daysactive'] > 3) {
    $color['fahistory'] == 'blue';
} elseif ($days['daysactive'] > 1) {
    $color['fahistory'] == 'limegreen';
} else {
    $color['fahistory'] == 'lightgray';
}
$badgejs .= 'badge["fahistory"] = "' . $color['fahistory'] . '";';
$badgejs .= 'badge["fahistoryval"] = "' . number_format($days['daysactive']) . '";';

Please take a look and let me know what you think Ravinder!

Thanks

PS: I have not debugged that code above yet and realize that we need to add logic to not query the DB after we reset; because we already have the value (1) so no reason to do the extra query, etc.
This User Gave Thanks to Neo For This Post:
 

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
GLCLIPPLANE(3G) 						   OpenGL Manual						   GLCLIPPLANE(3G)

NAME
glClipPlane - specify a plane against which all geometry is clipped C SPECIFICATION
void glClipPlane(GLenum plane, const GLdouble * equation); PARAMETERS
plane Specifies which clipping plane is being positioned. Symbolic names of the form GL_CLIP_PLANEi, where i is an integer between 0 and GL_MAX_CLIP_PLANES-1, are accepted. equation Specifies the address of an array of four double-precision floating-point values. These values are interpreted as a plane equation. DESCRIPTION
Geometry is always clipped against the boundaries of a six-plane frustum in x, y, and z. glClipPlane allows the specification of additional planes, not necessarily perpendicular to the x, y, or z axis, against which all geometry is clipped. To determine the maximum number of additional clipping planes, call glGetIntegerv() with argument GL_MAX_CLIP_PLANES. All implementations support at least six such clipping planes. Because the resulting clipping region is the intersection of the defined half-spaces, it is always convex. glClipPlane specifies a half-space using a four-component plane equation. When glClipPlane is called, equation is transformed by the inverse of the modelview matrix and stored in the resulting eye coordinates. Subsequent changes to the modelview matrix have no effect on the stored plane-equation components. If the dot product of the eye coordinates of a vertex with the stored plane equation components is positive or zero, the vertex is in with respect to that clipping plane. Otherwise, it is out. To enable and disable clipping planes, call glEnable() and glDisable() with the argument GL_CLIP_PLANEi, where i is the plane number. All clipping planes are initially defined as (0, 0, 0, 0) in eye coordinates and are disabled. NOTES
It is always the case that GL_CLIP_PLANEi = GL_CLIP_PLANE0 + i. ERRORS
GL_INVALID_ENUM is generated if plane is not an accepted value. GL_INVALID_OPERATION is generated if glClipPlane is executed between the execution of glBegin() and the corresponding execution of glEnd(). ASSOCIATED GETS
glGetClipPlane() glIsEnabled() with argument GL_CLIP_PLANEi SEE ALSO
glEnable() COPYRIGHT
Copyright (C) 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/. AUTHORS
opengl.org opengl.org 06/10/2014 GLCLIPPLANE(3G)
All times are GMT -4. The time now is 04:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy