From: Pascal Corpet Date: Tue, 1 Feb 2005 23:47:47 +0000 (+0000) Subject: Fiche publique X-Git-Tag: xorg/old~323 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=f170dfea9c7002317e9e8a9507b67bd2441046e2;p=platal.git Fiche publique git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-436 --- diff --git a/htdocs/fiche.php b/htdocs/fiche.php index 67ddca9..3c80478 100644 --- a/htdocs/fiche.php +++ b/htdocs/fiche.php @@ -21,7 +21,7 @@ require_once("xorg.inc.php"); -new_simple_page('fiche.tpl',AUTH_COOKIE); +new_simple_page('fiche.tpl', AUTH_PUBLIC); require_once('user.func.inc.php'); if (!Env::has('user') && !Env::has('mat')) { @@ -74,6 +74,67 @@ if($user['x'] < 160){ $user['x'] = 160; } $page->assign('photo_url', $photo); + +// manage the public fiche +$page->assign('logged', logged()); +if (!logged()) { + if ($user['mobile_pub'] != 'public') $user['mobile'] = ''; + if ($user['web_pub'] != 'public') $user['web'] = ''; + if ($user['freetext_pub'] != 'public') $user['freetext'] = ''; + foreach ($user['adr'] as $i=>$adr) { + if ($adr['pub'] != 'public' && $adr['tel_pub'] != 'public') + unset($user['adr'][$i]); + elseif ($adr['pub'] != 'public') { + $user['adr'][$i]['adr1'] = ''; + $user['adr'][$i]['adr2'] = ''; + $user['adr'][$i]['adr3'] = ''; + $user['adr'][$i]['ville'] = ''; + $user['adr'][$i]['cp'] = ''; + $user['adr'][$i]['region'] = ''; + $user['adr'][$i]['pays'] = ''; + } + elseif ($adr['tel_pub'] != 'public') { + $user['adr'][$i]['tel'] = ''; + $user['adr'][$i]['fax'] = ''; + } + } + foreach ($user['adr_pro'] as $i=>$adr) { + if ($adr['pub'] != 'public' && $adr['tel_pub'] != 'public' && $adr['adr_pub'] != 'public') + unset($user['adr_pro'][$i]); + else { + if ($adr['adr_pub'] != 'public') { + $user['adr_pro'][$i]['adr1'] = ''; + $user['adr_pro'][$i]['adr2'] = ''; + $user['adr_pro'][$i]['adr3'] = ''; + $user['adr_pro'][$i]['ville'] = ''; + $user['adr_pro'][$i]['cp'] = ''; + $user['adr_pro'][$i]['region'] = ''; + $user['adr_pro'][$i]['pays'] = ''; + } + if ($adr['pub'] != 'public') { + $user['adr_pro'][$i]['entreprise'] = ''; + $user['adr_pro'][$i]['secteur'] = ''; + $user['adr_pro'][$i]['fonction'] = ''; + $user['adr_pro'][$i]['poste'] = ''; + } + if ($adr['tel_pub'] != 'public') { + $user['adr_pro'][$i]['tel'] = ''; + $user['adr_pro'][$i]['fax'] = ''; + $user['adr_pro'][$i]['mobile'] = ''; + } + } + } +} +foreach($user['adr_pro'] as $i=>$pro) { + if ($pro['entreprise'] == '' && $pro['fonction'] == '' + && $pro['secteur'] == '' && $pro['poste'] == '' + && $pro['adr1'] == '' && $pro['adr2'] == '' && $pro['adr3'] == '' + && $pro['cp'] == '' && $pro['ville'] == '' && $pro['pays'] == '' + && $pro['tel'] == '' && $pro['fax'] == '' && $pro['mobile'] == '') + unset($user['adr_pro'][$i]); +} +if (count($user['adr_pro']) == 0) unset($user['adr_pro']); +if (count($user['adr']) == 0) unset($user['adr']); $page->assign_by_ref('x', $user); // alias virtual @@ -90,4 +151,5 @@ $page->assign('virtualalias', $res->fetchOneCell()); $page->addJsLink('javascript/close_on_esc.js'); $page->run(); +// vim:set et sws=4 sw=4 sts=4: ?> diff --git a/include/user.func.inc.php b/include/user.func.inc.php index 7ccb82c..8dae224 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -158,6 +158,7 @@ function &get_user_details($login, $from_uid = '') $reqsql = "SELECT u.user_id, u.promo, u.prenom, u.nom, u.epouse, u.date, u.cv, u.perms IN ('admin','user') AS inscrit, FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces, q.profile_nick AS nickname, q.profile_from_ax, q.profile_mobile AS mobile, q.profile_web AS web, q.profile_freetext AS freetext, + q.profile_mobile_pub AS mobile_pub, q.profile_web_pub AS web_pub, q.profile_freetext_pub AS freetext_pub, IF(gp.nat='',gp.pays,gp.nat) AS nationalite, gp.a2 AS iso3166, a.alias AS forlife, a2.alias AS bestalias, c.uid IS NOT NULL AS is_contact, @@ -180,7 +181,8 @@ function &get_user_details($login, $from_uid = '') $sql = "SELECT e.entreprise, s.label as secteur , ss.label as sous_secteur , f.fonction_fr as fonction, e.poste, e.adr1, e.adr2, e.adr3, e.cp, e.ville, - gp.pays, gr.name, e.tel, e.fax, e.mobile, e.entrid + gp.pays, gr.name AS region, e.tel, e.fax, e.mobile, e.entrid, + e.pub, e.tel_pub FROM entreprises AS e LEFT JOIN emploi_secteur AS s ON(e.secteur = s.id) LEFT JOIN emploi_ss_secteur AS ss ON(e.ss_secteur = ss.id AND e.secteur = ss.secteur) @@ -195,7 +197,8 @@ function &get_user_details($login, $from_uid = '') $sql = "SELECT a.adr1,a.adr2,a.adr3,a.cp,a.ville, gp.pays,gr.name AS region,a.tel,a.fax, FIND_IN_SET('active', a.statut) AS active, a.adrid, - FIND_IN_SET('res-secondaire', a.statut) AS secondaire + FIND_IN_SET('res-secondaire', a.statut) AS secondaire, + a.pub, a.tel_pub FROM adresses AS a LEFT JOIN geoloc_pays AS gp ON (gp.a2=a.pays) LEFT JOIN geoloc_region AS gr ON (gr.a2=a.pays and gr.region=a.region) diff --git a/templates/fiche.tpl b/templates/fiche.tpl index 16cf3b2..5c5420b 100644 --- a/templates/fiche.tpl +++ b/templates/fiche.tpl @@ -32,6 +32,7 @@ function chgMainWinLoc( strPage ) {
{if $x.sexe}•{/if} {$x.prenom} {if $x.epouse eq ""}{$x.nom}{else}{$x.epouse} ({$x.nom}){/if} + {min_auth level="cookie"} {if $x.nickname} (aka {$x.nickname}){/if}  Afficher la carte de visite @@ -50,12 +51,17 @@ function chgMainWinLoc( strPage ) { admin {/perms} + {/min_auth}
+ {min_auth level="cookie"}
Fiche mise à jour
le {$x.date|date_format}
+ {/min_auth} + {if $logged || $c.mobile}
+ {min_auth level="cookie"} + {/min_auth}
{if $x.mobile}Mobile : {$x.mobile}
{/if}
+ {/if}
{if $x.iso3166} {$x.nationalite}  {/if} - X {$x.promo}{if $x.applis_join} - Formation : {$x.applis_join|smarty:nodefaults}{/if} + X {$x.promo}{if $x.applis_join} - Formation : {$x.applis_join|smarty:nodefaults} {/if} + {min_auth level="cookie"} {if $x.is_referent} [Ma fiche référent] {/if} + {/min_auth}
+ {min_auth level="cookie"} Photo de {$x.forlife} {if $x.section}Section : {$x.section}
{/if} {if $x.binets_join}Binet(s) : {$x.binets_join}
{/if} {if $x.gpxs_join}Groupe(s) X : {$x.gpxs_join|smarty:nodefaults}
{/if} + {/min_auth} {if $x.web}Site Web : {$x.web}{/if} {if $x.freetext}
Commentaires :
{$x.freetext|nl2br}{/if} @@ -148,6 +160,7 @@ function chgMainWinLoc( strPage ) { {/if} + {min_auth level="cookie"} {if $x.medals} @@ -177,6 +190,7 @@ function chgMainWinLoc( strPage ) { {/if} + {/min_auth} diff --git a/templates/include/minifiche.tpl b/templates/include/minifiche.tpl index bc5a3f6..0cdccd8 100644 --- a/templates/include/minifiche.tpl +++ b/templates/include/minifiche.tpl @@ -27,10 +27,11 @@ {min_auth level="cookie"} {if !$c.dcd && $c.inscrit}{/if} {/min_auth} + {only_public} + {if !$c.dcd && $c.inscrit}{/if} + {/only_public} {if $c.epouse}{$c.epouse} {$c.prenom}
(née {$c.nom}){else}{$c.nom} {$c.prenom}{/if} - {min_auth level="cookie"} {if !$c.dcd && $c.inscrit}
{/if} - {/min_auth}