From: Florent Bruneau Date: Sun, 9 Sep 2007 17:43:07 +0000 (+0200) Subject: Merge branch 'profile_edit' X-Git-Tag: xorg/0.9.15~174 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=be6ab042d1dc34d9e42557281b48dd8da400231b;hp=32111f706bcbf1d3244f64b7928b37bbc5210ab0;p=platal.git Merge branch 'profile_edit' Conflicts: htdocs/css/default.css htdocs/css/keynote.css htdocs/css/openweb.css include/platal.inc.php modules/profile/assign_adresses.inc.php modules/profile/assign_poly.inc.php modules/profile/get_adresses.inc.php modules/profile/get_deco.inc.php modules/profile/get_general.inc.php modules/profile/get_mentor.inc.php modules/profile/update_adresses.inc.php modules/profile/verif_adresses.inc.php modules/profile/verif_general.inc.php Signed-off-by: Florent Bruneau --- diff --git a/classes/plwizard.php b/classes/plwizard.php index 9a58afe..b5affd1 100644 --- a/classes/plwizard.php +++ b/classes/plwizard.php @@ -69,27 +69,34 @@ class PlWizard 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) @@ -123,7 +130,7 @@ class PlWizard $_SESSION[$this->name . '_page'] = null; } - private function &getPage($id) + private function getPage($id) { $page = $this->pages[$id]; return new $page($this); @@ -131,40 +138,71 @@ class PlWizard 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); } } diff --git a/configs/mails.conf b/configs/mails.conf index fb63f39..f0b3d7b 100644 --- a/configs/mails.conf +++ b/configs/mails.conf @@ -31,6 +31,10 @@ replyto=info+nlp@polytechnique.org 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" replyto=info@amicale.polytechnique.org diff --git a/htdocs/css/default.css b/htdocs/css/default.css index 21e3537..d4ece44 100644 --- a/htdocs/css/default.css +++ b/htdocs/css/default.css @@ -278,30 +278,77 @@ div.long td.rt { width: 65%; } [ 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{ diff --git a/htdocs/css/keynote.css b/htdocs/css/keynote.css index cf322fb..1745d5f 100644 --- a/htdocs/css/keynote.css +++ b/htdocs/css/keynote.css @@ -101,6 +101,18 @@ p.smaller { 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; @@ -191,7 +203,7 @@ table.tinybicol td, table.bicol td { 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; @@ -204,6 +216,11 @@ td.action { } 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 ] @@ -286,28 +303,77 @@ div.long td.rt { width: 65%; } [ 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{ diff --git a/htdocs/css/openweb.css b/htdocs/css/openweb.css index f0f9d9a..6ae26a9 100644 --- a/htdocs/css/openweb.css +++ b/htdocs/css/openweb.css @@ -269,30 +269,78 @@ div.long td.rt { width: 65%; } [ 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{ diff --git a/htdocs/javascript/ajax.js b/htdocs/javascript/ajax.js index a839afc..2d67102 100644 --- a/htdocs/javascript/ajax.js +++ b/htdocs/javascript/ajax.js @@ -103,7 +103,7 @@ function _showTempMessage(id, state, back) var obj = document.getElementById(id); if (currentTempMessage != state) { return; - } + } setOpacity(obj, back * 4); if (back > 0) { setTimeout("_showTempMessage('" + id + "', " + currentTempMessage + "," + (back-1) + ")", 125); diff --git a/include/fonction.emploi.inc.php b/include/fonction.emploi.inc.php deleted file mode 100644 index ee67115..0000000 --- a/include/fonction.emploi.inc.php +++ /dev/null @@ -1,41 +0,0 @@ - \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.= "\n"; - else - $html .= "\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: -?> diff --git a/include/geoloc.inc.php b/include/geoloc.inc.php index de0d4d4..89ecd45 100644 --- a/include/geoloc.inc.php +++ b/include/geoloc.inc.php @@ -42,17 +42,6 @@ function geoloc_country($current, $avail_only = false) 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 @@ -79,15 +68,6 @@ function geoloc_region($country, $current, $avail_only = false) } 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) @@ -225,7 +205,7 @@ function compare_addresses_text($a, $b) return false; } foreach ($la as $i=>$l) { - if (levenshtein($l, $lb[$i]) > 3) { + if (levenshtein(trim($l), trim($lb[$i])) > 3) { return false; } } diff --git a/include/secteur.emploi.inc.php b/include/secteur.emploi.inc.php deleted file mode 100644 index 4f2d48b..0000000 --- a/include/secteur.emploi.inc.php +++ /dev/null @@ -1,60 +0,0 @@ - \n"; - $res = XDB::iterRow("SELECT id, label FROM emploi_secteur"); - while (list($tmp_id, $tmp_label) = $res->next()) { - $html .= "\n"; - } - return $html; -} - -function select_ss_secteur($secteur,$ss_secteur){ - if ($secteur) { - $html = "\n"; - $res = XDB::iterRow("SELECT id, label FROM emploi_ss_secteur WHERE secteur = {?}", $secteur); - while (list($tmp_id, $tmp_label) = $res->next()){ - $html .= "\n"; - } - return $html; - } - else{ - return "\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: -?> diff --git a/include/user.func.inc.php b/include/user.func.inc.php index b515c0c..aca62cd 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -477,7 +477,7 @@ function &get_user_details($login, $from_uid = '', $view = 'private') $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 ) diff --git a/include/validations/medals.inc.php b/include/validations/medals.inc.php index e419e46..7e65dc5 100644 --- a/include/validations/medals.inc.php +++ b/include/validations/medals.inc.php @@ -104,6 +104,20 @@ class MedalReq extends Validate } // }}} + // {{{ 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; + } + + // }}} } // }}} diff --git a/include/xorg/session.inc.php b/include/xorg/session.inc.php index 6e8b3e8..35de42e 100644 --- a/include/xorg/session.inc.php +++ b/include/xorg/session.inc.php @@ -239,7 +239,8 @@ function try_cookie() 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 diff --git a/modules/profile.php b/modules/profile.php index 95ffb9d..abf5de5 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -32,6 +32,13 @@ class ProfileModule extends PLModule '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), @@ -95,6 +102,19 @@ class ProfileModule extends PLModule 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'); @@ -255,19 +275,11 @@ class ProfileModule extends PLModule 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 @@ -305,96 +317,106 @@ class ProfileModule extends PLModule } } + // 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) diff --git a/modules/profile/addresses.inc.php b/modules/profile/addresses.inc.php new file mode 100644 index 0000000..89a3de1 --- /dev/null +++ b/modules/profile/addresses.inc.php @@ -0,0 +1,239 @@ +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: +?> diff --git a/modules/profile/assign_adresses.inc.php b/modules/profile/assign_adresses.inc.php deleted file mode 100644 index e9afd63..0000000 --- a/modules/profile/assign_adresses.inc.php +++ /dev/null @@ -1,110 +0,0 @@ - $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: -?> diff --git a/modules/profile/assign_deco.inc.php b/modules/profile/assign_deco.inc.php deleted file mode 100644 index 4f3c931..0000000 --- a/modules/profile/assign_deco.inc.php +++ /dev/null @@ -1,46 +0,0 @@ -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: -?> diff --git a/modules/profile/assign_emploi.inc.php b/modules/profile/assign_emploi.inc.php deleted file mode 100644 index ce9a5f4..0000000 --- a/modules/profile/assign_emploi.inc.php +++ /dev/null @@ -1,47 +0,0 @@ -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: -?> diff --git a/modules/profile/assign_general.inc.php b/modules/profile/assign_general.inc.php deleted file mode 100644 index 033bc1c..0000000 --- a/modules/profile/assign_general.inc.php +++ /dev/null @@ -1,52 +0,0 @@ -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: -?> diff --git a/modules/profile/assign_mentor.inc.php b/modules/profile/assign_mentor.inc.php deleted file mode 100644 index 728a8d3..0000000 --- a/modules/profile/assign_mentor.inc.php +++ /dev/null @@ -1,34 +0,0 @@ -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: -?> diff --git a/modules/profile/assign_poly.inc.php b/modules/profile/assign_poly.inc.php deleted file mode 100644 index d423fa2..0000000 --- a/modules/profile/assign_poly.inc.php +++ /dev/null @@ -1,39 +0,0 @@ -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: -?> diff --git a/modules/profile/assign_skill.inc.php b/modules/profile/assign_skill.inc.php deleted file mode 100644 index 9f2adc1..0000000 --- a/modules/profile/assign_skill.inc.php +++ /dev/null @@ -1,39 +0,0 @@ -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: -?> diff --git a/modules/profile/decos.inc.php b/modules/profile/decos.inc.php new file mode 100644 index 0000000..ebd8f12 --- /dev/null +++ b/modules/profile/decos.inc.php @@ -0,0 +1,150 @@ +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: +?> diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php new file mode 100644 index 0000000..3e66990 --- /dev/null +++ b/modules/profile/general.inc.php @@ -0,0 +1,208 @@ +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: +?> diff --git a/modules/profile/get_adresses.inc.php b/modules/profile/get_adresses.inc.php deleted file mode 100644 index 2f653b0..0000000 --- a/modules/profile/get_adresses.inc.php +++ /dev/null @@ -1,128 +0,0 @@ -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: -?> diff --git a/modules/profile/get_deco.inc.php b/modules/profile/get_deco.inc.php deleted file mode 100644 index f0e658c..0000000 --- a/modules/profile/get_deco.inc.php +++ /dev/null @@ -1,64 +0,0 @@ -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: -?> diff --git a/modules/profile/get_emploi.inc.php b/modules/profile/get_emploi.inc.php deleted file mode 100644 index 8397612..0000000 --- a/modules/profile/get_emploi.inc.php +++ /dev/null @@ -1,86 +0,0 @@ -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: -?> diff --git a/modules/profile/get_general.inc.php b/modules/profile/get_general.inc.php deleted file mode 100644 index 8f7eadb..0000000 --- a/modules/profile/get_general.inc.php +++ /dev/null @@ -1,81 +0,0 @@ -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: -?> diff --git a/modules/profile/get_mentor.inc.php b/modules/profile/get_mentor.inc.php deleted file mode 100644 index 53d18a6..0000000 --- a/modules/profile/get_mentor.inc.php +++ /dev/null @@ -1,103 +0,0 @@ -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: -?> diff --git a/modules/profile/get_poly.inc.php b/modules/profile/get_poly.inc.php deleted file mode 100644 index 85c2ee7..0000000 --- a/modules/profile/get_poly.inc.php +++ /dev/null @@ -1,58 +0,0 @@ -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: -?> diff --git a/modules/profile/get_skill.inc.php b/modules/profile/get_skill.inc.php deleted file mode 100644 index d5a2ee1..0000000 --- a/modules/profile/get_skill.inc.php +++ /dev/null @@ -1,94 +0,0 @@ -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: -?> diff --git a/modules/profile/groups.inc.php b/modules/profile/groups.inc.php new file mode 100644 index 0000000..dcc8298 --- /dev/null +++ b/modules/profile/groups.inc.php @@ -0,0 +1,111 @@ +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: +?> diff --git a/modules/profile/jobs.inc.php b/modules/profile/jobs.inc.php new file mode 100644 index 0000000..5b497c9 --- /dev/null +++ b/modules/profile/jobs.inc.php @@ -0,0 +1,217 @@ +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: +?> diff --git a/modules/profile/mentor.inc.php b/modules/profile/mentor.inc.php new file mode 100644 index 0000000..5928acd --- /dev/null +++ b/modules/profile/mentor.inc.php @@ -0,0 +1,160 @@ +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: +?> diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php new file mode 100644 index 0000000..e06e247 --- /dev/null +++ b/modules/profile/page.inc.php @@ -0,0 +1,295 @@ +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: +?> diff --git a/modules/profile/skills.inc.php b/modules/profile/skills.inc.php new file mode 100644 index 0000000..a922fc0 --- /dev/null +++ b/modules/profile/skills.inc.php @@ -0,0 +1,112 @@ +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: +?> diff --git a/modules/profile/tabs.inc.php b/modules/profile/tabs.inc.php deleted file mode 100644 index 34b74ae..0000000 --- a/modules/profile/tabs.inc.php +++ /dev/null @@ -1,54 +0,0 @@ - "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: -?> diff --git a/modules/profile/update_adresses.inc.php b/modules/profile/update_adresses.inc.php deleted file mode 100644 index 0ec632f..0000000 --- a/modules/profile/update_adresses.inc.php +++ /dev/null @@ -1,137 +0,0 @@ -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: -?> diff --git a/modules/profile/update_deco.inc.php b/modules/profile/update_deco.inc.php deleted file mode 100644 index da6d8ad..0000000 --- a/modules/profile/update_deco.inc.php +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/modules/profile/update_emploi.inc.php b/modules/profile/update_emploi.inc.php deleted file mode 100644 index 622cbb5..0000000 --- a/modules/profile/update_emploi.inc.php +++ /dev/null @@ -1,46 +0,0 @@ - diff --git a/modules/profile/update_general.inc.php b/modules/profile/update_general.inc.php deleted file mode 100644 index ccdaeb5..0000000 --- a/modules/profile/update_general.inc.php +++ /dev/null @@ -1,60 +0,0 @@ -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: -?> diff --git a/modules/profile/update_skill.inc.php b/modules/profile/update_skill.inc.php deleted file mode 100644 index 90ddbd4..0000000 --- a/modules/profile/update_skill.inc.php +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/modules/profile/verif_adresses.inc.php b/modules/profile/verif_adresses.inc.php deleted file mode 100644 index 953f2c1..0000000 --- a/modules/profile/verif_adresses.inc.php +++ /dev/null @@ -1,206 +0,0 @@ - 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: -?> diff --git a/modules/profile/verif_deco.inc.php b/modules/profile/verif_deco.inc.php deleted file mode 100644 index 4c844bd..0000000 --- a/modules/profile/verif_deco.inc.php +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/modules/profile/verif_emploi.inc.php b/modules/profile/verif_emploi.inc.php deleted file mode 100644 index 7c96990..0000000 --- a/modules/profile/verif_emploi.inc.php +++ /dev/null @@ -1,125 +0,0 @@ -{}#~;!§*`[]|%^=")) < 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: -?> diff --git a/modules/profile/verif_general.inc.php b/modules/profile/verif_general.inc.php deleted file mode 100644 index c3a2b6b..0000000 --- a/modules/profile/verif_general.inc.php +++ /dev/null @@ -1,66 +0,0 @@ -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: -?> diff --git a/modules/profile/verif_mentor.inc.php b/modules/profile/verif_mentor.inc.php deleted file mode 100644 index b1707f3..0000000 --- a/modules/profile/verif_mentor.inc.php +++ /dev/null @@ -1,34 +0,0 @@ -{}~§`|%$^")) < 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: -?> diff --git a/modules/profile/verif_poly.inc.php b/modules/profile/verif_poly.inc.php deleted file mode 100644 index 4c844bd..0000000 --- a/modules/profile/verif_poly.inc.php +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/modules/profile/verif_skill.inc.php b/modules/profile/verif_skill.inc.php deleted file mode 100644 index 90ddbd4..0000000 --- a/modules/profile/verif_skill.inc.php +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/modules/profile/update_mentor.inc.php b/plugins/function.geoloc_country.php similarity index 87% rename from modules/profile/update_mentor.inc.php rename to plugins/function.geoloc_country.php index a3e6df0..fee2b21 100644 --- a/modules/profile/update_mentor.inc.php +++ b/plugins/function.geoloc_country.php @@ -19,12 +19,13 @@ * 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: ?> diff --git a/modules/profile/update_poly.inc.php b/plugins/function.geoloc_region.php similarity index 84% rename from modules/profile/update_poly.inc.php rename to plugins/function.geoloc_region.php index c6562ab..e7a3a69 100644 --- a/modules/profile/update_poly.inc.php +++ b/plugins/function.geoloc_region.php @@ -19,9 +19,13 @@ * 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: ?> diff --git a/templates/core/plwizard.tpl b/templates/core/plwizard.tpl new file mode 100644 index 0000000..3a0d2ad --- /dev/null +++ b/templates/core/plwizard.tpl @@ -0,0 +1,43 @@ +{**************************************************************************} +{* *} +{* 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 *} +{* *} +{**************************************************************************} + +
+
+ {foreach from=$pages item=title key=id} +
+ {if $stateless || $id gt $current}{/if} + {$title} + {if $stateless || $id gt $current}{/if} +
+ {/foreach} +
+
+
+ {foreach from=$xorg_errors item=err} +
{$err|smarty:nodefaults}
+ {/foreach} + {include file=$wiz_page} +
+
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/geoloc/form.address.tpl b/templates/geoloc/form.address.tpl index 4a14a05..8ad46c7 100644 --- a/templates/geoloc/form.address.tpl +++ b/templates/geoloc/form.address.tpl @@ -20,37 +20,45 @@ {* *} {**************************************************************************} - {if $adr.geoloc} - - - - 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.
- - -

