Merge branch 'platal-1.0.0'
[platal.git] / templates / profile / profile.tpl
1 {**************************************************************************}
2 {*                                                                        *}
3 {*  Copyright (C) 2003-2010 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 = platal_baseurl + 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 //]]></script>
40 {/literal}
41
42 <div id="fiche">
43   <div id="photo" class="part">
44     {assign var=photo value=$profile->getPhoto(false)}
45     {if $photo}<img alt="Photo de {$profile->fullName()}" src="photo/{$profile->hrid()}{if $with_pending_pic}/req{/if}" width="{$photo->width()}"/>{/if}
46
47     {if $logged && $view eq 'private' && ( $profile->section|smarty:nodefaults || $profile->getBinets()|smarty:nodefaults || ($owner && $owner->groups(true,true)|smarty:nodefaults))}
48       <h2>À l'X&hellip;</h2>
49       {if $profile->section}<div><em class="intitule">Section&nbsp;: </em><span>{$profile->section}</span></div>{/if}
50
51       {assign var=binets value=$profile->getBinets()}
52       {if $binets|@count}<div><em class="intitule">Binet{if count($binets) > 1}s{/if}&nbsp;: </em>
53       <span>{', '|implode:$profile->getBinetsNames()}</span></div>{/if}
54
55       {if $owner && $view eq 'private'}
56         {assign var=groups value=$owner->groups(true,true)}
57         {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>
58         <span><br/>
59         {foreach from=$groups item=group name=groups}{if !$smarty.foreach.groups.first}, {/if}<span title="{$group.nom}"><a href="{$group.site}">{$group.nom}</a></span>{/foreach}
60         </span></div>{/if}
61       {/if}
62
63     {/if}
64
65     {* 458752 stands for 0x70000 = Profile::NETWORKING_ALL *}
66     {assign var=networking value=$profile->getNetworking(458752)}
67     {if count($networking) > 0}
68       <h2>Sur le web...</h2>
69       {foreach from=$networking item=network}
70         <img style="width: auto; padding: 0" src="profile/networking/{$network.nwid}" alt="{$network.name}" title="{$network.name}"/>
71         {if $network.link}
72           <a href="{$network.link|replace:'%s':$network.address}">{$network.address}</a>
73         {else}
74           {$network.address}
75         {/if}
76         <br/>
77       {/foreach}
78     {/if}
79
80     {if $profile->freetext}
81       <h2>Commentaires&nbsp;:</h2>
82       <span>{$profile->freetext|miniwiki|smarty:nodefaults}</span>
83     {/if}
84
85   </div>
86
87   <div id="fiche_identite" class="part">
88     <div class="civilite">
89       {if $profile->isFemale()}&bull;{/if}
90         {if $view eq 'private'}{$profile->private_name}{else}{$profile->public_name}{/if}
91
92       {if $logged}
93         &nbsp;{if !$profile->isDead()}<a href="vcard/{$owner->login()}.vcf">{*
94           *}{icon name=vcard title="Afficher la carte de visite"}</a>{/if}
95
96         {if !$smarty.session.user->isContact($profile)}
97         <a href="javascript:chgMainWinLoc('carnet/contacts?action=ajouter&amp;user={$owner->login()}&amp;token={xsrf_token}')">
98           {icon name=add title="Ajouter à mes contacts"}</a>
99         {else}
100         <a href="javascript:chgMainWinLoc('carnet/contacts?action=retirer&amp;user={$owner->login()}&amp;token={xsrf_token}')">
101           {icon name=cross title="Retirer de mes contacts"}</a>
102         {/if}
103
104         {if hasPerm('admin')}
105         <a href="javascript:chgMainWinLoc('admin/user/{$owner->login()}')">
106           {icon name=wrench title="administrer user"}</a>
107         {/if}
108
109         {if $owner->login() eq $smarty.session.hruid}
110         <a href="javascript:chgMainWinLoc('profile/edit')">{icon name="user_edit" title="Modifier ma fiche"}</a>
111         {elseif hasPerm('edit_directory')}
112         <a href="javascript:chgMainWinLoc('profile/edit/{$profile->hrpid}')">{icon name="user_edit" title="Modifier cette fiche"}</a>
113         {/if}
114       {/if}
115     </div>
116
117     {if $logged && $view eq 'private'}
118     <div class='maj'>
119       Fiche mise à jour<br />
120       le {$profile->last_change|date_format}
121     </div>
122     {/if}
123
124     {* 121634816 is Profile::PHONE_LINK_PROFILE | Profile::PHONE_TYPE_ANY = 0x7400000 *}
125     {assign var=phones value=$profile->getPhones(121634816)}
126     {if ($logged && $view eq 'private') || count($phones) > 0}
127     <div class="contact">
128       {if $logged && $view eq 'private'}
129       <div class='email'>
130         {if $profile->isDead()}
131         Décédé{if $profile->isFemale()}e{/if} le {$profile->deathdate|date_format}
132         {elseif $owner && $owner->lost}
133         Ce{if $profile->isFemale()}tte{/if} camarade n'a plus d'adresse de redirection valide,<br />
134         <a href="marketing/broken/{$owner->login()}" class="popup">clique ici si tu connais son adresse email&nbsp;!</a>
135         {elseif $owner && $owner->state != 'active'}
136         Cette personne n'est pas inscrite à Polytechnique.org,<br />
137         <a href="marketing/public/{$owner->login()}" class="popup">clique ici si tu connais son adresse email&nbsp;!</a>
138         {else}
139         {if $virtualalias}
140         <a href="mailto:{$virtualalias}">{$virtualalias}</a><br />
141         {/if}
142         <a href="mailto:{$owner->bestEmail()}">{$owner->bestEmail()}</a>
143         {if $owner->bestEmail() neq $owner->forlifeEmail()}<br />
144         <a href="mailto:{$owner->forlifeEmail()}">{$owner->forlifeEmail()}</a>
145         {/if}
146         {/if}
147       </div>
148       {/if}
149       {if count($phones) > 0}
150       <div style="float: right">
151         {display_phones tels=$phones dcd=$profile->isDead()}
152       </div>
153       {/if}
154       <div class='spacer'></div>
155     </div>
156     {else}
157     <div class='spacer'></div>
158     {/if}
159
160     <div class='formation'>
161       {foreach from=$profile->nationalities() item=country key=code}
162       <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />&nbsp;
163       {/foreach}
164
165       {$profile->promo()}
166
167       {if $logged && $profile->mentor_expertise}
168       [<a href="referent/{$profile->hrid()}" class='popup2'>Ma fiche référent</a>]
169       {/if}
170
171       {assign var=educations value=$profile->getEducations(32)}
172       {if count($educations) > 0}
173         &nbsp;-&nbsp;Formation&nbsp;:
174         <ul>
175         {foreach from=$educations item=edu}
176           <li>{display_education edu=$edu profile=$profile full=true}</li>
177         {/foreach}
178         </ul>
179       {/if}
180
181       {assign var=corps value=$profile->getCorps()}
182       {if $corps && ($corps->current || $corps->original)}
183         <ul>
184         {if $corps->current}
185           <li>
186             Corps actuel&nbsp;: {$corps->current_name}
187             {if $corps->current_rank}({$corps->current_rank}){/if}
188           </li>
189         {/if}
190         {if $corps->current != $corps->original && $corps->original}
191           <li>Corps d'origine&nbsp;: {$corps->original_name}</li>
192         {/if}
193         </ul>
194       {/if}
195
196     </div>
197   </div>
198
199   {assign var=addr value=$profile->getAddresses(3)}
200   {if count($addr) > 0}
201   <div class="part">
202     <h2>Contact&nbsp;: </h2>
203     {if $profile->isDead()}
204       {assign var=address_name value="Dernière adresse"}
205     {else}
206       {assign var=address_name value="Adresse"}
207     {/if}
208     {foreach from=$addr item="address" name=addresses}
209       {if $smarty.foreach.addresses.iteration is even}
210         {assign var=pos value="right"}
211       {else}
212         {assign var=pos value="left"}
213       {/if}
214       {if $address->hasFlag('current')}
215       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" actuelle&nbsp;:"
216                for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
217       {elseif $address->hasFlag('secondary')}
218       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" secondaire&nbsp;:"
219                for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
220       {else}
221       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" principale&nbsp;:"
222                for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
223       {/if}
224       {if $smarty.foreach.addresses.iteration is even}<div class="spacer"></div>{/if}
225     {/foreach}
226   </div>
227   {/if}
228
229   {assign var=jobs value=$profile->getJobs(2)}
230   {if count($jobs) > 0}
231   <div class="part">
232     <h2>Informations professionnelles&nbsp;:</h2>
233     {foreach from=$jobs item="job" key="i"}
234       {if $i neq 0}<hr />{/if}
235       {include file="include/emploi.tpl" job=$job}
236       {assign var=jobPhones value=$job->phones()}
237       {if $job->address()}
238         {include file="geoloc/address.tpl" address=$job->address() titre="Adresse&nbsp;: " for=$job->company->name pos="left" phones=$jobPhones}
239       {elseif $jobPhones|@count neq 0}
240         {display_phones tels=$jobPhones}
241       {/if}
242       <div class="spacer">&nbsp;</div>
243     {/foreach}
244   </div>
245   {/if}
246
247   {assign var=medals value=$profile->getMedals()}
248   {if count($medals) > 0}
249     <div class="part">
250       <h2>Distinctions&nbsp;: </h2>
251       {foreach from=$medals item=m}
252       <div class="medal_frame">
253         <img src="profile/medal/thumb/{$m.mid}" height="50px" alt="{$m.text}" title="{$m.text}" style='float: left;' />
254         <div class="medal_text">
255           {$m.text}<br />{$m.grade}
256         </div>
257       </div>
258       {/foreach}
259       <div class="spacer">&nbsp;</div>
260     </div>
261   {/if}
262
263   {if $logged && $profile->cv}
264   <div class="part">
265     <h2>Curriculum Vitae&nbsp;:</h2>
266     {$profile->cv|miniwiki:title|smarty:nodefaults}
267   </div>
268   {/if}
269
270   {if $view eq 'public'}
271   <div class="part">
272     <small>
273     Cette fiche est publique et visible par tout internaute,<br />
274     vous pouvez aussi voir <a href="profile/private/{$profile->hrid()}?display=light">celle&nbsp;réservée&nbsp;aux&nbsp;X</a>.
275     </small>
276   </div>
277   {elseif $view eq 'ax'}
278   <div class="part">
279     <small>
280     Cette fiche est privée et ne recense que les informations transmises à l'AX.
281     </small>
282   </div>
283   {/if}
284
285   <div class="spacer"></div>
286 </div>
287
288 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}