Show ax_id on profile for admins.
[platal.git] / templates / profile / profile.tpl
1 {**************************************************************************}
2 {*                                                                        *}
3 {*  Copyright (C) 2003-2014 Polytechnique.org                             *}
4 {*  http://opensource.polytechnique.org/                                  *}
5 {*                                                                        *}
6 {*  This program is free software; you can redistribute it and/or modify  *}
7 {*  it under the terms of the GNU General Public License as published by  *}
8 {*  the Free Software Foundation; either version 2 of the License, or     *}
9 {*  (at your option) any later version.                                   *}
10 {*                                                                        *}
11 {*  This program is distributed in the hope that it will be useful,       *}
12 {*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
13 {*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
14 {*  GNU General Public License for more details.                          *}
15 {*                                                                        *}
16 {*  You should have received a copy of the GNU General Public License     *}
17 {*  along with this program; if not, write to the Free Software           *}
18 {*  Foundation, Inc.,                                                     *}
19 {*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
20 {*                                                                        *}
21 {**************************************************************************}
22
23 {literal}
24 <script type="text/javascript">//<![CDATA[
25 function chgMainWinLoc(strPage)
26 {
27   strPage = $.plURL(strPage);
28   if (parent.opener) {
29     try {
30       parent.opener.document.location = strPage;
31       window.close();
32     } catch(e) {
33       window.open(strPage);
34     }
35   } else {
36     document.location = strPage;
37   }
38 }
39
40 $($.closeOnEsc);
41
42 //]]></script>
43 {/literal}
44 <div id="fiche">
45   <div id="photo" class="part">
46     {assign var=photo value=$profile->getPhoto(false)}
47     {if $photo}<img alt="Photo de {$profile->fullName()}" src="photo/{$profile->hrid()}{if $with_pending_pic}/req{/if}" width="{$photo->width()}"/>{/if}
48
49     {if $logged && $view->isVisible(#Visibility::EXPORT_AX#) && ( $profile->section|smarty:nodefaults || $profile->getBinets()|smarty:nodefaults || ($owner && $owner->groups(true,true)|smarty:nodefaults))}
50       <h2>À l'X&hellip;</h2>
51       {if $profile->section}<div><em class="intitule">Section&nbsp;: </em><span>{$profile->section}</span></div>{/if}
52
53       {assign var=binets value=$profile->getFullBinets()}
54       {if $binets|@count}<div><em class="intitule">Binet{if count($binets) > 1}s{/if}&nbsp;: </em>
55       <span> <br />
56       {foreach from=$binets item=binet name=binets}
57         {if !$smarty.foreach.binets.first}, {/if}
58         <span title="{$binet.text}">{if $binet.url}<a href="{$binet.url}">{/if}{$binet.text}{if $binet.url}</a>{/if}</span>
59       {/foreach}
60       </span></div>{/if}
61
62       {if $owner && $view->isVisible(#Visibility::EXPORT_AX#)}
63         {assign var=groups value=$owner->groups(true,true)}
64         {if $groups|@count}<div><em class="intitule">Groupe{if count($groups) > 1}s{/if} et institution{if count($groups) > 1}s{/if} X&nbsp;: </em>
65         <span><br/>
66         {foreach from=$groups item=group name=groups}
67           {if !$smarty.foreach.groups.first}, {/if}
68           <span title="{$group.nom}"><a href="{if $group.site}{$group.site}{else}http://www.polytechnique.net/{$group.diminutif}{/if}">{$group.nom}</a></span>
69         {/foreach}
70         </span></div>{/if}
71       {/if}
72
73     {/if}
74
75     {assign var=networking value=$profile->getNetworking(#Profile::NETWORKING_ALL#)}
76     {if count($networking) > 0}
77       <h2>Sur le web...</h2>
78       {foreach from=$networking item=network}
79         <img style="width: auto; padding: 0" src="profile/networking/{$network.nwid}" alt="{$network.name}" title="{$network.name}"/>
80         {if $network.link}
81           <a href="{$network.link|replace:'%s':$network.address}">{$network.address}</a>
82         {else}
83           {$network.address}
84         {/if}
85         <br/>
86       {/foreach}
87     {/if}
88
89     {if $profile->freetext}
90       <h2>Commentaires&nbsp;:</h2>
91       <span>{$profile->freetext|miniwiki|smarty:nodefaults}</span>
92     {/if}
93
94   </div>
95
96   <div id="fiche_identite" class="part">
97     <div class="civilite">
98       {if $profile->isFemale()}&bull;{/if}
99       {if $view->isVisible(#Visibility::EXPORT_PRIVATE#)}{$profile->private_name}{else}{$profile->public_name}{/if}
100       {if hasPerm('admin') || $smarty.session.user->canEdit($profile)} {$profile->ax_id}{/if}
101
102       {if $logged}
103         &nbsp;{if !$profile->isDead()}<a href="vcard/{$owner->login()}.vcf">{*
104           *}{icon name=vcard title="Afficher la carte de visite"}</a>{/if}
105
106         {if !$smarty.session.user->isContact($profile)}
107         <a href="javascript:chgMainWinLoc('carnet/contacts?action=ajouter&amp;user={$owner->login()}&amp;token={xsrf_token}')">
108           {icon name=add title="Ajouter à mes contacts"}</a>
109         {else}
110         <a href="javascript:chgMainWinLoc('carnet/contacts?action=retirer&amp;user={$owner->login()}&amp;token={xsrf_token}')">
111           {icon name=cross title="Retirer de mes contacts"}</a>
112         {/if}
113
114         {if hasPerm('admin')}
115         <a href="javascript:chgMainWinLoc('admin/user/{$owner->login()}')">
116           {icon name=wrench title="administrer user"}</a>
117         {/if}
118
119         {if $smarty.session.user->isMyProfile($profile)}
120         <a href="javascript:chgMainWinLoc('profile/edit')">{icon name="user_edit" title="Modifier ma fiche"}</a>
121         {elseif hasPerm('admin') || $smarty.session.user->canEdit($profile)}
122         <a href="javascript:chgMainWinLoc('profile/edit/{$profile->hrpid}')">
123           {icon name=user_edit title="modifier la fiche"}
124         </a>
125         {/if}
126       {/if}
127     </div>
128
129     {if $logged && $view->isVisible(#Visibility::EXPORT_AX#) && $owner && $owner->state eq 'active'}
130     <div class='maj'>
131       Fiche mise à jour<br />
132       le {$profile->last_change|date_format}
133     </div>
134     {/if}
135
136     {* 121634816 is Profile::PHONE_LINK_PROFILE | Profile::PHONE_TYPE_ANY = 0x7400000 *}
137     {assign var=phones value=$profile->getPhones(121634816)}
138     {if ($logged && $view->isVisible(#Visibility::EXPORT_AX#)) || count($phones) > 0}
139     <div class="contact">
140       {if $logged && $view->isVisible(#Visibility::EXPORT_AX#)}
141       <div class='email'>
142         {if $profile->isDead()}
143         Décédé{if $profile->isFemale()}e{/if} le {$profile->deathdate|date_format}
144         {elseif $owner && $owner->lost}
145         Ce{if $profile->isFemale()}tte{/if} camarade n'a plus d'adresse de redirection valide,<br />
146         <a href="marketing/broken/{$owner->login()}" class="popup">clique ici si tu connais son adresse email&nbsp;!</a>
147         {elseif $owner && $owner->state != 'active'}
148         Cette personne n'est pas inscrite à Polytechnique.org,<br />
149         <a href="marketing/public/{$owner->login()}" class="popup">clique ici si tu connais son adresse email&nbsp;!</a>
150         {else}
151         {if $virtualalias && $view->isVisible(#Visibility::EXPORT_PRIVATE#) && $virtualalias neq $owner->bestEmail()}
152         <a href="mailto:{$virtualalias}">{$virtualalias}</a><br />
153         {/if}
154         <a href="mailto:{$owner->bestEmail()}">{$owner->bestEmail()}</a>
155         {if $owner->bestEmail() neq $owner->forlifeEmail()}<br />
156         <a href="mailto:{$owner->forlifeEmail()}">{$owner->forlifeEmail()}</a>
157         {/if}
158         {/if}
159       </div>
160       {/if}
161       {if count($phones) > 0}
162       <div style="float: right">
163         {display_phones tels=$phones dcd=$profile->isDead()}
164       </div>
165       {/if}
166       <div class='spacer'></div>
167     </div>
168     {else}
169     <div class='spacer'></div>
170     {/if}
171
172     <div class='formation'>
173       {foreach from=$profile->nationalities() item=country key=code}
174       <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />&nbsp;
175       {/foreach}
176
177       {$profile->promo('details')}
178
179       {if $logged && $view->isVisible(#Visibility::EXPORT_AX#) && $profile->mentor_expertise}
180       [<a href="referent/{$profile->hrid()}" class='popup2'>Ma fiche référent</a>]
181       {/if}
182
183       {assign var=educations value=$profile->getEducations(32)}
184       {if count($educations) > 0}
185         <ul>
186         {foreach from=$educations item=edu}
187           <li>{display_education edu=$edu profile=$profile full=true}</li>
188         {/foreach}
189         </ul>
190       {/if}
191
192       {assign var=corps value=$profile->getCorps()}
193       {if $corps && ($corps->current || $corps->original)}
194         <ul>
195         {if $corps->current}
196           <li>
197             Corps actuel&nbsp;: {$corps->current_name}
198             {if $corps->current_rank}({$corps->current_rank}){/if}
199           </li>
200         {/if}
201         {if $corps->current != $corps->original && $corps->original}
202           <li>Corps d'origine&nbsp;: {$corps->original_name}</li>
203         {/if}
204         </ul>
205       {/if}
206
207     </div>
208   </div>
209
210   {assign var=addr value=$profile->getAddresses(3)}
211   {if count($addr) > 0}
212   <div class="part">
213     <h2>Contact&nbsp;: </h2>
214     {if $profile->isDead()}
215       {assign var=address_name value="Dernière adresse"}
216     {else}
217       {assign var=address_name value="Adresse"}
218     {/if}
219     {foreach from=$addr item="address" name=addresses}
220       {if $smarty.foreach.addresses.iteration is even}
221         {assign var=pos value="right"}
222       {else}
223         {assign var=pos value="left"}
224       {/if}
225       {if $address->hasFlag('current')}
226       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" actuelle&nbsp;:"
227                for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
228       {elseif $address->hasFlag('secondary')}
229       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" secondaire&nbsp;:"
230                for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
231       {else}
232       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" principale&nbsp;:"
233                for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
234       {/if}
235       {if $smarty.foreach.addresses.iteration is even}<div class="spacer"></div>{/if}
236     {/foreach}
237   </div>
238   {/if}
239
240   {assign var=jobs value=$profile->getJobs(2)}
241   {if count($jobs) > 0}
242   <div class="part">
243     <h2>Informations professionnelles&nbsp;:</h2>
244     {foreach from=$jobs item="job" key="i"}
245       {if $i neq 0}<hr />{/if}
246       {include file="include/emploi.tpl" job=$job}
247       {assign var=jobPhones value=$job->phones()}
248       {if $job->address()}
249         {include file="geoloc/address.tpl" address=$job->address() titre="Adresse&nbsp;: " for=$job->company->name pos="left" phones=$jobPhones}
250       {elseif $jobPhones|@count neq 0}
251         {display_phones tels=$jobPhones}
252       {/if}
253       <div class="spacer">&nbsp;</div>
254     {/foreach}
255   </div>
256   {/if}
257
258   {assign var=medals value=$profile->getMedals()}
259   {if count($medals) > 0}
260     <div class="part">
261       <h2>Distinctions&nbsp;: </h2>
262       {foreach from=$medals item=m}
263       <div class="medal_frame">
264         <img src="profile/medal/thumb/{$m.mid}" height="50px" alt="{$m.text}" title="{$m.text}" style='float: left;' />
265         <div class="medal_text">
266           {$m.text}{if $m.level} ({$m.level}){/if}<br />{$m.grade}
267         </div>
268       </div>
269       {/foreach}
270       <div class="spacer">&nbsp;</div>
271     </div>
272   {/if}
273
274   {if $logged && $profile->cv}
275   <div class="part">
276     <h2>Curriculum Vitae&nbsp;:</h2>
277     {$profile->cv|miniwiki:title|smarty:nodefaults}
278   </div>
279   {/if}
280
281   {if $view->level() eq #Visibility::VIEW_PUBLIC#}
282   <div class="part">
283     <small>
284     Cette fiche est publique et visible par tout internaute,<br />
285     vous pouvez aussi voir <a href="profile/private/{$profile->hrid()}?display=light">celle&nbsp;réservée&nbsp;aux&nbsp;X</a>.
286     </small>
287   </div>
288   {elseif $view->level() eq #Visibility::VIEW_AX#}
289   <div class="part">
290     <small>
291     Cette fiche est privée et ne recense que les informations transmises à l'AX.
292     </small>
293   </div>
294   {/if}
295
296   <div class="spacer"></div>
297 </div>
298
299 {* vim:set et sw=2 sts=2 sws=2 fenc=utf-8: *}