- [Valider] -

- {else} - - - - - {/if} - - - - - - - - - - + +{if $adr.geoloc} +
+ 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. +
+ +{/if} +
+ +{if $adr.geoloc} + + + + + +
+ + + + + + + + + + + + {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/geoloc/mail_geoloc.tpl b/templates/geoloc/mail_geoloc.tpl new file mode 100644 index 0000000..4b74f32 --- /dev/null +++ b/templates/geoloc/mail_geoloc.tpl @@ -0,0 +1,42 @@ +{**************************************************************************} +{* *} +{* 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: *} diff --git a/templates/include/flags.radio.tpl b/templates/include/flags.radio.tpl index ab32d54..1c21d20 100644 --- a/templates/include/flags.radio.tpl +++ b/templates/include/flags.radio.tpl @@ -19,25 +19,56 @@ {* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} {* *} {**************************************************************************} -{if $display neq "mini"} +{if $display eq "mini"} + + + + + + + + + +{elseif $display eq "div"} + + + + + + + + + +{else} + {if !$notable} + {/if}
- + site public - + transmis à l'AX - + privé @@ -47,17 +78,9 @@
+ {if !$notable} -{else} - - - - - - - - - + {/if} {/if} {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/adresses.address.tpl b/templates/profile/adresses.address.tpl new file mode 100644 index 0000000..1ae3caa --- /dev/null +++ b/templates/profile/adresses.address.tpl @@ -0,0 +1,103 @@ +{**************************************************************************} +{* *} +{* 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} + +{/if} +{assign var=adpref value="addresses[$i]"} +{assign var=adid value="addresses_$i"} + + + + + + + + + + + + + + + + + +
+
+ + +
+ + Adresse n°{$i+1} +
+
+ {include file="include/flags.radio.tpl" name="`$adpref`[pub]" notable=true val=$adr.pub display="div"} +
+
+
{include file="geoloc/form.address.tpl" name=$adpref id=$adid adr=$adr}
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ {foreach from=$adr.tel key=t item=tel} +
+ {include file="profile/adresses.tel.tpl" t=$t tel=$tel} +
+ {/foreach} + {if $adr.tel|@count eq 0} +
+ {include file="profile/adresses.tel.tpl" t=0 tel=0} +
+ {/if} + +
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/adresses.tel.tpl b/templates/profile/adresses.tel.tpl new file mode 100644 index 0000000..a641895 --- /dev/null +++ b/templates/profile/adresses.tel.tpl @@ -0,0 +1,39 @@ +{**************************************************************************} +{* *} +{* 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} + +{/if} +{assign var=telpref value="`$adpref`[tel][`$t`]"} +{assign var=telid value="`$adid`_tel_`$t`"} +
+ {include file="include/flags.radio.tpl" name="`$telpref`[pub]" val=$tel.pub display="div"} +
+N°{$t+1} + + + + + {icon name=cross title="Supprimer ce numéro de téléphone"} + + +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/adresses.tpl b/templates/profile/adresses.tpl index 2f7b9da..9d6f176 100644 --- a/templates/profile/adresses.tpl +++ b/templates/profile/adresses.tpl @@ -20,106 +20,134 @@ {* *} {**************************************************************************} + + +{foreach key=i item=adr from=$addresses} +
+{include file="profile/adresses.address.tpl" i=$i adr=$adr} +
+{/foreach} +{if $addresses|@count eq 0} +
+{include file="profile/adresses.address.tpl" i=0 adr=0} +
+{/if} + + {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/base.tpl b/templates/profile/base.tpl new file mode 100644 index 0000000..addb55b --- /dev/null +++ b/templates/profile/base.tpl @@ -0,0 +1,41 @@ +{**************************************************************************} +{* *} +{* 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 *} +{* *} +{**************************************************************************} + +
+
+ {icon name=information title="Voir ma fiche"} Tu peux consulter ta fiche telle que la + voient les X, + l'AX ou + n'importe quel internaute. + {include file="include/flags.radio.tpl" notable=true disabled=true name="profile_ex_pub"} +
+
+ {include file=$profile_page} +
+
+ + + +
+
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/deco.medal.tpl b/templates/profile/deco.medal.tpl new file mode 100644 index 0000000..280d256 --- /dev/null +++ b/templates/profile/deco.medal.tpl @@ -0,0 +1,44 @@ +{**************************************************************************} +{* *} +{* 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} + +{/if} +
+
+ +
+
+
+ {if !$medal.valid}(en attente de {if $ajaxdeco}validation{else}modération{/if}){/if}
+
+
+ {icon name="cross" title="Supprimer cette médaille"} + {if !$ajaxdeco} + + {/if} +
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/deco.tpl b/templates/profile/deco.tpl index ae09bea..b4eb62b 100644 --- a/templates/profile/deco.tpl +++ b/templates/profile/deco.tpl @@ -21,192 +21,122 @@ {**************************************************************************} -{literal} - - -{if $smarty.request.medal_op eq "ajouter"} -
- Ta demande a bien été prise en compte, elle sera validée prochainement par un administrateur. -
-{/if} -
- - - - - - - - - - - {foreach from=$medals item=m} - - - - - - {/foreach} - {foreach from=$medals_valid item=v} - - - - - {/foreach} - - - + +
- Médailles, Décorations, Prix, ... -
- - - - - -
- - - ces informations sont normalement publiques (JO, ...) mais tu peux choisir de les associer a ta fiche publique -
-
- {$m.medal} - - {$m.medal}
- {if $grades[$m.id]|@count} - {foreach from=$grades[$m.id] item=g} - {if $g.gid eq $m.gid}{$g.text}{/if} - {/foreach} - {/if} -
- - retirer - -
- mid}src="images/medals/{$m.img}"{/if} - {/foreach} - {/foreach} - title="Validation" alt="Validation" width="32" /> - - - {foreach from=$medal_list item=list} - {foreach from=$list item=m} - {if $m.id eq $v->mid}{$m.text} (en attente de validation){/if} - {/foreach} - {/foreach} -
- {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} -
- - annuler - -
-   - - + + + + + - - -
+ Médailles, Décorations, Prix, ... +
+
+
+ +
+
+ ces informations sont normalement publiques (JO, ...) mais tu peux choisir de les associer a ta fiche publique +
+
+
+ - -
- - ajouter + + {icon name=add title="Ajouter cette médaille"} -
- + + {foreach from=$medals item=medal key=id} + {include file="profile/deco.medal.tpl" medal=$medal id=$id} + {/foreach} +
+ + {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/emploi.tpl b/templates/profile/emploi.tpl deleted file mode 100644 index bad6bca..0000000 --- a/templates/profile/emploi.tpl +++ /dev/null @@ -1,233 +0,0 @@ -{**************************************************************************} -{* *} -{* 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} - -
- - - - - - {include file=include/flags.radio.tpl name="pubpro[$i]" val=$pubpro.$i} - - - - - - - - - - - - - - - - - - - - - {include file=include/flags.radio.tpl name="adr_pubpro[$i]" val=$adr_pubpro.$i} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {include file=include/flags.radio.tpl name="tel_pubpro[$i]" val=$tel_pubpro.$i} - - - - - - - - - - - - - {include file=include/flags.radio.tpl name="email_pubpro[$i]" val=$email_pubpro.$i} - - - - - - - - -
- Informations professionnelles - Entreprise n°{$i+1} -
- Entreprise ou organisme - - -
- Secteur d'activité - - -
- Sous-Secteur d'activité - - -
- Poste occupé - - -
- Fonction occupée - - -
- Adresse professionnelle - - -
-   - - -
-   - - -
- Code postal
-
- -
- Ville
-
- -
- Pays - - -
- Région ou département
- (selon pays) -
- -
- Téléphone professionnel - - -   -
- Fax - - -
- Mobile - - -
- E-mail - - -
- Page web - - -
-
- -{/section} - -
- - - - - - - - - - - -
- Informations professionnelles - CV -
- - - - - -
- - - privé -
-
- Curriculum vitae
- Le CV n'est jamais public.
- Comment remplir mon CV ?

- {icon name=information title="Syntaxe wiki"} Voir la syntaxe wiki -
- {javascript name=ajax} - -
- -
-
- -{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/general.tpl b/templates/profile/general.tpl index b515d4d..6c304d2 100644 --- a/templates/profile/general.tpl +++ b/templates/profile/general.tpl @@ -50,7 +50,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -101,17 +101,17 @@ (4ème année de l'X) - + {applis_options selected=$appli1.id}
- @@ -121,17 +121,17 @@ Post-application - + {applis_options selected=$appli2.id}
- @@ -218,7 +218,7 @@ 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 ! Ta fiche avec la nouvelle photo) - {/if}. + {/if} :  [ PHOTO ] @@ -256,7 +256,8 @@ Surnom - + @@ -294,7 +295,7 @@ + {if $errors.mobile}class="error"{/if} value="{$mobile}" /> @@ -320,7 +321,7 @@ + {if $errors.web}class="error"{/if} value="{$web}" /> @@ -342,20 +343,24 @@ - Complément libre - Commentaire ? ICQ ? etc... - - - {javascript name=ajax} - - -
- +
+ Complément libre + Commentaire ? ICQ ? etc... +
+ + + + + diff --git a/templates/profile/groups.tpl b/templates/profile/groups.tpl new file mode 100644 index 0000000..cf24edd --- /dev/null +++ b/templates/profile/groups.tpl @@ -0,0 +1,162 @@ +{**************************************************************************} +{* *} +{* 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} + +{/literal} + + + + + + + + + + + + + + + + + + {foreach item=text key=bid from=$binets} + + + + + {/foreach} + + + + + + {foreach item=text key=bid from=$groupesx} + + + + + {/foreach} +
+ Informations polytechniciennes +
+ + privé +
+ + + +
+ + + + {icon name="add" title="Ajouter ce binet"} +
+ + +
+ {$text} +
+ {icon name="cross" title="Supprimer ce binet"} +
Groupe(s) X + + {icon name="add" title="Ajouter ce groupe X"} +
+ + +
+ {$text} +
+ {icon name="cross" title="Supprimer ce groupe X"} +
+ + + +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/jobs.job.tpl b/templates/profile/jobs.job.tpl new file mode 100644 index 0000000..bcda539 --- /dev/null +++ b/templates/profile/jobs.job.tpl @@ -0,0 +1,161 @@ +{**************************************************************************} +{* *} +{* 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} + +{/if} +{assign var=jobid value="job_`$i`"} +{assign var=jobpref value="jobs[`$i`]"} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ {include file="include/flags.radio.tpl" notable=true display="div" name="`$jobpref`[pub]" value=$job.pub} +
+ Entreprise n°{$i+1} : + + + {icon name=cross title="Supprimer cet emploi"} + +
Page Web + +
Secteur d'activité + +
Sous-Secteur d'activité +
Poste occupé + +
Fonction occupée + +
+ E-mail professionnel : + + + {include file="include/flags.radio.tpl" name="`$jobpref`[email_pub]" val=$job.mail_pub display="div"} + +
+
+
Adresse
+
+ {include file="include/flags.radio.tpl" name="`$jobpref`[adr][pub]" val=$job.adr.pub display="div"} +
+
+ {include file="geoloc/form.address.tpl" name="`$jobpref`[adr]" id="`$jobid`_adr" adr=$job.adr} +
+
+
+
Téléphone
+
+ {include file="include/flags.radio.tpl" name="`$jobpref`[tel_pub]" val=$job.tel_pub display="div"} +
+ + + + + + + + + + + + + +
Bureau : + +
Fax : +
Mobile : + +
+
+
+
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/jobs.secteur.tpl b/templates/profile/jobs.secteur.tpl new file mode 100644 index 0000000..dac620c --- /dev/null +++ b/templates/profile/jobs.secteur.tpl @@ -0,0 +1,31 @@ +{**************************************************************************} +{* *} +{* 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=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/jobs.tpl b/templates/profile/jobs.tpl new file mode 100644 index 0000000..e42a14a --- /dev/null +++ b/templates/profile/jobs.tpl @@ -0,0 +1,147 @@ +{**************************************************************************} +{* *} +{* 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 *} +{* *} +{**************************************************************************} + + + +{foreach from=$jobs item=job key=i} +{include file="profile/jobs.job.tpl" i=$i job=$job new=false} + +{/foreach} +{if $jobs|@count eq 0} +{include file="profile/jobs.job.tpl" i=0 job=0 new=true} + +{/if} + + + + + + + + + + +
+ Curriculum vitae +
+ +
+ + +
+
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/mentor.tpl b/templates/profile/mentor.tpl index bb9e1af..4817dbe 100644 --- a/templates/profile/mentor.tpl +++ b/templates/profile/mentor.tpl @@ -20,239 +20,231 @@ {* *} {**************************************************************************} - + {/literal} +//]]>

-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. +

+

+ Tu peux mentionner ici les domaines de compétences, les expériences + notamment internationales sur la base desquels tu seras identifiable depuis + la page de recherche d'un conseil professionnel.

+

Le mentoring est particulièrement important pour les camarades :

  • encore jeunes, sont en train de bâtir leur projet professionnel,
  • ou bien, plus âgés, souhaitent réorienter leur carrière,
-

-te contactent afin de te demander conseil, dans les domaines que tu connais -bien, et pour lesquels tu pourrais les aider, remplis cette rubrique.
-Tu peux mentionner ici les domaines de compétences, les expériences -notamment internationales sur la base desquels tu seras identifiable depuis -la page de recherche d'un conseil professionnel. -

-
- - - - - - - - - - - - - {foreach from=$mentor_pays item=pays key=i} - - - - - - {/foreach} - {if $can_add_pays} - - - - - - {/if} -
- Pays dont tu connais bien la culture professionnelle - - - -
- - - - - -
- - - privé -
-
- Pays - - - -   -
- {$pays} - -    - - retirer -
- - - - ajouter -
-
+ + + + + + + + + + + + + +
+ Pays dont tu connais bien la culture professionnelle +
+ + privé +
+
Pays
+ + +
+ {foreach from=$countries item=country key=i} + + {/foreach} +
-
- - - - - - - - - - - - - {foreach from=$mentor_secteur item=secteur key=i} - - - - - - {/foreach} - {if $can_add_secteurs} - - - - - - {/if} -
- Secteurs d'activité dans lesquels tu as beaucoup exercé - - - - - -
- - - - - -
- - - privé -
-
- Secteur - - Sous-Secteur - -   -
- {$secteur} - - {$mentor_ss_secteur.$i} - - retirer -
- - - - - ajouter -
-
+ + + + + + + + + + + + + + + + +
+ Secteurs d'activité dans lesquels tu as beaucoup exercé +
+ + privé +
+
Secteur
+ +
+
Sous-secteur
+ +
+ {if $secteurs|@count} + {foreach from=$secteurs item=secteur key=s} + {foreach from=$secteur item=ss_sect key=ss} + + {/foreach} + {/foreach} + {/if} +
-
- - - - - - - - - - - - - -
- Expérience et expertises que tu acceptes de faire partager -
- - - - - -
- - - privé -
-
- 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. Il est obligatoire de - remplir cette dernière case pour apparaître dans la base de données - des "Mentors". -
-
- -
-
+ + + + + + + + + + + + + +
+ Expérience et expertises que tu acceptes de faire partager +
+ + privé +
+ 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. Il est obligatoire de + remplir cette dernière case pour apparaître dans la base de données + des "Mentors". +
+ +
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/poly.tpl b/templates/profile/poly.tpl deleted file mode 100644 index c914139..0000000 --- a/templates/profile/poly.tpl +++ /dev/null @@ -1,189 +0,0 @@ -{**************************************************************************} -{* *} -{* 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} - -{/literal} -
- - - - - - - - - - - - - - - - - - - - {foreach from=$binets item=b} - - - - - - {/foreach} - - - - - - - {foreach from=$groupesx item=g} - - - - - - {/foreach} - - - -
- Informations polytechniciennes -
- - - - - -
- - - privé -
-
- (ex-)Section - - - -   -
- (ex-)Binet(s) - - {$b.text} - - - retirer - -
-   - - - - - ajouter - -
- Groupe(s) X - - {$g.text} - - - retirer - -
-   - - - - - ajouter - -
-
- -{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/profile.tpl b/templates/profile/profile.tpl index c2aa469..5af2146 100644 --- a/templates/profile/profile.tpl +++ b/templates/profile/profile.tpl @@ -167,7 +167,7 @@ function chgMainWinLoc(strPage)

Distinctions :

{foreach from=$x.medals item=m}
- {$m.medal} + {$m.medal}
{$m.medal}
{$m.grade}
diff --git a/templates/profile/skill.skill.tpl b/templates/profile/skill.skill.tpl new file mode 100644 index 0000000..5579bc6 --- /dev/null +++ b/templates/profile/skill.skill.tpl @@ -0,0 +1,39 @@ +{**************************************************************************} +{* *} +{* 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} + +{/if} +
+
+ {$skill.text} + +
+ + {icon name=cross title="Supprimer"} +
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/skill.tpl b/templates/profile/skill.tpl index 8619657..aea9c70 100644 --- a/templates/profile/skill.tpl +++ b/templates/profile/skill.tpl @@ -21,194 +21,117 @@ {**************************************************************************} + {/literal} +//]]> -
- - - - - - - - - - - - - {foreach from=$cpro_name key=i item=name} - - - - - - {/foreach} - {if $nb_cpro < $nb_cpro_max} - - - + + + + +
- Compétences professionnelles - - - -
- - - - - -
- - - privé -
-
- Domaine - - Niveau - -   -
- {$name} - -   {$cpro_level.$i} - - retirer -
- - - + + + + + - - - {/if} -
+ Compétences professionnelles +
+
+ + privé +
+
+ Domaine : + -
- ajouter -
- + + +
+ {foreach from=$competences item=competence key=id} + {include file="profile/skill.skill.tpl" cat='competences' skill=$competence id=$id levels=$comp_level} + {/foreach} +
-
- - - - - - - - - - - - - {foreach from=$langue_name item=name key=i} - - - - - - {/foreach} - {if $nb_lg < $nb_lg_max} - - - + + + + +
- Compétences linguistiques - - - -
- - - - - -
- - - privé -
-
- Langue - - Niveau - - Quel niveau ? -
- {$name} - -   {if $langue_level.$i == 0}-{else}{$langue_level.$i}{/if} - - retirer -
- - - + + + + + - - - {/if} -
Compétences linguistiques
+
+ + privé +
+
+ Domaine : + -
- ajouter -
- + + +
+ {foreach from=$langues item=langue key=id} + {include file="profile/skill.skill.tpl" cat='langues' skill=$langue id=$id levels=$lang_level} + {/foreach} +
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/skin/common.content.tpl b/templates/skin/common.content.tpl index 7f6ac58..ecf08f4 100644 --- a/templates/skin/common.content.tpl +++ b/templates/skin/common.content.tpl @@ -37,9 +37,11 @@ Nous conseillons très vivement d'utiliser des navigateurs récents, tels
{/if} +{if !$xorg_no_errors && !$xorg_failure} {foreach from=$xorg_errors item=err}
{$err|smarty:nodefaults}
{/foreach} +{/if} {if !$xorg_failure && $xorg_tpl}{include file=$xorg_tpl}{/if} diff --git a/upgrade/0.9.15/02_entreprises.sql b/upgrade/0.9.15/02_entreprises.sql new file mode 100644 index 0000000..79cd796 --- /dev/null +++ b/upgrade/0.9.15/02_entreprises.sql @@ -0,0 +1,8 @@ +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: