protected $stateless;
protected $pages;
+ protected $titles;
protected $lookup;
+ protected $inv_lookup;
public function __construct($name, $layout, $stateless = false)
{
- $this->name = 'wiz_' . $name;
- $this->layout = $layout;
+ $this->name = 'wiz_' . $name;
+ $this->layout = $layout;
$this->stateless = $stateless;
$this->pages = array();
$this->lookup = array();
+ $this->titles = array();
if (!isset($_SESSION[$this->name])) {
$_SESSION[$this->name] = array();
+ $_SESSION[$this->name . '_page'] = null;
+ $_SESSION[$this->name . '_stack'] = array();
}
- $_SESSION[$this->name . '_page'] = null;
}
- public function addPage($class, $id = null)
+ public function addPage($class, $title, $id = null)
{
- if ($id != null) {
- $this->lookup[$id] = count($this->pages);
+ if ($id == null) {
+ $id = count($this->pages);
}
- $this->pages[] = $class;
+ $this->lookup[$id] = count($this->pages);
+ $this->inv_lookup[] = $id;
+ $this->pages[] = $class;
+ $this->titles[] = $title;
}
public function set($varname, $value)
$_SESSION[$this->name . '_page'] = null;
}
- private function &getPage($id)
+ private function getPage($id)
{
$page = $this->pages[$id];
return new $page($this);
public function apply(PlatalPage &$smarty, $baseurl, $pgid = null)
{
- $curpage =& $_SESSION[$this->name . '_page'];
+ if ($this->stateless && (isset($this->lookup[$pgid]) || isset($this->pages[$pgid]))) {
+ $curpage = is_numeric($pgid) ? $pgid : $this->lookup[$pgid];
+ } else if ($this->stateless && is_null($pgid)) {
+ $curpage = 0;
+ } else {
+ $curpage = $_SESSION[$this->name . '_page'];
+ }
+ $oldpage = $curpage;
// Process the previous page
- if (!is_null($curpage)) {
- $page = $this->getPage($curpage);
+ if (Post::has('valid_page')) {
+ $page = $this->getPage(Post::i('valid_page'));
+ $curpage = Post::i('valid_page');
$next = $page->process();
+ $last = $curpage;
switch ($next) {
case PlWizard::FIRST_PAGE:
$curpage = 0;
break;
case PlWizard::PREVIOUS_PAGE:
- $curpage--;
+ if (!$this->stateless && count($_SESSION[$this->name . '_stack'])) {
+ $curpage = array_pop($_SESSION[$this->name . '_stack']);
+ } elseif ($curpage && $this->stateless) {
+ $curpage--;
+ } else {
+ $curpage = 0;
+ }
break;
case PlWizard::NEXT_PAGE:
- $curpage++;
+ if ($curpage < count($this->pages) - 1) {
+ $curpage++;
+ }
break;
case PlWizard::LAST_PAGE:
$curpage = count($this->pages) - 1;
break;
case PlWizard::CURRENT_PAGE: break; // don't change the page
default:
- $curpage = is_numeric($next) ? $next : $this->lookup[$curpage];
+ $curpage = is_numeric($next) ? $next : $this->lookup[$next];
break;
}
- } else {
- $curpage = 0;
+ if (!$this->stateless) {
+ array_push($_SESSION[$this->name . '_stack'], $last);
+ }
}
- if ($this->stateless && (in_array($pgid, $this->lookup) || isset($this->pages[$pgid]))) {
- $curpage = $pgid;
+ if (is_null($curpage)) {
+ $curpage = 0;
}
// Prepare the page
- $page = $this->getPage($curpage);
+ $_SESSION[$this->name . '_page'] = $curpage;
+ if ($curpage != $oldpage) {
+ pl_redirect($baseurl . '/' . $this->inv_lookup[$curpage]);
+ } else if (!isset($page)) {
+ $page = $this->getPage($curpage);
+ }
+ $smarty->changeTpl($this->layout);
+ $smarty->assign('pages', $this->titles);
+ $smarty->assign('current', $curpage);
+ $smarty->assign('lookup', $this->inv_lookup);
+ $smarty->assign('stateless', $this->stateless);
+ $smarty->assign('wiz_baseurl', $baseurl);
+ $smarty->assign('tab_width', (int)(99 / count($this->pages)));
$smarty->assign('wiz_page', $page->template());
+ $smarty->assign('xorg_no_errors', true);
$page->prepare($smarty);
}
}
from=webmaster@polytechnique.org
to=web@polytechnique.org
+[geoloc_error]
+from=webmaster@polytechnique.org
+to=geoloc@staff.polytechnique.org
+
[mails_ax]
from="Association des Anciens élèves de l'X" <info@amicale.polytechnique.org>
replyto=info@amicale.polytechnique.org
[ onglets des profils ]
*******************************************************************************/
-table.flags {
- margin: 1em 0em 0em 0em;
+.wizard {
+ margin-top: -4px;
+ margin-left: -16px;
}
-table.flags input { margin: 0px 2px; padding: 0px; }
-table.flags td.texte, tr.flags td.texte {
- font-size: smaller;
- font-weight: bold;
- padding: 3px;
+.wizard .wiz_header {
+ height: 32px;
+ width: 100%;
+ background-color: #aaa;
+ margin-bottom: 1em;
}
-table.flags td.vert, tr.flags td.vert {
- background: green;
- padding: 3px;
+
+.wizard .wiz_header .wiz_tab {
+ background-color: #aaa;
+ vertical-align: middle;
+ height: 100%;
text-align: center;
+ font-size: 75%;
+ border-right: 1px solid #888;
}
-table.flags td.orange, tr.flags td.orange {
- background: #ff9900;
- padding: 3px;
- text-align: center;
+
+.wizard .wiz_header .active {
+ background-color: #444;
+ color: #fff;
}
-table.flags td.rouge, tr.flags td.rouge {
- background: red;
- padding: 3px;
- text-align: center;
+
+.wizard .wiz_header .wiz_tab:hover {
+ background-color: #777;
+}
+
+.wizard .wiz_header .wiz_tab a {
+ color: #000;
+ text-decoration: none;
+ vertical-align: middle;
+}
+
+.wizard .wiz_header .active a {
+ color: #fff;
+}
+
+.wizard .wiz_content {
+ margin-left: 16px;
+}
+
+.flags {
+ margin: 0.5em 0 0 0;
+ padding: 0;
+}
+.flags input {
+ margin: 0px 2px;
+ padding: 0px;
+}
+.flags .texte {
+ font-size: smaller;
+ font-weight: bold;
+ padding: 0 8px 0 0;
+}
+.flags .vert {
+ background: url('../images/icons/flag_green.gif') top right no-repeat;
+ padding: 0 16px 0 0;
+ margin-left: 16px;
+}
+.flags .orange {
+ background: url('../images/icons/flag_orange.gif') top right no-repeat;
+ padding: 0 16px 0 0;
+ margin-left: 16px;
+}
+.flags .rouge {
+ background: url('../images/icons/flag_red.gif') top right no-repeat;
+ padding: 0 16px 0 0;
+ margin-left: 16px;
}
table.cadre_a_onglet{
background: inherit;
}
+input.error, textarea.error {
+ background-color: #faa;
+}
+
+input.valid, textarea.valid {
+ background-color: #afa;
+}
+
+input.warning, textarea.warning {
+ background-color: #fda;
+}
+
h1 {
background-color: inherit;
margin: 0.5em 0 0.5em -8px;
table.tinybicol td, table.bicol td, table.tinybicol tr, table.bicol tr { padding: 4px; }
td.half { width: 50%; padding: 4px; }
-td.titre {
+.titre {
color: #000000;
background: inherit;
font-weight: bold;
}
td.action a { padding: 0px 2px 0px 2px; }
+th.grayed {
+ background: url('../images/skins/keynote_bg_lighter.png') #848495 top left repeat-x fixed;
+ font-style: italic;
+}
+
/*******************************************************************************
4 Tableau de choix de skins
[ Styles pour les tableaux de types de ceux des skins ]
[ onglets des profils ]
*******************************************************************************/
-table.flags, tr.flags {
+.wizard {
+ margin-top: -4px;
+ margin-left: -16px;
+}
+
+.wizard .wiz_header {
+ height: 32px;
+ width: 100%;
+ background-color: #aaa;
+ margin-bottom: 1em;
+}
+
+.wizard .wiz_header .wiz_tab {
+ background-color: #aaa;
+ vertical-align: middle;
+ height: 100%;
+ text-align: center;
+ font-size: 75%;
+ border-right: 1px solid #888;
+}
+
+.wizard .wiz_header .active {
+ background-color: #444;
+ color: #fff;
+}
+
+.wizard .wiz_header .wiz_tab:hover {
+ background-color: #777;
+}
+
+.wizard .wiz_header .wiz_tab a {
+ color: #000;
+ text-decoration: none;
+ vertical-align: middle;
+}
+
+.wizard .wiz_header .active a {
+ color: #fff;
+}
+
+.wizard .wiz_content {
+ margin-left: 16px;
+}
+
+.flags {
margin: 0.5em 0 0 0;
padding: 0;
}
-table.flags input { margin: 0px 2px; padding: 0px; }
-
-table.flags td.texte, tr.flags td.texte {
+.flags input {
+ margin: 0px 2px;
+ padding: 0px;
+}
+.flags .texte {
font-size: smaller;
font-weight: bold;
padding: 0 8px 0 0;
}
-table.flags td.vert, tr.flags td.vert {
+.flags .vert {
background: url('../images/icons/flag_green.gif') top right no-repeat;
padding: 0 16px 0 0;
+ margin-left: 16px;
}
-table.flags td.orange, tr.flags td.orange {
+.flags .orange {
background: url('../images/icons/flag_orange.gif') top right no-repeat;
padding: 0 16px 0 0;
+ margin-left: 16px;
}
-table.flags td.rouge, tr.flags td.rouge {
+.flags .rouge {
background: url('../images/icons/flag_red.gif') top right no-repeat;
padding: 0 16px 0 0;
+ margin-left: 16px;
}
table.cadre_a_onglet{
[ onglets des profils ]
*******************************************************************************/
-table.flags {
- margin: 1em 0em 0em 0em;
+.wizard {
+ margin-left: -1em;
+ margin-right: -1em;
}
-table.flags input { margin: 0px 2px; padding: 0px; }
-table.flags td.texte {
- font-size: smaller;
- font-weight: bold;
- padding: 3px;
+.wizard .wiz_header {
+ height: 32px;
+ width: 100%;
+ background-color: #aaa;
+ margin-bottom: 1em;
}
-table.flags td.vert, tr.flags td.vert {
- background: green;
- padding: 3px;
+
+.wizard .wiz_header .wiz_tab {
+ background-color: #aaa;
+ vertical-align: middle;
+ height: 100%;
text-align: center;
+ font-size: 75%;
+ border-right: 1px solid #888;
}
-table.flags td.orange, tr.flags td.orange {
- background: #ff9900;
- padding: 3px;
- text-align: center;
+
+.wizard .wiz_header .active {
+ background-color: #444;
+ color: #fff;
}
-table.flags td.rouge, tr.flags td.rouge {
- background: red;
- padding: 3px;
- text-align: center;
+
+.wizard .wiz_header .wiz_tab:hover {
+ background-color: #777;
+}
+
+.wizard .wiz_header .wiz_tab a {
+ color: #000;
+ text-decoration: none;
+ vertical-align: middle;
+}
+
+.wizard .wiz_header .active a {
+ color: #fff;
+}
+
+.wizard .wiz_content {
+ margin-left: 1em;
+ margin-right: 1em;
+}
+
+.flags {
+ margin: 0.5em 0 0 0;
+ padding: 0;
+}
+.flags input {
+ margin: 0px 2px;
+ padding: 0px;
+}
+.flags .texte {
+ font-size: smaller;
+ font-weight: bold;
+ padding: 0 8px 0 0;
+}
+.flags .vert {
+ background: url('../images/icons/flag_green.gif') top right no-repeat;
+ padding: 0 16px 0 0;
+ margin-left: 16px;
+}
+.flags .orange {
+ background: url('../images/icons/flag_orange.gif') top right no-repeat;
+ padding: 0 16px 0 0;
+ margin-left: 16px;
+}
+.flags .rouge {
+ background: url('../images/icons/flag_red.gif') top right no-repeat;
+ padding: 0 16px 0 0;
+ margin-left: 16px;
}
table.cadre_a_onglet{
var obj = document.getElementById(id);
if (currentTempMessage != state) {
return;
- }
+ }
setOpacity(obj, back * 4);
if (back > 0) {
setTimeout("_showTempMessage('" + id + "', " + currentTempMessage + "," + (back-1) + ")", 125);
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-function select_fonction($fonction){
- $html = "<option value='' ". (($fonction == '0')?"selected='selected'":"") ."> </option>\n";
-
- $res = XDB::iterRow("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) from fonctions_def ORDER BY id");
- while(list($fid, $flabel, $ftitre) = $res->next()){
- if($ftitre)
- $html.= "<option value='$fid' " . (($fonction == $fid)?"selected='selected'":"") . ">$flabel</option>\n";
- else
- $html .= "<option value=\"$fid\" " . (($fonction == $fid)?"selected='selected'":"") . ">* $flabel</option>\n";
- }
- return $html;
-}
-
-function _select_fonction_smarty($params){
- return select_fonction($params['fonction']);
-}
-
-$page->register_function('select_fonction', '_select_fonction_smarty');
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
return $html;
}
-function _geoloc_country_smarty($params)
-{
- echo "miqjfmeij";
- if(!isset($params['country'])) {
- return;
- }
- return geoloc_country($params['country'], @$params['available']);
-}
-
-$GLOBALS['page']->register_function('geoloc_country', '_geoloc_country_smarty');
-
/** donne la liste deroulante des regions pour un pays
* @param $pays le pays dont on veut afficher les regions
* @param $current la region actuellement selectionnee
}
return $html;
}
-
-function _geoloc_region_smarty($params, &$smarty)
-{
- if(!isset($params['country']) || !isset($params['region'])) {
- return;
- }
- return geoloc_region($params['country'], $params['region'], @$params['available']);
-}
-$GLOBALS['page']->register_function('geoloc_region', '_geoloc_region_smarty');
// }}}
// {{{ get_address_infos($txt)
return false;
}
foreach ($la as $i=>$l) {
- if (levenshtein($l, $lb[$i]) > 3) {
+ if (levenshtein(trim($l), trim($lb[$i])) > 3) {
return false;
}
}
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-
-function select_secteur($secteur){
- if ($secteur == '') {
- $secteur = -1;
- }
- $html = "<option value=\"\" ". (($secteur == '')?"selected='selected'":"") ."> </option>\n";
- $res = XDB::iterRow("SELECT id, label FROM emploi_secteur");
- while (list($tmp_id, $tmp_label) = $res->next()) {
- $html .= "<option value=\"$tmp_id\" " . (($secteur == $tmp_id)?"selected='selected'":"") . ">$tmp_label</option>\n";
- }
- return $html;
-}
-
-function select_ss_secteur($secteur,$ss_secteur){
- if ($secteur) {
- $html = "<option value=\"\"> </option>\n";
- $res = XDB::iterRow("SELECT id, label FROM emploi_ss_secteur WHERE secteur = {?}", $secteur);
- while (list($tmp_id, $tmp_label) = $res->next()){
- $html .= "<option value=\"$tmp_id\" ". (($ss_secteur == $tmp_id)?"selected='selected'":"") .">$tmp_label</option>\n";
- }
- return $html;
- }
- else{
- return "<option value=\"\" selected='selected'> </option>\n";
- }
-}
-
-//fonctions pour smarty
-function _select_secteur_smarty($params){
- return select_secteur($params['secteur']);
-}
-
-function _select_ss_secteur_smarty($params){
- return select_ss_secteur($params['secteur'], $params['ss_secteur']);
-}
-$page->register_function('select_secteur', '_select_secteur_smarty');
-$page->register_function('select_ss_secteur', '_select_ss_secteur_smarty');
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
$user['applis_join'] = join(', ', $user['applis_fmt']);
if (has_user_right($user['medals_pub'], $view)) {
- $res = XDB::iterator("SELECT m.id, m.text AS medal, m.type, m.img, s.gid, g.text AS grade
+ $res = XDB::iterator("SELECT m.id, m.text AS medal, m.type, s.gid, g.text AS grade
FROM profile_medals_sub AS s
INNER JOIN profile_medals AS m ON ( s.mid = m.id )
LEFT JOIN profile_medals_grades AS g ON ( s.mid = g.mid AND s.gid = g.gid )
}
// }}}
+ // {{{ function get_request($medal)
+
+ static public function get_request($uid, $type)
+ {
+ $reqs = Validate::get_typed_requests($uid, 'medal');
+ foreach ($reqs as &$req) {
+ if ($req->mid == $type) {
+ return $req;
+ }
+ }
+ return null;
+ }
+
+ // }}}
}
// }}}
function start_connexion ($uid, $identified)
{
$res = XDB::query("
- SELECT u.user_id AS uid, prenom, nom, nom_usage, perms, promo, matricule, password, FIND_IN_SET('femme', u.flags) AS femme,
+ SELECT u.user_id AS uid, prenom, prenom_ini, nom, nom_ini, nom_usage, perms, promo, promo_sortie,
+ matricule, password, FIND_IN_SET('femme', u.flags) AS femme,
UNIX_TIMESTAMP(s.start) AS lastlogin, s.host, a.alias AS forlife, a2.alias AS bestalias,
q.core_mail_fmt AS mail_fmt, UNIX_TIMESTAMP(q.banana_last) AS banana_last, q.watch_last, q.core_rss_hash,
FIND_IN_SET('watch', u.flags) AS watch_account, q.last_version
'profile/private' => $this->make_hook('profile', AUTH_COOKIE),
'profile/ax' => $this->make_hook('ax', AUTH_COOKIE, 'admin'),
'profile/edit' => $this->make_hook('p_edit', AUTH_MDP),
+ 'profile/ajax/address' => $this->make_hook('ajax_address', AUTH_COOKIE, 'user', NO_AUTH),
+ 'profile/ajax/tel' => $this->make_hook('ajax_tel', AUTH_COOKIE, 'user', NO_AUTH),
+ 'profile/ajax/medal' => $this->make_hook('ajax_medal', AUTH_COOKIE, 'user', NO_AUTH),
+ 'profile/ajax/job' => $this->make_hook('ajax_job', AUTH_COOKIE, 'user', NO_AUTH),
+ 'profile/ajax/secteur' => $this->make_hook('ajax_secteur', AUTH_COOKIE, 'user', NO_AUTH),
+ 'profile/ajax/skill' => $this->make_hook('ajax_skill', AUTH_COOKIE, 'user', NO_AUTH),
+ 'profile/medal' => $this->make_hook('medal', AUTH_PUBLIC),
'profile/orange' => $this->make_hook('p_orange', AUTH_MDP),
'profile/usage' => $this->make_hook('p_usage', AUTH_MDP),
exit;
}
+ function handler_medal(&$page, $mid)
+ {
+ $res = XDB::query("SELECT img
+ FROM profile_medals
+ WHERE id = {?}",
+ $mid);
+ $img = dirname(__FILE__).'/../htdocs/images/medals/' . $res->fetchOneCell();
+ $type = mime_content_type($img);
+ header("Content-Type: $type");
+ echo file_get_contents($img);
+ exit;
+ }
+
function handler_photo_change(&$page)
{
$page->changeTpl('profile/trombino.tpl');
http_redirect("http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&anc_id=$mat");
}
- function handler_p_edit(&$page, $opened_tab = 'general')
+ function handler_p_edit(&$page, $opened_tab = null)
{
global $globals;
- $page->changeTpl('profile/edit.tpl');
-
- $page->addCssLink('profil.css');
- $page->assign('xorg_title', 'Polytechnique.org - Mon Profil');
-
- require_once dirname(__FILE__) . '/profile/tabs.inc.php';
- require_once 'profil.func.inc.php';
- require_once 'synchro_ax.inc.php';
-
+ // Finish registration procedure
if (Post::v('register_from_ax_question')) {
XDB::execute('UPDATE auth_user_quick
SET profile_from_ax = 1
}
}
+ // AX Synchronization
+ require_once 'synchro_ax.inc.php';
if (is_ax_key_missing()) {
$page->assign('no_private_key', true);
}
-
if (Env::v('synchro_ax') == 'confirm' && !is_ax_key_missing()) {
ax_synchronize(S::v('bestalias'), S::v('uid'));
$page->trig('Ton profil a été synchronisé avec celui du site polytechniciens.com');
}
- // pour tous les tabs, la date de naissance pour verifier
- // quelle est bien rentree et la date.
- $res = XDB::query(
- "SELECT naissance, DATE_FORMAT(date, '%d.%m.%Y')
- FROM auth_user_md5
- WHERE user_id={?}", S::v('uid'));
- list($naissance, $date_modif_profil) = $res->fetchOneRow();
-
- // lorsqu'on n'a pas la date de naissance en base de données
- if (!$naissance) {
- // la date de naissance n'existait pas et vient d'être soumise dans la variable
- if (Env::has('birth')) {
- //en cas d'erreur :
- if (!ereg('[0-3][0-9][0-1][0-9][1][9]([0-9]{2})', Env::v('birth'))) {
- $page->assign('etat_naissance', 'query');
- $page->trig('Date de naissance incorrecte ou incohérente.');
- return;
- }
-
- //sinon
- $birth = sprintf("%s-%s-%s", substr(Env::v('birth'), 4, 4),
- substr(Env::v('birth'), 2, 2),
- substr(Env::v('birth'), 0, 2));
- XDB::execute("UPDATE auth_user_md5
- SET naissance={?}
- WHERE user_id={?}", $birth,
- S::v('uid'));
- $page->assign('etat_naissance', 'ok');
- return;
- }
-
- $page->assign('etat_naissance', 'query');
- return; // on affiche le formulaire pour naissance
- }
+ // Misc checks
+ // TODO: Block if birth date is missing ?
- //doit-on faire un update ?
- if (Env::has('modifier') || Env::has('suivant')) {
- require_once dirname(__FILE__) . "/profile/get_{$opened_tab}.inc.php";
- require_once dirname(__FILE__) . "/profile/verif_{$opened_tab}.inc.php";
+ $page->addJsLink('ajax.js');
+ $page->addJsLink('jquery.js');
+ $wiz = new PlWizard('Profil', 'core/plwizard.tpl', true);
+ require_once dirname(__FILE__) . '/profile/page.inc.php';
+ $wiz->addPage('ProfileGeneral', 'Général', 'general');
+ $wiz->addPage('ProfileAddresses', 'Adresses personnelles', 'adresses');
+ $wiz->addPage('ProfileGroups', 'Groupes X - Binets', 'poly');
+ $wiz->addPage('ProfileDecos', 'Décorations - Medailles', 'deco');
+ $wiz->addPage('ProfileJobs', 'Informations professionnelles', 'emploi');
+ $wiz->addPage('ProfileSkills', 'Compétences diverses', 'skill');
+ $wiz->addPage('ProfileMentor', 'Mentoring', 'mentor');
+ $wiz->apply($page, 'profile/edit', $opened_tab);
- if($page->nb_errs()) {
- require_once dirname(__FILE__) . "/profile/assign_{$opened_tab}.inc.php";
- $page->assign('onglet', $opened_tab);
- $page->assign('onglet_tpl', "profile/$opened_tab.tpl");
- return;
- }
+ $page->addCssLink('profil.css');
+ $page->assign('xorg_title', 'Polytechnique.org - Mon Profil');
+ }
- $date=date("Y-m-j");//nouvelle date de mise a jour
+ function handler_ajax_address(&$page, $adid)
+ {
+ $page->changeTpl('profile/adresses.address.tpl', NO_SKIN);
+ $page->assign('i', $adid);
+ $page->assign('adr', array());
+ $page->assign('ajaxadr', true);
+ }
- //On sauvegarde l'uid pour l'AX
- /* on sauvegarde les changements dans user_changes :
- * on a juste besoin d'insérer le user_id de la personne dans la table
- */
- XDB::execute('REPLACE INTO user_changes SET user_id={?}',
- S::v('uid'));
+ function handler_ajax_tel(&$page, $adid, $telid)
+ {
+ $page->changeTpl('profile/adresses.tel.tpl', NO_SKIN);
+ $page->assign('i', $adid);
+ $page->assign('adid', "addresses_$adid");
+ $page->assign('adpref', "addresses[$adid]");
+ $page->assign('t', $telid);
+ $page->assign('tel', array());
+ $page->assign('ajaxtel', true);
+ }
- if (!S::has('suid')) {
- require_once 'notifs.inc.php';
- register_watch_op(S::v('uid'), WATCH_FICHE);
- }
+ function handler_ajax_medal(&$page, $id)
+ {
+ $page->changeTpl('profile/deco.medal.tpl', NO_SKIN);
+ $page->assign('id', $id);
+ $page->assign('medal', array('valid' => 0, 'grade' => 0));
+ $page->assign('ajaxdeco', true);
+ }
- // mise a jour des champs relatifs au tab ouvert
- require_once dirname(__FILE__) . "/profile/update_{$opened_tab}.inc.php";
+ function handler_ajax_job(&$page, $id)
+ {
+ $page->changeTpl('profile/jobs.job.tpl', NO_SKIN);
+ $page->assign('i', $id);
+ $page->assign('job', array());
+ $page->assign('ajaxjob', true);
+ $page->assign('new', true);
+ $page->assign('secteurs', XDB::iterator("SELECT id, label
+ FROM emploi_secteur"));
+ $page->assign('fonctions', XDB::iterator("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) AS title
+ FROM fonctions_def
+ ORDER BY id"));
+ }
- $log =& $_SESSION['log'];
- $log->log('profil', $opened_tab);
- $page->assign('etat_update', 'ok');
- }
+ function handler_ajax_secteur(&$page, $id, $sect, $ssect = -1)
+ {
+ $res = XDB::iterator("SELECT id, label
+ FROM emploi_ss_secteur
+ WHERE secteur = {?}", $sect);
+ $page->changeTpl('profile/jobs.secteur.tpl', NO_SKIN);
+ $page->assign('id', $id);
+ $page->assign('ssecteurs', $res);
+ $page->assign('sel', $ssect);
+ }
- if (Env::has('suivant')) {
- pl_redirect('profile/edit/' . get_next_tab($opened_tab));
+ function handler_ajax_skill(&$page, $cat, $id)
+ {
+ $page->changeTpl('profile/skill.skill.tpl', NO_SKIN);
+ $page->assign('ajaxskill', true);
+ $page->assign('cat', $cat);
+ $page->assign('id', $id);
+ if ($cat == 'competences') {
+ $page->assign('levels', array('initié' => 'initié',
+ 'bonne connaissance' => 'bonne connaissance',
+ 'expert' => 'expert'));
+ } else {
+ $page->assign('levels', array(1 => 'connaissance basique',
+ 2 => 'maîtrise des bases',
+ 3 => 'maîtrise limitée',
+ 4 => 'maîtrise générale',
+ 5 => 'bonne maîtrise',
+ 6 => 'maîtrise complète'));
}
-
- require_once dirname(__FILE__) . "/profile/get_{$opened_tab}.inc.php";
- require_once dirname(__FILE__) . "/profile/verif_{$opened_tab}.inc.php";
- require_once dirname(__FILE__) . "/profile/assign_{$opened_tab}.inc.php";
-
- $page->assign('onglet', $opened_tab);
- $page->assign('onglet_tpl', "profile/$opened_tab.tpl");
-
- return;
}
function handler_p_orange(&$page)
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2007 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+class ProfileAddress extends ProfileGeoloc
+{
+ private $bool;
+ private $pub;
+ private $tel;
+
+ public function __construct()
+ {
+ $this->bool = new ProfileBool();
+ $this->pub = new ProfilePub();
+ $this->tel = new ProfileTel();
+ }
+
+ private function cleanAddress(ProfilePage &$page, array &$address, &$success)
+ {
+ if (@$address['changed']) {
+ $address['datemaj'] = time();
+ }
+ $success = true;
+ foreach ($address['tel'] as $t=>&$tel) {
+ if (@$tel['removed'] || !trim($tel['tel'])) {
+ unset($address['tel'][$t]);
+ } else {
+ $tel['pub'] = $this->pub->value($page, 'pub', $tel['pub'], $s);
+ $tel['tel'] = $this->tel->value($page, 'tel', $tel['tel'], $s);
+ if (!$s) {
+ $tel['error'] = true;
+ $success = false;
+ }
+ }
+ unset($tel['removed']);
+ }
+ $address['checked'] = $this->bool->value($page, 'checked', $address['checked'], $s);
+ $address['secondaire'] = $this->bool->value($page, 'secondaire', $address['secondaire'], $s);
+ $address['mail'] = $this->bool->value($page, 'mail', $address['mail'], $s);
+ $address['temporary'] = $this->bool->value($page, 'temporary', $address['temporary'], $s);
+ $address['current'] = $this->bool->value($page, 'current', @$address['current'], $s);
+ $address['pub'] = $this->pub->value($page, 'pub', $address['pub'], $s);
+ unset($address['parsevalid']);
+ unset($address['changed']);
+ unset($address['removed']);
+ unset($address['display']);
+ }
+
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $init = false;
+ if (is_null($value)) {
+ $value = $page->values['addresses'];
+ $init = true;
+ }
+ foreach ($value as $key=>&$adr) {
+ if (@$adr['removed']) {
+ unset($value[$key]);
+ }
+ }
+ $current = 0;
+ foreach ($value as $key=>&$adr) {
+ if (@$adr['current']) {
+ $current++;
+ }
+ }
+ if (!$init && $current != 1 && count($value) > 0) {
+ $success = false;
+ } else {
+ $success = true;
+ }
+ foreach ($value as $key=>&$adr) {
+ $ls = true;
+ $this->geolocAddress($adr, $s);
+ $ls = ($ls && $s);
+ $this->cleanAddress($page, $adr, $s);
+ $ls = ($ls && $s);
+ if (!trim($adr['text'])) {
+ unset($value[$key]);
+ } else if (!$init) {
+ $success = ($success && $ls);
+ }
+ }
+ return $value;
+ }
+
+ private function saveTel($adrid, $telid, array &$tel)
+ {
+ XDB::execute("INSERT INTO tels (uid, adrid, telid,
+ tel_type, tel_pub, tel)
+ VALUES ({?}, {?}, {?},
+ {?}, {?}, {?})",
+ S::i('uid'), $adrid, $telid,
+ $tel['type'], $tel['pub'], $tel['tel']);
+ }
+
+ private function saveAddress($adrid, array &$address)
+ {
+ $flags = array();
+ if ($address['secondaire']) {
+ $flags[] = 'res-secondaire';
+ }
+ if ($address['mail']) {
+ $flags[] = 'courrier';
+ }
+ if ($address['temporary']) {
+ $flags[] = 'temporaire';
+ }
+ if ($address['current']) {
+ $flags[] = 'active';
+ }
+ if ($address['checked']) {
+ $flags[] = 'coord-checked';
+ }
+ $flags = implode(',', $flags);
+ XDB::execute("INSERT INTO adresses (adr1, adr2, adr3,
+ postcode, city, cityid,
+ country, region, regiontxt,
+ pub, datemaj, statut,
+ uid, adrid)
+ VALUES ({?}, {?}, {?},
+ {?}, {?}, {?},
+ {?}, {?}, {?},
+ {?}, FROM_UNIXTIME({?}), {?},
+ {?}, {?})",
+ $address['adr1'], $address['adr2'], $address['adr3'],
+ $address['postcode'], $address['city'], $address['cityid'],
+ $address['country'], $address['region'], $address['regiontxt'],
+ $address['pub'], $address['datemaj'], $flags,
+ S::i('uid'), $adrid);
+ foreach ($address['tel'] as $telid=>&$tel) {
+ $this->saveTel($adrid, $telid, $tel);
+ }
+ }
+
+ public function save(ProfilePage &$page, $field, $value)
+ {
+ XDB::execute("DELETE FROM adresses
+ WHERE uid = {?}",
+ S::i('uid'));
+ XDB::execute("DELETE FROM tels
+ WHERE uid = {?}",
+ S::i('uid'));
+ foreach ($value as $adrid=>&$address) {
+ $this->saveAddress($adrid, $address);
+ }
+ }
+}
+
+class ProfileAddresses extends ProfilePage
+{
+ protected $pg_template = 'profile/adresses.tpl';
+
+ public function __construct(PlWizard &$wiz)
+ {
+ parent::__construct($wiz);
+ $this->settings['addresses'] = new ProfileAddress();
+ }
+
+ protected function fetchData()
+ {
+ if (count($this->orig) > 0) {
+ $this->values = $this->orig;
+ return;
+ }
+ // Build the addresses tree
+ $res = XDB::query("SELECT a.adrid AS id, a.adr1, a.adr2, a.adr3,
+ UNIX_TIMESTAMP(a.datemaj) AS datemaj,
+ a.postcode, a.city, a.cityid, a.region, a.regiontxt,
+ a.pub, a.country, gp.pays AS countrytxt, gp.display,
+ FIND_IN_SET('coord-checked', a.statut) AS checked,
+ FIND_IN_SET('res-secondaire', a.statut) AS secondaire,
+ FIND_IN_SET('courrier', a.statut) AS mail,
+ FIND_IN_SET('temporaire', a.statut) AS temporary,
+ FIND_IN_SET('active', a.statut) AS current
+ FROM adresses AS a
+ INNER JOIN geoloc_pays AS gp ON(gp.a2 = a.country)
+ WHERE uid = {?} AND NOT FIND_IN_SET('pro', statut)
+ ORDER BY adrid",
+ S::i('uid'));
+ if ($res->numRows() == 0) {
+ $this->values['addresses'] = array();
+ } else {
+ $this->values['addresses'] = $res->fetchAllAssoc();
+ }
+
+ $res = XDB::iterator("SELECT adrid, tel_type AS type, tel_pub AS pub, tel
+ FROM tels
+ WHERE uid = {?}
+ ORDER BY adrid",
+ S::i('uid'));
+ $i = 0;
+ $adrNb = count($this->values['addresses']);
+ while ($tel = $res->next()) {
+ $adrid = $tel['adrid'];
+ unset($tel['adrid']);
+ while ($i < $adrNb && $this->values['addresses'][$i]['id'] < $adrid) {
+ $i++;
+ }
+ if ($i >= $adrNb) {
+ break;
+ }
+ $address =& $this->values['addresses'][$i];
+ if (!isset($address['tel'])) {
+ $address['tel'] = array();
+ }
+ if ($address['id'] == $adrid) {
+ $address['tel'][] = $tel;
+ }
+ }
+ foreach ($this->values['addresses'] as $id=>&$address) {
+ if (!isset($address['tel'])) {
+ $address['tel'] = array();
+ }
+ unset($address['id']);
+ }
+ parent::fetchData();
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-global $adresses;
-
-//on génère une éventuelle nouvelle adresse
-if (!isset($adresses) || (count($adresses) < $nb_adr_max)){
- $adrid = generate_new_adrid();
- $adresses[$adrid]['adrid'] = $adrid;
- $adr = &$adresses[$adrid];
- $adr['adr1'] = '';
- $adr['adr2'] = '';
- $adr['adr3'] = '';
- $adr['postcode'] = '';
- $adr['city'] = '';
- $adr['country'] = '00';
- $adr['region'] = '';
- $adr['secondaire'] = 1;
- $adr['courrier'] = 0;
- $adr['active'] = 0;
- $adr['temporaire'] = 1;
- $adr['pub'] = 'private';
- $adr['nouvelle'] = 'new'; //n'est pas issue d'un formulaire (sert dans update_adresses...)
-}
-
-unset($adr);
-unset($adrid);
-
-reset($adresses);
-//on génère un éventuel nouveau tel pour chaque adresse
-foreach($adresses as $adrid => $adr){
- if (!isset($adr['tels']) || count($adr['tels']) == 0) {
- $adresses[$adrid]['tels'] = array(
- array('tel' => '', 'tel_pub' => 'private', 'tel_type' => 'Tél.', 'telid' => 0, 'new_tel' => true),
- array('tel' => '', 'tel_pub' => 'private', 'tel_type' => 'Fax', 'telid' => 1, 'new_tel' => true));
- } elseif (count($adr['tels']) < $nb_tel_max) {
- $adresses[$adrid]['tels'][] =
- array('tel' => '', 'tel_pub' => 'private', 'tel_type' => 'Autre', 'telid' => generate_new_telid($adr), 'new_tel' => true);
- }
-}
-
-unset($adr);
-unset($adrid);
-
-//tri des adresses :
-
-reset($adresses);
-$i = 1;
-foreach($adresses as $adrid_ => $adr_){
- if(($adresses[$adrid_]['active']) && ($adr_['nouvelle'] != 'new')){
- $ordre_des_adrid[$i] = $adrid_;
- $i++;
- $est_attribuee[$adrid_] = 1;
- }
- else
- $est_attribuee[$adrid_] = 0;
-}
-
-reset($adresses);
-foreach($adresses as $adrid_ => $adr_){
- if(($adresses[$adrid_]['secondaire'] == 0) && ($est_attribuee[$adrid_] == 0) && ($adr_['nouvelle'] != 'new')){ // principale et non attribuee
- $ordre_des_adrid[$i] = $adrid_;
- $i++;
- $est_attribuee[$adrid_] = 1;
- }
-}
-
-reset($adresses);
-foreach($adresses as $adrid_ => $adr_){
- if(($adresses[$adrid_]['temporaire'] == 0) && ($est_attribuee[$adrid_] == 0) && ($adr_['nouvelle'] != 'new')){ // permanente et non attribuee
- $ordre_des_adrid[$i] = $adrid_;
- $i++;
- $est_attribuee[$adrid_] = 1;
- }
-}
-reset($adresses);
-foreach($adresses as $adrid_ => $adr_){
- if($est_attribuee[$adrid_] == 0){ // non attribuee
- $ordre_des_adrid[$i] = $adrid_;
- $i++;
- $est_attribuee[$adrid_] = 1;
- }
-}
-
-$nb_adr = $i - 1;
-$page->assign_by_ref('ordre_adrid',$ordre_des_adrid);
-$page->assign('nb_adr',$nb_adr+1);
-
-$page->assign('adresses', $adresses);
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-
-$res = XDB::iterator("SELECT * FROM profile_medals_grades ORDER BY mid, pos");
-$grades = Array();
-while ($tmp = $res->next()) {
- $grades[$tmp['mid']][] = $tmp;
-}
-
-$res = XDB::iterator("SELECT *, FIND_IN_SET('validation', flags) AS validate FROM profile_medals ORDER BY type, text");
-$mlist = Array();
-while ($tmp = $res->next()) {
- $mlist[$tmp['type']][] = $tmp;
-}
-
-$trad = Array('ordre' => 'Ordres ...', 'croix' => 'Croix ...', 'militaire' => 'Médailles militaires ...',
- 'honneur' => 'Médailles d\'honneur', 'resistance' => 'Médailles de la résistance ...', 'prix' => 'Prix ...');
-
-$page->assign('grades', $grades);
-$page->assign('medals', $medals);
-$page->assign('trad', $trad);
-$page->assign('medals_pub', $medals_pub);
-$page->assign('medal_list', $mlist);
-$page->assign('medals_valid', $medals_valid);
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as pubprolished by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$page->assign('endrid',$endrid);
-$page->assign('entreprise',$entreprise);
-$page->assign('secteur',$secteur);
-$page->assign('ss_secteur',$ss_secteur);
-$page->assign('poste',$poste);
-$page->assign('fonction',$fonction);
-$page->assign('adrpro1',$adrpro1);
-$page->assign('adrpro2',$adrpro2);
-$page->assign('adrpro3',$adrpro3);
-$page->assign('postcodepro',$postcodepro);
-$page->assign('citypro',$citypro);
-$page->assign('countrypro',$countrypro);
-$page->assign('regionpro',$regionpro);
-$page->assign('telpro',$telpro);
-$page->assign('faxpro',$faxpro);
-$page->assign('mobilepro', $mobilepro);
-$page->assign('pubpro',$pubpro);
-$page->assign('adr_pubpro',$adr_pubpro);
-$page->assign('tel_pubpro',$tel_pubpro);
-$page->assign('emailpro',$emailpro);
-$page->assign('email_pubpro',$email_pubpro);
-$page->assign('webpro',$webpro);
-$page->assign('cv',$cv);
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$page->assign('mobile_pub',$mobile_pub);
-$page->assign('web_pub',$web_pub);
-$page->assign('freetext_pub',$freetext_pub);
-
-$page->assign('nom', $nom);
-$page->assign('prenom', $prenom);
-$page->assign('promo', $promo);
-$page->assign('promo_sortie', $promo_sortie);
-$page->assign('nom_usage', $nom_usage);
-
-$page->assign('nationalite',$nationalite);
-
-$page->assign('mobile',$mobile);
-
-$page->assign('web',$web);
-
-$page->assign('freetext',$freetext);
-
-$page->assign('appli_id1',$appli_id1);
-$page->assign('appli_id2',$appli_id2);
-$page->assign('appli_type1',$appli_type1);
-$page->assign('appli_type2',$appli_type2);
-
-$page->assign('photo_pub',$photo_pub);
-$page->assign('nouvellephoto', $nouvellephoto);
-$page->assign('nickname', $nickname);
-
-$page->assign('synchro_ax', $synchro_ax);
-$page->assign('matricule_ax', $matricule_ax);
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$page->assign('mentor_secteur_id_new', $mentor_secteur_id_new);
-$page->assign('can_add_pays', $nb_mentor_pays < $max_mentor_pays);
-$page->assign('can_add_secteurs', $nb_mentor_secteurs < $max_mentor_secteurs);
-$page->assign('mentor_expertise', $mentor_expertise);
-$page->assign('mentor_pid', $mentor_pid);
-$page->assign('mentor_pays', $mentor_pays);
-$page->assign('mentor_sid', $mentor_sid);
-$page->assign('mentor_secteur', $mentor_secteur);
-$page->assign('mentor_ssid', $mentor_ssid);
-$page->assign('mentor_ss_secteur', $mentor_ss_secteur);
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$uid = S::v('uid');
-
-$res = XDB::query(
- "SELECT text,id
- FROM binets_ins, binets_def
- WHERE binets_def.id=binets_ins.binet_id AND user_id={?}", $uid);
-$page->assign('binets', $res->fetchAllAssoc());
-
-$res = XDB::query(
- "SELECT text,id
- FROM groupesx_ins, groupesx_def
- WHERE groupesx_def.id=groupesx_ins.gid AND guid={?}", $uid);
-$page->assign('groupesx', $res->fetchAllAssoc());
-
-$page->assign('section', $section);
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$page->assign('nb_lg_max', $nb_lg_max);
-$page->assign('nb_cpro_max', $nb_cpro_max);
-$page->assign('nb_lg', $nb_lg);
-$page->assign_by_ref('langue_id', $langue_id);
-$page->assign_by_ref('langue_name', $langue_name);
-$page->assign_by_ref('langue_level', $langue_level);
-$page->assign('nb_cpro', $nb_cpro);
-$page->assign_by_ref('cpro_id', $cpro_id);
-$page->assign_by_ref('cpro_name', $cpro_name);
-$page->assign_by_ref('cpro_level', $cpro_level);
-$page->assign_by_ref('langues_levels',$langues_levels);
-$page->assign_by_ref('langues_def',$langues_def);
-$page->assign_by_ref('comppros_levels',$comppros_levels);
-$page->assign_by_ref('comppros_def',$comppros_def);
-$page->assign_by_ref('comppros_title',$comppros_title);
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2007 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+class ProfileDeco implements ProfileSetting
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $success = true;
+ if (is_null($value)) {
+ // Fetch already attributed medals
+ $res = XDB::iterRow("SELECT m.id AS id, s.gid AS grade
+ FROM profile_medals_sub AS s
+ INNER JOIN profile_medals AS m ON ( s.mid = m.id )
+ WHERE s.uid = {?}",
+ S::i('uid'));
+ $value = array();
+ while (list($id, $grade) = $res->next()) {
+ $value[$id] = array('grade' => $grade,
+ 'valid' => '1');
+ }
+
+ // Fetch not yet validated medals
+ require_once('validations.inc.php');
+ $medals = Validate::get_typed_requests(S::i('uid'), 'medal');
+ foreach ($medals as &$medal) {
+ $value[$medal->mid] = array('grade' => $medal->gid,
+ 'valid' => '0');
+ }
+ } else if (!is_array($value)) {
+ $value = array();
+ }
+ ksort($value);
+ return $value;
+ }
+
+ public function save(ProfilePage &$page, $field, $value)
+ {
+ require_once('validations.inc.php');
+
+ $orig =& $page->orig[$field];
+
+ // Remove old ones
+ foreach ($orig as $id=>&$val) {
+ if (!isset($value[$id]) || $val['grade'] != $value[$id]['grade']) {
+ if ($val['valid']) {
+ XDB::execute("DELETE FROM profile_medals_sub
+ WHERE uid = {?} AND mid = {?}",
+ S::i('uid'), $id);
+ } else {
+ $req = MedalReq::get_request(S::i('uid'), $id);
+ if ($req) {
+ $req->clean();
+ }
+ }
+ }
+ }
+
+ // Add new ones
+ foreach ($value as $id=>&$val) {
+ if (!isset($orig[$id]) || $orig[$id]['grade'] != $val['grade']) {
+ $req = new MedalReq(S::i('uid'), $id, $val['grade']);
+ $req->submit();
+ }
+ }
+ }
+}
+
+class ProfileDecos extends ProfilePage
+{
+ protected $pg_template = 'profile/deco.tpl';
+
+ public function __construct(PlWizard &$wiz)
+ {
+ parent::__construct($wiz);
+ $this->settings['medals'] = new ProfileDeco();
+ $this->settings['medals_pub'] = new ProfilePub();
+ }
+
+ protected function fetchData()
+ {
+ $res = XDB::query("SELECT profile_medals_pub
+ FROM auth_user_quick
+ WHERE user_id = {?}",
+ S::i('uid'));
+ $this->values['medals_pub'] = $res->fetchOneCell();
+ parent::fetchData();
+ }
+
+ protected function saveData()
+ {
+ parent::saveData();
+ if ($this->changed['medals_pub']) {
+ XDB::execute("UPDATE auth_user_quick
+ SET profile_medals_pub = {?}
+ WHERE user_id = {?}",
+ $this->values['medals_pub'], S::i('uid'));
+ }
+ }
+
+ public function prepare(PlatalPage &$page)
+ {
+ parent::prepare($page);
+ $res = XDB::iterator("SELECT *
+ FROM profile_medals_grades
+ ORDER BY mid, pos");
+ $grades = array();
+ while ($tmp = $res->next()) {
+ $grades[$tmp['mid']][] = $tmp;
+ }
+ $page->assign('grades', $grades);
+
+ $res = XDB::iterator("SELECT *, FIND_IN_SET('validation', flags) AS validate
+ FROM profile_medals
+ ORDER BY type, text");
+ $mlist = array();
+ while ($tmp = $res->next()) {
+ $mlist[$tmp['type']][] = $tmp;
+ }
+ $page->assign('medal_list', $mlist);
+
+ $trad = Array('ordre' => 'Ordres',
+ 'croix' => 'Croix',
+ 'militaire' => 'Médailles militaires',
+ 'honneur' => 'Médailles d\'honneur',
+ 'resistance' => 'Médailles de la résistance',
+ 'prix' => 'Prix');
+ $page->assign('trad', $trad);
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2007 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+class ProfileNom implements ProfileSetting
+{
+ private function matchWord($old, $new, $newLen) {
+ return ($i = strpos($old, $new)) !== false
+ && ($i == 0 || $old{$i-1} == ' ')
+ && ($i + $newLen == strlen($old) || $old{$i + $newLen} == ' ');
+ }
+
+ private function prepareField($value)
+ {
+ $value = strtoupper(replace_accent($value));
+ return preg_replace('/[^A-Z]/', ' ', $value);
+ }
+
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $success = true;
+ $current = S::v($field);
+ $init = S::v($field . '_ini');
+ if (is_null($value)) {
+ return $current;
+ }
+ if ($value == $current || $value == $init) {
+ return $value;
+ }
+ $ini = $this->prepareField($init);
+ $old = $this->prepareField($current);
+ $new = $this->prepareField($value);
+ $newLen = strlen($new);
+ $success = $this->matchWord($old, $new, $newLen)
+ || $this->matchWord($ini, $new, $newLen);
+ if (!$success) {
+ global $page;
+ $page->trig("Le $field que tu as choisi ($value) est trop loin de ton $field initial ($init)"
+ . (($init == $current)? "" : " et de ton prénom précédent ($current)"));
+ }
+ return $success ? $value : $current;
+ }
+
+ public function save(ProfilePage &$page, $field, $new_value)
+ {
+ $_SESSION[$field] = $new_value;
+ }
+}
+
+class ProfileAppli implements ProfileSetting
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $success = true;
+ if (is_null($value)) {
+ return $page->values[$field];
+ }
+ return $value;
+ }
+
+ public function save(ProfilePage &$page, $field, $new_value)
+ {
+ $index = ($field == 'appli1' ? 0 : 1);
+ if ($new_value['id'] > 0) {
+ XDB::execute("REPLACE INTO applis_ins
+ SET uid = {?}, aid = {?}, type = {?}, ordre = {?}",
+ S::i('uid'), $new_value['id'], $new_value['type'], $index);
+ } else {
+ XDB::execute("DELETE FROM applis_ins
+ WHERE uid = {?} AND ordre = {?}",
+ S::i('uid'), $index);
+ }
+ }
+}
+
+class ProfileGeneral extends ProfilePage
+{
+ protected $pg_template = 'profile/general.tpl';
+
+ public function __construct(PlWizard &$wiz)
+ {
+ parent::__construct($wiz);
+ $this->settings['nom'] = $this->settings['prenom']
+ = new ProfileNom();
+ $this->settings['mobile_pub']
+ = $this->settings['web_pub']
+ = $this->settings['freetext_pub']
+ = $this->settings['photo_pub']
+ = new ProfilePub();
+ $this->settings['freetext']
+ = $this->settings['nationalite']
+ = $this->settings['nick']
+ = null;
+ $this->settings['synchro_ax']
+ = new ProfileBool();
+ $this->settings['mobile'] = new ProfileTel();
+ $this->settings['web'] = new ProfileWeb();
+ $this->settings['appli1']
+ = $this->settings['appli2']
+ = new ProfileAppli();
+ }
+
+ protected function fetchData()
+ {
+ if (count($this->orig) > 0) {
+ $this->values = $this->orig;
+ return;
+ }
+
+ // Checkout all data...
+ $res = XDB::query("SELECT u.promo, u.promo_sortie, u.nom_usage, u.nationalite,
+ q.profile_mobile as mobile, q.profile_mobile_pub as mobile_pub,
+ q.profile_web as web, q.profile_web_pub as web_pub,
+ q.profile_freetext as freetext, q.profile_freetext_pub as freetext_pub,
+ q.profile_nick as nick, q.profile_from_ax as synchro_ax, u.matricule_ax,
+ IF(a1.aid IS NULL, -1, a1.aid) as appli_id1, a1.type as appli_type1,
+ IF(a2.aid IS NULL, -1, a2.aid) as appli_id2, a2.type as appli_type2
+ FROM auth_user_md5 AS u
+ INNER JOIN auth_user_quick AS q USING(user_id)
+ LEFT JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0)
+ LEFT JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)
+ WHERE u.user_id = {?}", S::v('uid', -1));
+ $this->values = $res->fetchOneAssoc();
+
+ // Reformat formation data
+ $this->values['appli1'] = array('id' => $this->values['appli_id1'],
+ 'type' => $this->values['appli_type1']);
+ unset($this->values['appli_id1']);
+ unset($this->values['appli_type1']);
+ $this->values['appli2'] = array('id' => $this->values['appli_id2'],
+ 'type' => $this->values['appli_type2']);
+ unset($this->values['appli_id2']);
+ unset($this->values['appli_type2']);
+
+ // Retreive photo informations
+ $res = XDB::query("SELECT pub
+ FROM photo
+ WHERE uid = {?}", S::v('uid'));
+ $this->values['photo_pub'] = $res->fetchOneCell();
+
+ $res = XDB::query("SELECT COUNT(*)
+ FROM requests
+ WHERE type='photo' AND user_id = {?}",
+ S::v('uid'));
+ $this->values['nouvellephoto'] = $res->fetchOneCell();
+ parent::fetchData();
+ }
+
+ protected function saveData()
+ {
+ parent::saveData();
+ if ($this->changed['nationalite'] || $this->changed['nom'] || $this->changed['prenom']) {
+ XDB::execute("UPDATE auth_user_md5
+ SET nationalite = {?}, nom={?}, prenom={?}
+ WHERE user_id = {?}",
+ $this->values['nationalite'], $this->values['nom'], $this->values['prenom'], S::v('uid'));
+ }
+ if ($this->changed['nick'] || $this->changed['mobile'] || $this->changed['mobile_pub']
+ || $this->changed['web'] || $this->changed['web_pub'] || $this->changed['freetext']
+ || $this->changed['freetext_pub'] || $this->changed['synchro_ax']) {
+ XDB::execute("UPDATE auth_user_quick
+ SET profile_nick= {?}, profile_mobile={?}, profile_mobile_pub={?},
+ profile_web={?}, profile_web_pub={?}, profile_freetext={?},
+ profile_freetext_pub={?}, profile_from_ax = {?}
+ WHERE user_id = {?}",
+ $this->values['nick'], $this->values['mobile'], $this->values['mobile_pub'],
+ $this->values['web'], $this->values['web_pub'],
+ $this->values['freetext'], $this->values['freetext_pub'],
+ $this->values['synchro_ax'], S::v('uid'));
+ }
+ if ($this->changed['nick']) {
+ require_once('user.func.inc.php');
+ user_reindex(S::v('uid'));
+ }
+ if ($this->changed['photo_pub']) {
+ XDB::execute("UPDATE photo
+ SET pub = {?}
+ WHERE uid = {?}",
+ $this->values['photo_pub'], S::v('uid'));
+ }
+ }
+
+ public function prepare(PlatalPage &$page)
+ {
+ parent::prepare($page);
+ require_once "applis.func.inc.php";
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-require_once('geoloc.inc.php');
-
-global $adresses, $nb_adr_max, $nb_tel_max;
-
-// on limite à 6 adresses personnelles par utilisateur
-$nb_adr_max = 6; // ( = max(adrid possibles)
-// on limite à 4 numéros de téléphone par adresse
-$nb_tel_max = 4; // ( = max(telid possibles)
-
-//les adresses sont stockées dans un tableau global indéxé par adrid;
-
-function is_adr_empty($adrid){
- $adr = &$GLOBALS['adresses'][$adrid];
- $emptytel = count($adr['tels']) == 0;
- if (!$emptytel) {
- $emptytel = true;
- foreach ($adr['tels'] as $t) if ($t['tel']) {
- $emptytel = false;
- break;
- }
- }
- return (
- ($adr['adr1'] == '') && ($adr['adr2'] == '') && ($adr['adr3'] == '') &&
- ($adr['postcode'] == '') && ($adr['city'] == '') && ($adr['country'] == '00') &&
- ($emptytel)
- );
-}
-
-function delete_address($adrid, $in_request_array = false){
- XDB::execute("DELETE FROM adresses WHERE uid = {?} AND adrid = {?}",
- S::v('uid', -1), $adrid);
- XDB::execute("DELETE FROM tels WHERE uid = {?} AND adrid = {?}",
- S::v('uid', -1), $adrid);
- if ($in_request_array == true){
- unset($_REQUEST['adrid'][$adrid]);
- } else{
- unset($GLOBALS['adresses'][$adrid]);
- }
-}
-
-//on verifie si on nous a demande une suppression
-$req_adrid_del = Env::v('adrid_del', Array());
-for ($i = 1; $i <= $nb_adr_max; $i++) {
- if (isset($req_adrid_del[$i])) {
- delete_address($i,true);
- }
-}
-if (Env::i('deltel')) {
- XDB::execute("DELETE FROM tels WHERE uid = {?} AND adrid = {?} AND telid = {?}",
- S::v('uid', -1), Env::i('adrid'), Env::i('telid'));
-}
-
-//$sql_order = "ORDER BY (NOT FIND_IN_SET('active', statut)), FIND_IN_SET('temporaire', statut)";
-$sql_order = '';
-
-//recuperation des adrid
-$res = XDB::query("SELECT adrid FROM adresses WHERE uid = {?} AND NOT FIND_IN_SET('pro', statut) ".$sql_order, S::v('uid', -1));
-$adrids = $res->fetchColumn();
-
-//recuperation des donnees de la bd
-$res = XDB::iterRow(
- "SELECT
- FIND_IN_SET('res-secondaire', statut), FIND_IN_SET('courrier', statut),
- FIND_IN_SET('active', statut), FIND_IN_SET('temporaire', statut),
- adr1, adr2, adr3, postcode, city, cityid,
- a.country, region, regiontxt, pub,
- gp.pays AS countrytxt, gp.display
- FROM adresses AS a INNER JOIN geoloc_pays AS gp ON(gp.a2 = a.country)
- WHERE uid = {?} AND NOT FIND_IN_SET('pro',statut) ".$sql_order
-, S::v('uid', -1)
-);
-
-$nb_adr = $res->total();
-
-for ($i = 0; $i < $nb_adr; $i++) {
- $adrid = $adrids[$i];
- $adresses[$adrid]['adrid'] = $adrid;
- list(
- $adresses[$adrid]['secondaire'], $adresses[$adrid]['courrier'],
- $adresses[$adrid]['active'], $adresses[$adrid]['temporaire'],
- $adresses[$adrid]['adr1'], $adresses[$adrid]['adr2'], $adresses[$adrid]['adr3'], $adresses[$adrid]['postcode'], $adresses[$adrid]['city'], $adresses[$adrid]['cityid'],
- $adresses[$adrid]['country'], $adresses[$adrid]['region'], $adresses[$adrid]['regiontxt'],
- $adresses[$adrid]['pub'],
- $adresses[$adrid]['countrytxt'],$adresses[$adrid]['display']) = $res->next();
- $adresses[$adrid]['nouvelle'] = 'modif';
- $adresses[$adrid]['numero_formulaire'] = -1;
- require_once('geoloc.inc.php');
- $adresses[$adrid]['txt'] = get_address_text($adresses[$adrid]);
-}
-
-$restels = XDB::iterator(
- "SELECT
- t.adrid, telid, tel_type, t.tel_pub, t.tel
- FROM tels AS t INNER JOIN adresses AS a ON(t.uid = a.uid AND t.adrid = a.adrid)
- WHERE t.uid = {?} AND NOT FIND_IN_SET('pro',statut) ORDER BY t.adrid, tel_type DESC, telid"
-, S::v('uid', -1)
-);
-while ($tel = $restels->next()) {
- $adrid = $tel['adrid'];
- unset($tel['adrid']);
- if (!isset($adresses[$adrid]['tels']))
- $adresses[$adrid]['tels'] = array($tel);
- else
- $adresses[$adrid]['tels'][] = $tel;
-}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-require_once('validations.inc.php');
-
-if (Env::has('medal_op')) {
- if (Env::v('medal_op')=='retirer' && Env::i('medal_id')) {
- XDB::execute("DELETE FROM profile_medals_sub WHERE uid = {?} AND mid = {?}", S::v('uid', -1), Env::i('medal_id', -1));
- }
-
- if (Env::v('medal_op')=='ajouter' && Env::i('medal_id')) {
- $req = new MedalReq(S::v('uid',-1),Env::i('medal_id'), Env::i('grade_id'));
- $req->submit();
- unset($_REQUEST['medal_op']); // pour ne pas avoir le message d'attente de validation
- }
-
- if (Env::v('medal_op')=='annuler' && Env::i('medal_id')) {
- $req = Validate::get_typed_request(S::i('uid'), 'medal', Env::v('medal_id'));
- $req->clean();
- }
-}
-if (Post::has('grade')) {
- foreach (Post::v('grade') as $mid=>$gid) {
- XDB::execute('UPDATE profile_medals_sub SET gid={?} WHERE uid={?} AND mid={?}', $gid, S::v('uid'), $mid);
- }
-}
-
-$res = XDB::query(
- "SELECT m.id, m.text AS medal, m.type, m.img, s.gid
- FROM profile_medals_sub AS s
- INNER JOIN profile_medals AS m ON ( s.mid = m.id )
- WHERE s.uid = {?}", S::v('uid', -1));
-
-$medals = $res->fetchAllAssoc();
-
-$res = XDB::query("SELECT profile_medals_pub FROM auth_user_quick WHERE user_id = {?}", S::v('uid', -1));
-$medals_pub = $res->fetchOneCell();
-
-$medals_valid = Validate::get_typed_requests(S::i('uid'), 'medal');
-
-if(Env::has('modifier') || Env::has('suivant')) {
- $medals_pub = Env::has('medals_pub')?'public':'private';
-}
-
-// vim:set et sws=4 sw=4 sts=4 enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-require_once('geoloc.inc.php');
-require_once('secteur.emploi.inc.php');
-require_once('fonction.emploi.inc.php');
-
-$res = XDB::iterRow("SELECT entrid, entreprise, secteur, ss_secteur, poste, fonction,
- adr1, adr2, adr3, postcode, city, country, region, tel, fax, mobile,
- pub, adr_pub, tel_pub, email, email_pub, web
- FROM entreprises
- WHERE uid = {?} ORDER BY entrid",S::v('uid', -1));
-
-$nb_res = $res->total();
-for($i = 0; $i < $nb_res ; $i++){
- list($endrid[$i], $entreprise[$i], $secteur[$i], $ss_secteur[$i], $poste[$i], $fonction[$i],
- $adrpro1[$i], $adrpro2[$i], $adrpro3[$i], $postcodeppro[$i], $citypro[$i], $countrypro[$i], $regionpro[$i],
- $telpro[$i], $faxpro[$i], $mobilepro[$i], $pubpro[$i], $adr_pubpro[$i],
- $tel_pubpro[$i], $emailpro[$i], $email_pubpro[$i], $webpro[$i]) = $res->next();
-}
-//limite dure a 2
-for($i = $nb_res; $i < 2 ; $i++){
- $endrid[$i] = $i;
- $entreprise[$i] = '';
- $secteur[$i] = '';
- $ss_secteur[$i] = '';
- $poste[$i] = '';
- $fonction[$i] = '0';
- $adrpro1[$i] = '';
- $adrpro2[$i] = '';
- $adrpro3[$i] = '';
- $postcodepro[$i] = '';
- $citypro[$i] = '';
- $countrypro[$i] = '00';
- $regionpro[$i] = '';
- $telpro[$i] = '';
- $faxpro[$i] = '';
- $mobilepro[$i] = '';
- $pubpro[$i] = '';
- $adr_pubpro[$i] = '';
- $tel_pubpro[$i] = '';
- $emailpro[$i] = '';
- $email_pubpro[$i] = '';
- $webpro[$i] = '';
-}
-
-//recuperation des donnees sur les secteurs :
-
-$res = XDB::iterRow("SELECT id, label FROM emploi_secteur");
-
-while(list($tmp_secteur_id, $tmp_secteur_label) = $res->next()){
- $secteurs[$tmp_secteur_id] = $tmp_secteur_label;
-}
-
-//recuperation des donnees sur les fonctions :
-$res = XDB::iterRow("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) FROM fonctions_def ORDER BY id");
-
-while(list($tmp_fonction_id, $tmp_fonction_label, $tmp_fonction_titre) = $res->next()){
- $fonctions[$tmp_fonction_id] = $tmp_fonction_label;
- $fonctions_titre[$tmp_fonction_id] = $tmp_fonction_titre;
-}
-
-//recuperation du CV
-$res = XDB::query("SELECT cv FROM auth_user_md5 WHERE user_id = {?}", S::v('uid', -1));
-$cv = $res->fetchOneCell();
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-// on ramène les données du profil connecté (uid paramètre de session)
-$sql = "SELECT u.nom, u.prenom, u.nom_ini, u.prenom_ini, u.promo, u.promo_sortie, u.nom_usage, u.nationalite,
- q.profile_mobile, q.profile_mobile_pub, q.profile_web, q.profile_web_pub, q.profile_freetext, q.profile_freetext_pub, q.profile_nick,
- q.profile_from_ax, u.matricule_ax,
- a1.aid, a1.type, a2.aid, a2.type
- FROM auth_user_md5 AS u
- INNER JOIN auth_user_quick AS q USING(user_id)
- LEFT JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0)
- LEFT JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)
- WHERE u.user_id = {?}";
-
-$result = XDB::query($sql, S::v('uid', -1));
-list($nom, $prenom, $nom_ini, $prenom_ini, $promo, $promo_sortie, $nom_usage, $nationalite,
- $mobile, $mobile_pub, $web, $web_pub, $freetext, $freetext_pub, $nickname,
- $synchro_ax, $matricule_ax,
- $appli_id1,$appli_type1, $appli_id2,$appli_type2) = $result->fetchOneRow();
-
-$result = XDB::query("SELECT pub FROM photo WHERE uid = {?}", S::v('uid', -1));
-$photo_pub = $result->fetchOneCell();
-
-$nom_anc = $nom;
-$prenom_anc = $prenom;
-$nationalite_anc = $nationalite;
-$nickname_anc = $nickname;
-
-replace_ifset($nom,'nom');
-replace_ifset($prenom,'prenom');
-replace_ifset($nationalite,'nationalite');
-replace_ifset($mobile,'mobile');
-replace_ifset($web,"web");
-replace_ifset($freetext,"freetext");
-replace_ifset($appli_id1,"appli_id1");
-replace_ifset($appli_id2,"appli_id2");
-replace_ifset($appli_type1,"appli_type1");
-replace_ifset($appli_type2,"appli_type2");
-replace_ifset($nickname,"nickname");
-
-if(Env::has('modifier') || Env::has('suivant') && $opened_tab == 'general') {
- $mobile_pub = Env::v('mobile_pub');
- $web_pub = Env::has('web_pub')?'public':'private';
- $freetext_pub = Env::has('freetext_pub')?'public':'private';
- $photo_pub = Env::has('photo_pub')?'public':'private';
- $synchro_ax = Env::has("synchro_ax")?1:0;
-}
-
-require_once("xorg.misc.inc.php");
- $nom = strtoupper($nom);
- $nom_comp = replace_accent($nom);
- $nom_anc_comp = replace_accent($nom_anc);
-
- $prenom = make_firstname_case($prenom);
- $prenom_comp = replace_accent($prenom);
- $prenom_anc_comp = replace_accent($prenom_anc);
-
-// Y a-t-il une photo en attente de confirmation ?
-$sql = XDB::query("SELECT COUNT(*) FROM requests WHERE type='photo' AND user_id = {?}", S::v('uid', -1));
-$nouvellephoto=$sql->fetchOneCell();
-
-// vim:set et sws=4 sw=4 sts=4 enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-require_once('geoloc.inc.php');
-require_once('secteur.emploi.inc.php');
-
-$max_mentor_pays = 10;
-$max_mentor_secteurs = 10;
-
-//recuperation de l'expertise
-$res = XDB::query("SELECT expertise FROM mentor WHERE uid = {?}", S::v('uid',-1));
-
-$mentor_expertise = $res->fetchOneCell();
-$mentor_expertise_bd = $mentor_expertise;
-
-//suppression eventuelle d'un pays
-if(Post::v('mentor_pays_op', '') == 'retirer') {
- if(Post::has('mentor_pays_id')) {
- $id_supprimee = Post::v('mentor_pays_id', '00');
- XDB::execute("DELETE FROM mentor_pays WHERE uid = {?} AND pid = {?} LIMIT 1", S::v('uid', -1), $id_supprimee);
- }
-}
-
-//recuperation des pays
-$res = XDB::iterRow("SELECT m.pid, p.pays
- FROM mentor_pays AS m
- LEFT JOIN geoloc_pays AS p ON(m.pid = p.a2) WHERE m.uid = {?} LIMIT {?}", S::v('uid', -1), $max_mentor_pays);
-$nb_mentor_pays = $res->total();
-$mentor_pid = $mentor_pays = Array();
-for($i = 1; $i <= $nb_mentor_pays ; $i++) list($mentor_pid[$i], $mentor_pays[$i]) = $res->next();
-
-//ajout eventuel d'un pays
-if((Post::v('mentor_pays_op', '') == 'ajouter') && ($nb_mentor_pays < $max_mentor_pays)) {
- if(Post::v('mentor_pays_id', '00') != '00') {
- $id_ajoutee = Post::v('mentor_pays_id', '00');
- XDB::execute("INSERT INTO mentor_pays(uid, pid) VALUES({?}, {?})", S::v('uid', -1), $id_ajoutee);
- $nb_mentor_pays++;
- $mentor_pid[$nb_mentor_pays] = $id_ajoutee;
- $mentor_pays[$nb_mentor_pays] = Post::v('mentor_pays_name', '');
- }
-}
-
-
-
-//suppression d'un secteur / ss-secteur
-if(Post::v('mentor_secteur_op', '') == 'retirer') {
- if(Post::has('mentor_secteur_id')) {
- $id_supprimee = Post::v('mentor_secteur_id', '');
- XDB::execute("DELETE FROM mentor_secteurs WHERE uid = {?} AND secteur = {?} LIMIT 1", S::v('uid', -1), $id_supprimee);
- }
-}
-
-//recuperation des secteurs
-$res = XDB::iterRow("SELECT m.secteur, s.label, m.ss_secteur, ss.label
- FROM mentor_secteurs AS m
- LEFT JOIN emploi_secteur AS s ON(m.secteur = s.id)
- LEFT JOIN emploi_ss_secteur AS ss ON(s.id = ss.secteur AND m.ss_secteur = ss.id)
- WHERE m.uid = {?}
- LIMIT {?}", S::v('uid', -1), $max_mentor_pays);
-$nb_mentor_secteurs = $res->total();
-$mentor_sid = $mentor_secteur = $mentor_ssid = $mentor_ss_secteur = Array();
-for($i = 1; $i <= $nb_mentor_secteurs ; $i++)
- list($mentor_sid[$i], $mentor_secteur[$i], $mentor_ssid[$i], $mentor_ss_secteur[$i]) = $res->next();
-
-//ajout d'un secteur
-$mentor_secteur_id_new = '';
-if((Post::v('mentor_secteur_op', '')== 'ajouter') && ($nb_mentor_secteurs < $max_mentor_secteurs)) {
- if(Post::v('mentor_secteur_id', '') != '')
- {
- $sid_ajoutee = Post::v('mentor_secteur_id', '');
- if(Post::has('mentor_ss_secteur_id'))
- $ssid_ajoutee = Post::v('mentor_ss_secteur_id', '');
- XDB::execute("INSERT INTO mentor_secteurs (uid, secteur, ss_secteur)
- VALUES({?}, {?}, {?})", S::v('uid', -1), $sid_ajoutee, ($ssid_ajoutee == '')?null:$ssid_ajoutee);
- $nb_mentor_secteurs++;
- $mentor_sid[$nb_mentor_secteurs] = $sid_ajoutee;
- $mentor_secteur[$nb_mentor_secteurs] = Post::v('mentor_secteur_name', '');
- $mentor_ssid[$nb_mentor_secteurs] = $ssid_ajoutee;
- $mentor_ss_secteur[$nb_mentor_secteurs] = Post::v('mentor_ss_secteur_name', '');
- }
-} elseif(Post::has('mentor_secteur_id_new')){
- $mentor_secteur_id_new = Post::v('mentor_secteur_id_new', '');
-}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-
-//declaration des fonctions msarty pour les binets et groupex
-
-$sql = "SELECT section".
- " FROM auth_user_md5 AS u".
- " WHERE user_id = {?}";
-
-$result = XDB::query($sql, S::v('uid', -1));
-$section = $result->fetchOneCell();
-
-replace_ifset($section,'section');
-
-/************* gestion des binets ************/
-if (Env::has('binet_op')) {
- // retrait binet
- if( (Env::v('binet_op', '')=='retirer')&&(Env::i('binet_id', 0) != 0)) {
- XDB::execute("DELETE FROM binets_ins WHERE user_id = {?} AND binet_id = {?}", S::v('uid', -1), Env::i('binet_id', -1));
- }
- // ajout binet
- if (Env::v('binet_op')=="ajouter" && (Env::i('binet_id', 0) != 0)) {
- XDB::execute("INSERT INTO binets_ins (user_id,binet_id) VALUES({?}, {?})", S::v('uid', -1), Env::i('binet_id', -1));
- }
-}
-/************* gestion des groupes X ************/
-if (Env::has('groupex_op')) {
- // retrait groupe X
- if (Env::v('groupex_op')=="retirer" && (Env::i('groupex_id', 0) != 0)) {
- XDB::execute("DELETE FROM groupesx_ins WHERE guid = {?} AND gid = {?}", S::v('uid', -1), Env::i('groupex_id', -1));
- }
- // ajout groupe X
- if (Env::v('groupex_op')=="ajouter" && (Env::i('groupex_id', 0) != 0)) {
- XDB::execute("INSERT INTO groupesx_ins (guid, gid) VALUES ({?}, {?})", S::v('uid', -1), Env::i('groupex_id', -1));
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-
-if(Env::has('langue_op')){
- if(Env::v('langue_op', '')=='retirer'){
- XDB::execute("DELETE FROM langues_ins WHERE uid = {?} AND lid = {?}", S::v('uid', -1), Env::v('langue_id', ''));
- } elseif(Env::v('langue_op', '') == 'ajouter'){
- if(Env::v('langue_id', '') != '')
- XDB::execute("INSERT INTO langues_ins (uid,lid,level) VALUES ({?}, {?}, {?})", S::v('uid', -1), Env::v('langue_id', ''), Env::v('langue_level', ''));
- }
-}
-
-if(Env::has('comppros_op')){
- if(Env::v('comppros_op', '')=='retirer'){
- XDB::execute("DELETE FROM competences_ins WHERE uid = {?} AND cid = {?}", S::v('uid', -1), Env::v('comppros_id', ''));
- } elseif(Env::v('comppros_op', '') == 'ajouter') {
- if(Env::v('comppros_id', '') != '')
- XDB::execute("INSERT INTO competences_ins (uid,cid,level) VALUES({?}, {?}, {?})", S::v('uid', -1), Env::v('comppros_id', ''), Env::v('comppros_level', ''));
- }
-}
-
-// nombre maximum autorisé de langues
-$nb_lg_max = 10;
-// nombre maximum autorisé de compétences professionnelles
-$nb_cpro_max = 20;
-
-$res = XDB::iterRow("SELECT ld.id, ld.langue_fr, li.level FROM langues_ins AS li, langues_def AS ld "
- ."WHERE (li.lid=ld.id AND li.uid= {?}) LIMIT $nb_lg_max", S::v('uid', -1));
-
-$nb_lg = $res->total();
-
-for ($i = 1; $i <= $nb_lg; $i++) {
- list($langue_id[$i], $langue_name[$i], $langue_level[$i]) = $res->next();
-}
-
-$res = XDB::iterRow("SELECT cd.id, cd.text_fr, ci.level FROM competences_ins AS ci, competences_def AS cd "
- ."WHERE (ci.cid=cd.id AND ci.uid={?}) LIMIT $nb_cpro_max", S::v('uid', -1));
-
-$nb_cpro = $res->total();
-
-for ($i = 1; $i <= $nb_cpro; $i++) {
- list($cpro_id[$i], $cpro_name[$i], $cpro_level[$i]) = $res->next();
-}
-//Definitions des tables de correspondances id => nom
-
-$langues_levels = Array(
- 1 => "1",
- 2 => "2",
- 3 => "3",
- 4 => "4",
- 5 => "5",
- 6 => "6"
-);
-
-$res = XDB::iterRow("SELECT id, langue_fr FROM langues_def");
-
-while(list($tmp_lid, $tmp_lg_fr) = $res->next()){
- $langues_def[$tmp_lid] = $tmp_lg_fr;
-}
-
-$comppros_levels = Array(
- 'initié' => 'initié',
- 'bonne connaissance' => 'bonne connaissance',
- 'expert' => 'expert'
-);
-
-$res = XDB::iterRow("SELECT id, text_fr, FIND_IN_SET('titre',flags) FROM competences_def");
-
-while(list($tmp_id, $tmp_text_fr, $tmp_title) = $res->next()){
- $comppros_def[$tmp_id] = $tmp_text_fr;
- $comppros_title[$tmp_id] = $tmp_title;
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2007 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+class ProfileSection implements ProfileSetting
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $success = true;
+ if (is_null($value)) {
+ $res = XDB::query("SELECT section
+ FROM auth_user_md5
+ WHERE user_id = {?}",
+ S::i('uid'));
+ return intval($res->fetchOneCell());
+ }
+ return intval($value);
+ }
+
+ public function save(ProfilePage &$page, $field, $value)
+ {
+ XDB::execute("UPDATE auth_user_md5
+ SET section = {?}
+ WHERE user_id = {?}",
+ $value, S::i('uid'));
+ }
+}
+
+class ProfileGroup implements ProfileSetting
+{
+ private $table;
+ private $user_field;
+ private $group_field;
+
+ public function __construct($table, $user, $group)
+ {
+ $this->table = $table;
+ $this->user_field = $user;
+ $this->group_field = $group;
+ }
+
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ if (is_null($value)) {
+ $value = array();
+ $res = XDB::iterRow("SELECT g.id, g.text
+ FROM {$this->table}_def AS g
+ INNER JOIN {$this->table}_ins AS i ON (i.{$this->group_field} = g.id)
+ WHERE i.{$this->user_field} = {?}",
+ S::i('uid'));
+ while (list($gid, $text) = $res->next()) {
+ $value[intval($gid)] = $text;
+ }
+ }
+ if (!is_array($value)) {
+ $value = array();
+ }
+ ksort($value);
+ $success = true;
+ return $value;
+ }
+
+ public function save(ProfilePage &$page, $field, $value)
+ {
+ XDB::execute("DELETE FROM {$this->table}_ins
+ WHERE {$this->user_field} = {?}",
+ S::i('uid'));
+ if (!count($value)) {
+ return;
+ }
+ $insert = array();
+ foreach ($value as $id=>$text) {
+ $insert[] = '(' . S::i('uid') . ", $id)";
+ }
+ XDB::execute("INSERT INTO {$this->table}_ins ({$this->user_field}, {$this->group_field})
+ VALUES " . implode(',', $insert));
+ }
+}
+
+class ProfileGroups extends ProfilePage
+{
+ protected $pg_template = 'profile/groups.tpl';
+
+ public function __construct(PlWizard &$wiz)
+ {
+ parent::__construct($wiz);
+ $this->settings['section'] = new ProfileSection();
+ $this->settings['binets'] = new ProfileGroup('binets', 'user_id', 'binet_id');
+ $this->settings['groupesx'] = new ProfileGroup('groupesx', 'guid', 'gid');
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2007 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+class ProfileJob extends ProfileGeoloc
+{
+ private $pub;
+ private $mail;
+ private $web;
+ private $tel;
+ private $bool;
+ private $checks;
+
+ public function __construct()
+ {
+ $this->pub = new ProfilePub();
+ $this->mail = new ProfileEmail();
+ $this->web = new ProfileWeb();
+ $this->tel = new ProfileTel();
+ $this->bool = new ProfileBool();
+ $this->checks = array('web' => array('web'),
+ 'mail' => array('email'),
+ 'tel' => array('tel', 'fax', 'mobile'),
+ 'pub' => array('pub', 'tel_pub', 'email_pub'));
+ }
+
+ private function cleanJob(ProfilePage &$page, array &$job, &$success)
+ {
+ $success = true;
+ foreach ($this->checks as $obj=>&$fields) {
+ $chk =& $this->$obj;
+ foreach ($fields as $field) {
+ $job[$field] = $chk->value($page, $field, $job[$field], $s);
+ if (!$s) {
+ $success = false;
+ $job[$field . '_error'] = true;
+ }
+ }
+ }
+ $job['adr']['pub'] = $this->pub->value($page, 'adr_pub', @$job['adr']['pub'], $s);
+ $job['adr']['checked'] = $this->bool->value($page, 'adr_checked', @$job['adr']['checked'], $s);
+ unset($job['removed']);
+ unset($job['new']);
+ unset($job['adr']['changed']);
+ unset($job['adr']['parsevalid']);
+ unset($job['adr']['display']);
+ }
+
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $init = false;
+ if (is_null($value)) {
+ $value = $page->values['jobs'];
+ $init = true;
+ }
+ $success = true;
+ foreach ($value as $key=>&$job) {
+ if (@$job['removed'] || !trim($job['name'])) {
+ unset($value[$key]);
+ }
+ }
+ foreach ($value as $key=>&$job) {
+ $ls = true;
+ $this->geolocAddress($job['adr'], $s);
+ $ls = ($ls && $s);
+ $this->cleanJob($page, $job, $s);
+ $ls = ($ls && $s);
+ if (!$init) {
+ $success = ($success && $ls);
+ }
+ }
+ return $value;
+ }
+
+ public function save(ProfilePage &$page, $field, $value)
+ {
+ XDB::execute("DELETE FROM entreprises
+ WHERE uid = {?}",
+ S::i('uid'));
+ $i = 0;
+ foreach ($value as &$job) {
+ XDB::execute("INSERT INTO entreprises (uid, entrid, entreprise, secteur, ss_secteur,
+ fonction, poste, adr1, adr2, adr3, postcode,
+ city, cityid, country, region, regiontxt,
+ tel, fax, mobile, email, web,
+ pub, adr_pub, tel_pub, email_pub, flags)
+ VALUES ({?}, {?}, {?}, {?}, {?},
+ {?}, {?}, {?}, {?}, {?}, {?},
+ {?}, {?}, {?}, {?}, {?},
+ {?}, {?}, {?}, {?}, {?},
+ {?}, {?}, {?}, {?}, {?})",
+ S::i('uid'), $i++, $job['name'], $job['secteur'], $job['ss_secteur'],
+ $job['fonction'], $job['poste'], $job['adr']['adr1'], $job['adr']['adr2'], $job['adr']['adr3'],
+ $job['adr']['postcode'],
+ $job['adr']['city'], $job['adr']['cityid'], $job['adr']['country'], $job['adr']['region'],
+ $job['adr']['regiontxt'],
+ $job['tel'], $job['fax'], $job['mobile'], $job['email'], $job['web'],
+ $job['pub'], $job['adr']['pub'], $job['tel_pub'], $job['email_pub'],
+ $job['adr']['checked'] ? 'geoloc' : '');
+ }
+ }
+}
+
+class ProfileJobs extends ProfilePage
+{
+ protected $pg_template = 'profile/jobs.tpl';
+
+ public function __construct(PlWizard &$wiz)
+ {
+ parent::__construct($wiz);
+ $this->settings['cv'] = null;
+ $this->settings['jobs'] = new ProfileJob();
+ }
+
+ protected function fetchData()
+ {
+ if (count($this->orig) > 0) {
+ $this->values = $this->orig;
+ return;
+ }
+ // Checkout the CV
+ $res = XDB::query("SELECT cv
+ FROM auth_user_md5
+ WHERE user_id = {?}",
+ S::i('uid'));
+ $this->values['cv'] = $res->fetchOneCell();
+
+ // Build the jobs tree
+ $res = XDB::iterRow("SELECT e.entreprise, e.secteur, e.ss_secteur,
+ e.fonction, e.poste, e.adr1, e.adr2, e.adr3,
+ e.postcode, e.city, e.cityid, e.region, e.regiontxt,
+ e.country, gp.pays, gp.display,
+ FIND_IN_SET('geoloc', flags),
+ e.tel, e.fax, e.mobile, e.email, e.web, e.pub,
+ e.adr_pub, e.tel_pub, e.email_pub
+ FROM entreprises AS e
+ INNER JOIN geoloc_pays AS gp ON(gp.a2 = e.country)
+ WHERE uid = {?} AND entreprise != ''
+ ORDER BY entrid", S::i('uid'));
+ $this->values['jobs'] = array();
+ while (list($name, $secteur, $ss_secteur, $fonction, $poste,
+ $adr1, $adr2, $adr3, $postcode, $city, $cityid,
+ $region, $regiontxt, $country, $countrytxt, $display,
+ $checked, $tel, $fax, $mobile, $email, $web,
+ $pub, $adr_pub, $tel_pub, $email_pub) = $res->next()) {
+ $this->values['jobs'][] = array('name' => $name,
+ 'secteur' => $secteur,
+ 'ss_secteur' => $ss_secteur,
+ 'fonction' => $fonction,
+ 'poste' => $poste,
+ 'adr' => array('adr1' => $adr1,
+ 'adr2' => $adr2,
+ 'adr3' => $adr3,
+ 'postcode' => $postcode,
+ 'city' => $city,
+ 'cityid' => $cityid,
+ 'region' => $region,
+ 'regiontxt' => $regiontxt,
+ 'country' => $country,
+ 'countrytxt' => $countrytxt,
+ 'display' => $display,
+ 'pub' => $adr_pub,
+ 'checked' => $checked),
+ 'tel' => $tel,
+ 'fax' => $fax,
+ 'mobile' => $mobile,
+ 'email' => $email,
+ 'web' => $web,
+ 'pub' => $pub,
+ 'adr_pub' => $adr_pub,
+ 'tel_pub' => $tel_pub,
+ 'email_pub' => $email_pub);
+ }
+ parent::fetchData();
+ }
+
+ protected function saveData()
+ {
+ if ($this->changed['cv']) {
+ XDB::execute("UPDATE auth_user_md5
+ SET cv = {?}
+ WHERE user_id = {?}",
+ $this->values['cv'], S::i('uid'));
+ }
+ parent::saveData();
+ }
+
+ public function prepare(PlatalPage &$page)
+ {
+ parent::prepare($page);
+ $page->assign('secteurs', XDB::iterator("SELECT id, label
+ FROM emploi_secteur"));
+ $page->assign('fonctions', XDB::iterator("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) AS title
+ FROM fonctions_def
+ ORDER BY id"));
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2007 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+class ProfileSecteurs implements ProfileSetting
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $success = true;
+ if (is_null($value)) {
+ $value = array();
+ $res = XDB::iterRow("SELECT m.secteur, m.ss_secteur, ss.label
+ FROM mentor_secteurs AS m
+ INNER JOIN emploi_secteur AS s ON(m.secteur = s.id)
+ INNER JOIN emploi_ss_secteur AS ss ON(s.id = ss.secteur AND m.ss_secteur = ss.id)
+ WHERE m.uid = {?}",
+ S::i('uid'));
+ while (list($s, $ss, $ssname) = $res->next()) {
+ if (!isset($value[$s])) {
+ $value[$s] = array($ss => $ssname);
+ } else {
+ $value[$s][$ss] = $ssname;
+ }
+ }
+ } else if (!is_array($value)) {
+ $value = array();
+ } else if (count($value) > 10) {
+ global $page;
+ $page->trig("Le nombre de secteurs d'expertise est limité à 10");
+ $success = false;
+ }
+ ksort($value);
+ foreach ($value as &$sss) {
+ ksort($sss);
+ }
+ return $value;
+ }
+
+ public function save(ProfilePage &$page, $field, $value)
+ {
+
+ XDB::execute("DELETE FROM mentor_secteurs
+ WHERE uid = {?}",
+ S::i('uid'));
+ if (!count($value)) {
+ return;
+ }
+ foreach ($value as $id=>&$sect) {
+ foreach ($sect as $sid=>&$name) {
+ XDB::execute("INSERT INTO mentor_secteurs (uid, secteur, ss_secteur)
+ VALUES ({?}, {?}, {?})",
+ S::i('uid'), $id, $sid);
+ }
+ }
+ }
+}
+
+class ProfileCountry implements ProfileSetting
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $success = true;
+ if (is_null($value)) {
+ $value = array();
+ $res = XDB::iterRow("SELECT m.pid, p.pays
+ FROM mentor_pays AS m
+ INNER JOIN geoloc_pays AS p ON(m.pid = p.a2)
+ WHERE m.uid = {?}",
+ S::i('uid'));
+ while (list($id, $name) = $res->next()) {
+ $value[$id] = $name;
+ }
+ } else if (!is_array($value)) {
+ $value = array();
+ } else if (count($value) > 10) {
+ global $page;
+ $page->trig("Le nombre de secteurs d'expertise est limité à 10");
+ $success = false;
+ }
+ ksort($value);
+ return $value;
+ }
+
+ public function save(ProfilePage &$page, $field, $value)
+ {
+ XDB::execute("DELETE FROM mentor_pays
+ WHERE uid = {?}",
+ S::i('uid'));
+ foreach ($value as $id=>&$name) {
+ XDB::execute("INSERT INTO mentor_pays (uid, pid)
+ VALUES ({?}, {?})",
+ S::i('uid'), $id);
+ }
+ }
+}
+
+
+class ProfileMentor extends ProfilePage
+{
+ protected $pg_template = 'profile/mentor.tpl';
+
+ public function __construct(PlWizard &$wiz)
+ {
+ parent::__construct($wiz);
+ $this->settings['expertise'] = null;
+ $this->settings['secteurs'] = new ProfileSecteurs();
+ $this->settings['countries'] = new ProfileCountry();
+ }
+
+ protected function fetchData()
+ {
+ if (count($this->orig) > 0) {
+ $this->values = $this->orig;
+ return;
+ }
+ $res = XDB::query("SELECT expertise
+ FROM mentor
+ WHERE uid = {?}",
+ S::i('uid'));
+ $this->value['expertise'] = $res->fetchOneCell();
+ parent::fetchData();
+ }
+
+ protected function saveData()
+ {
+ parent::saveData();
+ if ($this->changed['expertise']) {
+ XDB::execute("REPLACE INTO mentor (uid, expertise)
+ VALUES ({?}, {?})",
+ S::i('uid'), $this->values['expertise']);
+ }
+ }
+
+ public function prepare(PlatalPage &$page)
+ {
+ parent::prepare($page);
+ $page->assign('secteurs_sel', XDB::iterator("SELECT id, label
+ FROM emploi_secteur"));
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2007 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+interface ProfileSetting
+{
+ /** Get a field and a value, check that the given value is
+ * valid, if not, return a corrected value. If no valid value can be
+ * computed from the input data, the success flag is set to false.
+ *
+ * If value is null, the default value should be returned.
+ * TODO: check this does not conflict with some possible values.
+ *
+ * Whatever happen, this function must always returns the function to
+ * show on the page to the user.
+ */
+ public function value(ProfilePage &$page, $field, $value, &$success);
+
+ /** Save the new value for the given field.
+ */
+ public function save(ProfilePage &$page, $field, $new_value);
+}
+
+abstract class ProfileNoSave implements ProfileSetting
+{
+ public function save(ProfilePage &$page, $field, $new_value) { }
+}
+
+class ProfileWeb extends ProfileNoSave
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ if (is_null($value)) {
+ return isset($page->values[$field]) ? $page->values[$field] : S::v($field);
+ }
+ $value = trim($value);
+ $success = empty($value) || preg_match("{^(https?|ftp)://[a-zA-Z0-9._%#+/?=&~-]+$}i", $value);
+ if (!$success) {
+ global $page;
+ $page->trig('URL Incorrecte : une url doit commencer par http:// ou https:// ou ftp://'
+ . ' et ne pas contenir de caractères interdits');
+ }
+ return $value;
+ }
+}
+
+class ProfileEmail extends ProfileNoSave
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ if (is_null($value)) {
+ return isset($page->values[$field]) ? $page->values[$field] : S::v($field);
+ }
+ $value = trim($value);
+ require_once 'xorg.misc.inc.php';
+ $success = empty($value) || isvalid_email($value);
+ if (!$success) {
+ global $page;
+ $page->trig('Adresse Email invalide');
+ }
+ return $value;
+ }
+}
+
+
+class ProfileTel extends ProfileNoSave
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ if (is_null($value)) {
+ return isset($page->values[$field]) ? $page->values[$field] : S::v($field);
+ }
+ $success = !preg_match('/[<>{}@&#~\/:;?,!§*_`\[\]|%$^=]/', $value, $matches);
+ if (!$success) {
+ global $page;
+ $page->trig('Le numéro de téléphone contient un caractère interdit : ' . pl_entities($matches[0][0]));
+ }
+ return $value;
+ }
+}
+
+class ProfilePub extends ProfileNoSave
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $success = true;
+ if (is_null($value)) {
+ return isset($page->values[$field]) ? $page->values[$field] : S::v($field);
+ }
+ if (is_null($value) || !$value) {
+ $value = 'private';
+ } else if ($value == 'on') { // Checkbox
+ $value = 'public';
+ }
+ return $value;
+ }
+}
+
+class ProfileBool extends ProfileNoSave
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $success = true;
+ if (is_null($value)) {
+ $value = @$page->values[$field];
+ }
+ return $value ? 1 : 0;
+ }
+}
+
+abstract class ProfileGeoloc implements ProfileSetting
+{
+ protected function geolocAddress(array &$address, &$success)
+ {
+ require_once 'geoloc.inc.php';
+ $success = true;
+ unset($address['geoloc']);
+ unset($address['geoloc_cityid']);
+ if (@$address['parsevalid']
+ || (@$address['text'] && @$address['changed'])
+ || (@$address['text'] && !@$address['cityid'])) {
+ $address = array_merge($address, empty_address());
+ $new = get_address_infos(@$address['text']);
+ if (compare_addresses_text(@$address['text'], $geotxt = get_address_text($new))
+ || (@$address['parsevalid'] && @$address['cityid'])) {
+ $address = array_merge($address, $new);
+ $address['checked'] = true;
+ } else if (@$address['parsevalid']) {
+ $address = array_merge($address, cut_address(@$address['text']));
+ $address['checked'] = true;
+ $mailer = new PlMailer('geoloc/mail_geoloc.tpl');
+ $mailer->assign('text', get_address_text($address));
+ $mailer->assign('geoloc', $geotxt);
+ $mailer->send();
+ } else if (@$address['changed'] || !@$address['checked']) {
+ $success = false;
+ $address = array_merge($address, cut_address(@$address['text']));
+ $address['checked'] = false;
+ $address['geoloc'] = $geotxt;
+ $address['geoloc_cityid'] = $new['cityid'];
+ } else {
+ $address = array_merge($address, cut_address(@$address['text']));
+ $address['checked'] = true;
+ }
+ }
+ $address['text'] = get_address_text($address);
+ }
+}
+
+
+abstract class ProfilePage implements PlWizardPage
+{
+ protected $wizard;
+ protected $pg_template;
+ protected $settings = array(); // A set ProfileSetting objects
+ protected $errors = array(); // A set of boolean with the value check errors
+ protected $changed = array(); // A set of boolean indicating wether the value has been changed
+
+ public $orig = array();
+ public $values = array();
+
+ public function __construct(PlWizard &$wiz)
+ {
+ $this->wizard =& $wiz;
+ }
+
+ protected function fetchData()
+ {
+ if (count($this->orig) > 0) {
+ $this->values = $this->orig;
+ return;
+ }
+ foreach ($this->settings as $field=>&$setting) {
+ $success = false;
+ if (!is_null($setting)) {
+ $this->values[$field] = $setting->value($this, $field, null, $success);
+ } else if (!isset($this->values[$field])) {
+ $this->values[$field] = S::v($field);
+ }
+ $this->errors[$field] = false;
+ }
+ $this->orig = $this->values;
+ }
+
+ protected function saveData()
+ {
+ foreach ($this->settings as $field=>&$setting) {
+ if (!is_null($setting) && $this->changed[$field]) {
+ $setting->save($this, $field, $this->values[$field]);
+ }
+ }
+
+ // Update the last modification date
+ XDB::execute('REPLACE INTO user_changes
+ SET user_id = {?}', S::v('uid'));
+ global $platal;
+ $log =& $_SESSION['log'];
+ $log->log('profil', $platal->pl_self(1));
+ }
+
+ protected function checkChanges()
+ {
+ $newvalues = $this->values;
+ $this->values = array();
+ $this->fetchData();
+ $this->values = $newvalues;
+ $changes = false;
+ foreach ($this->settings as $field=>&$setting) {
+ if ($this->orig[$field] != $this->values[$field]) {
+ $this->changed[$field] = true;
+ $changes = true;
+ } else {
+ $this->changed[$field] = false;
+ }
+ }
+ return $changes;
+ }
+
+ protected function markChange()
+ {
+ }
+
+ public function template()
+ {
+ return 'profile/base.tpl';
+ }
+
+ public function prepare(PlatalPage &$page)
+ {
+ if (count($this->values) == 0) {
+ $this->fetchData();
+ }
+ foreach ($this->values as $field=>&$value) {
+ $page->assign($field, $value);
+ }
+ $page->assign('profile_page', $this->pg_template);
+ $page->assign('errors', $this->errors);
+ }
+
+ public function process()
+ {
+ $global_success = true;
+ $this->fetchData();
+ foreach ($this->settings as $field=>&$setting) {
+ $success = false;
+ if (!is_null($setting)) {
+ $this->values[$field] = $setting->value($this, $field, Post::v($field, ''), $success);
+ } else {
+ $success = true;
+ $this->values[$field] = Post::v($field, '');
+ }
+ $this->errors[$field] = !$success;
+ $global_success = $global_success && $success;
+ }
+ if ($global_success) {
+ if ($this->checkChanges()) {
+ $this->saveData();
+ $this->markChange();
+ }
+ return Post::has('next_page') ? PlWizard::NEXT_PAGE : PlWizard::CURRENT_PAGE;
+ }
+ global $page;
+ $page->trig("Certains champs n'ont pas pu être validés, merci de corriger les informations "
+ . "de ton profil et de revalider ta demande");
+ return PlWizard::CURRENT_PAGE;
+ }
+}
+
+require_once dirname(__FILE__) . '/general.inc.php';
+require_once dirname(__FILE__) . '/addresses.inc.php';
+require_once dirname(__FILE__) . '/groups.inc.php';
+require_once dirname(__FILE__) . '/decos.inc.php';
+require_once dirname(__FILE__) . '/jobs.inc.php';
+require_once dirname(__FILE__) . '/skills.inc.php';
+require_once dirname(__FILE__) . '/mentor.inc.php';
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2007 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+class ProfileSkill implements ProfileSetting
+{
+ private $table;
+ private $skill_field;
+ private $text_field;
+
+ public function __construct($table, $skill, $text)
+ {
+ $this->table = $table;
+ $this->skill_field = $skill;
+ $this->text_field = $text;
+ }
+
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ if (is_null($value)) {
+ $value = array();
+ $res = XDB::iterRow("SELECT s.id, s.{$this->text_field}, i.level
+ FROM {$this->table}_def AS s
+ INNER JOIN {$this->table}_ins AS i ON(s.id = i.{$this->skill_field})
+ WHERE i.uid = {?}",
+ S::i('uid'));
+ while (list($sid, $text, $level) = $res->next()) {
+ $value[$sid] = array('text' => $text, 'level' => $level);
+ }
+ }
+ if (!is_array($value)) {
+ $value = array();
+ } else {
+ foreach ($value as $id=>&$skill) {
+ if (!isset($skill['text']) || empty($skill['text'])) {
+ $res = XDB::query("SELECT {$this->text_field}
+ FROM {$this->table}_def
+ WHERE id = {?}", $id);
+ $skill['text'] = $res->fetchOneCell();
+ }
+ }
+ }
+ ksort($value);
+ $success = true;
+ return $value;
+ }
+
+ public function save(ProfilePage &$page, $field, $value)
+ {
+ XDB::execute("DELETE FROM {$this->table}_ins
+ WHERE uid = {?}",
+ S::i('uid'));
+ if (!count($value)) {
+ return;
+ }
+ foreach ($value as $id=>&$skill) {
+ XDB::execute("INSERT INTO {$this->table}_ins (uid, {$this->skill_field}, level)
+ VALUES ({?}, {?}, {?})",
+ S::i('uid'), $id, $skill['level']);
+ }
+ }
+}
+
+class ProfileSkills extends ProfilePage
+{
+ protected $pg_template = 'profile/skill.tpl';
+
+ public function __construct(PlWizard &$wiz)
+ {
+ parent::__construct($wiz);
+ $this->settings['competences'] = new ProfileSkill('competences', 'cid', 'text_fr');
+ $this->settings['langues'] = new ProfileSkill('langues', 'lid', 'langue_fr');
+ }
+
+ public function prepare(PlatalPage &$page)
+ {
+ parent::prepare($page);
+ $page->assign('comp_list', XDB::iterator("SELECT id, text_fr, FIND_IN_SET('titre',flags) AS title
+ FROM competences_def"));
+ $page->assign('comp_level', array('initié' => 'initié',
+ 'bonne connaissance' => 'bonne connaissance',
+ 'expert' => 'expert'));
+ $page->assign('lang_list', XDB::iterator("SELECT id, langue_fr
+ FROM langues_def"));
+ $page->assign('lang_level', array(1 => 'connaissance basique',
+ 2 => 'maîtrise des bases',
+ 3 => 'maîtrise limitée',
+ 4 => 'maîtrise générale',
+ 5 => 'bonne maîtrise',
+ 6 => 'maîtrise complète'));
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-
-$GLOBALS['tabname_array'] = Array(
- "general" => "Général",
- "adresses" => "Adresses\npersonnelles",
- "poly" => "Groupes X\nBinets",
- "deco" => "Décorations\nMédailles",
- "emploi" => "Informations\nprofessionnelles",
- "skill" => "Compétences\ndiverses",
- "mentor" => "Mentoring"
-);
-
-$page->assign('onglets', $GLOBALS['tabname_array']);
-
-function get_next_tab($tabname) {
- $tabname_array = $GLOBALS['tabname_array'];
-
- reset ($tabname_array);
- while (list($current_tab, ) = each($tabname_array)) {
- if ($current_tab == $tabname){
- $res = key($tabname_array);// each() sets key to the next element
- if (is_null($res)) {
- reset($tabname_array);
- return key($tabname_array);
- }
- return $res;
- }
- }
-
- return null;
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-global $adresses;
-reset($adresses);
-
-function insert_new_tel($adrid, $tel) {
- if ($tel['tel'] == "")
- return;
- $r = XDB::query("SELECT MAX(telid+1) FROM tels WHERE uid = {?} AND adrid = {?}", S::v('uid',-1), $adrid);
- $newid = $r->fetchOneCell();
- if (!$newid) $newid = 0;
- XDB::execute( "INSERT INTO tels SET tel_type = {?}, tel_pub = {?},
- tel = {?}, uid = {?}, adrid = {?}, telid = {?}",
- $tel['tel_type'], $tel['tel_pub'], $tel['tel'],
- S::v('uid', -1), $adrid, $newid);
-}
-
-foreach ($adresses as $adrid => $adr) {
- if ($adr['nouvelle'] != 'new') {
- // test si on vient de creer cette adresse dans verif_adresse.inc.php
-
- //construction des bits
- $statut = "";
- if ($adr["secondaire"]) $statut .= 'res-secondaire,';
- if ($adr["courrier"]) $statut .= 'courrier,';
- if ($adr["active"]) $statut .= 'active,';
- if ($adr["temporaire"]) $statut .= 'temporaire,';
- if (! empty($statut)) $statut = substr($statut, 0, -1);
- $precise_coords = "";
- if (isset($adr['precise_lat']) && isset($adr['precise_lon'])) {
- $precise_coords = ", glat = '".$adr['precise_lat']."'";
- $precise_coords .= ", glng = '".$adr['precise_lon']."'";
- }
-
- if ($adr["nouvelle"] == 'ajout') {
- //nouvelle adresse
- if (is_adr_empty($adrid)) {
- unset($adresses[$adrid]);
- continue;
- }
- XDB::execute("INSERT INTO adresses SET adr1 = {?}, adr2 = {?},
- adr3 = {?}, postcode = {?}, city = {?}, cityid = {?},
- country = {?}, region = {?}, regiontxt = {?},
- pub = {?}, datemaj = NOW(), statut = {?}, uid = {?},
- adrid = {?}".$precise_coords, $adr['adr1'], $adr['adr2'],
- $adr['adr3'], $adr['postcode'], $adr['city'],
- $adr['cityid'], $adr['country'], $adr['region'],
- $adr['regiontxt'], $adr['pub'], $statut,
- S::v('uid', -1), $adrid);
- $telsvalues = "";
- foreach ($adr['tels'] as $tel) {
- insert_new_tel($adrid, $tel);
- }
- } else {
- //c'est une mise à jour
- XDB::execute("UPDATE adresses SET adr1 = {?}, adr2 = {?},
- adr3 = {?}, postcode = {?}, city = {?}, cityid = {?},
- country = {?}, region = {?}, regiontxt = {?},
- pub = {?}, datemaj = NOW(), statut = {?}".$precise_coords."
- WHERE uid = {?} AND adrid = {?}", $adr['adr1'],
- $adr['adr2'], $adr['adr3'], $adr['postcode'],
- $adr['city'], $adr['cityid'], $adr['country'],
- $adr['region'], $adr['regiontxt'], $adr['pub'],
- $statut, S::v('uid', -1), $adrid);
- foreach ($adr['tels'] as $tel) {
- if (isset($tel['new_tel'])) {
- if ($tel['new_tel'])
- insert_new_tel($adrid, $tel);
- } else {
- if ($tel['tel'] != "") {
- XDB::execute(
- "UPDATE tels SET
- tel_type = {?},
- tel_pub = {?},
- tel = {?}
- WHERE
- uid = {?} AND
- adrid = {?} AND
- telid = {?}",
- $tel['tel_type'],
- $tel['tel_pub'],
- $tel['tel'],
- S::v('uid', -1),
- $adrid,
- $tel['telid']);
- } else {
- XDB::execute(
- "DELETE FROM tels WHERE
- uid = {?} AND
- adrid = {?} AND
- telid = {?}",
- S::v('uid', -1),
- $adrid,
- $tel['telid']);
- }
- }
- }
- }// fin nouvelle / ancienne adresse
- }//fin if nouvellement crée
-}//fin foreach
-
-
-//on vire les adresses vides :
-if(isset($adresses)){ // s'il y en a
- reset($adresses);
- foreach($adresses as $adrid => $adr){
- // on vire les tels vides
- foreach ($adr['tels'] as $telid => $tel) {
- if ($tel['tel'] == '') unset($adresses[$adrid]['tels'][$telid]);
- }
- if(is_adr_empty($adrid)){
- delete_address($adrid);
- }
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-XDB::execute("UPDATE auth_user_quick SET profile_medals_pub = {?} WHERE user_id = {?}", $medals_pub, S::v('uid', -1));
-
-// vim:set et sws=4 sw=4 sts=4 enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-for($i = 0; $i < 2; $i++){
-
- XDB::execute("REPLACE INTO entreprises(uid,entrid,entreprise,secteur,ss_secteur,poste,fonction,adr1,adr2,adr3,postcode,city,country,region,tel,fax,mobile,pub, adr_pub, tel_pub, email, email_pub, web) ".
- "VALUES ({?}, {?}, {?}, ".
- "{?},".
- "{?}".
- ", {?}, {?}, ".
- "{?}, {?}, {?}, {?}, ".
- "{?}, {?}, ".
- "{?}, {?}, {?}, {?}, ".
- "{?}, {?}, {?}, ".
- "{?}, {?}, {?})",
- S::v('uid', -1) , $i , $entreprise[$i] ,
- ( ($secteur[$i] == "") ? null : $secteur[$i]), //sinon un faux 0 est rentre dans la base
- ( ($ss_secteur[$i] == "") ? null : $ss_secteur[$i]),
- $poste[$i], $fonction[$i],
- $adrpro1[$i], $adrpro2[$i], $adrpro3[$i], $postcodepro[$i],
- $citypro[$i], $countrypro[$i],
- $regionpro[$i], $telpro[$i], $faxpro[$i], $mobilepro[$i],
- $pubpro[$i], $adr_pubpro[$i], $tel_pubpro[$i],
- $emailpro[$i], $email_pubpro[$i], $webpro[$i]);
-}
-XDB::execute("UPDATE auth_user_md5 set cv= {?} WHERE user_id = {?}", $cv, S::v('uid', -1));
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-if ($appli_id1>0)
- XDB::execute("REPLACE INTO applis_ins SET uid= {?}, aid = {?}, type = {?}, ordre = 0", S::v('uid', -1), $appli_id1, $appli_type1);
-else
- XDB::execute("DELETE FROM applis_ins WHERE uid= {?} AND ordre=0", S::v('uid', -1));
-
-if ($appli_id2>0)
- XDB::execute("REPLACE INTO applis_ins SET uid= {?}, aid = {?}, type = {?}, ordre = 1", S::v('uid', -1), $appli_id2, $appli_type2);
-else
- XDB::execute("DELETE FROM applis_ins WHERE uid= {?} AND ordre=1", S::v('uid', -1));
-
-if ($nationalite != $nationalite_anc || $nom != $nom_anc || $prenom != $prenom_anc) {
- $sql = "UPDATE auth_user_md5
- SET nationalite= {?},
- nom = {?},
- prenom = {?} WHERE user_id= {?}";
- XDB::execute($sql, $nationalite, $nom, $prenom, S::v('uid', -1));
-}
-XDB::execute(
- "UPDATE auth_user_quick SET
- profile_nick={?},
- profile_mobile={?}, profile_mobile_pub={?},
- profile_web={?}, profile_web_pub={?},
- profile_freetext={?}, profile_freetext_pub={?},
- profile_from_ax = {?}
- WHERE user_id = {?}",
- $nickname,
- $mobile, $mobile_pub,
- $web, $web_pub,
- $freetext, $freetext_pub,
- $synchro_ax,
- S::v('uid', -1));
-
-if ($nickname != $nickname_anc) {
- require_once('user.func.inc.php');
- user_reindex(S::v('uid', -1));
-}
-XDB::execute("UPDATE photo SET pub = {?} WHERE uid = {?}", $photo_pub, S::v('uid', -1));
-// vim:set et sws=4 sts=4 sw=4 enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-//rien a faire
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-global $adresses;
-
-function generate_new_adrid(){
- global $adresses;
- if(!isset($adresses)) //aucune adresses => retourne 1
- return 1;
- reset($adresses);
- $i = 0;
- $adrid_array = Array();
- foreach($adresses as $numero => $adr){
- $adrid_array[$i] = $numero;
- $i++;
- }
- sort($adrid_array,SORT_NUMERIC); // classe les adrid dans l'ordre croissant
- $new_adrid = 1;
- while(list($key,$current_adrid) = each($adrid_array)){
- if($current_adrid == $new_adrid)
- $new_adrid++;
- else
- return $new_adrid; //s'ils sont differents, il y a un trou dans la liste des adrid donc new_adrid convient
- }
- //si aucun convient, on retourne le plus grand des adrid actuel + 1
- return $new_adrid;
-}
-
-function generate_new_telid($adr){
- $i = 0;
- $telid_array = Array();
- foreach($adr['tels'] as $tel){
- $telid_array[$i] = $tel['telid'];
- $i++;
- }
- sort($telid_array,SORT_NUMERIC); // classe les adrid dans l'ordre croissant
- $new_telid = 0;
- foreach($telid_array as $current_telid)
- if ($current_telid == $new_telid)
- $new_telid ++;
- else
- return $new_telid;//s'ils sont differents, il y a un trou dans la liste des telid donc new_telid convient
- //si aucun convient, on retourne le plus grand des telid actuel + 1
- return $new_telid;
-}
-
-function replace_ifset_adr($varname, $i){
- $tab = Env::v($varname, Array());
- if (isset($tab[$i]))
- $GLOBALS['adresses'][$i][$varname] = $tab[$i];
-}
-
-function replace_ifset_tel($varname, $i, $t){
- $tab = Env::v($varname.$t, Array());
- if (isset($tab[$i]))
- $GLOBALS['adresses'][$i]['tels'][$t][$varname] = $tab[$i];
-}
-
-function get_adr_arg($varname, $i) {
- $tab = Env::v($varname, Array());
- return @$tab[$i];
-}
-
-function set_flag_adr($varname,$i){
- $tab = Env::v($varname, Array());
- if (isset($tab[$i])){
- $GLOBALS['adresses'][$i][$varname] = 1;
- }
- else
- $GLOBALS['adresses'][$i][$varname] = '0';
-}
-
-function replace_tel($i, $t){
- replace_ifset_tel('telid', $i, $t);
- replace_ifset_tel('tel', $i, $t);
- replace_ifset_tel('tel_pub', $i, $t);
- replace_ifset_tel('tel_type', $i, $t);
- replace_ifset_tel('new_tel', $i, $t);
-}
-
-function replace_address($i){
- global $adresses, $nb_tel_max;
- if(!isset($adresses[$i])){
- $adresses[$i]['nouvelle'] = 'ajout';
- $adresses[$i]['adrid'] = $i;
- }
-
- replace_ifset_adr('secondaire', $i);
- set_flag_adr('courrier', $i);
- replace_ifset_adr('temporaire', $i);
- if(Env::i('adrid_active', $i+1) == $i)
- $adresses[$i]['active'] = 1;
- else
- $adresses[$i]['active'] = 0;
- replace_ifset_adr('adr1', $i);
- replace_ifset_adr('adr2', $i);
- replace_ifset_adr('adr3', $i);
- replace_ifset_adr('postcode', $i);
- replace_ifset_adr('city', $i);
- replace_ifset_adr('cityid', $i);
- replace_ifset_adr('country', $i);
- replace_ifset_adr('region', $i);
- replace_ifset_adr('pub', $i);
-
- for ($telid = 0; $telid <= $nb_tel_max; $telid++) {
- $tab = Env::v('telid'.$telid, Array());
- if(isset($tab[$i])){ //ce telid etait donc present dans le formulaire
- replace_tel($i, $telid);
- }
- }
-
- if (!get_adr_arg('parsevalid', $i)) replace_ifset_adr('txt', $i);
- $tab = Env::v('numero_formulaire', Array());
- if($tab[$i])
- $adresses[$i]['numero_formulaire'] = $tab[$i];
- else
- $adresses[$i]['numero_formulaire'] = -1;
-}
-
-function geoloc_adresse($i) {
- global $adresses;
- $change = Env::v('change'.$i);
- if (get_adr_arg('parsevalid', $i) || ($adresses[$i]['txt'] && $change) || (!$adresses[$i]['cityid'])) {
- require_once('geoloc.inc.php');
- // erases the previous address (but not the phone or pub)
- $adresses[$i] = array_merge($adresses[$i], empty_address());
- // localize new address
- $new = get_address_infos($adresses[$i]['txt']);
- if (compare_addresses_text($adresses[$i]['txt'], $geotxt = get_address_text($new)) || get_adr_arg('parsevalid', $i))
- $adresses[$i] = array_merge($adresses[$i], $new);
- else {
- $adresses[$i] = array_merge($adresses[$i], cut_address($adresses[$i]['txt']));
- $adresses[$i]['geoloc'] = $geotxt;
- $adresses[$i]['geoloc_cityid'] = $new['cityid'];
- }
- }
- $adresses[$i]['txt'] = get_address_text($adresses[$i]);
-}
-
-//remplace par les eventuelles nouvelles valeurs :
-for ($adrid = 1; $adrid <= $nb_adr_max; $adrid++) {
- $tab = Env::v('adrid', Array());
- if(isset($tab[$adrid])){ //cet adrid etait donc present dans le formulaire
- replace_address($adrid);
- }
- if (isset($adresses[$adrid]['txt']))
- geoloc_adresse($adrid);
-}
-
-if ($opened_tab == 'adresses' && Env::has('modifier')){ // on ne valide que qd on vient du formulaire
-$adresses_principales = 0;
-reset($adresses);
-foreach($adresses as $adrid => $adr) {
- //validité de chaque adresse
- $description = (($adr['numero_formulaire'] > 0)?"Adresse n°{$adr['numero_formulaire']}":"Nouvelle adresse");
- if (strlen(strtok($adr['adr1'],"<>{}@~?!§*`|%$^=+")) < strlen($adr['adr1'])) {
- $page->trig("Le champ '$description - Ligne 1' contient un caractère interdit.");
- }
- if (strlen(strtok($adr['adr2'],"<>{}@~?!§*`|%$^=+")) < strlen($adr['adr2'])) {
- $page->trig("Le champ '$description - Ligne 2' contient un caractère interdit.");
- }
- if (strlen(strtok($adr['adr3'],"<>{}@~?!§*`|%$^=+")) < strlen($adr['adr3'])) {
- $page->trig("Le champ '$description - Ligne 3' contient un caractère interdit.");
- }
- if (strlen(strtok($adr['postcode'],"<>{}@~?!§*`|%$^=+")) < strlen($adr['postcode'])) {
- $page->trig("Le champ '$description - Code Postal' contient un caractère interdit.");
- }
- if (is_array($adr['tels'])) {
- foreach ($adr['tels'] as $tel) {
- if (strlen(strtok($tel['tel'],"<>{}@&#~:;?,!§*_`[]|%$^=\"")) < strlen($tel['tel'])) {
- $page->trig("Le champ '$description - ".$tel['tel_type']."' contient un caractère interdit.");
- }
- }
- }
- if(!$adr['secondaire']) {
- if($adresses_principales == 1) { //deja une adresse principale
- $page->trig("Tu ne peux avoir qu'une résidence principale.");
- $adresses_principales++; //pour eviter de repeter le message plusieurs fois
- } else {
- $adresses_principales = 1;
- }
- }
-}
-
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-include_once('xorg.misc.inc.php');
-
-function set_flag_i(&$var,$var_name,$i){
- $tab = Env::v($var_name, array());
- if(isset($tab[$i])){
- $var[$i] = 1;
- }
- else
- $var[$i] = '0';
-}
-
-for($i = 0; $i < 2; $i++){
-replace_ifset_i($entreprise,"entreprise",$i);
-replace_ifset_i($poste,"poste",$i);
-replace_ifset_i($secteur,"secteur",$i);
-replace_ifset_i($ss_secteur,"ss_secteur",$i);
-replace_ifset_i($fonction,"fonction",$i);
-
-replace_ifset_i($adrpro1,"adrpro1",$i);
-replace_ifset_i($adrpro2,"adrpro2",$i);
-replace_ifset_i($adrpro3,"adrpro3",$i);
-replace_ifset_i($postcodepro,"postcodepro",$i);
-replace_ifset_i($citypro,"citypro",$i);
-replace_ifset_i($countrypro,"countrypro",$i);
-replace_ifset_i($regionpro,"regionpro",$i);
-replace_ifset_i($telpro,"telpro",$i);
-replace_ifset_i($faxpro,"faxpro",$i);
-replace_ifset_i($mobilepro,"mobilepro",$i);
-replace_ifset_i($pubpro,"pubpro",$i);
-replace_ifset_i($adr_pubpro,"adr_pubpro",$i);
-replace_ifset_i($tel_pubpro,"tel_pubpro",$i);
-replace_ifset_i($emailpro,"emailpro",$i);
-replace_ifset_i($email_pubpro,"email_pubpro",$i);
-replace_ifset_i($webpro,"webpro",$i);
-replace_ifset($cv,"cv");
-
-// validité de l'entreprise
-$j = $i+1;
-if (strlen(strtok($entreprise[$i],"<>{}#~;!§*`[]|%^=")) < strlen($entreprise[$i]))
-{
- $page->trig("Le champ 'Entreprise $j' contient un caractère interdit.");
-}
-
-//validité du poste
-if (strlen(strtok($poste[$i],"<>{}~?!§*`|%$^=+")) < strlen($poste[$i]))
-{
- $page->trig("Le champ 'Poste $j' contient un caractère interdit.");
-}
-
-// correction du champ web si vide
-if ($webpro[$i]=="http://" or $webpro[$i] == '') {
- $webpro[$i]='';
-} elseif (!preg_match("{^(https?|ftp)://[a-zA-Z0-9._%#+/?=&~-]+$}i", $webpro[$i])) {
- // validité de l'url donnée dans web
- $page->trig("URL incorrecte dans le champ 'Page web', une url doit commencer par
- http:// ou https:// ou ftp:// et ne pas contenir de caractères interdits");
-} else {
- $webpro[$i] = str_replace('&', '&', $webpro[$i]);
-}
-
-// validité de l'e-mail
-if ($emailpro[$i]) {
- $emailpro[$i] = strtolower(trim($emailpro[$i]));
- if (!isvalid_email($emailpro[$i])) {
- $page->trig("Adresse e-mail incorrecte dans le champ 'E-mail'");
- }
-}
-
-if (strlen(strtok($adrpro1[$i],"<>{}@~?!§*`|%$^=+")) < strlen($adrpro1[$i]))
- {
- $page->trig("Le champ 'Adresse professionnelle $j - Ligne 1' contient un caractère interdit.");
- }
- if (strlen(strtok($adrpro2[$i],"<>{}@~?!§*`|%$^=+")) < strlen($adrpro2[$i]))
- {
- $page->trig("Le champ 'Adresse professionnelle $j - Ligne 2' contient un caractère interdit.");
- }
- if (strlen(strtok($adrpro3[$i],"<>{}@~?!§*`|%$^=+")) < strlen($adrpro3[$i]))
- {
- $page->trig("Le champ 'Adresse professionnelle $j - Ligne 3' contient un caractère interdit.");
- }
- if (strlen(strtok($postcodepro[$i],"<>{}@~?!§*`|%$^=+")) < strlen($postcodepro[$i]))
- {
- $page->trig("Le champ 'Code Postal professionnel $j' contient un caractère interdit.");
- }
- if (strlen(strtok($citypro[$i],"<>{}@~?!§*`|%$^=+")) < strlen($citypro[$i]))
- {
- $page->trig("Le champ 'Ville professionnelle $j' contient un caractère interdit.");
- }
- if (strlen(strtok($telpro[$i],"<>{}@&#~\/:;?,!§*_`[]|%$^=")) < strlen($telpro[$i]))
- {
- $page->trig("Le champ 'Téléphone professionnel $j' contient un caractère interdit.");
- }
- if (strlen(strtok($faxpro[$i],"<>{}@&#~\/:;?,!§*_`[]|%$^=")) < strlen($faxpro[$i]))
- {
- $page->trig("Le champ 'Fax professionnel $j' contient un caractère interdit.");
- }
- if (strlen(strtok($mobilepro[$i],"<>{}@&#~\/:;?,!§*_`[]|%$^=")) < strlen($mobilepro[$i]))
- {
- $page->trig("Le champ 'Mobile professionnel $j' contient un caractère interdit.");
- }
-
-}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-function strmatch_whole_words($nouveau, $ancien) {
- $nouveau = strtoupper($nouveau);
- $ancien = strtoupper($ancien);
- $len_nouveau = strlen($nouveau);
- return (($i = strpos($ancien, $nouveau)) !== false && ($i == 0 || $ancien{$i-1} == ' ' || $ancien{$i-1} == '-') && ($i + $len_nouveau == strlen($ancien) || $ancien{$i + $len_nouveau} == ' ' || $ancien{$i+$len_nouveau} == '-'));
-}
-
-// validite du nom
-if ($nom != $nom_anc &&
- !strmatch_whole_words($nom_comp, $nom_anc_comp) &&
- ($nom_anc_comp == $nom_ini || !strmatch_whole_words($nom_comp, $nom_ini))) {
- $page->trig("Le nom que tu as choisi ($nom) est trop loin de ton nom initial ($nom_ini)".(($nom_ini==$nom_anc_comp)?"":" et de ton nom précédent ($nom_anc)"));
-}
-
-// validite du prenom
-if ($prenom != $prenom_anc &&
- !strmatch_whole_words($prenom_comp, $prenom_anc_comp) &&
- ($prenom_anc_comp == $prenom_ini || !strmatch_whole_words($prenom_comp, $prenom_ini))) {
- $page->trig("Le prénom que tu as choisi ($prenom) est trop loin de ton prénom initial ($prenom_ini)".(($prenom_ini==$prenom_anc_comp)?"":" et de ton prénom précédent ($prenom_anc)"));
-}
-
-// validité du mobile
-if (strlen(strtok($mobile,"<>{}@&#~\/:;?,!§*_`[]|%$^=")) < strlen($mobile)) {
- $page->trig("Le champ 'Téléphone mobile' contient un caractère interdit.");
-}
-
-// correction du champ web si vide
-if ($web=="http://" or $web == '') {
- $web='';
-} elseif (!preg_match("{^(https?|ftp)://[a-zA-Z0-9._%#+/?=&~-]+$}i", $web)) {
- // validité de l'url donnée dans web
- $page->trig("URL incorrecte dans le champ 'Page web perso', une url doit commencer par
- http:// ou https:// ou ftp:// et ne pas contenir de caractères interdits");
-} else {
- $web = str_replace('&', '&', $web);
-}
-
-//validité du champ libre
-if (strlen(strtok($freetext,"<>")) < strlen($freetext))
-{
- $page->trig("Le champ 'Complément libre' contient un caractère interdit.");
-}
-
-// vim:set et sws=4 sts=4 sw=4 enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-
-//au cas ou le submit du formulaire vient d'un changement du nouveau secteur
-if(Post::has('mentor_expertise')){
- $mentor_expertise = Post::v('mentor_expertise');
- if(!empty($mentor_expertise)){
- if (strlen(strtok($mentor_expertise,"<>{}~§`|%$^")) < strlen($mentor_expertise)){//TODO: affiner la liste
- $page->trig("L'expertise contient un caractère interdit.");
- }
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-//rien a faire
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-//mise a jour d'expertise si nécessaire
-
-if($mentor_expertise != $mentor_expertise_bd) {
- XDB::execute("REPLACE INTO mentor(uid, expertise) VALUES({?}, {?})", S::v('uid', -1), $mentor_expertise);
+function smarty_function_geoloc_country($params, &$smarty) {
+ require_once 'geoloc.inc.php';
+ if(!isset($params['country'])) {
+ return;
+ }
+ return geoloc_country($params['country'], @$params['available']);
}
-
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-$sql = "UPDATE auth_user_md5 set section= {?} WHERE user_id= {?}";
-
-XDB::execute($sql, $section, S::v('uid', -1));
+function smarty_function_geoloc_region($params, &$smarty) {
+ require_once 'geoloc.inc.php';
+ if(!isset($params['country']) || !isset($params['region'])) {
+ return;
+ }
+ return geoloc_region($params['country'], $params['region'], @$params['available']);
+}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<div class="wizard" style="clear: both">
+ <div class="wiz_header">
+ {foreach from=$pages item=title key=id}
+ <div class="wiz_tab {if $id eq $current}active{/if} {if !$stateless && $current gt $id}grayed{/if}"
+ style="float: left; width: {$tab_width}%">
+ {if $stateless || $id gt $current}<a href="{$wiz_baseurl}/{$lookup[$id]}">{/if}
+ {$title}
+ {if $stateless || $id gt $current}</a>{/if}
+ </div>
+ {/foreach}
+ <div style="clear: both"></div>
+ </div>
+ <div class="wiz_content" style="clear: both">
+ {foreach from=$xorg_errors item=err}
+ <div class="erreur">{$err|smarty:nodefaults}</div>
+ {/foreach}
+ {include file=$wiz_page}
+ </div>
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{* *}
{**************************************************************************}
- {if $adr.geoloc}
- <tr>
- <td class="cold" colspan="5">
- <input type="hidden" name="change{$adrid}" value="0"/>
- <span class="erreur">La geolocalisation n'a pas donné un résultat certain, valide la nouvelle adresse ou modifie l'ancienne pour que ton adresse puisse être prise en compte.</span><br />
- <script type="text/javascript">setTimeout("document.location += '#adr{$adrid}'", 10);</script>
- <textarea name="txt[{$adrid}]" cols="30" rows="4" onchange="form.change{$adrid}.value=1"
- {if !$adr.cityid}style="background:#FAA"{/if}
- >{$adr.txt}</textarea>
- <textarea cols="30" rows="4"
- style="border:inherit;background:#AFA"
- onclick="blur()"
- >{$adr.geoloc}</textarea><p class="right">
- [<a href="profile/edit/{$onglet}?parsevalid[{$adrid}]=1&modifier=1">Valider</a>]
- </p>
- {else}
- <tr class="center">
- <td class="cold" colspan="5">
- <input type="hidden" name="change{$adrid}" />
- <textarea name="txt[{$adrid}]" cols="43" rows="4" onchange="form.change{$adrid}.value=1"
- {if $adr.nouvelle != 'new' && !$adr.cityid}style="background:#FAA"{/if}
- >{$adr.txt}</textarea>
- {/if}
- <input type="hidden" name="cityid[{$adrid}]" value="{$adr.cityid}" />
- <input type="hidden" name="adr1[{$adrid}]" value="{$adr.adr1}" />
- <input type="hidden" name="adr2[{$adrid}]" value="{$adr.adr2}" />
- <input type="hidden" name="adr3[{$adrid}]" value="{$adr.adr3}" />
- <input type="hidden" name="postcode[{$adrid}]" value="{$adr.postcode}"/>
- <input type="hidden" name="city[{$adrid}]" value="{$adr.city}" />
- <input type="hidden" name="country[{$adrid}]" value="{$adr.country}" />
- <input type="hidden" name="region[{$adrid}]" value="{$adr.region}" />
- </td>
- </tr>
+<input type="hidden" name="{$name}[changed]" value="0"/>
+{if $adr.geoloc}
+<div class="erreur" id="{$id}_geoloc_error">
+ La geolocalisation n'a pas donné un résultat certain, valide la nouvelle adresse
+ ou modifie l'ancienne pour que ton adresse puisse être prise en compte.
+</div>
+<script type="text/javascript">setTimeout("document.location += '#{$adid}'", 10);</script>
+{/if}
+<div>
+<textarea name="{$name}[text]" cols="30" rows="4"
+ onchange="form['{$name}[changed]'].value=1"
+ {if !$adr.cityid && $adr.datemaj}class="error"{/if}
+ >{$adr.text}</textarea>
+{if $adr.geoloc}
+<span id="{$id}_geoloc">
+<textarea cols="30" rows="4"
+ class="valid"
+ name="{$name}[geoloc]"
+ onclick="blur()"
+ >{$adr.geoloc}</textarea>
+<input type="hidden" name="{$name}[geoloc_cityid]" value="{$adr.geoloc_cityid}" />
+<input type="hidden" name="{$name}[parsevalid]" value="0" />
+</span>
+</div>
+<div class="center" id="{$id}_geoloc_valid">
+ <a href="javascript:validAddress('{$id}', '{$name}')">Valider ta version</a>
+ •
+ <a href="javascript:validGeoloc('{$id}', '{$name}')">Valider la version géolocalisée</a>
+{/if}
+</div>
+<input type="hidden" name="{$name}[cityid]" value="{$adr.cityid}" />
+<input type="hidden" name="{$name}[adr1]" value="{$adr.adr1}" />
+<input type="hidden" name="{$name}[adr2]" value="{$adr.adr2}" />
+<input type="hidden" name="{$name}[adr3]" value="{$adr.adr3}" />
+<input type="hidden" name="{$name}[postcode]" value="{$adr.postcode}"/>
+<input type="hidden" name="{$name}[city]" value="{$adr.city}" />
+<input type="hidden" name="{$name}[country]" value="{$adr.country}" />
+<input type="hidden" name="{$name}[countrytxt]" value="{$adr.countrytxt}" />
+<input type="hidden" name="{$name}[region]" value="{$adr.region}" />
+<input type="hidden" name="{$name}[regiontxt]" value="{$adr.regiontxt}" />
+<input type="hidden" name="{$name}[checked]" value="{$adr.checked}" />
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{config_load file="mails.conf" section="geoloc_error"}
+{if $mail_part eq 'head'}
+{from full=#from#}
+{to addr=#to#}
+{subject text="Adresse impossible à geolocaliser"}
+{elseif $mail_part eq 'wiki'}
+Un camarade {$smarty.session.forlife} a forcé l'utilisation de l'adresse entrée
+à la main et a refusé la version geolocalisée :
+
+'''Version utilisateur (validée) :'''\\
+{$text|replace:"\n":"\\\\\n"}
+
+'''Version geoloc (refusée) :'''\\
+{$geoloc|replace:"\n":"\\\\\n"}
+
+-- \\
+Webmaster de Polytechnique.org
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
{* *}
{**************************************************************************}
-{if $display neq "mini"}
+{if $display eq "mini"}
+<td class="vert">
+ <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if}
+ {if $disabled}disabled="disabled"{/if} />
+</td>
+<td class="orange">
+ <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if}
+ {if $disabled}disabled="disabled"{/if}/>
+</td>
+<td class="rouge">
+ <input type="radio" name="{$name}" value="private" {if $val eq 'private' || (!$val && !$disabled)}checked="checked"{/if}
+ {if $disabled}disabled="disabled"{/if}/>
+</td>
+{elseif $display eq "div"}
+<span class="vert">
+ <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if}
+ {if $disabled}disabled="disabled"{/if}/>
+</span>
+<span class="orange">
+ <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if}
+ {if $disabled}disabled="disabled"{/if}/>
+</span>
+<span class="rouge">
+ <input type="radio" name="{$name}" value="private" {if $val eq 'private' || (!$val && !$disabled)}checked="checked"{/if}
+ {if $disabled}disabled="disabled"{/if}/>
+</span>
+{else}
+ {if !$notable}
<tr>
<td colspan="5" class="pflags">
+ {/if}
<table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
<tr>
<td class="vert">
- <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if} />
+ <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if}
+ {if $disabled}disabled="disabled"{/if} />
</td>
<td class="texte">
site public
</td>
<td class="orange">
- <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if} />
+ <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if}
+ {if $disabled}disabled="disabled"{/if}/>
</td>
<td class="texte">
transmis à l'AX
</td>
<td class="rouge">
- <input type="radio" name="{$name}" value="private" {if $val eq 'private'}checked="checked"{/if} />
+ <input type="radio" name="{$name}" value="private" {if $val eq 'private' || (!$val && !$disabled)}checked="checked"{/if}
+ {if $disabled}disabled="disabled"{/if} />
</td>
<td class="texte">
privé
</td>
</tr>
</table>
+ {if !$notable}
</td>
</tr>
-{else}
- <td class="vert">
- <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if} />
- </td>
- <td class="orange">
- <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if} />
- </td>
- <td class="rouge">
- <input type="radio" name="{$name}" value="private" {if $val eq 'private'}checked="checked"{/if} />
- </td>
+ {/if}
{/if}
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{if $ajaxadr}
+<?xml version="1.0" encoding="utf-8"?>
+{/if}
+{assign var=adpref value="addresses[$i]"}
+{assign var=adid value="addresses_$i"}
+<input type="hidden" name="{$adpref}[removed]" value="0"/>
+<input type="hidden" name="{$adpref}[datemaj]" value="{$adr.datemaj}"/>
+<table class="bicol" style="display: none; margin-bottom: 1em" id="{$adid}_grayed">
+ <tr>
+ <th class="grayed">
+ <div style="float: right">
+ <a href="javascript:restoreAddress('{$adid}', '{$adpref}')">{icon name=arrow_refresh title="Restaurer l'adresse"}</a>
+ </div>
+ Restaurer l'adresse n°{$i+1}
+ </th>
+ </tr>
+</table>
+<table class="bicol" style="margin-bottom: 1em" id="{$adid}">
+ <tr>
+ <th>
+ <div style="float: left">
+ <input name="{$adpref}[current]" type="radio" value="1" {if $adr.current}checked="checked"{/if}
+ id="{$adid}_current" onchange="checkCurrentAddress(this); return true" />
+ <label for="{$adid}_current" class="smaller" style="font-weight: normal">actuelle</label>
+ </div>
+ <div style="float: right">
+ <a href="javascript:removeAddress('{$adid}', '{$adpref}')">{icon name=cross title="Supprimer l'adresse"}</a>
+ </div>
+ Adresse n°{$i+1}
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <div style="margin-bottom: 0.2em" class="flags">
+ {include file="include/flags.radio.tpl" name="`$adpref`[pub]" notable=true val=$adr.pub display="div"}
+ </div>
+ <div style="clear: both"></div>
+ <div style="float: left">{include file="geoloc/form.address.tpl" name=$adpref id=$adid adr=$adr}</div>
+ <div style="float: left">
+ <div>
+ <input type="radio" name="{$adpref}[temporary]" id="{$adid}_temp_0" value="0"
+ {if !$adr.temporary}checked="checked"{/if} /><label for="{$adid}_temp_0">permanente</label>
+ <input type="radio" name="{$adpref}[temporary]" id="{$adid}_temp_1" value="1"
+ {if $adr.temporary}checked="checked"{/if} /><label for="{$adid}_temp_1">temporaire</label>
+ </div>
+ <div>
+ <input type="radio" name="{$adpref}[secondaire]" id="{$adid}_sec_0" value="0"
+ {if !$adr.secondaire}checked="checked"{/if} /><label for="{$adid}_sec_0">ma résidence principale</label>
+ <input type="radio" name="{$adpref}[secondaire]" id="{$adid}_sec_1" value="1"
+ {if $adr.secondaire}checked="checked"{/if} /><label for="{$adid}_sec_1">une résidence secondaire</label>
+ </div>
+ <div>
+ <input type="checkbox" name="{$adpref}[mail]" id="{$adid}_mail"
+ {if $adr.mail}checked="checked"{/if} />
+ <label for="{$adid}_mail">on peut m'y envoyer du courrier par la poste</label>
+ </div>
+ </div>
+ </td>
+ </tr>
+ <tr class="pair">
+ <td>
+ {foreach from=$adr.tel key=t item=tel}
+ <div id="{"`$adid`_tel_`$t`"}" style="clear: both">
+ {include file="profile/adresses.tel.tpl" t=$t tel=$tel}
+ </div>
+ {/foreach}
+ {if $adr.tel|@count eq 0}
+ <div id="{"`$adid`_tel_0"}" style="clear: both">
+ {include file="profile/adresses.tel.tpl" t=0 tel=0}
+ </div>
+ {/if}
+ <div id="{$adid}_add_tel" class="center" style="clear: both">
+ <a href="javascript:addTel({$i})">
+ {icon name=add title="Ajouter un numéro de téléphone"} Ajouter un numéro de téléphone
+ </a>
+ </div>
+ </td>
+ </tr>
+</table>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{if $ajaxtel}
+<?xml version="1.0" encoding="utf-8"?>
+{/if}
+{assign var=telpref value="`$adpref`[tel][`$t`]"}
+{assign var=telid value="`$adid`_tel_`$t`"}
+<div style="float: right" class="flags">
+ {include file="include/flags.radio.tpl" name="`$telpref`[pub]" val=$tel.pub display="div"}
+</div>
+<span class="titre">N°{$t+1}</span>
+<input type="hidden" name="{$telpref}[removed]" value="0" />
+<input type="text" size="10" maxlength="30" name="{$telpref}[type]" value="{$tel.type|default:"Tél."}" />
+<input type="text" size="19" maxlength="28" name="{$telpref}[tel]" {if $tel.error}class="error"{/if} value="{$tel.tel}" />
+<a href="javascript:removeObject('{$telid}', '{$telpref}')">
+ {icon name=cross title="Supprimer ce numéro de téléphone"}
+</a>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{* *}
{**************************************************************************}
+<script type="text/javascript">//<![CDATA[
+{literal}
+function removeObject(id, pref)
+{
+ document.getElementById(id).style.display = "none";
+ document.forms.prof_annu[pref + "[removed]"].value = "1";
+}
-<div class="blocunite_tab">
- <table class="bicol" cellspacing="0" cellpadding="0" summary="Profil: Adresses personnelles">
- <tr>
- <th colspan="5">
- Adresses personnelles
- </th>
- </tr>
+function restoreObject(id, pref)
+{
+ document.getElementById(id).style.display = '';
+ document.forms.prof_annu[pref + "[removed]"].value = "0";
+}
- {section name=i loop=$nb_adr start=1 max=$nb_adr}
- {*
- $adrid = $ordre_adrid[$i];
- $adr = &$adresses[$adrid];
- *}
- {assign var='adrid' value=$ordre_adrid[i]}
- {assign var='adr' value=$adresses.$adrid}
- <tr>
- <th colspan="5">
- <a id='adr{$adrid}'></a>
- {if $adr.nouvelle != 'new'}Adresse n°{$smarty.section.i.index}{else}Rentre ici une nouvelle adresse{/if}
- <input type="hidden" name="adrid[{$adrid}]" value="{$adrid}" />
- {if $adr.nouvelle == 'new'}
- <input type="hidden" name="numero_formulaire[{$adrid}]" value="0" />
- {else}
- <input type="hidden" name="numero_formulaire[{$adrid}]" value="{$smarty.section.i.index}" />
- {/if}
- {if $adr.nouvelle != 'new'}
- <a href="profile/edit/{$onglet}?adrid_del[{$adrid}]=1" style="color:inherit">{icon name=cross title="Supprimer cette adresse"}</a>
- {/if}
- </th>
- </tr>
- {include file="include/flags.radio.tpl" name="pub[$adrid]" val=$adr.pub}
- <tr>
- <td class="left">
-
- </td>
- <td colspan="4" class="right">
- <em>c'est à cette adresse que je suis actuellement</em>
- <input name="adrid_active" type="radio" value="{$adrid}" {if $adr.active}checked="checked"{/if} />
- </td>
- </tr>
- {if $adr.nouvelle != 'new'}
- {assign var="titre" value="Adresse n°`$smarty.section.i.index` :"}
- {else}
- {assign var="titre" value="Nouvelle adresse :"}
- {/if}
- {include file="geoloc/form.address.tpl" adr=$adr titre=$titre}
- <tr>
- <td class="colg">
- <span class="titre">Adresse:</span>
- </td>
- <td class="cold" colspan="4">
- <input type="radio" name="temporaire[{$adrid}]" value="0" {if !$adr.temporaire}checked="checked"{/if} />
- permanente
- <input type="radio" name="temporaire[{$adrid}]" value="1" {if $adr.temporaire}checked="checked"{/if} />
- temporaire
- </td>
- </tr>
- <tr>
- <td class="colg">
-
- </td>
- <td class="cold" colspan="4">
- <input type="radio" name="secondaire[{$adrid}]" value="0" {if !$adr.secondaire}checked="checked"{/if} />
- ma résidence principale
- <input type="radio" name="secondaire[{$adrid}]" value="1" {if $adr.secondaire}checked="checked"{/if} />
- une résidence secondaire
- </td>
- </tr>
- <tr>
- <td class="colg">
-
- </td>
- <td class="cold" colspan="4">
- <input type="checkbox" name="courrier[{$adrid}]" value="1" {if $adr.courrier}checked="checked"{/if} /> on peut m'y envoyer du courrier par la poste
- </td>
- </tr>
- {foreach from=$adr.tels item="tel"}
- <tr class="flags">
- <td class="colg">
- <input type="hidden" name="telid{$tel.telid}[{$adrid}]" value="{$tel.telid}"/>
- {if $tel.new_tel && !$tel.tel}
- <input type="hidden" name="new_tel{$tel.telid}[{$adrid}]" value="1"/>
- {/if}
- <span class="titre" onclick="this.style.display='none';var d = document.getElementById('tel_type{$adrid}_{$tel.telid}');d.style.display='inline';d.select();d.focus();">{$tel.tel_type} :</span>
- <input id="tel_type{$adrid}_{$tel.telid}" style="display:none" type="text" size="5" maxlength="30" name="tel_type{$tel.telid}[{$adrid}]" value="{$tel.tel_type}"/>
- </td>
- <td>
- <input type="text" size="19" maxlength="28" name="tel{$tel.telid}[{$adrid}]" value="{$tel.tel}" />
- {if $tel.tel}
- <a href="profile/edit/{$onglet}?adrid={$adrid}&telid={$tel.telid}&deltel=1">{icon name=cross title="Supprimer ce tél."}</a>
- {/if}
- </td>
- {include file="include/flags.radio.tpl" name="tel_pub`$tel.telid`[$adrid]" val=$tel.tel_pub display="mini"}
- </tr>
- {/foreach}
- <tr><td colspan="5"> </td></tr>
- {/section}
- <tr><td colspan="5"> </td></tr>
- </table>
+function getAddressElement(adrid, adelement)
+{
+ return document.forms.prof_annu["addresses[" + adrid + "][" + adelement + "]"];
+}
+
+function checkCurrentAddress(newCurrent)
+{
+ var hasCurrent = false;
+ var i = 0;
+ while (getAddressElement(i, 'pub') != null) {
+ var radio = getAddressElement(i, 'current');
+ var removed = getAddressElement(i, 'removed');
+ if (removed.value == "1" && radio.checked) {
+ radio.checked = false;
+ } else if (radio.checked && radio != newCurrent) {
+ radio.checked = false;
+ } else if (radio.checked) {
+ hasCurrent = true;
+ }
+ i++;
+ }
+ if (!hasCurrent) {
+ i = 0;
+ while (getAddressElement(i, 'pub') != null) {
+ var radio = getAddressElement(i, 'current');
+ var removed = getAddressElement(i, 'removed');
+ if (removed.value != "1") {
+ radio.checked= true;
+ return;
+ }
+ i++;
+ }
+ }
+}
+
+function removeAddress(id, pref)
+{
+ removeObject(id, pref);
+ checkCurrentAddress(null);
+ if (document.forms.prof_annu[pref + '[datemaj]'].value != '') {
+ document.getElementById(id + '_grayed').style.display = '';
+ }
+}
+
+function restoreAddress(id, pref)
+{
+ document.getElementById(id + '_grayed').style.display = 'none';
+ checkCurrentAddress(null);
+ restoreObject(id, pref);
+}
+
+function addAddress()
+{
+ var i = 0;
+ while (getAddressElement(i, 'pub') != null) {
+ i++;
+ }
+ $("#add_adr").before('<div id="addresses_' + i + '_cont"></div>');
+ Ajax.update_html('addresses_' + i + '_cont', 'profile/ajax/address/' + i, checkCurrentAddress);
+}
+
+function addTel(id)
+{
+ var i = 0;
+ var adid = 'addresses_' + id;
+ var tel = adid + '_tel_';
+ while (document.getElementById(tel + i) != null) {
+ i++;
+ }
+ $('#' + adid + '_add_tel').before('<div id="' + tel + i + '" style="clear: both"></div>');
+ Ajax.update_html(tel + i, 'profile/ajax/tel/' + id + '/' + i);
+}
+
+function validGeoloc(id, pref)
+{
+ document.getElementById(id + '_geoloc').style.display = 'none';
+ document.getElementById(id + '_geoloc_error').style.display = 'none';
+ document.getElementById(id + '_geoloc_valid').style.display = 'none';
+ document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
+ document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value;
+ attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
+ function() { document.forms.prof_annu[pref + "[text]"].blur(); });
+ document.forms.prof_annu[pref + "[text]"].className = '';
+}
+
+function validAddress(id, pref)
+{
+ document.getElementById(id + '_geoloc').style.display = 'none';
+ document.getElementById(id + '_geoloc_error').style.display = 'none';
+ document.getElementById(id + '_geoloc_valid').style.display = 'none';
+ document.forms.prof_annu[pref + "[parsevalid]"].value = "0";
+ attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
+ function() { document.forms.prof_annu[pref + "[text]"].blur(); });
+ document.forms.prof_annu[pref + "[text]"].className = '';
+}
+
+{/literal}
+//]]></script>
+
+{foreach key=i item=adr from=$addresses}
+<div id="{"addresses_`$i`_cont"}">
+{include file="profile/adresses.address.tpl" i=$i adr=$adr}
+</div>
+{/foreach}
+{if $addresses|@count eq 0}
+<div id="addresses_0_cont">
+{include file="profile/adresses.address.tpl" i=0 adr=0}
+</div>
+{/if}
+
+<div id="add_adr" class="center">
+ <a href="javascript:addAddress()">
+ {icon name=add title="Ajouter une adresse"} Ajouter une adresse
+ </a>
</div>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<form action="{$wiz_baseurl}/{$lookup[$current]}" method="post" id="prof_annu">
+ <div>
+ {icon name=information title="Voir ma fiche"} Tu peux consulter ta fiche telle que la
+ voient <a class="popup2" href="profile/{$smarty.session.forlife}">les X</a>,
+ <a class="popup2" href="profile/{$smarty.session.forlife}?view=ax">l'AX</a> ou
+ <a class="popup2" href="profile/{$smarty.session.forlife}?view=public">n'importe quel internaute</a>.
+ {include file="include/flags.radio.tpl" notable=true disabled=true name="profile_ex_pub"}
+ </div>
+ <div style="margin-top: 1em">
+ {include file=$profile_page}
+ </div>
+ <div style="clear: both" class="center">
+ <input type="hidden" name="valid_page" value="{$current}" />
+ <input type="submit" name="current_page" value="Valider les modifications" />
+ <input type="submit" name="next_page" value="Valider et passer à la page suivante" />
+ </div>
+</form>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{if $ajaxdeco}
+<?xml version="1.0" encoding="utf-8"?>
+{/if}
+<div id="medal_{$id}" style="clear: both; margin-top: 1em; height: 50px; vertical-align: middle">
+ <div style="float: left; margin-right: 0.3em">
+ <img src="profile/medal/{$id}" height="50" />
+ </div>
+ <div style="float: left; width: 70%">
+ <div><b id="medal_name_{$id}"></b>
+ {if !$medal.valid}(en attente de {if $ajaxdeco}validation{else}modération{/if}){/if}</div>
+ <div id="medal_grade_{$id}"><input type="hidden" name="medals[{$id}][valid]" value="{$medal.valid}" /></div>
+ </div>
+ <a href="javascript:remove({$id})" style="vertical-align: middle">{icon name="cross" title="Supprimer cette médaille"}</a>
+ {if !$ajaxdeco}
+ <script type="text/javascript">
+ getMedalName({$id});
+ buildGrade({$id}, {$medal.grade});
+ </script>
+ {/if}
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{**************************************************************************}
-{literal}
<script type="text/javascript">//<![CDATA[
- var valid = new array();
- function medal_add()
- {
- var selid = document.forms.prof_annu.medal_sel.selectedIndex;
- document.forms.prof_annu.medal_id.value = document.forms.prof_annu.medal_sel.options[selid].value;
- document.forms.prof_annu.grade_id.value = document.forms.prof_annu.grade_sel.value;
- document.forms.prof_annu.medal_op.value = "ajouter";
- document.forms.prof_annu.submit();
- }
+{literal}
+var subgrades = new array();
+var names = new array();
- function medal_del( id )
- {
- document.forms.prof_annu.medal_id.value = id;
- document.forms.prof_annu.medal_op.value = "retirer";
- document.forms.prof_annu.submit();
+function update()
+{
+ var val = document.forms.prof_annu['medal_sel'].value;
+ if (val == '' || document.getElementById('medal_' + val) != null) {
+ document.getElementById('medal_add').style.display = 'none';
+ } else {
+ document.getElementById('medal_add').style.display = '';
}
+}
- function medal_cancel(stamp)
- {
- document.forms.prof_annu.medal_id.value = stamp;
- document.forms.prof_annu.medal_op.value = "annuler";
- document.forms.prof_annu.submit();
- }
- var subgrades = new array();
- function getoption( select_input, j)
- {
- if (!document.all)
- {
- return select_input.options[j];
- }
- else
- {
- return j;
- }
- }
- function medal_grades( sel_medal )
- {
- var subg = subgrades[sel_medal.selectedIndex];
- document.getElementById("grade_sel_div").style.display = subg?"inline":"none";
- if (!subg) return;
- var select = document.getElementById("grade_sel");
- while (select.length > 1)
- {
- select.remove(1);
- }
+function getMedalName(id)
+{
+ document.getElementById('medal_name_' + id).innerHTML = names[id];
+}
- for (i=0; i < subg.length; i++)
- {
- var dmc = document.createElement("option");
- dmc.text= subg[i][1];
- dmc.value = subg[i][0];
- select.add(dmc,getoption(select,i));
+function buildGrade(id, current)
+{
+ var grade;
+ var subg = subgrades[id];
+ var obj = $('#medal_grade_' + id);
+ if (!subg) {
+ obj.prepend('<input type="hidden" name="medals[' + id + '][grade]" value="0" />');
+ } else {
+ var html = 'Agrafe : <select name="medals[' + id + '][grade]">';
+ html += '<option value="0">Non précisée</option>';
+ for (grade = 0 ; grade < subg.length ; grade++) {
+ html += '<option value="' + subg[grade][0] + '">' + subg[grade][1] + '</option>';
}
- var vide = document.createElement("option");
- vide.text = "";
- vide.value = 0;
- select.add(vide,getoption(select,0));
- select.remove(subg.length+1);
+
+ html += '</select>';
+ obj.prepend(html);
}
- //]]>
+}
+
+function makeAddProcess(id)
+{
+ return function(data)
+ {
+ $('#medals').after(data);
+ update();
+ getMedalName(id);
+ buildGrade(id, 0);
+ };
+}
+
+function add()
+{
+ var id = document.forms.prof_annu['medal_sel'].value;
+ $.get(platal_baseurl + 'profile/ajax/medal/' + id, makeAddProcess(id));
+}
+
+function remove(id)
+{
+ $("#medal_" + id).remove();
+ update();
+}
+
{/literal}
{foreach from=$medal_list key=type item=list}
- {foreach from=$list item=m}{if $grades[$m.id]|@count}
+ {foreach from=$list item=m}
+ names[{$m.id}] = "{$m.text}";
+ {if $grades[$m.id]|@count}
+ names[{$m.id}] = "{$m.text}";
subgrades[{$m.id}] = new array({$grades[$m.id]|@count});
- i = 0;
{foreach from=$grades[$m.id] item=g}
- subgrades[{$m.id}][i] = [{$g.gid},"{$g.text}"];
- i++;
+ subgrades[{$m.id}][{$g.gid-1}] = [{$g.gid},"{$g.text}"];
{/foreach}
{/if}{/foreach}
{/foreach}
+//]]></script>
-</script>
-
-{if $smarty.request.medal_op eq "ajouter"}
-<div class="erreur">
- Ta demande a bien été prise en compte, elle sera validée prochainement par un administrateur.
-</div>
-{/if}
-<div class="blocunite_tab">
- <input type="hidden" value="" name="medal_op" />
- <input type="hidden" value="" name="medal_id" />
- <input type="hidden" value="" name="grade_id" />
- <table class="bicol" cellspacing="0" cellpadding="0">
- <tr>
- <th colspan="3">
- Médailles, Décorations, Prix, ...
- </th>
- </tr>
- <tr>
- <td colspan="3" class="pflags">
- <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
- <tr>
- <td class="vert">
- <input type="checkbox" name="medals_pub"{if $medals_pub eq 'public'} checked="checked"{/if} />
- </td>
- <td class="texte">
- ces informations sont normalement publiques (JO, ...) mais tu peux choisir de les associer a ta fiche publique
- </td>
- </tr>
- </table>
- </td>
- </tr>
- {foreach from=$medals item=m}
- <tr>
- <td class="colg">
- <img src='images/medals/{$m.img}' width="32" alt="{$m.medal}" title="{$m.medal}" />
- </td>
- <td class="colm">
- <span class="valeur">{$m.medal}</span><br />
- {if $grades[$m.id]|@count}
- {foreach from=$grades[$m.id] item=g}
- {if $g.gid eq $m.gid}{$g.text}{/if}
- {/foreach}
- {/if}
- </td>
- <td class="cold">
- <span class="lien">
- <a href="javascript:medal_del({$m.id});">retirer</a>
- </span>
- </td>
- </tr>
- {/foreach}
- {foreach from=$medals_valid item=v}
- <tr>
- <td class="colg">
- <img
- {foreach from=$medal_list item=list}
- {foreach from=$list item=m}
- {if $m.id eq $v->mid}src="images/medals/{$m.img}"{/if}
- {/foreach}
- {/foreach}
- title="Validation" alt="Validation" width="32" />
- <td class="colm">
- <span class="valeur">
- {foreach from=$medal_list item=list}
- {foreach from=$list item=m}
- {if $m.id eq $v->mid}{$m.text} <em>(en attente de validation)</em>{/if}
- {/foreach}
- {/foreach}
- </span><br />
- {foreach from=$grades key=mid item=grd}
- {if $mid eq $v->mid}
- {foreach from=$grd item=g}
- {if $g.gid eq $v->gid}{$g.text}{/if}
- {/foreach}
- {/if}
- {/foreach}
- </td>
- <td class="cold">
- <span class="lien">
- <a href="javascript:medal_cancel({$v->stamp});">annuler</a>
- </span>
- </tr>
- </tr>
- {/foreach}
- <tr>
- <td class="colg">
-
- </td>
- <td class="colm">
- <select name="medal_sel" onchange="medal_grades(this)">
+<table class="bicol">
+ <tr>
+ <th>
+ Médailles, Décorations, Prix, ...
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <div class="flags">
+ <div class="vert" style="float: left">
+ <input type="checkbox" name="medals_pub"{if $medals_pub eq 'public'} checked="checked"{/if} />
+ </div>
+ <div class="texte">
+ ces informations sont normalement publiques (JO, ...) mais tu peux choisir de les associer a ta fiche publique
+ </div>
+ </div>
+ <div style="clear: both; margin-top: 0.2em" id="medals">
+ <select name="medal_sel" onchange="update()">
<option value=''></option>
{foreach from=$medal_list key=type item=list}
- <optgroup label="{$trad[$type]}">
+ <optgroup label="{$trad[$type]}...">
{foreach from=$list item=m}
<option value="{$m.id}">{$m.text}</option>
{/foreach}
</optgroup>
{/foreach}
</select>
- <div id="grade_sel_div" style="display:none"><br/>
- <select name="grade_sel" id="grade_sel">
- <option value="0"></option>
- </select>
- </div>
- </td>
- <td class="cold">
- <span class="lien">
- <a href="javascript:medal_add();">ajouter</a>
+ <span id="medal_add">
+ <a href="javascript:add();">{icon name=add title="Ajouter cette médaille"}</a>
</span>
- </td>
- </tr>
- </table>
-</div>
+ </div>
+ {foreach from=$medals item=medal key=id}
+ {include file="profile/deco.medal.tpl" medal=$medal id=$id}
+ {/foreach}
+ </td>
+ </tr>
+</table>
+
+<script type="text/javascript">
+update();
+</script>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
+++ /dev/null
-{**************************************************************************}
-{* *}
-{* Copyright (C) 2003-2007 Polytechnique.org *}
-{* http://opensource.polytechnique.org/ *}
-{* *}
-{* This program is free software; you can redistribute it and/or modify *}
-{* it under the terms of the GNU General Public License as published by *}
-{* the Free Software Foundation; either version 2 of the License, or *}
-{* (at your option) any later version. *}
-{* *}
-{* This program is distributed in the hope that it will be useful, *}
-{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
-{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
-{* GNU General Public License for more details. *}
-{* *}
-{* You should have received a copy of the GNU General Public License *}
-{* along with this program; if not, write to the Free Software *}
-{* Foundation, Inc., *}
-{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
-{* *}
-{**************************************************************************}
-
-
-{section name=adresses_pro loop=2}
-{assign var='i' value=$smarty.section.adresses_pro.index}
-
-<div class="blocunite{if !$i}tab{/if}">
-
- <table class="bicol" cellspacing="0" cellpadding="0" summary="Profil: Informations professionnelles - Entreprise n°{$i+1}">
- <tr>
- <th colspan="2">
- Informations professionnelles - Entreprise n°{$i+1}
- </th>
- </tr>
- {include file=include/flags.radio.tpl name="pubpro[$i]" val=$pubpro.$i}
- <tr>
- <td class="colg">
- <span class="titre">Entreprise ou organisme</span>
- </td>
- <td class="cold">
- <input type="text" size="35" maxlength="100" name="entreprise[{$i}]"
- value="{$entreprise.$i}" />
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Secteur d'activité</span>
- </td>
- <td class="cold">
- <select name="secteur[{$i}]" onchange="this.form.submit();">
- {select_secteur secteur=$secteur.$i}
- </select>
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Sous-Secteur d'activité</span>
- </td>
- <td class="cold">
- <select name="ss_secteur[{$i}]">
- {select_ss_secteur secteur=$secteur.$i ss_secteur=$ss_secteur.$i}
- </select>
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Poste occupé</span>
- </td>
- <td class="cold">
- <input type="text" size="35" maxlength="120" name="poste[{$i}]"
- value="{$poste.$i}" />
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Fonction occupée</span>
- </td>
- <td class="cold">
- <select name="fonction[{$i}]">
- {select_fonction fonction=$fonction.$i}
- </select>
- </td>
- </tr>
- {include file=include/flags.radio.tpl name="adr_pubpro[$i]" val=$adr_pubpro.$i}
- <tr>
- <td class="colg">
- <span class="titre">Adresse professionnelle</span>
- </td>
- <td class="cold">
- <input type="text" name="adrpro1[{$i}]" size="40" maxlength="88" value="{$adrpro1.$i}" />
- </td>
- </tr>
- <tr>
- <td class="colg">
-
- </td>
- <td class="cold">
- <input type="text" name="adrpro2[{$i}]" size="40" maxlength="88" value="{$adrpro2.$i}" />
- </td>
- </tr>
- <tr>
- <td class="colg">
-
- </td>
- <td class="cold">
- <input type="text" name="adrpro3[{$i}]" size="40" maxlength="88" value="{$adrpro3.$i}" />
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Code postal</span><br />
- </td>
- <td class="cold">
- <input type="text" name="postcodepro[{$i}]" value="{$postcodepro.$i}" size="8" maxlength="8" />
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Ville</span><br />
- </td>
- <td class="cold">
- <input type="text" name="citypro[{$i}]" value="{$citypro.$i}" size="40" maxlength="50" />
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Pays</span>
- </td>
- <td class="cold">
- <select name="countrypro[{$i}]" onchange="this.form.submit();">
- {geoloc_country country=$countrypro.$i}
- </select>
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Région ou département</span><br />
- <span class="comm">(selon pays)</span>
- </td>
- <td class="cold">
- <select name="regionpro[{$i}]">
- {geoloc_region country=$countrypro.$i region=$regionpro.$i}
- </select>
- </td>
- </tr>
- {include file=include/flags.radio.tpl name="tel_pubpro[$i]" val=$tel_pubpro.$i}
- <tr>
- <td class="colg">
- <span class="titre">Téléphone professionnel</span>
- </td>
- <td>
- <input type="text" size="18" maxlength="18" name="telpro[{$i}]" value="{$telpro.$i}" />
-
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Fax</span>
- </td>
- <td>
- <input type="text" size="18" maxlength="18" name="faxpro[{$i}]" value="{$faxpro.$i}" />
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Mobile</span>
- </td>
- <td>
- <input type="text" size="18" maxlength="18" name="mobilepro[{$i}]" value="{$mobilepro.$i}" />
- </td>
- </tr>
- {include file=include/flags.radio.tpl name="email_pubpro[$i]" val=$email_pubpro.$i}
- <tr>
- <td class="colg">
- <span class="titre">E-mail</span>
- </td>
- <td>
- <input type="text" size="30" maxlength="60" name="emailpro[{$i}]" value="{$emailpro.$i}" />
- </td>
- </tr>
- <tr>
- <td class="colg">
- <span class="titre">Page web</span>
- </td>
- <td>
- <input type="text" size="30" maxlength="255" name="webpro[{$i}]" value="{$webpro.$i}" />
- </td>
- </tr>
- </table>
-</div>
-
-{/section}
-
-<div class="blocunite">
- <table class="bicol" cellspacing="0" cellpadding="0"
- summary="Profil: Informations professionnelles - CV">
- <tr>
- <th colspan="2">
- Informations professionnelles - CV
- </th>
- </tr>
- <tr>
- <td colspan="2" class="flags">
- <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
- <tr>
- <td class="rouge">
- <input type="checkbox" name="accesCV" checked="checked" disabled="disabled" />
- </td>
- <td class="texte">
- privé
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td class="dcolg">
- <span class="titre">Curriculum vitae</span><br />
- <span class="comm">Le CV n'est <strong>jamais</strong> public.<br />
- <a href="Xorg/FAQ?display=light#cv" class="popup_800x480">Comment remplir mon CV ?</a></span><br />
- <span class="comm"><a href="wiki_help" class="popup3">{icon name=information title="Syntaxe wiki"} Voir la syntaxe wiki</a></span>
- </td>
- <td class="dcold">
- {javascript name=ajax}
- <div id="cv_preview" style="display: none"></div>
- <textarea name="cv" id="cv" rows="15" cols="40">{$cv}</textarea><br />
- <input type="submit" name="preview" value="Aperçu" onclick="previewWiki('cv', 'cv_preview', true, 'cv_preview'); return false;" />
- </td>
- </tr>
- </table>
-</div>
-
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
<span class="comm"></span>
</td>
<td class="cold">
- <input type='text' name='nom' value="{$nom}" />
+ <input type='text' name='nom' {if $errors.nom}class="error"{/if} value="{$nom}" />
</td>
</tr>
<tr>
<span class="comm"></span>
</td>
<td class="cold">
- <input type='text' name='prenom' value="{$prenom}" />
+ <input type='text' name='prenom' {if $errors.prenom}class="error"{/if} value="{$prenom}" />
</td>
</tr>
<tr>
<span class="comm">(4ème année de l'X)</span>
</td>
<td class="cold">
- <select name="appli_id1" onchange="fillType(this.form.appli_type1, this.selectedIndex-1);">
- {applis_options selected=$appli_id1}
+ <select name="appli1[id]" onchange="fillType(this.form['appli1[type]'], this.selectedIndex-1);">
+ {applis_options selected=$appli1.id}
</select>
<br />
- <select name="appli_type1">
+ <select name="appli1[type]">
<option value=""></option>
</select>
<script type="text/javascript">
<!--
- fillType(document.forms.prof_annu.appli_type1, document.forms.prof_annu.appli_id1.selectedIndex-1);
- selectType(document.forms.prof_annu.appli_type1, '{$appli_type1}');
+ fillType(document.forms.prof_annu['appli1[type]'], document.forms.prof_annu['appli1[id]'].selectedIndex-1);
+ selectType(document.forms.prof_annu['appli1[type]'], '{$appli1.type}');
//-->
</script>
</td>
<span class="titre">Post-application</span>
</td>
<td class="dcold">
- <select name="appli_id2" onchange="fillType(this.form.appli_type2, this.selectedIndex-1);">
- {applis_options selected=$appli_id2}
+ <select name="appli2[id]" onchange="fillType(this.form['appli[type]'], this.selectedIndex-1);">
+ {applis_options selected=$appli2.id}
</select>
<br />
- <select name="appli_type2">
+ <select name="appli2[type]">
<option value=""></option>
</select>
<script type="text/javascript">
<!--
- fillType(document.forms.prof_annu.appli_type2, document.forms.prof_annu.appli_id2.selectedIndex-1);
- selectType(document.forms.prof_annu.appli_type2, '{$appli_type2}');
+ fillType(document.forms.prof_annu['appli2[type]'], document.forms.prof_annu['appli2[id]'].selectedIndex-1);
+ selectType(document.forms.prof_annu['appli2[type]'], '{$appli2.type}');
//-->
</script>
</td>
de changer ta photo, celle-ci correspond à ton ancien
profil car la nouvelle n'a pas encore été validée par un administrateur du site !
<a href="profile/{$smarty.session.forlife}?modif=new" class="popup2">Ta fiche avec la nouvelle photo</a>)
- {/if}.
+ {/if} :
</td>
<td class="dcolg">
<img src="photo/{$smarty.session.forlife}" alt=" [ PHOTO ] " />
<span class="titre">Surnom</span>
</td>
<td class="cold">
- <input type="text" size="35" maxlength="64" name="nickname" value="{$nickname}" />
+ <input type="text" size="35" maxlength="64"
+ {if $errors.nick}class="error"{/if} name="nick" value="{$nick}" />
</td>
</tr>
<tr>
</td>
<td class="cold">
<input type="text" size="18" maxlength="18" name="mobile"
- value="{$mobile}" />
+ {if $errors.mobile}class="error"{/if} value="{$mobile}" />
</td>
</tr>
<tr>
</td>
<td class="dcold">
<input type="text" size="35" maxlength="95" name="web"
- value="{$web}" />
+ {if $errors.web}class="error"{/if} value="{$web}" />
</td>
</tr>
<tr>
</tr>
<tr>
<td class="dcolg">
- <span class="titre">Complément libre</span>
- <span class="comm">Commentaire ? ICQ ? etc...</span>
- </td>
- <td class="dcold">
- {javascript name=ajax}
- <div id="ft_preview" style="display: none"></div>
- <textarea name="freetext" id="freetext" rows="3" cols="29" >{$freetext}</textarea>
- <br/>
- <span class="smaller">
+ <div>
+ <span class="titre">Complément libre</span>
+ <span class="comm">Commentaire ? ICQ ? etc...</span>
+ </div>
+ <div class="smaller" style="margin-top: 30px">
<a href="wiki_help/notitle" class="popup3">
{icon name=information title="Syntaxe wiki"} Voir la syntaxe wiki autorisée pour le commentaire
</a>
- </span><br />
- <input type="submit" name="preview" value="Aperçu" onclick="previewWiki('freetext', 'ft_preview', true, 'ft_preview'); return false;" />
+ <div class="center">
+ <input type="submit" name="preview" value="Aperçu"
+ onclick="previewWiki('freetext', 'ft_preview', true, 'ft_preview'); return false;" />
+ </div>
+ </div>
+ </td>
+ <td class="dcold">
+ <div id="ft_preview" style="display: none"></div>
+ <textarea name="freetext" {if $errors.freetext}class="error"{/if}
+ id="freetext" rows="8" cols="35" >{$freetext}</textarea>
</td>
</tr>
</table>
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+
+{literal}
+<script type="text/javascript">//<![CDATA[
+ var gdt = new Date();
+ var year = gdt.getYear();
+ if (year < 1000) {
+ year += 1900;
+ }
+
+ var oldMate = year >= {/literal}{$smarty.session.promo_sortie}{literal};
+
+ function printTitle(text)
+ {
+ if (oldMate) {
+ document.write("ex-" + text);
+ } else {
+ document.write(text);
+ }
+ }
+
+ function update(type)
+ {
+ var val = document.forms.prof_annu[type + '_sel'].value;
+ if (val == '0' || document.getElementById(type + '_' + val) != null) {
+ document.getElementById(type + '_add').style.display = 'none';
+ } else {
+ document.getElementById(type + '_add').style.display = '';
+ }
+ }
+
+ function remove(cat, id)
+ {
+ $('#' + cat + '_' + id).remove();
+ update(cat);
+ }
+
+ function add(cat)
+ {
+ var cb = document.forms.prof_annu[cat + '_sel'];
+ var id = cb.value;
+ var text = cb.options[cb.selectedIndex].text;
+ var html = '<tr id="' + cat + '_' + id + '">'
+ + ' <td>'
+ + ' <input type="hidden" name="' + cat + '[' + id + ']" value="' + text + '" />'
+ + ' </td>'
+ + ' <td>'
+ + ' <div style="float: left; width: 70%">'
+ + text
+ + ' </div>'
+ + ' <a href="javascript:remove(\'' + cat + '\', ' + id + ')">'
+ + ' <img src="images/icons/cross.gif" alt="cross" title="Supprimer ce groupe" />'
+ + ' </a>'
+ + ' </td>'
+ + '</tr>';
+ $('#' + cat).after(html);
+ update(cat);
+ }
+
+ //]]>
+</script>
+{/literal}
+
+<table class="bicol" summary="Profil: Informations Polytechniciennes">
+ <tr>
+ <th colspan="2">
+ Informations polytechniciennes
+ </th>
+ </tr>
+ <tr>
+ <td colspan="2" class="flags">
+ <span class="rouge"><input type="checkbox" name="accesX" checked="checked" disabled="disabled" /></span>
+ <span class="texte">privé</span>
+ </td>
+ </tr>
+ <tr class="top">
+ <td class="titre" style="width: 30%">
+ <script type="text/javascript">printTitle("Section")</script>
+ </td>
+ <td>
+ <select name="section">
+ {select_db_table table="sections" valeur=$section}
+ </select>
+ </td>
+ </tr>
+ <!-- Binets -->
+ <tr id="binets">
+ <td class="titre">
+ <script type="text/javascript">printTitle("Binet(s)")</script>
+ </td>
+ <td>
+ <select name="binets_sel" onchange="update('binets')">
+ {select_db_table table="binets_def" valeur=0 champ="text" pad='1'}
+ </select>
+ <a id="binets_add" href="javascript:add('binets')">{icon name="add" title="Ajouter ce binet"}</a>
+ </td>
+ </tr>
+ {foreach item=text key=bid from=$binets}
+ <tr id="binets_{$bid}">
+ <td>
+ <input type="hidden" name="binets[{$bid}]" value="{$text}" />
+ </td>
+ <td>
+ <div style="float: left; width: 70%">
+ {$text}
+ </div>
+ <a href="javascript:remove('binets', {$bid})">{icon name="cross" title="Supprimer ce binet"}</a>
+ </td>
+ </tr>
+ {/foreach}
+ <!-- Groupes X -->
+ <tr id="groupesx">
+ <td class="titre">Groupe(s) X</td>
+ <td>
+ <select name="groupesx_sel" onchange="update('groupesx')">
+ {select_db_table table="groupesx_def" valeur=0 champ="text" pad='1'}
+ </select>
+ <a id="groupesx_add" href="javascript:add('groupesx')">{icon name="add" title="Ajouter ce groupe X"}</a>
+ </td>
+ </tr>
+ {foreach item=text key=bid from=$groupesx}
+ <tr id="groupesx_{$bid}">
+ <td>
+ <input type="hidden" name="groupesx[{$bid}]" value="{$text}" />
+ </td>
+ <td>
+ <div style="float: left; width: 70%">
+ {$text}
+ </div>
+ <a href="javascript:remove('groupesx', {$bid})">{icon name="cross" title="Supprimer ce groupe X"}</a>
+ </td>
+ </tr>
+ {/foreach}
+</table>
+
+<script type="text/javascript">
+update('groupesx');
+update('binets');
+</script>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{if $ajaxjob}
+<?xml version="1.0" encoding="utf-8"?>
+{/if}
+{assign var=jobid value="job_`$i`"}
+{assign var=jobpref value="jobs[`$i`]"}
+<div id="{$jobid}">
+ <input type="hidden" name="{$jobpref}[removed]" value="0" />
+ <input type="hidden" name="{$jobpref}[new]" value="{if $new}1{else}0{/if}" />
+ <table id="{$jobid}_grayed" class="bicol" style="display: none; margin-bottom: 1em">
+ <tr>
+ <th class="grayed">
+ <div style="float: right">
+ <a href="javascript:restoreJob('{$jobid}', '{$jobpref}')">{icon name=arrow_refresh title="Restaure l'emploi"}</a>
+ </div>
+ Restaurer l'entreprise n°{$i+1} : <span id="{$jobid}_grayed_name"></span>
+ </th>
+ </tr>
+ </table>
+ <table id="{$jobid}_cont" class="bicol" summary="Entreprise n°{$i+1}" style="margin-bottom: 1em">
+ <tr>
+ <th colspan="2" style="text-align: right">
+ <div class="flags" style="float: left; text-align: left">
+ {include file="include/flags.radio.tpl" notable=true display="div" name="`$jobpref`[pub]" value=$job.pub}
+ </div>
+ Entreprise n°{$i+1} :
+ <input type="text" {if $job.name_error}class="error"{/if} size="35" maxlength="100"
+ name="{$jobpref}[name]" value="{$job.name}" />
+ <a href="javascript:removeJob('{$jobid}', '{$jobpref}')">
+ {icon name=cross title="Supprimer cet emploi"}
+ </a>
+ </th>
+ </tr>
+ <tr>
+ <td class="titre">Page Web</td>
+ <td>
+ <input type="text" size="35" maxlength="255" {if $job.web_error}class="error"{/if}
+ name="{$jobpref}[web]" value="{$job.web}" />
+ </td>
+ </tr>
+ <tr>
+ <td class="titre">Secteur d'activité</td>
+ <td>
+ <select name="{$jobpref}[secteur]" onchange="updateSecteur({$i}, '{$jobid}', '{$jobpref}', ''); return true;">
+ <option value=""> </option>
+ {iterate from=$secteurs item=secteur}
+ <option value="{$secteur.id}" {if $secteur.id eq $job.secteur}selected="selected"{/if}>
+ {$secteur.label}
+ </option>
+ {/iterate}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="titre">Sous-Secteur d'activité</td>
+ <td id="{$jobid}_ss_secteur">
+ </td>
+ </tr>
+ <tr>
+ <td class="titre">Poste occupé</td>
+ <td>
+ <input type="text" size="35" maxlength="120" {if $job.poste_error}class="error"{/if}
+ name="{$jobpref}[poste]" value="{$job.poste}" />
+ </td>
+ </tr>
+ <tr>
+ <td class="titre">Fonction occupée</td>
+ <td>
+ <select name="{$jobpref}[fonction]">
+ <option value=""> </option>
+ {assign var=ingroup value=false}
+ {iterate from=$fonctions item=fonct}
+ {if $fonct.title}
+ {if $ingroup}</optgroup>{/if}
+ <optgroup label="{$fonct.fonction_fr}">
+ {assign var=ingroup value=true}
+ {/if}
+ <option value="{$fonct.id}" {if $fonct.id eq $job.fonction}selected="selected"{/if}>
+ {$fonct.fonction_fr}
+ </option>
+ {/iterate}
+ {if $ingroup}</optgroup>{/if}
+ </select>
+ </td>
+ </tr>
+ <tr class="pair">
+ <td colspan="2">
+ <span class="titre">E-mail professionnel :</span>
+ <input type="text" size="30" maxlength="60" {if $job.email_error}class="error"{/if}
+ name="{$jobpref}[email]" value="{$job.email}" />
+ <span class="flags">
+ {include file="include/flags.radio.tpl" name="`$jobpref`[email_pub]" val=$job.mail_pub display="div"}
+ </span>
+ </td>
+ </tr>
+ <tr class="pair">
+ <td colspan="2">
+ <div style="float: left">
+ <div class="titre">Adresse</div>
+ <div class="flags">
+ {include file="include/flags.radio.tpl" name="`$jobpref`[adr][pub]" val=$job.adr.pub display="div"}
+ </div>
+ <div style="margin-top: 20px; clear: both">
+ {include file="geoloc/form.address.tpl" name="`$jobpref`[adr]" id="`$jobid`_adr" adr=$job.adr}
+ </div>
+ </div>
+ <div style="float: right; width: 50%">
+ <div class="titre">Téléphone</div>
+ <div class="flags">
+ {include file="include/flags.radio.tpl" name="`$jobpref`[tel_pub]" val=$job.tel_pub display="div"}
+ </div>
+ <table style="clear: both">
+ <tr>
+ <td>Bureau :</td>
+ <td>
+ <input type="text" size="18" maxlength="18" {if $job.tel_error}class="error"{/if}
+ name="{$jobpref}[tel]" value="{$job.tel}" />
+ </td>
+ </tr>
+ <tr>
+ <td>Fax :</td>
+ <td>
+ <input type="text" size="18" maxlength="18" {if $job.fax_error}class="error"{/if}
+ name="{$jobpref}[fax]" value="{$job.fax}" /></td>
+ </tr>
+ <tr>
+ <td>Mobile :</td>
+ <td>
+ <input type="text" size="18" maxlength="18" {if $job.mobile_error}class="error"{/if}
+ name="{$jobpref}[mobile]" value="{$job.mobile}" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ </table>
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<?xml version="1.0" encoding="utf-8"?>
+<select name="jobs[{$id}][ss_secteur]">
+ <option value=""></option>
+ {iterate from=$ssecteurs item=ssecteur}
+ <option value="{$ssecteur.id}" {if $ssecteur.id eq $sel}selected="selected"{/if}>{$ssecteur.label}</option>
+ {/iterate}
+</select>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<script type="text/javascript">//<![CDATA[
+{literal}
+
+function removeJob(id, pref)
+{
+ document.getElementById(id + '_cont').style.display = 'none';
+ if (document.forms.prof_annu[pref + '[new]'].value == '0') {
+ document.getElementById(id + '_grayed').style.display = '';
+ document.getElementById(id + '_grayed_name').innerHTML =
+ document.forms.prof_annu[pref + "[name]"].value.replace('<', '<');
+ }
+ document.forms.prof_annu[pref + "[removed]"].value = "1";
+}
+
+function restoreJob(id, pref)
+{
+ document.getElementById(id + '_cont').style.display = '';
+ document.getElementById(id + '_grayed').style.display = 'none';
+ document.forms.prof_annu[pref + "[removed]"].value = "0";
+}
+
+function updateSecteur(nb, id, pref, sel)
+{
+ var secteur = document.forms.prof_annu[pref + '[secteur]'].value;
+ if (secteur == '') {
+ secteur = '-1';
+ }
+ Ajax.update_html(id + '_ss_secteur', 'profile/ajax/secteur/' +nb + '/' + secteur + '/' + sel);
+}
+
+function makeAddJob(id)
+{
+ return function(data)
+ {
+ $('#add_job').before(data);
+ updateSecteur('job_' + id, 'jobs[' + id + ']', '');
+ };
+}
+
+function addJob()
+{
+ var i = 0;
+ while (document.getElementById('job_' + i) != null) {
+ ++i;
+ }
+ $.get(platal_baseurl + 'profile/ajax/job/' + i, makeAddJob(i));
+}
+
+function validGeoloc(id, pref)
+{
+ document.getElementById(id + '_geoloc').style.display = 'none';
+ document.getElementById(id + '_geoloc_error').style.display = 'none';
+ document.getElementById(id + '_geoloc_valid').style.display = 'none';
+ document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
+ document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value;
+ document.forms.prof_annu[pref + "[cityid]"].value = document.forms.prof_annu[pref + "[geoloc_cityid]"].value;
+ attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
+ function() { document.forms.prof_annu[pref + "[text]"].blur(); });
+ document.forms.prof_annu[pref + "[text]"].className = '';
+}
+
+function validAddress(id, pref)
+{
+ document.getElementById(id + '_geoloc').style.display = 'none';
+ document.getElementById(id + '_geoloc_error').style.display = 'none';
+ document.getElementById(id + '_geoloc_valid').style.display = 'none';
+ document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
+ attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
+ function() { document.forms.prof_annu[pref + "[text]"].blur(); });
+ document.forms.prof_annu[pref + "[text]"].className = '';
+}
+
+{/literal}
+//]]></script>
+
+{foreach from=$jobs item=job key=i}
+{include file="profile/jobs.job.tpl" i=$i job=$job new=false}
+<script type="text/javascript">updateSecteur({$i}, '{"job_`$i`"}', '{"jobs[`$i`]"}', '{$job.ss_secteur}');</script>
+{/foreach}
+{if $jobs|@count eq 0}
+{include file="profile/jobs.job.tpl" i=0 job=0 new=true}
+<script type="text/javascript">updateSecteur(0, 'job_0', 'jobs[0]', '-1');</script></script>
+{/if}
+
+<div id="add_job" class="center">
+ <a href="javascript:addJob()">
+ {icon name=add title="Ajouter un emploi"} Ajouter un emploi
+ </a>
+</div>
+
+<table class="bicol" summary="CV" style="margin-top: 1.5em">
+ <tr>
+ <th>
+ Curriculum vitae
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <div style="float: left; width: 25%">
+ <div class="flags">
+ <span class="rouge"><input type="checkbox" name="accesCV" checked="checked" disabled="disabled" /></span>
+ <span class="texte">privé</span>
+ </div>
+ <div class="smaller" style="margin-top: 30px">
+ <a href="Xorg/FAQ?display=light#cv" class="popup_800x480">
+ {icon name="lightbulb" title="Astuce"}Comment remplir mon CV ?
+ </a><br />
+ <a href="wiki_help" class="popup3">
+ {icon name=information title="Syntaxe wiki"} Voir la syntaxe wiki
+ </a>
+ <div class="center">
+ <input type="submit" name="preview" value="Aperçu du CV"
+ onclick="previewWiki('cv', 'cv_preview', true, 'cv_preview'); return false;" />
+ </div>
+ </div>
+ </div>
+ <div style="float: right">
+ <div id="cv_preview" style="display: none"></div>
+ <textarea name="cv" {if $errors.cv}class="error"{/if} id="cv" rows="15" cols="55">{$cv}</textarea>
+ </div>
+ </td>
+ </tr>
+</table>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{* *}
{**************************************************************************}
-
+<script type="text/javascript">//<![CDATA[
{literal}
-<script type="text/javascript">
- //<![CDATA[
- function mentor_pays_add()
- {
- var selid = document.forms.prof_annu.mentor_pays_id_new.selectedIndex;
- document.forms.prof_annu.mentor_pays_id.value = document.forms.prof_annu.mentor_pays_id_new.options[selid].value;
- document.forms.prof_annu.mentor_pays_name.value = document.forms.prof_annu.mentor_pays_id_new.options[selid].text;
- document.forms.prof_annu.mentor_pays_op.value = "ajouter";
- document.forms.prof_annu.submit();
- } // function mentor_pays_add()
- function mentor_pays_del( pid )
- {
- document.forms.prof_annu.mentor_pays_id.value = pid;
- document.forms.prof_annu.mentor_pays_op.value = "retirer";
- document.forms.prof_annu.submit();
- } // function mentor_pays_del( pid )
+function updateCountry()
+{
+ var val = document.forms.prof_annu.countries_sel.value;
+ var show = true;
+ if (val == '') {
+ show = false;
+ }
+ if (document.getElementById('countries_' + val) != null) {
+ show = false;
+ }
+ document.getElementById('countries_add').style.display = show ? '' : 'none';
+}
+
+function addCountry()
+{
+ var cb = document.forms.prof_annu.countries_sel;
+ var val = cb.value;
+ var text = cb.options[cb.selectedIndex].text;
+ var html = '<div id="countries_' + val + '" style="clear: both; margin-bottom: 0.7em">'
+ + ' <div style="float: left; width: 50%">' + text + '</div>'
+ + ' <input type="hidden" name="countries[' + val + ']" value="' + text + '" />'
+ + ' <a href="javascript:removeCountry(\'' + val + '\')">'
+ + ' <img src="images/icons/cross.gif" alt="" title="Supprimer ce pays" />'
+ + ' </a>'
+ + '</div>';
+ $('#countries').append(html);
+ updateCountry();
+}
+
+function removeCountry(id)
+{
+ $('#countries_' + id).remove();
+ updateCountry();
+}
+
+function updateSSecteur()
+{
+ var s = document.forms.prof_annu.secteur_sel.value;
+ var ss = document.forms.prof_annu['jobs[-1][ss_secteur]'].value;
+ var show = true;
+ if (s == '' || ss == '') {
+ show = false;
+ }
+ if (document.getElementById('secteurs_' + s + '_' + ss) != null) {
+ show = false;
+ }
+ document.getElementById('secteurs_add').style.display = show ? 'block' : 'none';
+}
+
+function updateSecteur()
+{
+ var secteur = document.forms.prof_annu.secteur_sel.value;
+ if (secteur == '') {
+ secteur = '-1';
+ }
+ $.get(platal_baseurl + 'profile/ajax/secteur/-1/' + secteur,
+ function(data) {
+ data = '<a href="javascript:addSecteur()" style="display: none; float: right" id="secteurs_add">'
+ + ' <img src="images/icons/add.gif" alt="" title="Ajouter ce secteur" />'
+ + '</a>' + data;
+ document.getElementById('ss_secteur_sel').innerHTML = data;
+ attachEvent(document.forms.prof_annu['jobs[-1][ss_secteur]'], 'change', updateSSecteur);
+ });
+}
+
+function addSecteur()
+{
+ var scb = document.forms.prof_annu.secteur_sel;
+ var s = scb.value;
+ var st = scb.options[scb.selectedIndex].text;
- function mentor_secteur_add()
- {
- var selid_secteur = document.forms.prof_annu.mentor_secteur_id_new.selectedIndex;
- document.forms.prof_annu.mentor_secteur_id.value = document.forms.prof_annu.mentor_secteur_id_new.options[selid_secteur].value;
- document.forms.prof_annu.mentor_secteur_name.value = document.forms.prof_annu.mentor_secteur_id_new.options[selid_secteur].text;
- var selid_ss_secteur = document.forms.prof_annu.mentor_ss_secteur_id_new.selectedIndex;
- document.forms.prof_annu.mentor_ss_secteur_id.value = document.forms.prof_annu.mentor_ss_secteur_id_new.options[selid_ss_secteur].value;
- document.forms.prof_annu.mentor_ss_secteur_name.value = document.forms.prof_annu.mentor_ss_secteur_id_new.options[selid_ss_secteur].text;
- document.forms.prof_annu.mentor_secteur_op.value = "ajouter";
- document.forms.prof_annu.submit();
- } // function mentor_secteur_add()
+ var sscb = document.forms.prof_annu['jobs[-1][ss_secteur]'];
+ var ss = sscb.value;
+ var sst = sscb.options[sscb.selectedIndex].text;
- function mentor_secteur_del( sid )
- {
- document.forms.prof_annu.mentor_secteur_id.value = sid;
- document.forms.prof_annu.mentor_secteur_op.value = "retirer";
- document.forms.prof_annu.submit();
- } // function mentor_secteur_del( sid )
+ var html = '<div id="secteurs_' + s + '_' + ss + '" style="clear: both; margin-top: 0.5em" class="titre">'
+ + ' <a href="javascript:removeSecteur(\'' + s + '\', \'' + ss + '\')" style="display: block; float: right">'
+ + ' <img src="images/icons/cross.gif" alt="" title="Supprimer ce secteur" />'
+ + ' </a>'
+ + ' <input type="hidden" name="secteurs[' + s + '][' + ss + ']" value="' + sst + '" />'
+ + ' ' + sst
+ + '</div>';
+ $('#secteurs').append(html);
+ updateSSecteur();
+}
+
+function removeSecteur(s, ss)
+{
+ $('#secteurs_' + s + '_' + ss).remove();
+ updateSSecteur();
+}
- //]]>
-</script>
{/literal}
+//]]></script>
<p>
-Si tu acceptes que ceux de nos camarades qui,
+ Si tu acceptes que ceux des camarades te contactent afin de te demander
+ conseil, dans les domaines que tu connais bien, et pour lesquels tu pourrais
+ les aider, remplis cette rubrique.
+</p>
+<p>
+ Tu peux mentionner ici les domaines de compétences, les expériences
+ notamment internationales sur la base desquels tu seras identifiable depuis
+ <a href="referent/search">la page de recherche d'un conseil professionnel</a>.<br />
</p>
+<p>Le mentoring est particulièrement important pour les camarades :</p>
<ul>
<li>encore jeunes, sont en train de bâtir leur projet professionnel,</li>
<li>ou bien, plus âgés, souhaitent réorienter leur carrière,</li>
</ul>
-<p>
-te contactent afin de te demander conseil, dans les domaines que tu connais
-bien, et pour lesquels tu pourrais les aider, remplis cette rubrique.<br />
-Tu peux mentionner ici les domaines de compétences, les expériences
-notamment internationales sur la base desquels tu seras identifiable depuis
-<a href="referent/search">la page de recherche d'un conseil professionnel</a>.
-</p>
-<div class="blocunite_tab">
- <table class="bicol" cellspacing="0" cellpadding="0" summary="Profil: Mentoring">
- <tr>
- <th colspan="3">
- Pays dont tu connais bien la culture professionnelle
- <input type="hidden" value="" name="mentor_pays_op" />
- <input type="hidden" value="00" name="mentor_pays_id" />
- <input type="hidden" value="" name="mentor_pays_name" />
- </th>
- </tr>
- <tr>
- <td colspan="3" class="pflags">
- <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
- <tr>
- <td class="rouge">
- <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
- </td>
- <td class="texte">
- privé
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr class="impair">
- <td class="colg">
- <span class="titre">Pays</span>
- </td>
- <td class="colm">
- <span class="titre"></span>
- </td>
- <td class="cold" style="width:15%">
-
- </td>
- </tr>
- {foreach from=$mentor_pays item=pays key=i}
- <tr class="{cycle values="pair,impair"}">
- <td class="colg">
- <span class="valeur">{$pays}</span>
- </td>
- <td class="colm">
- <span class="valeur"> </span>
- </td>
- <td class="cold">
- <span class="lien"><a href="javascript:mentor_pays_del('{$mentor_pid.$i}');">retirer</a></span>
- </td>
- </tr>
- {/foreach}
- {if $can_add_pays}
- <tr class="{cycle values="pair,impair"}">
- <td class="colg">
- <select name="mentor_pays_id_new">
- {geoloc_country country='00'}
- </select>
- </td>
- <td class="colm">
- </td>
- <td class="cold">
- <span class="lien"><a href="javascript:mentor_pays_add();">ajouter</a></span>
- </td>
- </tr>
- {/if}
- </table>
-</div>
+<table class="bicol" style="margin-bottom: 1em" summary="Profil: Mentoring">
+ <tr>
+ <th>
+ Pays dont tu connais bien la culture professionnelle
+ </th>
+ </tr>
+ <tr>
+ <td class="flags">
+ <span class="rouge"><input type="checkbox" name="accesX" checked="checked" disabled="disabled" /></span>
+ <span class="texte">privé</span>
+ </td>
+ </tr>
+ <tr class="impair">
+ <td>
+ <div style="float: left; width: 30%" class="titre">Pays</div>
+ <div id="countries_add" style="display: none; float: right">
+ <a href="javascript:addCountry()">{icon name=add title="Ajouter ce pays"}</a>
+ </div>
+ <select name="countries_sel" onchange="updateCountry()">
+ {geoloc_country country='00'}
+ </select>
+ </td>
+ </tr>
+ <tr class="pair">
+ <td id="countries">
+ {foreach from=$countries item=country key=i}
+ <div id="countries_{$i}" style="clear: both; margin-bottom: 0.7em">
+ <div style="float: left; width: 50%">{$country}</div>
+ <input type="hidden" name="countries[{$i}]" value="{$country}" />
+ <a href="javascript:removeCountry('{$i}')">{icon name=cross title="Supprimer ce pays"}</a>
+ </div>
+ {/foreach}
+ </td>
+ </tr>
+</table>
-<div class="blocunite">
- <table class="bicol" cellspacing="0" cellpadding="0"
- summary="Profil: Mentoring">
- <tr>
- <th colspan="3">
- Secteurs d'activité dans lesquels tu as beaucoup exercé
- <input type="hidden" value="" name="mentor_secteur_op" />
- <input type="hidden" value="" name="mentor_secteur_id" />
- <input type="hidden" value="" name="mentor_secteur_name" />
- <input type="hidden" value="" name="mentor_ss_secteur_id" />
- <input type="hidden" value="" name="mentor_ss_secteur_name" />
- </th>
- </tr>
- <tr>
- <td colspan="3" class="pflags">
- <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
- <tr>
- <td class="rouge">
- <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
- </td>
- <td class="texte">
- privé
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr class="impair">
- <td class="colg">
- <span class="titre">Secteur</span>
- </td>
- <td class="colm">
- <span class="titre">Sous-Secteur</span>
- </td>
- <td class="cold" style="width:15%">
-
- </td>
- </tr>
- {foreach from=$mentor_secteur item=secteur key=i}
- <tr class="{cycle values="pair,impair"}">
- <td class="colg">
- <span class="valeur">{$secteur}</span>
- </td>
- <td class="colm">
- <span class="valeur">{$mentor_ss_secteur.$i}</span>
- </td>
- <td class="cold">
- <span class="lien"><a href="javascript:mentor_secteur_del('{$mentor_sid.$i}');">retirer</a></span>
- </td>
- </tr>
- {/foreach}
- {if $can_add_secteurs}
- <tr class="{cycle values="pair,impair"}">
- <td class="colg">
- <select name="mentor_secteur_id_new" onchange="javascript:submit()">
- {select_secteur secteur=$mentor_secteur_id_new}
- </select>
- </td>
- <td class="colm">
- <select name="mentor_ss_secteur_id_new">
- {select_ss_secteur secteur=$mentor_secteur_id_new ss_secteur=''}
- </select>
- </td>
- <td class="cold">
- <span class="lien"><a href="javascript:mentor_secteur_add();">ajouter</a></span>
- </td>
- </tr>
- {/if}
- </table>
-</div>
+<table class="bicol" style="margin-bottom: 1em" summary="Profil: Mentoring">
+ <tr>
+ <th>
+ Secteurs d'activité dans lesquels tu as beaucoup exercé
+ </th>
+ </tr>
+ <tr>
+ <td class="flags">
+ <span class="rouge"><input type="checkbox" name="accesX" checked="checked" disabled="disabled" /></span>
+ <span class="texte">privé</span>
+ </td>
+ </tr>
+ <tr>
+ <td id="secteur_sel">
+ <div style="float: left; width: 30%" class="titre">Secteur</div>
+ <select name="secteur_sel" onchange="updateSecteur()">
+ <option value=""> </option>
+ {iterate from=$secteurs_sel item=secteur}
+ <option value="{$secteur.id}">{$secteur.label}</option>
+ {/iterate}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div style="float: left; width: 30%" class="titre">Sous-secteur</div>
+ <span id="ss_secteur_sel"></span>
+ </td>
+ </tr>
+ <tr class="pair">
+ <td id="secteurs">
+ {if $secteurs|@count}
+ {foreach from=$secteurs item=secteur key=s}
+ {foreach from=$secteur item=ss_sect key=ss}
+ <div id="secteurs_{$s}_{$ss}" style="clear: both; margin-top: 0.5em" class="titre">
+ <a href="javascript:removeSecteur('{$s}', '{$ss}')" style="display: block; float: right">
+ {icon name=cross title="Supprimer ce secteur"}
+ </a>
+ <input type="hidden" name="secteurs[' + s + '][' + ss + ']" value="{$ss_sect}" />
+ {$ss_sect}
+ </div>
+ {/foreach}
+ {/foreach}
+ {/if}
+ </td>
+ </tr>
+</table>
-<div class="blocunite">
- <table class="bicol" cellspacing="0" cellpadding="0"
- summary="Profil: Mentoring">
- <tr>
- <th colspan="3">
- Expérience et expertises que tu acceptes de faire partager
- </th>
- </tr>
- <tr>
- <td colspan="3" class="pflags">
- <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
- <tr>
- <td class="rouge">
- <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
- </td>
- <td class="texte">
- privé
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan="3">
- Dans cette case il te faut indiquer en quelques mots ce qui t'a
- amené à acquérir l'expérience indiquée, et dans quelle mesure tu
- veux bien que ceux de nos camarades qui seraient intéressés par un
- contact avec toi, en prennent l'initiative. <strong>Il est obligatoire de
- remplir cette dernière case pour apparaître dans la base de données
- des "Mentors".</strong>
- <br />
- </td>
- </tr>
- <tr>
- <td colspan="3">
- <textarea rows="8" cols="60" name="mentor_expertise">{$mentor_expertise}</textarea>
- </td>
- </tr>
- </table>
-</div>
+<table class="bicol" summary="Profil: Mentoring">
+ <tr>
+ <th>
+ Expérience et expertises que tu acceptes de faire partager
+ </th>
+ </tr>
+ <tr>
+ <td class="flags">
+ <span class="rouge"><input type="checkbox" name="accesX" checked="checked" disabled="disabled" /></span>
+ <span class="texte">privé</span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Dans cette case il te faut indiquer en quelques mots ce qui t'a
+ amené à acquérir l'expérience indiquée, et dans quelle mesure tu
+ veux bien que ceux de nos camarades qui seraient intéressés par un
+ contact avec toi, en prennent l'initiative. <strong>Il est obligatoire de
+ remplir cette dernière case pour apparaître dans la base de données
+ des "Mentors".</strong>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <textarea rows="8" cols="60" name="expertise">{$expertise}</textarea>
+ </td>
+ </tr>
+</table>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
+++ /dev/null
-{**************************************************************************}
-{* *}
-{* Copyright (C) 2003-2007 Polytechnique.org *}
-{* http://opensource.polytechnique.org/ *}
-{* *}
-{* This program is free software; you can redistribute it and/or modify *}
-{* it under the terms of the GNU General Public License as published by *}
-{* the Free Software Foundation; either version 2 of the License, or *}
-{* (at your option) any later version. *}
-{* *}
-{* This program is distributed in the hope that it will be useful, *}
-{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
-{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
-{* GNU General Public License for more details. *}
-{* *}
-{* You should have received a copy of the GNU General Public License *}
-{* along with this program; if not, write to the Free Software *}
-{* Foundation, Inc., *}
-{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
-{* *}
-{**************************************************************************}
-
-
-{literal}
-<script type="text/javascript">//<![CDATA[
- /** defgroup user_profile Gestion du profil utilisateur */
-
- /** ajout d'un binet au profil de l'utilisateur en base de données
- * le binet est déterminé par binet_id qui est sélectionné dans un SELECT
- * @ingroup user_profile
- * @return VOID
- */
- function binet_add()
- {
- var selid = document.forms.prof_annu.binet_sel.selectedIndex;
- document.forms.prof_annu.binet_id.value = document.forms.prof_annu.binet_sel.options[selid].value;
- document.forms.prof_annu.binet_op.value = "ajouter";
- document.forms.prof_annu.submit();
- } // function binet_add()
-
-
-
- /** suppression d'un binet du profil de l'utilisateur en base de données
- * @ingroup user_profile
- * @param id INT id du binet
- * @return VOID
- */
- function binet_del( id )
- {
- document.forms.prof_annu.binet_id.value = id;
- document.forms.prof_annu.binet_op.value = "retirer";
- document.forms.prof_annu.submit();
- } // END function binet_del( id )
-
-
-
- /** ajout d'un groupeX au profil de l'utilisateur en base de données
- * le groupeX est déterminé par groupex_id qui est sélectionné dans un SELECT
- * @ingroup user_profile
- * @return VOID
- */
- function groupex_add()
- {
- var selid = document.forms.prof_annu.groupex_sel.selectedIndex;
- document.forms.prof_annu.groupex_id.value = document.forms.prof_annu.groupex_sel.options[selid].value;
- document.forms.prof_annu.groupex_op.value = "ajouter";
- document.forms.prof_annu.submit();
- } // END function groupex_add()
-
- /** suppression d'un groupeX du profil de l'utilisateur en base de données
- * @ingroup user_profile
- * @param id INT id du groupeX
- * @return VOID
- */
- function groupex_del( id )
- {
- document.forms.prof_annu.groupex_id.value = id;
- document.forms.prof_annu.groupex_op.value = 'retirer';
- document.forms.prof_annu.submit();
- } // END function groupex_del( id )
-
- //]]>
-</script>
-{/literal}
-<div class="blocunite_tab">
- <input type="hidden" value="" name="binet_op" />
- <input type="hidden" value="" name="binet_id" />
- <input type="hidden" value="" name="groupex_op" />
- <input type="hidden" value="" name="groupex_id" />
- <table class="bicol" cellspacing="0" cellpadding="0"
- summary="Profil: Informations Polytechniciennes">
- <tr>
- <th colspan="3">
- Informations polytechniciennes
- </th>
- </tr>
- <tr>
- <td colspan="3" class="pflags">
- <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
- <tr>
- <td class="rouge">
- <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
- </td>
- <td class="texte">
- privé
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr class="top">
- <td class="colg">
- <span class="titre">(ex-)Section</span>
- </td>
- <td class="colm">
- <select name="section">
- {select_db_table table="sections" valeur=$section}
- </select>
- </td>
- <td class="cold">
-
- </td>
- </tr>
- <!-- Binets -->
- <tr class="top">
- <td class="colg">
- <span class="titre">(ex-)Binet(s)</span>
- </td>
- {foreach from=$binets item=b}
- <td class="colm">
- <span class="valeur">{$b.text}</span>
- </td>
- <td class="cold">
- <span class="lien">
- <a href="javascript:binet_del({$b.id});">retirer</a>
- </span>
- </td>
- </tr>
- <tr>
- <td class="colg">
-
- </td>
- {/foreach}
- <td class="colm">
- <select name="binet_sel">
- {select_db_table table="binets_def" valeur=0 champ="text" pad='1'}
- </select>
- </td>
- <td class="cold">
- <span class="lien">
- <a href="javascript:binet_add();">ajouter</a>
- </span>
- </td>
- </tr>
- <!-- Groupes X -->
- <tr class="top">
- <td class="colg">
- <span class="titre">Groupe(s) X</span>
- </td>
- {foreach from=$groupesx item=g}
- <td class="colm">
- <span class="valeur">{$g.text}</span>
- </td>
- <td class="cold">
- <span class="lien">
- <a href="javascript:groupex_del({$g.id});">retirer</a>
- </span>
- </td>
- </tr>
- <tr>
- <td class="colg">
-
- </td>
- {/foreach}
- <td class="colm">
- <select name="groupex_sel">
- {select_db_table table="groupesx_def" valeur=0 champ="text" pad='1'}
- </select>
- </td>
- <td class="dcold">
- <span class="lien">
- <a href="javascript:groupex_add();">ajouter</a>
- </span>
- </td>
- </tr>
- </table>
-</div>
-
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
<h2>Distinctions : </h2>
{foreach from=$x.medals item=m}
<div class="medal_frame">
- <img src="images/medals/{$m.img}" width="24" alt="{$m.medal}" title="{$m.medal}" style='float: left;' />
+ <img src="profile/medal/{$m.id}" width="24" alt="{$m.medal}" title="{$m.medal}" style='float: left;' />
<div class="medal_text">
{$m.medal}<br />{$m.grade}
</div>
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{if $ajaxskill}
+<?xml version="1.0" encoding="utf-8"?>
+{/if}
+<div id="{$cat}_{$id}" style="clear: both; margin-top: 0.5em">
+ <div style="float: left; width: 50%" class="titre" id="{$cat}_{$id}_title">
+ {$skill.text}
+ <input type="hidden" name="{"`$cat`[`$id`][text]"}" value="{$skill.text}" />
+ </div>
+ <select name="{"`$cat`[`$id`][level]"}">
+ {foreach from=$levels item=level key=lid}
+ <option value="{$lid}" {if $skill.level eq $lid}selected="selected"{/if}>{$level}</option>
+ {/foreach}
+ </select>
+ <a href="javascript:remove('{$cat}', '{$id}')">{icon name=cross title="Supprimer"}</a>
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{**************************************************************************}
+<script type="text/javascript">//<![CDATA[
{literal}
-<script type="text/javascript">
- //<![CDATA[
- function langue_add()
- {
- var selectid = document.forms.prof_annu.langue_sel_add.selectedIndex;
- document.forms.prof_annu.langue_id.value = document.forms.prof_annu.langue_sel_add.options[selectid].value;
- var selectid_level = document.forms.prof_annu.langue_level_sel_add.selectedIndex;
- document.forms.prof_annu.langue_level.value = document.forms.prof_annu.langue_level_sel_add.options[selectid_level].value;
- document.forms.prof_annu.langue_op.value = "ajouter";
- document.forms.prof_annu.submit();
- } // function langue_add()
- function langue_del( lid )
- {
- document.forms.prof_annu.langue_id.value = lid;
- document.forms.prof_annu.langue_op.value = "retirer";
- document.forms.prof_annu.submit();
- } // function langue_del( id )
+function update(cat)
+{
+ var val = document.forms.prof_annu[cat + '_sel'].value;
+ var show = true;
+ if (val == '') {
+ show = false;
+ }
+ if (document.getElementById(cat + '_' + val) != null) {
+ show = false;
+ }
+ document.getElementById(cat + '_add').style.display = show ? '' : 'none';
+}
- function comppros_add()
- {
- var selectid = document.forms.prof_annu.comppros_sel_add.selectedIndex;
- document.forms.prof_annu.comppros_id.value = document.forms.prof_annu.comppros_sel_add.options[selectid].value;
- var selectid_level = document.forms.prof_annu.comppros_level_sel_add.selectedIndex;
- document.forms.prof_annu.comppros_level.value = document.forms.prof_annu.comppros_level_sel_add.options[selectid_level].value;
- document.forms.prof_annu.comppros_op.value = "ajouter";
- document.forms.prof_annu.submit();
- } // function langue_add()
+function add(cat)
+{
+ var sel = document.forms.prof_annu[cat + '_sel'];
+ var val = sel.value;
+ var text = sel.options[sel.selectedIndex].text;
+ $.get(platal_baseurl + 'profile/ajax/skill/' + cat + '/' + val,
+ function(data) {
+ $('#' + cat).append(data);
+ document.getElementById(cat + '_' + val + '_title').innerHTML = text;
+ update(cat);
+ });
+}
+
+function remove(cat, id)
+{
+ $('#' + cat + '_' + id).remove();
+ update(cat);
+}
- function comppros_del( cid )
- {
- document.forms.prof_annu.comppros_id.value = cid;
- document.forms.prof_annu.comppros_op.value = "retirer";
- document.forms.prof_annu.submit();
- } // function comppros_del( id )
- //]]>
-</script>
{/literal}
+//]]></script>
-<div class="blocunite_tab">
- <table class="bicol"cellspacing="0" cellpadding="0"
- summary="Profil: Compétences professionnelles">
- <tr>
- <th colspan="3">
- Compétences professionnelles
- <input type="hidden" value="" name="comppros_op" />
- <input type="hidden" value="" name="comppros_id" />
- <input type="hidden" value="" name="comppros_level" />
- </th>
- </tr>
- <tr>
- <td colspan="3" class="pflags">
- <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
- <tr>
- <td class="rouge">
- <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
- </td>
- <td class="texte">
- privé
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr class="impair">
- <td class="colg">
- <span class="titre">Domaine</span>
- </td>
- <td class="colm">
- <span class="titre">Niveau</span>
- </td>
- <td class="cold" style="width:15%">
-
- </td>
- </tr>
- {foreach from=$cpro_name key=i item=name}
- <tr class="{cycle values="pair,impair"}">
- <td class="colg">
- <span class="valeur">{$name}</span>
- </td>
- <td class="colm">
- <span class="valeur"> {$cpro_level.$i}</span>
- </td>
- <td class="cold">
- <span class="lien"><a href="javascript:comppros_del('{$cpro_id.$i}');">retirer</a></span>
- </td>
- </tr>
- {/foreach}
- {if $nb_cpro < $nb_cpro_max}
- <tr class="{cycle values="pair,impair"}">
- <td class="colg">
- <select name="comppros_sel_add">
- <option value=""></option>
- {foreach from=$comppros_def item=cn key=id}
- <option value="{$id}">{if $comppros_title.$id}-{else} {/if} {$cn}</option>
- {/foreach}
- </select>
- </td>
- <td class="colm">
- <select name="comppros_level_sel_add">
+<table class="bicol" style="margin-bottom: 1em">
+ <tr>
+ <th>
+ Compétences professionnelles
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <div class="flags">
+ <span class="rouge"><input type="checkbox" name="accesX" checked="checked" disabled="disabled" /></span>
+ <span class="texte">privé</span>
+ </div>
+ <div>
+ <span class="titre">Domaine :</span>
+ <select name="competences_sel" onchange="update('competences')">
<option value=""></option>
- {foreach from=$comppros_levels item=ln key=l}
- <option value="{$l}">{$ln}</option>
- {/foreach}
+ {assign var=ingroup value=false}
+ {iterate from=$comp_list item=comp}
+ {if $comp.title}
+ {if $ingroup}</optgroup>{/if}
+ <optgroup label="{$comp.text_fr}">
+ {assign var=ingroup value=true}
+ {/if}
+ <option value="{$comp.id}">{$comp.text_fr}</option>
+ {/iterate}
+ {if $ingroup}</optgroup>{/if}
</select>
- </td>
- <td class="cold">
- <span class="lien"><a href="javascript:comppros_add();">ajouter</a></span>
- </td>
- </tr>
- {/if}
- </table>
-</div>
+ <span id="competences_add" style="display: none">
+ <a href="javascript:add('competences')">{icon name=add title="Ajouter cette compétence"}</a>
+ </span>
+ </div>
+ </td>
+ </tr>
+ <tr class="pair">
+ <td id="competences">
+ {foreach from=$competences item=competence key=id}
+ {include file="profile/skill.skill.tpl" cat='competences' skill=$competence id=$id levels=$comp_level}
+ {/foreach}
+ </td>
+ </tr>
+</table>
-<div class="blocunite">
- <table class="bicol" cellspacing="0" cellpadding="0"
- summary="Profil: Compétences linguistiques">
- <tr>
- <th colspan="3">
- Compétences linguistiques
- <input type="hidden" value="" name="langue_op" />
- <input type="hidden" value="" name="langue_id" />
- <input type="hidden" value="" name="langue_level" />
- </th>
- </tr>
- <tr>
- <td colspan="3" class="pflags">
- <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
- <tr>
- <td class="rouge">
- <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
- </td>
- <td class="texte">
- privé
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr class="impair">
- <td class="colg">
- <span class="titre">Langue</span>
- </td>
- <td class="colm">
- <span class="titre">Niveau</span>
- </td>
- <td class="cold" style="width:15%">
- <span class="lien"><a href="Xorg/FAQ?display=light#niveau_langue" class="popup_800x600">Quel niveau ?</a></span>
- </td>
- </tr>
- {foreach from=$langue_name item=name key=i}
- <tr class="{cycle values="pair,impair"}">
- <td class="colg">
- <span class="valeur">{$name}</span>
- </td>
- <td class="colm">
- <span class="valeur"> {if $langue_level.$i == 0}-{else}{$langue_level.$i}{/if}</span>
- </td>
- <td class="cold">
- <span class="lien"><a href="javascript:langue_del('{$langue_id.$i}');">retirer</a></span>
- </td>
- </tr>
- {/foreach}
- {if $nb_lg < $nb_lg_max}
- <tr class="{cycle values="pair,impair"}">
- <td class="colg">
- <select name="langue_sel_add">
- <option value=""></option>
- {foreach from=$langues_def item=n key=i}
- <option value="{$i}">{$n}</option>
- {/foreach}
- </select>
- </td>
- <td class="colm">
- <select name="langue_level_sel_add">
+<table class="bicol">
+ <tr>
+ <th>Compétences linguistiques</th>
+ </tr>
+ <tr>
+ <td>
+ <div class="flags">
+ <span class="rouge"><input type="checkbox" name="accesX" checked="checked" disabled="disabled" /></span>
+ <span class="texte">privé</span>
+ </div>
+ <div>
+ <span class="titre">Domaine :</span>
+ <select name="langues_sel" onchange="update('langues')">
<option value=""></option>
- {foreach from=$langues_levels item=l key=i}
- <option value="{$i}">{$l}</option>
- {/foreach}
+ {iterate from=$lang_list item=lang}
+ <option value="{$lang.id}">{$lang.langue_fr}</option>
+ {/iterate}
</select>
- </td>
- <td class="cold">
- <span class="lien"><a href="javascript:langue_add();">ajouter</a></span>
- </td>
- </tr>
- {/if}
- </table>
-</div>
+ <span id="langues_add" style="display: none">
+ <a href="javascript:add('langues')">{icon name=add title="Ajouter cette langue"}</a>
+ </span>
+ </div>
+ </td>
+ </tr>
+ <tr class="pair">
+ <td id="langues">
+ {foreach from=$langues item=langue key=id}
+ {include file="profile/skill.skill.tpl" cat='langues' skill=$langue id=$id levels=$lang_level}
+ {/foreach}
+ </td>
+ </tr>
+ </table>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
<br />
{/if}
+{if !$xorg_no_errors && !$xorg_failure}
{foreach from=$xorg_errors item=err}
<div class="erreur">{$err|smarty:nodefaults}</div>
{/foreach}
+{/if}
{if !$xorg_failure && $xorg_tpl}{include file=$xorg_tpl}{/if}
--- /dev/null
+alter table entreprises add column cityid int(11) default null after city;
+alter table entreprises add column regiontxt varchar(80) not null after region;
+alter table entreprises add column flags set('geoloc') not null;
+alter table entreprises add key cityid (cityid);
+alter table entreprises add key country (country);
+alter table entreprises add key region (region);
+
+# vim:set syntax=mysql: