rework XOrgDB -> XDB (shorter, easier to use).
[platal.git] / include / profil / get_mentor.inc.php
index c1b7c7d..08333e3 100644 (file)
@@ -26,7 +26,7 @@ $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 = {?}", Session::getInt('uid',-1));
 
 $mentor_expertise = $res->fetchOneCell();
 $mentor_expertise_bd = $mentor_expertise;
@@ -35,12 +35,12 @@ $mentor_expertise_bd = $mentor_expertise;
 if(Post::get('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);
+        XDB::execute("DELETE FROM mentor_pays WHERE uid = {?} AND pid = {?} LIMIT 1", Session::getInt('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);
 $nb_mentor_pays = $res->total();
@@ -51,7 +51,7 @@ for($i = 1; $i <= $nb_mentor_pays ; $i++) list($mentor_pid[$i], $mentor_pays[$i]
 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);
+       XDB::execute("INSERT INTO mentor_pays(uid, pid) VALUES({?}, {?})", Session::getInt('uid', -1), $id_ajoutee);
        $nb_mentor_pays++;
        $mentor_pid[$nb_mentor_pays] = $id_ajoutee;
        $mentor_pays[$nb_mentor_pays] = Post::get('mentor_pays_name', '');
@@ -64,12 +64,12 @@ if((Post::get('mentor_pays_op', '') == 'ajouter') && ($nb_mentor_pays < $max_men
 if(Post::get('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);
+        XDB::execute("DELETE FROM mentor_secteurs WHERE uid = {?} AND secteur = {?} LIMIT 1", Session::getInt('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)
@@ -88,7 +88,7 @@ if((Post::get('mentor_secteur_op', '')== 'ajouter') && ($nb_mentor_secteurs < $m
        $sid_ajoutee = Post::get('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)
+       XDB::execute("INSERT INTO mentor_secteurs (uid, secteur, ss_secteur)
                                    VALUES({?}, {?}, {?})", Session::getInt('uid', -1), $sid_ajoutee, ($ssid_ajoutee == '')?null:$ssid_ajoutee);
        $nb_mentor_secteurs++;
        $mentor_sid[$nb_mentor_secteurs] = $sid_ajoutee;