2fee8b61ba519c5203983d011386c4d7ecd9cb1f
[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     {assign var=hobbies value=$profile->getHobbies()}
90     {if count($hobbies) > 0}
91       <h2>Hobbies...</h2>
92       {foreach from=$hobbies key=type item=text}
93         <div><em class="intitule">{$type} : </em>{$text}</div>
94       {/foreach}
95     {/if}
96
97     {if $profile->freetext}
98       <h2>Commentaires&nbsp;:</h2>
99       <span>{$profile->freetext|miniwiki|smarty:nodefaults}</span>
100     {/if}
101
102   </div>
103
104   <div id="fiche_identite" class="part">
105     <div class="civilite">
106       {if $profile->isFemale()}&bull;{/if}
107       {if $view->isVisible(#Visibility::EXPORT_PRIVATE#)}{$profile->private_name}{else}{$profile->public_name}{/if}
108       {if hasPerm('admin') || $smarty.session.user->canEdit($profile)} {$profile->ax_id}{/if}
109
110       {if $logged}
111         &nbsp;{if !$profile->isDead()}<a href="vcard/{$owner->login()}.vcf">{*
112           *}{icon name=vcard title="Afficher la carte de visite"}</a>{/if}
113
114         {if !$smarty.session.user->isContact($profile)}
115         <a href="javascript:chgMainWinLoc('carnet/contacts?action=ajouter&amp;user={$owner->login()}&amp;token={xsrf_token}')">
116           {icon name=add title="Ajouter à mes contacts"}</a>
117         {else}
118         <a href="javascript:chgMainWinLoc('carnet/contacts?action=retirer&amp;user={$owner->login()}&amp;token={xsrf_token}')">
119           {icon name=cross title="Retirer de mes contacts"}</a>
120         {/if}
121
122         {if hasPerm('admin')}
123         <a href="javascript:chgMainWinLoc('admin/user/{$owner->login()}')">
124           {icon name=wrench title="administrer user"}</a>
125         {/if}
126
127         {if $smarty.session.user->isMyProfile($profile)}
128         <a href="javascript:chgMainWinLoc('profile/edit')">{icon name="user_edit" title="Modifier ma fiche"}</a>
129         {elseif hasPerm('admin') || $smarty.session.user->canEdit($profile)}
130         <a href="javascript:chgMainWinLoc('profile/edit/{$profile->hrpid}')">
131           {icon name=user_edit title="modifier la fiche"}
132         </a>
133         {/if}
134       {/if}
135     </div>
136
137     {if $logged && $view->isVisible(#Visibility::EXPORT_AX#) && $owner && $owner->state eq 'active'}
138     <div class='maj'>
139       Fiche mise à jour<br />
140       le {$profile->last_change|date_format}
141     </div>
142     {/if}
143
144     {* 121634816 is Profile::PHONE_LINK_PROFILE | Profile::PHONE_TYPE_ANY = 0x7400000 *}
145     {assign var=phones value=$profile->getPhones(121634816)}
146     {if ($logged && $view->isVisible(#Visibility::EXPORT_AX#)) || count($phones) > 0}
147     <div class="contact">
148       {if $logged && $view->isVisible(#Visibility::EXPORT_AX#)}
149       <div class='email'>
150         {if $profile->isDead()}
151         Décédé{if $profile->isFemale()}e{/if} le {$profile->deathdate|date_format}
152         {elseif $owner && $owner->lost}
153         Ce{if $profile->isFemale()}tte{/if} camarade n'a plus d'adresse de redirection valide,<br />
154         <a href="marketing/broken/{$owner->login()}" class="popup">clique ici si tu connais son adresse email&nbsp;!</a>
155         {elseif $owner && $owner->state != 'active'}
156         Cette personne n'est pas inscrite à Polytechnique.org,<br />
157         <a href="marketing/public/{$owner->login()}" class="popup">clique ici si tu connais son adresse email&nbsp;!</a>
158         {else}
159         {if $virtualalias && $view->isVisible(#Visibility::EXPORT_PRIVATE#) && $virtualalias neq $owner->bestEmail()}
160         <a href="mailto:{$virtualalias}">{$virtualalias}</a><br />
161         {/if}
162         <a href="mailto:{$owner->bestEmail()}">{$owner->bestEmail()}</a>
163         {if $owner->bestEmail() neq $owner->forlifeEmail()}<br />
164         <a href="mailto:{$owner->forlifeEmail()}">{$owner->forlifeEmail()}</a>
165         {/if}
166         {/if}
167       </div>
168       {/if}
169       {if count($phones) > 0}
170       <div style="float: right">
171         {display_phones tels=$phones dcd=$profile->isDead()}
172       </div>
173       {/if}
174       <div class='spacer'></div>
175     </div>
176     {else}
177     <div class='spacer'></div>
178     {/if}
179
180     <div class='formation'>
181       {foreach from=$profile->nationalities() item=country key=code}
182       <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />&nbsp;
183       {/foreach}
184
185       {$profile->promo('details')}
186
187       {if $logged && $view->isVisible(#Visibility::EXPORT_AX#) && $profile->mentor_expertise}
188       [<a href="referent/{$profile->hrid()}" class='popup2'>Ma fiche référent</a>]
189       {/if}
190
191       {assign var=educations value=$profile->getEducations(32)}
192       {if count($educations) > 0}
193         <ul>
194         {foreach from=$educations item=edu}
195           <li>{display_education edu=$edu profile=$profile full=true}</li>
196         {/foreach}
197         </ul>
198       {/if}
199
200       {assign var=corps value=$profile->getCorps()}
201       {if $corps && ($corps->current || $corps->original)}
202         <ul>
203         {if $corps->current}
204           <li>
205             Corps actuel&nbsp;: {$corps->current_name}
206             {if $corps->current_rank}({$corps->current_rank}){/if}
207           </li>
208         {/if}
209         {if $corps->current != $corps->original && $corps->original}
210           <li>Corps d'origine&nbsp;: {$corps->original_name}</li>
211         {/if}
212         </ul>
213       {/if}
214
215     </div>
216   </div>
217
218   {assign var=addr value=$profile->getAddresses(3)}
219   {if count($addr) > 0}
220   <div class="part">
221     <h2>Contact&nbsp;: </h2>
222     {if $profile->isDead()}
223       {assign var=address_name value="Dernière adresse"}
224     {else}
225       {assign var=address_name value="Adresse"}
226     {/if}
227     {foreach from=$addr item="address" name=addresses}
228       {if $smarty.foreach.addresses.iteration is even}
229         {assign var=pos value="right"}
230       {else}
231         {assign var=pos value="left"}
232       {/if}
233       {if $address->hasFlag('current')}
234       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" actuelle&nbsp;:"
235                for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
236       {elseif $address->hasFlag('secondary')}
237       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" secondaire&nbsp;:"
238                for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
239       {else}
240       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" principale&nbsp;:"
241                for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
242       {/if}
243       {if $smarty.foreach.addresses.iteration is even}<div class="spacer"></div>{/if}
244     {/foreach}
245   </div>
246   {/if}
247
248   {assign var=jobs value=$profile->getJobs(2)}
249   {if count($jobs) > 0}
250   <div class="part">
251     <h2>Informations professionnelles&nbsp;:</h2>
252     {foreach from=$jobs item="job" key="i"}
253       {if $i neq 0}<hr />{/if}
254       {include file="include/emploi.tpl" job=$job}
255       {assign var=jobPhones value=$job->phones()}
256       {if $job->address()}
257         {include file="geoloc/address.tpl" address=$job->address() titre="Adresse&nbsp;: " for=$job->company->name pos="left" phones=$jobPhones}
258       {elseif $jobPhones|@count neq 0}
259         {display_phones tels=$jobPhones}
260       {/if}
261       <div class="spacer">&nbsp;</div>
262     {/foreach}
263   </div>
264   {/if}
265
266   {assign var=medals value=$profile->getMedals()}
267   {if count($medals) > 0}
268     <div class="part">
269       <h2>Distinctions&nbsp;: </h2>
270       {foreach from=$medals item=m}
271       <div class="medal_frame">
272         <img src="profile/medal/thumb/{$m.mid}" height="50px" alt="{$m.text}" title="{$m.text}" style='float: left;' />
273         <div class="medal_text">
274           {$m.text}{if $m.level} ({$m.level}){/if}<br />{$m.grade}
275         </div>
276       </div>
277       {/foreach}
278       <div class="spacer">&nbsp;</div>
279     </div>
280   {/if}
281
282   {if $logged && $profile->cv}
283   <div class="part">
284     <h2>Curriculum Vitae&nbsp;:</h2>
285     {$profile->cv|miniwiki:title|smarty:nodefaults}
286   </div>
287   {/if}
288
289   {if $view->level() eq #Visibility::VIEW_PUBLIC#}
290   <div class="part">
291     <small>
292     Cette fiche est publique et visible par tout internaute,<br />
293     vous pouvez aussi voir <a href="profile/private/{$profile->hrid()}?display=light">celle&nbsp;réservée&nbsp;aux&nbsp;X</a>.
294     </small>
295   </div>
296   {elseif $view->level() eq #Visibility::VIEW_AX#}
297   <div class="part">
298     <small>
299     Cette fiche est privée et ne recense que les informations transmises à l'AX.
300     </small>
301   </div>
302   {/if}
303
304   <div class="spacer"></div>
305 </div>
306
307 {* vim:set et sw=2 sts=2 sws=2 fenc=utf-8: *}