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