X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;ds=inline;f=web%2Fbriskin5%2FObj%2Fplacing.phh;h=71cbca17bdf5dab758b8c4442d8967d8302c17bb;hb=6b3deca05aae68fbef085dd42861c19e546f8d25;hp=583fce72d222d4daf8d2bb453f163e9919e24f5a;hpb=bf073fd0ae276622564ef5404ddd182177901e6b;p=brisk.git diff --git a/web/briskin5/Obj/placing.phh b/web/briskin5/Obj/placing.phh index 583fce7..71cbca1 100644 --- a/web/briskin5/Obj/placing.phh +++ b/web/briskin5/Obj/placing.phh @@ -2,7 +2,7 @@ /* * brisk - placing.phh * - * Copyright (C) 2009 Matteo Nastasi + * Copyright (C) 2009-2012 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it @@ -20,23 +20,21 @@ * not, write to the Free Software Foundation, Inc, 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. * - * $Id$ - * */ -define(TOP_NUM, 10); -define(TRI_LIMIT, (90 * 24 * 60 * 60)); -define(TRI_MIN_GAMES, 70); -define(TRI_MAX_GAMES, 140); +define('TOP_NUM', 10); +define('TRI_LIMIT', (90 * 24 * 60 * 60)); +define('TRI_MIN_GAMES', 70); +define('TRI_MAX_GAMES', 140); -define(MON_LIMIT, (30 * 24 * 60 * 60)); -define(MON_MIN_GAMES, 35); -define(MON_MAX_GAMES, 70); +define('MON_LIMIT', (30 * 24 * 60 * 60)); +define('MON_MIN_GAMES', 35); +define('MON_MAX_GAMES', 70); -define(WEE_LIMIT, (7 * 24 * 60 * 60)); -define(WEE_MIN_GAMES, 10); -define(WEE_MAX_GAMES, 35); +define('WEE_LIMIT', (7 * 24 * 60 * 60)); +define('WEE_MIN_GAMES', 10); +define('WEE_MAX_GAMES', 35); class Ptsgam { @@ -51,7 +49,7 @@ class Ptsgam { $this->gam = $gam; } - function &myclone() + function myclone() { $ret = new Ptsgam($this->username, $this->pts, $this->gam); @@ -80,7 +78,7 @@ class Ptsgam { else return ($this->pts / $this->gam); } -} +} // class Ptsgam { function ptsgam_cmp($a, $b) { @@ -97,30 +95,40 @@ function ptsgam_cmp($a, $b) return (($norma < $normb) ? 1 : -1); } -function placings_show(&$user) +/* types of placing based on delta time */ +define(TY_DTIME_TRI, 0); +define(TY_DTIME_MON, 1); +define(TY_DTIME_WEE, 2); + +/* subtypes of placing based on number of played games */ +define(SUBTY_FREQ_LO, 0); +define(SUBTY_FREQ_HI, 1); + + +function placings_show($user) { $mtime = placing_time(); $tm = placing_date($mtime); $ret = sprintf("
Settimanale dal %s al %s (non meno di %d partite) %s | ", $tmwee[1], $tm[1], WEE_MAX_GAMES, placing_show($user, "wee_hi") );
- $ret .= sprintf("Settimanale dal %s al %s (meno di %d partite, più di %d) %s |
Settimanale dal %s al %s (non meno di %d partite) %s | ", $tmwee[1], $tm[1], WEE_MAX_GAMES, placing_show($user, TY_DTIME_WEE, SUBTY_FREQ_HI) );
+ $ret .= sprintf("Settimanale dal %s al %s (meno di %d partite, più di %d) %s |
Mensile dal %s al %s (non meno di %d partite) %s | ", $tmmon[1], $tm[1], MON_MAX_GAMES, placing_show($user, "mon_hi") );
- $ret .= sprintf("Mensile dal %s al %s (meno di %d partite, più di %d) %s |
Mensile dal %s al %s (non meno di %d partite) %s | ", $tmmon[1], $tm[1], MON_MAX_GAMES, placing_show($user, TY_DTIME_MON, SUBTY_FREQ_HI) );
+ $ret .= sprintf("Mensile dal %s al %s (meno di %d partite, più di %d) %s |
Trimestrale dal %s al %s (non meno di %d partite) %s | ", $tmtri[1], $tm[1], TRI_MAX_GAMES, placing_show($user, "tri_hi"));
- $ret .= sprintf("Trimestrale dal %s al %s (meno di %d partite, più di %d) %s |
Trimestrale dal %s al %s (non meno di %d partite) %s | ", $tmtri[1], $tm[1], TRI_MAX_GAMES, placing_show($user, TY_DTIME_TRI, SUBTY_FREQ_HI));
+ $ret .= sprintf("Trimestrale dal %s al %s (meno di %d partite, più di %d) %s |
Pos. | Utente | Score | (Punti/Partite) | "); + + for ($i = 0 ; $i < pg_numrows($pla_pg) ; $i++) { + $pla_obj = pg_fetch_object($pla_pg,$i); + + $ein = ""; + $eou = ""; + if ($user != FALSE) { + if ($user->code == $pla_obj->ucode) { + $ein = ""; + $eou = ""; + } + } + + /* when the user is far from the top-ten we place a ... separator before it */ + if ($pla_obj->rank > TOP_NUM) { + $ret .= sprintf("
---|---|---|---|
. . . . . . . . . . | |||
%d | %s%s%s | %s%12.3f%s | %s(%d/%d)%s |