X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fprofil%2Fget_mentor.inc.php;h=74a1f1071cd2c10f8c9e497770e0ab9d34473b63;hb=4e2929c6e6e7e5e175719a007a79598952bd9023;hp=c1b7c7d217afb13be60bbde8f13e3b05b81b51ea;hpb=50a40a33a496131e817df875607ea5542d096a64;p=platal.git diff --git a/include/profil/get_mentor.inc.php b/include/profil/get_mentor.inc.php index c1b7c7d..74a1f10 100644 --- a/include/profil/get_mentor.inc.php +++ b/include/profil/get_mentor.inc.php @@ -26,55 +26,55 @@ $max_mentor_pays = 10; $max_mentor_secteurs = 10; //recuperation de l'expertise -$res = $globals->xdb->query("SELECT expertise FROM mentor WHERE uid = {?}", Session::getInt('uid',-1)); +$res = XDB::query("SELECT expertise FROM mentor WHERE uid = {?}", S::v('uid',-1)); $mentor_expertise = $res->fetchOneCell(); $mentor_expertise_bd = $mentor_expertise; //suppression eventuelle d'un pays -if(Post::get('mentor_pays_op', '') == 'retirer') { +if(Post::v('mentor_pays_op', '') == 'retirer') { if(Post::has('mentor_pays_id')) { - $id_supprimee = Post::get('mentor_pays_id', '00'); - $globals->xdb->execute("DELETE FROM mentor_pays WHERE uid = {?} AND pid = {?} LIMIT 1", Session::getInt('uid', -1), $id_supprimee); + $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 = $globals->xdb->iterRow("SELECT m.pid, p.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 {?}", Session::getInt('uid', -1), $max_mentor_pays); + 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::get('mentor_pays_op', '') == 'ajouter') && ($nb_mentor_pays < $max_mentor_pays)) { - if(Post::get('mentor_pays_id', '00') != '00') { - $id_ajoutee = Post::get('mentor_pays_id', '00'); - $globals->xdb->execute("INSERT INTO mentor_pays(uid, pid) VALUES({?}, {?})", Session::getInt('uid', -1), $id_ajoutee); +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::get('mentor_pays_name', ''); + $mentor_pays[$nb_mentor_pays] = Post::v('mentor_pays_name', ''); } } //suppression d'un secteur / ss-secteur -if(Post::get('mentor_secteur_op', '') == 'retirer') { +if(Post::v('mentor_secteur_op', '') == 'retirer') { if(Post::has('mentor_secteur_id')) { - $id_supprimee = Post::get('mentor_secteur_id', ''); - $globals->xdb->execute("DELETE FROM mentor_secteurs WHERE uid = {?} AND secteur = {?} LIMIT 1", Session::getInt('uid', -1), $id_supprimee); + $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 = $globals->xdb->iterRow("SELECT m.secteur, s.label, m.ss_secteur, ss.label +$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 {?}", Session::getInt('uid', -1), $max_mentor_pays); + 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++) @@ -82,21 +82,21 @@ for($i = 1; $i <= $nb_mentor_secteurs ; $i++) //ajout d'un secteur $mentor_secteur_id_new = ''; -if((Post::get('mentor_secteur_op', '')== 'ajouter') && ($nb_mentor_secteurs < $max_mentor_secteurs)) { - if(Post::get('mentor_secteur_id', '') != '') +if((Post::v('mentor_secteur_op', '')== 'ajouter') && ($nb_mentor_secteurs < $max_mentor_secteurs)) { + if(Post::v('mentor_secteur_id', '') != '') { - $sid_ajoutee = Post::get('mentor_secteur_id', ''); + $sid_ajoutee = Post::v('mentor_secteur_id', ''); if(Post::has('mentor_ss_secteur_id')) - $ssid_ajoutee = Post::get('mentor_ss_secteur_id', ''); - $globals->xdb->execute("INSERT INTO mentor_secteurs (uid, secteur, ss_secteur) - VALUES({?}, {?}, {?})", Session::getInt('uid', -1), $sid_ajoutee, ($ssid_ajoutee == '')?null:$ssid_ajoutee); + $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::get('mentor_secteur_name', ''); + $mentor_secteur[$nb_mentor_secteurs] = Post::v('mentor_secteur_name', ''); $mentor_ssid[$nb_mentor_secteurs] = $ssid_ajoutee; - $mentor_ss_secteur[$nb_mentor_secteurs] = Post::get('mentor_ss_secteur_name', ''); + $mentor_ss_secteur[$nb_mentor_secteurs] = Post::v('mentor_ss_secteur_name', ''); } } elseif(Post::has('mentor_secteur_id_new')){ - $mentor_secteur_id_new = Post::get('mentor_secteur_id_new', ''); + $mentor_secteur_id_new = Post::v('mentor_secteur_id_new', ''); } ?>