| 1 | <?php |
| 2 | /*************************************************************************** |
| 3 | * Copyright (C) 2003-2004 Polytechnique.org * |
| 4 | * http://opensource.polytechnique.org/ * |
| 5 | * * |
| 6 | * This program is free software; you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
| 9 | * (at your option) any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, write to the Free Software * |
| 18 | * Foundation, Inc., * |
| 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
| 20 | ***************************************************************************/ |
| 21 | |
| 22 | |
| 23 | if(Env::has('langue_op')){ |
| 24 | if(Env::get('langue_op', '')=='retirer'){ |
| 25 | $globals->xdb->execute("DELETE FROM langues_ins WHERE uid = {?} AND lid = {?}", Session::getInt('uid', -1), Env::get('langue_id', '')); |
| 26 | } elseif(Env::get('langue_op', '') == 'ajouter'){ |
| 27 | if(Env::get('langue_id', '') != '') |
| 28 | $globals->xdb->execute("INSERT INTO langues_ins (uid,lid,level) VALUES ({?}, {?}, {?})", Session::getInt('uid', -1), Env::get('langue_id', ''), Env::get('langue_level', '')); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | if(Env::has('comppros_op')){ |
| 33 | if(Env::get('comppros_op', '')=='retirer'){ |
| 34 | $globals->xdb->execute("DELETE FROM competences_ins WHERE uid = {?} AND cid = {?}", Session::getInt('uid', -1), Env::get('comppros_id', '')); |
| 35 | } elseif(Env::get('comppros_op', '') == 'ajouter') { |
| 36 | if(Env::get('comppros_id', '') != '') |
| 37 | $globals->xdb->execute("INSERT INTO competences_ins (uid,cid,level) VALUES({?}, {?}, {?})", Session::getInt('uid', -1), Env::get('comppros_id', ''), Env::get('comppros_level', '')); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | // nombre maximum autorisé de langues |
| 42 | $nb_lg_max = 10; |
| 43 | // nombre maximum autorisé de compétences professionnelles |
| 44 | $nb_cpro_max = 20; |
| 45 | |
| 46 | $res = $globals->xdb->iterRow("SELECT ld.id, ld.langue_fr, li.level FROM langues_ins AS li, langues_def AS ld " |
| 47 | ."WHERE (li.lid=ld.id AND li.uid= {?}) LIMIT $nb_lg_max", Session::getInt('uid', -1)); |
| 48 | |
| 49 | $nb_lg = $res->total(); |
| 50 | |
| 51 | for ($i = 1; $i <= $nb_lg; $i++) { |
| 52 | list($langue_id[$i], $langue_name[$i], $langue_level[$i]) = $res->next(); |
| 53 | } |
| 54 | |
| 55 | $res = $globals->xdb->iterRow("SELECT cd.id, cd.text_fr, ci.level FROM competences_ins AS ci, competences_def AS cd " |
| 56 | ."WHERE (ci.cid=cd.id AND ci.uid={?}) LIMIT $nb_cpro_max", Session::getInt('uid', -1)); |
| 57 | |
| 58 | $nb_cpro = $res->total(); |
| 59 | |
| 60 | for ($i = 1; $i <= $nb_cpro; $i++) { |
| 61 | list($cpro_id[$i], $cpro_name[$i], $cpro_level[$i]) = $res->next(); |
| 62 | } |
| 63 | //Definitions des tables de correspondances id => nom |
| 64 | |
| 65 | $langues_levels = Array( |
| 66 | 1 => "1", |
| 67 | 2 => "2", |
| 68 | 3 => "3", |
| 69 | 4 => "4", |
| 70 | 5 => "5", |
| 71 | 6 => "6" |
| 72 | ); |
| 73 | |
| 74 | $res = $globals->xdb->iterRow("SELECT id, langue_fr FROM langues_def"); |
| 75 | |
| 76 | while(list($tmp_lid, $tmp_lg_fr) = $res->next()){ |
| 77 | $langues_def[$tmp_lid] = $tmp_lg_fr; |
| 78 | } |
| 79 | |
| 80 | $comppros_levels = Array( |
| 81 | 'initié' => 'initié', |
| 82 | 'bonne connaissance' => 'bonne connaissance', |
| 83 | 'expert' => 'expert' |
| 84 | ); |
| 85 | |
| 86 | $res = $globals->xdb->iterRow("SELECT id, text_fr, FIND_IN_SET('titre',flags) FROM competences_def"); |
| 87 | |
| 88 | while(list($tmp_id, $tmp_text_fr, $tmp_title) = $res->next()){ |
| 89 | $comppros_def[$tmp_id] = $tmp_text_fr; |
| 90 | $comppros_title[$tmp_id] = $tmp_title; |
| 91 | } |
| 92 | |
| 93 | ?> |