X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;ds=inline;f=web%2Fbriskin5%2FObj%2Fplacing.phh;h=fd932b4323a869cdc811884ea1e8afedacb7ce2d;hb=eb65f5518b0cacc60e1dd265ab966290e7cc0c54;hp=f0688999911c44998cd442f7c95169369b8ae2e1;hpb=fa82ba0deaaab26b5b9efe37c392a34cbec50a66;p=brisk.git diff --git a/web/briskin5/Obj/placing.phh b/web/briskin5/Obj/placing.phh index f068899..fd932b4 100644 --- a/web/briskin5/Obj/placing.phh +++ b/web/briskin5/Obj/placing.phh @@ -2,7 +2,7 @@ /* * brisk - placing.phh * - * Copyright (C) 2009-2011 Matteo Nastasi + * Copyright (C) 2009-2012 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it @@ -23,18 +23,18 @@ */ -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 { @@ -49,7 +49,7 @@ class Ptsgam { $this->gam = $gam; } - function &myclone() + function myclone() { $ret = new Ptsgam($this->username, $this->pts, $this->gam); @@ -78,7 +78,7 @@ class Ptsgam { else return ($this->pts / $this->gam); } -} +} // class Ptsgam { function ptsgam_cmp($a, $b) { @@ -95,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 |