From ef22fbdeb00050cff30775db711cafa93188297e Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Sat, 15 Jan 2005 23:08:16 +0000 Subject: [PATCH] now we can see medals in the fiche git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-349 --- include/profil/get_deco.inc.php | 10 +++++----- include/user.func.inc.php | 10 ++++++++++ templates/fiche.tpl | 28 ++++++++++++++++++++++++---- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/include/profil/get_deco.inc.php b/include/profil/get_deco.inc.php index 01853a2..0368f9f 100644 --- a/include/profil/get_deco.inc.php +++ b/include/profil/get_deco.inc.php @@ -28,11 +28,11 @@ if (Env::has('medal_op')) { $globals->xdb->execute("INSERT INTO profile_medals_sub (uid,mid) VALUES ({?}, {?})", Session::getInt('uid', -1), Env::getInt('medal_id')); } } - -foreach (Post::getMixed('grade') as $mid=>$gid) { - $globals->xdb->execute('UPDATE profile_medals_sub SET gid={?} WHERE uid={?} AND mid={?}', $gid, Session::getInt('uid'), $mid); -} - +if (Post::has('grade')) { + foreach (Post::getMixed('grade') as $mid=>$gid) { + $globals->xdb->execute('UPDATE profile_medals_sub SET gid={?} WHERE uid={?} AND mid={?}', $gid, Session::getInt('uid'), $mid); + } +} $res = $globals->xdb->query( "SELECT m.id, m.text AS medal, m.type, m.img, s.gid diff --git a/include/user.func.inc.php b/include/user.func.inc.php index 9829700..974d3bd 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -235,6 +235,16 @@ function &get_user_details($login, $from_uid = '') } $user['applis_join'] = join(', ', $user['applis_fmt']); + $res = $globals->xdb->iterator("SELECT m.id, m.text AS medal, m.type, m.img, s.gid, g.text AS grade + FROM profile_medals_sub AS s + INNER JOIN profile_medals AS m ON ( s.mid = m.id ) + LEFT JOIN profile_medals_grades AS g ON ( s.mid = g.mid AND s.gid = g.gid ) + WHERE s.uid = {?}", $uid); + $user['medals'] = Array(); + while ($tmp = $res->next()) { + $user['medals'][] = $tmp; + } + return $user; } diff --git a/templates/fiche.tpl b/templates/fiche.tpl index 6d47aa4..acdba44 100644 --- a/templates/fiche.tpl +++ b/templates/fiche.tpl @@ -101,13 +101,12 @@ function chgMainWinLoc( strPage ) {

Contact :

{foreach from=$x.adr item="address" key="i"} {if $address.active} - {assign var="address_titre" value="Mon adresse actuelle :"} + {include file="geoloc/address.tpl" address=$address titre_div=true titre="Mon adresse actuelle :"} {elseif $address.secondaire} - {assign var="address_titre" value="Adresse secondaire :"} + {include file="geoloc/address.tpl" address=$address titre_div=true titre="Adresse secondaire :"} {else} - {assign var="address_titre" value="Adresse principale :"} + {include file="geoloc/address.tpl" address=$address titre_div=true titre="Adresse principale :"} {/if} - {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_titre} {/foreach}
 
@@ -149,6 +148,27 @@ function chgMainWinLoc( strPage ) { {/if} + {if $x.medals} + + +

Distinctions :

+ {foreach from=$x.medals item=m} + + + + + +
+ {$m.medal} + + {$m.medal} +
{$m.grade} +
+ {/foreach} +
 
+ + + {/if} {if $x.cv} -- 2.1.4