From: Stéphane Jacob Date: Sun, 29 Mar 2009 17:11:43 +0000 (+0200) Subject: Fixes mentoring. X-Git-Tag: xorg/1.0.0~332^2~337^2~3 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=bdc3d2e9dd1b2369baed9f2a82f265c3dc1129bd;p=platal.git Fixes mentoring. --- diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js index bfd2059..70159b3 100644 --- a/htdocs/javascript/profile.js +++ b/htdocs/javascript/profile.js @@ -546,7 +546,7 @@ function addCountry() function updateSubSector() { var s = $('#sectorSelection').find('[name=sectorSelection]').val(); - var ss = $('#selectedSubSector').find("[name='jobs[-1][subSector]']").val(); + var ss = $('#subSectorSelection').find("[name='jobs[-1][subSector]']").val(); if ((s == '' || ss == '') || $('#sectors_' + s + '_' + ss).length != 0) { $('#addSector').hide(); } else { @@ -565,24 +565,24 @@ function updateSector() var sector = $('#sectorSelection').find('[name=sectorSelection]').val(); if (sector == '') { sector = '-1'; - $('#selectedSubSector').html(''); + $('#subSectorSelection').html(''); return; } $.get(platal_baseurl + 'profile/ajax/sector/-1/0/0/' + sector, function(data) { data = '' + data; - $('#selectedSubSector').html(data); - $('#selectedSubSector').find("[name='jobs[-1][subSector]']").change(updateSubSector); + $('#subSectorSelection').html(data); + $('#subSectorSelection').find("[name='jobs[-1][subSector]']").change(updateSubSector); }); } function addSector() { var s = $('#sectorSelection').find('[name=sectorSelection]').val(); - var ss = $('#selectedSubSector').find("[name='jobs[-1][subSector]']").val(); - var sst = $('#selectedSubSector').find("[name='jobs[-1][subSector]'] :selected").text(); + var ss = $('#subSectorSelection').find("[name='jobs[-1][subSector]']").val(); + var sst = $('#subSectorSelection').find("[name='jobs[-1][subSector]'] :selected").text(); var html = '
' + ' ' diff --git a/modules/profile/mentor.inc.php b/modules/profile/mentor.inc.php index 4fc7b94..e85318c 100644 --- a/modules/profile/mentor.inc.php +++ b/modules/profile/mentor.inc.php @@ -39,9 +39,9 @@ class ProfileSectors implements ProfileSetting $value[$s][$ss] = $ssname; } } - } else if (!is_array($value)) { + } elseif (!is_array($value)) { $value = array(); - } else if (count($value) > 10) { + } elseif (count($value) > 10) { Platal::page()->trigError("Le nombre de secteurs d'expertise est limité à 10."); $success = false; } @@ -61,8 +61,8 @@ class ProfileSectors implements ProfileSetting if (!count($value)) { return; } - foreach ($value as $id=>&$sect) { - foreach ($sect as $sid=>&$name) { + foreach ($value as $id => $sect) { + foreach ($sect as $sid => $name) { XDB::execute("INSERT INTO profile_mentor_sector (uid, sectorid, subsectorid) VALUES ({?}, {?}, {?})", S::i('uid'), $id, $sid); @@ -125,7 +125,7 @@ class ProfileMentor extends ProfilePage protected function _fetchData() { $res = XDB::query("SELECT expertise - FROM mentor + FROM profile_mentor WHERE uid = {?}", S::i('uid')); $this->values['expertise'] = $res->fetchOneCell(); @@ -136,12 +136,12 @@ class ProfileMentor extends ProfilePage if ($this->changed['expertise']) { $expertise = trim($this->values['expertise']); if (empty($expertise)) { - XDB::execute("DELETE FROM mentor + XDB::execute("DELETE FROM profile_mentor WHERE uid = {?}", S::i('uid')); $this->values['expertise'] = null; } else { - XDB::execute("REPLACE INTO mentor (uid, expertise) + XDB::execute("REPLACE INTO profile_mentor (uid, expertise) VALUES ({?}, {?})", S::i('uid'), $expertise); $this->values['expertise'] = $expertise; @@ -151,8 +151,8 @@ class ProfileMentor extends ProfilePage public function _prepare(PlPage &$page, $id) { - $page->assign('sectors', XDB::iterator("SELECT id, name - FROM profile_job_sector_enum")); + $page->assign('sectorList', XDB::iterator('SELECT id, name + FROM profile_job_sector_enum')); $page->assign('countryList', XDB::iterator("SELECT iso_3166_1_a2, countryFR FROM geoloc_countries diff --git a/templates/profile/mentor.tpl b/templates/profile/mentor.tpl index 093cfd2..36a6e87 100644 --- a/templates/profile/mentor.tpl +++ b/templates/profile/mentor.tpl @@ -97,7 +97,7 @@
Secteur