Only list sectors in which we have mentor listed.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 24 Jun 2010 12:34:53 +0000 (14:34 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 24 Jun 2010 12:35:45 +0000 (14:35 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
modules/profile.php
templates/profile/referent.tpl

index 0431923..d27f480 100644 (file)
@@ -539,11 +539,14 @@ class ProfileModule extends PLModule
         $wp = new PlWikiPage('Docs.Emploi');
         $wp->buildCache();
 
-        $page->setTitle('Conseil Pro');
+        $page->setTitle('Emploi et Carrières');
 
         // Retrieval of sector names
-        $sectors = DirEnum::getOptions(DirEnum::SECTORS);
-        $sectors[''] = '';
+        $sectors = XDB::fetchAllAssoc('id', 'SELECT  pjse.id, pjse.name
+                                               FROM  profile_job_sector_enum AS pjse
+                                         INNER JOIN  profile_mentor_sector AS pms ON (pms.sectorid = pjse.id)
+                                           GROUP BY  pjse.id
+                                           ORDER BY  pjse.name');
         $page->assign_by_ref('sectors', $sectors);
 
         // nb de mentors
@@ -574,9 +577,12 @@ class ProfileModule extends PLModule
         $page->assign('onchange', 'setSSectors()');
         $page->assign('id', 'ssect_field');
         $page->assign('name', 'subSector');
-        $it = XDB::iterator("SELECT  id, name AS field
-                               FROM  profile_job_subsector_enum
-                              WHERE  sectorid = {?}", $sect);
+        $it = XDB::iterator("SELECT  pjsse.id, pjsse.name AS field
+                               FROM  profile_job_subsector_enum AS pjsse
+                         INNER JOIN  profile_mentor_sector AS pms ON (pms.sectorid = pjsse.sectorid AND pms.subsectorid = pjsse.id)
+                              WHERE  pjsse.sectorid = {?}
+                           GROUP BY  pjsse.id
+                           ORDER BY  pjsse.name", $sect);
         $page->assign('list', $it);
     }
 
index a299529..110075a 100644 (file)
@@ -73,6 +73,7 @@ function setSubSectors()
       </td>
       <td>
         <select name="sector" id="sect_field" onchange="setSector(this.value)">
+          <option name=""></option>
           {html_options options=$sectors selected=$sectorSelection}
         </select>
       </td>