Deletes all references to sectors as they have been replaced by jobterms.
authorStéphane Jacob <sj@m4x.org>
Mon, 27 Sep 2010 08:15:44 +0000 (10:15 +0200)
committerStéphane Jacob <sj@m4x.org>
Mon, 27 Sep 2010 11:23:57 +0000 (13:23 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
15 files changed:
bin/cron/clean.php
classes/direnum.php
classes/profile.php
classes/userfilter.php
htdocs/javascript/profile.js
include/profilefields.inc.php
include/ufbuilder.inc.php
modules/profile.php
modules/search.php
templates/admin/index.tpl
templates/profile/jobs.alternates.tpl [deleted file]
templates/profile/jobs.sector.tpl [deleted file]
templates/profile/jobs.sub_sector.tpl [deleted file]
upgrade/1.0.1/99_jobs.sql
ut/checkdb.php

index 2663bb2..153da31 100755 (executable)
@@ -47,12 +47,6 @@ query('ALTER TABLE  profile_education_field_enum
           ORDER BY  field');
 query('ALTER TABLE  profile_job_enum
           ORDER BY  name');
-query('ALTER TABLE  profile_job_sector_enum
-          ORDER BY  name');
-query('ALTER TABLE  profile_job_subsector_enum
-          ORDER BY  name');
-query('ALTER TABLE  profile_job_subsubsector_enum
-          ORDER BY  name');
 query('ALTER TABLE  profile_langskill_enum
           ORDER BY  langue_fr');
 query('ALTER TABLE  profile_medal_enum
index 567f4de..0c22dc6 100644 (file)
@@ -49,7 +49,6 @@ class DirEnum
     const LOCALITIES     = 'localities';
 
     const COMPANIES      = 'companies';
-    const SECTORS        = 'sectors';
     const JOBDESCRIPTION = 'jobdescription';
     const JOBTERMS       = 'jobterms';
 
@@ -625,18 +624,6 @@ class DE_Companies extends DirEnumeration
 }
 // }}}
 
-// {{{ class DE_Sectors
-class DE_Sectors extends DirEnumeration
-{
-    protected $idfield   = 'profile_job_sector_enum.id';
-    protected $valfield  = 'profile_job_sector_enum.name';
-    protected $from      = 'profile_job_sector_enum';
-
-    protected $ac_join   = 'INNER JOIN profile_job ON (profile_job_sector_enum.id = profile_job.sectorid)';
-    protected $ac_unique = 'profile_job.pid';
-}
-// }}}
-
 // {{{ class DE_JobDescription
 class DE_JobDescription extends DirEnumeration
 {
index d3a1fdd..0adc9d3 100644 (file)
@@ -94,7 +94,6 @@ class Profile
     const FETCH_JOBS           = 0x000008;
     const FETCH_MEDALS         = 0x000010;
     const FETCH_NETWORKING     = 0x000020;
-    const FETCH_MENTOR_SECTOR  = 0x000040;
     const FETCH_MENTOR_COUNTRY = 0x000080;
     const FETCH_PHONES         = 0x000100;
     const FETCH_JOB_TERMS      = 0x000200;
@@ -697,27 +696,6 @@ class Profile
         $this->consolidateFields();
     }
 
-    /* Mentoring
-     */
-    private $mentor_sectors = null;
-    public function setMentoringSectors(ProfileMentoringSectors $sectors)
-    {
-        $this->mentor_sectors = $sectors;
-    }
-
-    public function getMentoringSectors()
-    {
-        if ($this->mentor_sectors == null && !$this->fetched(self::FETCH_MENTOR_SECTOR)) {
-            $this->setMentoringSectors($this->getProfileField(self::FETCH_MENTOR_SECTOR));
-        }
-
-        if ($this->mentor_sectors == null) {
-            return array();
-        } else {
-            return $this->mentor_sectors->sectors;
-        }
-    }
-
     private $mentor_countries = null;
     public function setMentoringCountries(ProfileMentoringCountries $countries)
     {
index f78635b..26241f3 100644 (file)
@@ -984,44 +984,6 @@ class UFC_Job_Company implements UserFilterCondition
 }
 // }}}
 
-// {{{ class UFC_Job_Sectorization
-/** Filters users based on the ((sub)sub)sector they work in
- * @param $val The ID of the sector, or an array of such IDs
- * @param $type The kind of search (subsubsector/subsector/sector)
- */
-class UFC_Job_Sectorization implements UserFilterCondition
-{
-    private $val;
-    private $type;
-
-    public function __construct($val, $type = UserFilter::JOB_SECTOR)
-    {
-        self::assertType($type);
-        if (!is_array($val)) {
-            $val = array($val);
-        }
-        $this->val = $val;
-        $this->type = $type;
-    }
-
-    private static function assertType($type)
-    {
-        if ($type != UserFilter::JOB_SECTOR && $type != UserFilter::JOB_SUBSECTOR && $type != UserFilter::JOB_SUBSUBSECTOR) {
-            Platal::page()->killError("Type de secteur non valide.");
-        }
-    }
-
-    public function buildCondition(PlFilter &$uf)
-    {
-        $sub = $uf->addJobSectorizationFilter($this->type);
-        $cond = $sub . '.id = ' . XDB::format('{?}', $this->val);
-        $jsub = $uf->addJobFilter();
-        $cond .= ' AND ' . $uf->getVisibilityCondition($jsub . '.pub');
-        return $cond;
-    }
-}
-// }}}
-
 // {{{ class UFC_Job_Terms
 /** Filters users based on the job terms they assigned to one of their
  * jobs.
@@ -1056,7 +1018,7 @@ class UFC_Job_Terms implements UserFilterCondition
 // {{{ class UFC_Job_Description
 /** Filters users based on their job description
  * @param $description The text being searched for
- * @param $fields The fields to search for (user-defined, ((sub|)sub|)sector)
+ * @param $fields The fields to search for (CV, user-defined)
  */
 class UFC_Job_Description implements UserFilterCondition
 {
@@ -1092,20 +1054,6 @@ class UFC_Job_Description implements UserFilterCondition
             $uf->requireProfiles();
             $conds[] = 'p.cv ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->description);
         }
-        if ($this->fields & UserFilter::JOB_SECTOR) {
-            $sub = $uf->addJobSectorizationFilter(UserFilter::JOB_SECTOR);
-            $conds[] = $sub . '.name ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->description);
-        }
-        if ($this->fields & UserFilter::JOB_SUBSECTOR) {
-            $sub = $uf->addJobSectorizationFilter(UserFilter::JOB_SUBSECTOR);
-            $conds[] = $sub . '.name ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->description);
-        }
-        if ($this->fields & UserFilter::JOB_SUBSUBSECTOR) {
-            $sub = $uf->addJobSectorizationFilter(UserFilter::JOB_SUBSUBSECTOR);
-            $conds[] = $sub . '.name ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->description);
-            $sub = $uf->addJobSectorizationFilter(UserFilter::JOB_ALTERNATES);
-            $conds[] = $sub . '.name ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->description);
-        }
         return implode(' OR ', $conds);
     }
 }
@@ -1313,37 +1261,6 @@ class UFC_Mentor_Terms implements UserFilterCondition
 }
 // }}}
 
-// {{{ class UFC_Mentor_Sectorization
-/** Filters users based on mentoring (sub|)sector
- * @param $sector ID of (sub)sector
- * @param $type Whether we are looking for a sector or a subsector
- */
-class UFC_Mentor_Sectorization implements UserFilterCondition
-{
-    const SECTOR    = 1;
-    const SUBSECTOR = 2;
-    private $sector;
-    private $type;
-
-    public function __construct($sector, $type = self::SECTOR)
-    {
-        $this->sector = $sector;
-        $this->type = $type;
-    }
-
-    public function buildCondition(PlFilter &$uf)
-    {
-        $sub = $uf->addMentorFilter(UserFilter::MENTOR_SECTOR);
-        if ($this->type == self::SECTOR) {
-            $field = 'sectorid';
-        } else {
-            $field = 'subsectorid';
-        }
-        return $sub . '.' . $field . ' = ' . XDB::format('{?}', $this->sector);
-    }
-}
-// }}}
-
 // {{{ class UFC_UserRelated
 /** Filters users based on a relation toward a user
  * @param $user User to which searched users are related
@@ -2608,31 +2525,17 @@ class UserFilter extends PlFilter
     /** JOBS
      */
 
-    const JOB_SECTOR        = 0x0001;
-    const JOB_SUBSECTOR     = 0x0002;
-    const JOB_SUBSUBSECTOR  = 0x0004;
-    const JOB_ALTERNATES    = 0x0008;
-    const JOB_USERDEFINED   = 0x0010;
-    const JOB_CV            = 0x0020;
-
-    const JOB_SECTORIZATION = 0x000F;
-    const JOB_ANY           = 0x003F;
+    const JOB_USERDEFINED = 0x0001;
+    const JOB_CV          = 0x0002;
+    const JOB_ANY         = 0x0003;
 
     /** Joins :
      * pj => profile_job
      * pje => profile_job_enum
-     * pjse => profile_job_sector_enum
-     * pjsse => profile_job_subsector_enum
-     * pjssse => profile_job_subsubsector_enum
-     * pja => profile_job_alternates
      * pjt => profile_job_terms
      */
-    private $with_pj = false;
+    private $with_pj  = false;
     private $with_pje = false;
-    private $with_pjse = false;
-    private $with_pjsse = false;
-    private $with_pjssse = false;
-    private $with_pja = false;
     private $with_pjt = 0;
 
     public function addJobFilter()
@@ -2649,24 +2552,6 @@ class UserFilter extends PlFilter
         return 'pje';
     }
 
-    public function addJobSectorizationFilter($type)
-    {
-        $this->addJobFilter();
-        if ($type == self::JOB_SECTOR) {
-            $this->with_pjse = true;
-            return 'pjse';
-        } else if ($type == self::JOB_SUBSECTOR) {
-            $this->with_pjsse = true;
-            return 'pjsse';
-        } else if ($type == self::JOB_SUBSUBSECTOR) {
-            $this->with_pjssse = true;
-            return 'pjssse';
-        } else if ($type == self::JOB_ALTERNATES) {
-            $this->with_pja = true;
-            return 'pja';
-        }
-    }
-
     /**
      * Adds a filter on job terms of profile.
      * @param $nb the number of job terms to use
@@ -2691,18 +2576,6 @@ class UserFilter extends PlFilter
         if ($this->with_pje) {
             $joins['pje'] = PlSqlJoin::left('profile_job_enum', '$ME.id = pj.jobid');
         }
-        if ($this->with_pjse) {
-            $joins['pjse'] = PlSqlJoin::left('profile_job_sector_enum', '$ME.id = pj.sectorid');
-        }
-        if ($this->with_pjsse) {
-            $joins['pjsse'] = PlSqlJoin::left('profile_job_subsector_enum', '$ME.id = pj.subsectorid');
-        }
-        if ($this->with_pjssse) {
-            $joins['pjssse'] = PlSqlJoin::left('profile_job_subsubsector_enum', '$ME.id = pj.subsubsectorid');
-        }
-        if ($this->with_pja) {
-            $joins['pja'] = PlSqlJoin::left('profile_job_alternates', '$ME.subsubsectorid = pj.subsubsectorid');
-        }
         if ($this->with_pjt > 0) {
             for ($i = 1; $i <= $this->with_pjt; ++$i) {
                 $joins['pjt_'.$i] = PlSqlJoin::left('profile_job_term', '$ME.pid = $PID');
@@ -2781,8 +2654,7 @@ class UserFilter extends PlFilter
     const MENTOR = 1;
     const MENTOR_EXPERTISE = 2;
     const MENTOR_COUNTRY = 3;
-    const MENTOR_SECTOR = 4;
-    const MENTOR_TERM = 5;
+    const MENTOR_TERM = 4;
 
     public function addMentorFilter($type)
     {
@@ -2797,9 +2669,6 @@ class UserFilter extends PlFilter
         case self::MENTOR_COUNTRY:
             $this->pms['pmc'] = 'profile_mentor_country';
             return 'pmc';
-        case self::MENTOR_SECTOR:
-            $this->pms['pms'] =  'profile_mentor_sector';
-            return 'pms';
         case self::MENTOR_TERM:
             $this->pms['pmt'] = 'profile_mentor_term';
             $this->mjtr = true;
index 75b5b8d..ce2273e 100644 (file)
@@ -45,11 +45,6 @@ function wizPage_onLoad(id)
         }
         break;
       case 'emploi':
-        for (var i = 0 ; $('#job_' + i).length != 0; ++i) {
-            updateJobSector(i, $('#job_' + i).find("[name='jobs[" + i + "][subSector]']").val());
-            updateJobSubSector(i, $('#job_' + i).find("[name='jobs[" + i + "][subSubSector]']").val());
-            updateJobAlternates(i);
-        }
         if ($('#job_0').find("[name='jobs[0][name]']").val() == '') {
             registerEnterpriseAutocomplete(0);
         }
@@ -505,48 +500,6 @@ function restoreJob(id, pref)
     $('#' + id).find("[name='" + pref + "[removed]']").val('0');
 }
 
-function updateJobSector(id, sel)
-{
-    var sector = $('#job_' + id).find("[name='jobs[" + id + "][sector]']").val();
-    if (sector == '') {
-        sector = '-1';
-    }
-    Ajax.update_html('job_' + id + '_subSector', 'profile/ajax/sector/' + id + '/job_' + id + '/jobs[' + id + ']/' + sector + '/' + sel);
-}
-
-function updateJobSubSector(id, sel)
-{
-    var subSector = $('#job_' + id).find("[name='jobs[" + id + "][subSector]']").val();
-    if (subSector == '') {
-        subSector = '-1';
-    }
-    Ajax.update_html('job_' + id + '_subSubSector', 'profile/ajax/sub_sector/' + id + '/' + subSector + '/' + sel);
-}
-
-function updateJobAlternates(id)
-{
-    var subSubSector = $('#job_' + id).find("[name='jobs[" + id + "][subSubSector]']").val();
-    if (subSubSector != '') {
-        Ajax.update_html('job_' + id + '_alternates', 'profile/ajax/alternates/' + id + '/' + subSubSector);
-    }
-}
-
-function emptyJobSubSector(id)
-{
-    Ajax.update_html('job_' + id + '_subSubSector', 'profile/ajax/sub_sector/' + id + '/-1/-1');
-}
-
-function emptyJobAlternates(id)
-{
-    Ajax.update_html('job_' + id + '_alternates', 'profile/ajax/alternates/' + id + '/-1');
-}
-
-function displayAllSector(id)
-{
-    $('.sector_text_' + id).remove();
-    $('.sector_' + id).show();
-}
-
 function makeAddJob(id)
 {
     return function(data)
@@ -720,58 +673,6 @@ function addCountry()
     updateElement('countries');
 }
 
-function updateSubSector()
-{
-    var s  = $('#sectorSelection').find('[name=sectorSelection]').val();
-    var ss = $('#subSectorSelection').find("[name='jobs[-1][subSector]']").val();
-    if ((s == '' || ss == '') || $('#sectors_' + s + '_' + ss).length != 0) {
-        $('#addSector').hide();
-    } else {
-        $('#addSector').show();
-    }
-}
-
-function removeSector(s, ss)
-{
-    $('#sectors_' + s + '_' + ss).remove();
-    updateSubSector();
-}
-
-function updateSector()
-{
-    var sector = $('#sectorSelection').find('[name=sectorSelection]').val();
-    if (sector == '') {
-        sector = '-1';
-        $('#subSectorSelection').html('');
-        return;
-    }
-    $.get(platal_baseurl + 'profile/ajax/sector/-1/0/0/' + sector,
-          function(data) {
-              data = '<a href="javascript:addSector()" style="display: none; float: right" id="addSector">'
-                   + '  <img src="images/icons/add.gif" alt="Ajouter ce secteur" title="Ajouter ce secteur" />'
-                   + '</a>' + data;
-              $('#subSectorSelection').html(data);
-              $('#subSectorSelection').find("[name='jobs[-1][subSector]']").change(updateSubSector);
-          });
-}
-
-function addSector()
-{
-    var s   = $('#sectorSelection').find('[name=sectorSelection]').val();
-    var ss  = $('#subSectorSelection').find("[name='jobs[-1][subSector]']").val();
-    var sst = $('#subSectorSelection').find("[name='jobs[-1][subSector]'] :selected").text();
-
-    var html = '<div id="sectors_' + s + '_' + ss + '" style="clear: both; margin-top: 0.5em" class="titre">'
-             + '  <a href="javascript:removeSector(\'' + s + '\',\'' + ss + '\')" style="display: block; float: right">'
-             + '    <img src="images/icons/cross.gif" alt="" title="Supprimer ce secteur" />'
-             + '  </a>'
-             + '  <input type="hidden" name="sectors[' + s + '][' + ss + ']" value="' + sst + '" />'
-             + '  ' + sst
-             + '</div>';
-    $('#sectors').append(html);
-    updateSubSector();
-}
-
 function registerEnterpriseAutocomplete(id)
 {
     $(".enterpriseName").each(
index 8863aa6..e841c16 100644 (file)
@@ -33,7 +33,6 @@ abstract class ProfileField
         Profile::FETCH_MEDALS         => 'ProfileMedals',
         Profile::FETCH_NETWORKING     => 'ProfileNetworking',
         Profile::FETCH_PHONES         => 'ProfilePhones',
-        Profile::FETCH_MENTOR_SECTOR  => 'ProfileMentoringSectors',
         Profile::FETCH_MENTOR_COUNTRY => 'ProfileMentoringCountries',
         Profile::FETCH_JOB_TERMS      => 'ProfileJobTerms',
         Profile::FETCH_MENTOR_TERMS   => 'ProfileMentoringTerms',
@@ -193,10 +192,6 @@ class Job
     public $user_site;
     public $user_email;
 
-    public $sector;
-    public $subsector;
-    public $subsubsector;
-
     /** Fields are:
      * pid, id, company_id, description, url, email
      */
@@ -475,33 +470,6 @@ class ProfileCorps extends ProfileField
     }
 }
 // }}}
-// {{{ class ProfileMentoringSectors                  [ Field ]
-class ProfileMentoringSectors extends ProfileField
-{
-    public $sectors = array();
-
-    public function __construct(PlInnerSubIterator $it)
-    {
-        $this->pid = $it->value();
-        while ($sector = $it->next()) {
-            $this->sectors[] = $sector;
-        }
-    }
-
-    public static function fetchData(array $pids, ProfileVisibility $visibility)
-    {
-        $data = XDB::iterator('SELECT  pms.pid, pjse.name AS sector, pjsse.name AS subsector
-                                 FROM  profile_mentor_sector AS pms
-                            LEFT JOIN  profile_job_sector_enum AS pjse ON (pjse.id = pms.sectorid)
-                            LEFT JOIN  profile_job_subsector_enum AS pjsse ON (pjsse.id = pms.subsectorid)
-                                WHERE  pms.pid IN {?}
-                             ORDER BY  ' . XDB::formatCustomOrder('pms.pid', $pids),
-                                $pids);
-
-        return PlIteratorUtils::subIterator($data, PlIteratorUtils::arrayValueCallback('pid'));
-    }
-}
-// }}}
 // {{{ class ProfileMentoringCountries                [ Field ]
 class ProfileMentoringCountries extends ProfileField
 {
index 09dc307..55de5e5 100644 (file)
@@ -190,7 +190,6 @@ class UFB_AdvancedSearch extends UserFilterBuilder
             new UFBF_AdminArea('region', 'Région'),
 
             new UFBF_JobCompany('entreprise', 'Entreprise'),
-            new UFBF_JobSector('sector', 'Poste'),
             new UFBF_JobDescription('jobdescription', 'Fonction'),
             new UFBF_JobCv('cv', 'CV'),
             new UFBF_JobTerms('jobterm', 'Mots-clefs'),
@@ -833,29 +832,6 @@ class UFBF_JobCompany extends UFBF_Text
 }
 // }}}
 
-// {{{ class UFBF_JobSector
-class UFBF_JobSector extends UFBF_Mixed
-{
-    protected $direnum = DirEnum::SECTORS;
-    private $onlymentorfield;
-
-    public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlymentorfield = 'only_referent')
-    {
-        parent::__construct($envfieldtext, $envfieldindex, $formtext);
-        $this->onlymentorfield = $onlymentorfield;
-    }
-
-    protected function buildUFC(UserFilterBuilder &$ufb)
-    {
-        if ($ufb->isOn($this->onlymentorfield)) {
-            return new UFC_Mentor_Sectorization($this->val, UserFilter::JOB_SUBSECTOR);
-        } else {
-            return new UFC_Job_Sectorization($this->val, UserFilter::JOB_SUBSUBSECTOR);
-        }
-    }
-}
-// }}}
-
 // {{{ class UFBF_JobTerms
 class UFBF_JobTerms extends UFBF_Index
 {
@@ -1081,24 +1057,6 @@ class UFBF_MentorTerm extends UFBF_Index
 }
 // }}}
 
-// {{{ class UFBF_MentorSectorization
-class UFBF_MentorSectorization extends UFBF_Index
-{
-    protected $type;
-
-    public function __construct($envfield, $formtext = '', $type = UFC_Mentor_Sectorization::SECTOR)
-    {
-        parent::__construct($envfield, $formtext);
-        $this->type = $type;
-    }
-
-    protected function buildUFC(UserFilterBuilder &$ufb)
-    {
-        return new UFC_Mentor_Sectorization($this->val, $this->type);
-    }
-}
-// }}}
-
 // {{{ class UFBF_MentorExpertise
 class UFBF_MentorExpertise extends UFBF_Text
 {
index 26a5046..f85558e 100644 (file)
@@ -38,9 +38,6 @@ class ProfileModule extends PLModule
             'profile/ajax/medal'         => $this->make_hook('ajax_medal',                 AUTH_COOKIE, 'user', NO_AUTH),
             'profile/networking'         => $this->make_hook('networking',                 AUTH_PUBLIC),
             'profile/ajax/job'           => $this->make_hook('ajax_job',                   AUTH_COOKIE, 'user', NO_AUTH),
-            'profile/ajax/sector'        => $this->make_hook('ajax_sector',                AUTH_COOKIE, 'user', NO_AUTH),
-            'profile/ajax/sub_sector'    => $this->make_hook('ajax_sub_sector',            AUTH_COOKIE, 'user', NO_AUTH),
-            'profile/ajax/alternates'    => $this->make_hook('ajax_alternates',            AUTH_COOKIE, 'user', NO_AUTH),
             'profile/ajax/skill'         => $this->make_hook('ajax_skill',                 AUTH_COOKIE, 'user', NO_AUTH),
             'profile/ajax/searchname'    => $this->make_hook('ajax_searchname',            AUTH_COOKIE, 'user', NO_AUTH),
             'profile/ajax/buildnames'    => $this->make_hook('ajax_buildnames',            AUTH_COOKIE, 'user', NO_AUTH),
@@ -52,7 +49,6 @@ class ProfileModule extends PLModule
             'profile/name_info'          => $this->make_hook('name_info',                  AUTH_PUBLIC),
 
             'referent'                   => $this->make_hook('referent',                   AUTH_COOKIE),
-            'referent/ssect'             => $this->make_hook('ref_sect',                   AUTH_COOKIE, 'user', NO_AUTH),
             'referent/country'           => $this->make_hook('ref_country',                AUTH_COOKIE, 'user', NO_AUTH),
             'referent/autocomplete'      => $this->make_hook('ref_autocomplete',           AUTH_COOKIE, 'user', NO_AUTH),
 
@@ -69,7 +65,6 @@ class ProfileModule extends PLModule
             'admin/sections'             => $this->make_hook('admin_sections',             AUTH_MDP, 'admin'),
             'admin/networking'           => $this->make_hook('admin_networking',           AUTH_MDP, 'admin'),
             'admin/trombino'             => $this->make_hook('admin_trombino',             AUTH_MDP, 'admin'),
-            'admin/sectors'              => $this->make_hook('admin_sectors',              AUTH_MDP, 'admin'),
             'admin/corps_enum'           => $this->make_hook('admin_corps_enum',           AUTH_MDP, 'admin'),
             'admin/corps_rank'           => $this->make_hook('admin_corps_rank',           AUTH_MDP, 'admin'),
             'admin/names'                => $this->make_hook('admin_names',                AUTH_MDP, 'admin'),
@@ -425,41 +420,10 @@ class ProfileModule extends PLModule
         $page->assign('i', $id);
         $page->assign('job', array());
         $page->assign('new', true);
-        $res = XDB::query("SELECT  id, name AS label
-                             FROM  profile_job_sector_enum");
-        $page->assign('sectors', $res->fetchAllAssoc());
         require_once "emails.combobox.inc.php";
         fill_email_combobox($page);
     }
 
-    function handler_ajax_sector(&$page, $id, $jobid, $jobpref, $sect, $ssect = -1)
-    {
-        pl_content_headers("text/html");
-        $res = XDB::iterator("SELECT  id, name, FIND_IN_SET('optgroup', flags) AS optgroup
-                                FROM  profile_job_subsector_enum
-                               WHERE  sectorid = {?}", $sect);
-        $page->changeTpl('profile/jobs.sector.tpl', NO_SKIN);
-        $page->assign('id', $id);
-        $page->assign('subSectors', $res);
-        $page->assign('sel', $ssect);
-        if ($id != -1) {
-            $page->assign('change', 1);
-            $page->assign('jobid', $jobid);
-            $page->assign('jobpref', $jobpref);
-        }
-    }
-    function handler_ajax_sub_sector(&$page, $id, $ssect, $sssect = -1)
-    {
-        pl_content_headers("text/html");
-        $res = XDB::iterator("SELECT  id, name
-                                FROM  profile_job_subsubsector_enum
-                               WHERE  subsectorid = {?}", $ssect);
-        $page->changeTpl('profile/jobs.sub_sector.tpl', NO_SKIN);
-        $page->assign('id', $id);
-        $page->assign('subSubSectors', $res);
-        $page->assign('sel', $sssect);
-    }
-
     /**
      * Page for url "profile/ajax/tree/jobterms". Display a JSon page containing
      * the sub-branches of a branch in the job terms tree.
@@ -477,26 +441,6 @@ class ProfileModule extends PLModule
         JobTerms::ajaxGetBranch(&$page, $filter);
     }
 
-    function handler_ajax_alternates(&$page, $id, $sssect)
-    {
-        pl_content_headers("text/html");
-        $res = XDB::iterator('SELECT  name
-                                FROM  profile_job_alternates
-                               WHERE  subsubsectorid = {?}
-                            ORDER BY  id',
-                             $sssect);
-        $page->changeTpl('profile/jobs.alternates.tpl', NO_SKIN);
-        $alternates = '';
-        if ($res->total() > 0) {
-            $alternate  = $res->next();
-            $alternates = $alternate['name'];
-            while ($alternate  = $res->next()) {
-                $alternates .= ', ' . $alternate['name'];
-            }
-        }
-        $page->assign('alternates', $alternates);
-    }
-
     function handler_ajax_skill(&$page, $cat, $id)
     {
         pl_content_headers("text/html");
@@ -549,24 +493,7 @@ class ProfileModule extends PLModule
 
         $page->assign_by_ref('profile', $pf);
 
-        /////  recuperations infos referent
-
-        // Sectors
-        $sectors = $subSectors = Array();
-        $res = XDB::iterRow(
-                "SELECT  s.name AS label, ss.name AS label
-                   FROM  profile_mentor_sector      AS m
-              LEFT JOIN  profile_job_sector_enum    AS s  ON(m.sectorid = s.id)
-              LEFT JOIN  profile_job_subsector_enum AS ss ON(m.sectorid = ss.sectorid AND m.subsectorid = ss.id)
-                  WHERE  pid = {?}", $pf->id());
-        while (list($sector, $subSector) = $res->next()) {
-            $sectors[]    = $sector;
-            $subSectors[] = $subSector;
-        }
-        $page->assign_by_ref('sectors', $sectors);
-        $page->assign_by_ref('subSectors', $subSectors);
-
-        // Countries.
+        // Retrieves referents' countries.
         $res = XDB::query(
                 "SELECT  gc.countryFR
                    FROM  profile_mentor_country AS m
@@ -577,35 +504,16 @@ class ProfileModule extends PLModule
         $page->addJsLink('close_on_esc.js');
     }
 
-    function handler_ref_sect(&$page, $sect)
-    {
-        pl_content_headers("text/html");
-        $page->changeTpl('include/field.select.tpl', NO_SKIN);
-        $page->assign('onchange', 'setSSectors()');
-        $page->assign('id', 'ssect_field');
-        $page->assign('name', 'subSector');
-        $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);
-    }
-
-    function handler_ref_country(&$page, $sect, $ssect = '')
+    function handler_ref_country(&$page)
     {
         pl_content_headers("text/html");
         $page->changeTpl('include/field.select.tpl', NO_SKIN);
         $page->assign('name', 'pays_sel');
-        $where = ($ssect ? ' AND ms.subsectorid = {?}' : '');
         $it = XDB::iterator("SELECT  gc.iso_3166_1_a2 AS id, gc.countryFR AS field
                                FROM  geoloc_countries       AS gc
                          INNER JOIN  profile_mentor_country AS mp ON (mp.country = gc.iso_3166_1_a2)
-                         INNER JOIN  profile_mentor_sector  AS ms ON (ms.pid = mp.pid)
-                              WHERE  ms.sectorid = {?} " . $where . "
                            GROUP BY  iso_3166_1_a2
-                           ORDER BY  countryFR", $sect, $ssect);
+                           ORDER BY  countryFR");
         $page->assign('list', $it);
     }
 
@@ -845,16 +753,6 @@ class ProfileModule extends PLModule
         $table_editor->describe('text','intitulé',true);
         $table_editor->apply($page, $action, $id);
     }
-    function handler_admin_sectors(&$page, $action = 'list', $id = null) {
-        $page->setTitle('Administration - Secteurs');
-        $page->assign('title', 'Gestion des secteurs');
-        $table_editor = new PLTableEditor('admin/sectors', 'profile_job_subsubsector_enum', 'id', true);
-        $table_editor->describe('sectorid', 'id du secteur', false);
-        $table_editor->describe('subsectorid', 'id du sous-secteur', false);
-        $table_editor->describe('name', 'nom', true);
-        $table_editor->describe('flags', 'affichage', true);
-        $table_editor->apply($page, $action, $id);
-    }
     function handler_admin_networking(&$page, $action = 'list', $id = null) {
         $page->assign('xorg_title', 'Polytechnique.org - Administration - Networking');
         $page->assign('title', 'Gestion des types de networking');
index 6ffb45c..ba1112f 100644 (file)
@@ -307,9 +307,6 @@ class SearchModule extends PLModule
           case 'section':
             $ids = DirEnum::getOptionsIter(DirEnum::SECTIONS);
             break;
-          case 'secteur':
-            $ids = DirEnum::getOptionsIter(DirEnum::SECTORS);
-            break;
           case 'jobterm':
             if (Env::has('jtid')) {
                 JobTerms::ajaxGetBranch(&$page, JobTerms::ONLY_JOBS);
index d8ef364..48e621e 100644 (file)
   <tr class="pair">
     <td class="titre">Emploi</td>
     <td>
-      <a href="admin/sectors">Secteurs</a>
-      &nbsp;&nbsp;|&nbsp;&nbsp;
       <a href="admin/jobs">Entreprises</a>
       &nbsp;&nbsp;|&nbsp;&nbsp;
       <a href="admin/corps_enum">Corps</a>
diff --git a/templates/profile/jobs.alternates.tpl b/templates/profile/jobs.alternates.tpl
deleted file mode 100644 (file)
index 46e06f8..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-{**************************************************************************}
-{*                                                                        *}
-{*  Copyright (C) 2003-2010 Polytechnique.org                             *}
-{*  http://opensource.polytechnique.org/                                  *}
-{*                                                                        *}
-{*  This program is free software; you can redistribute it and/or modify  *}
-{*  it under the terms of the GNU General Public License as published by  *}
-{*  the Free Software Foundation; either version 2 of the License, or     *}
-{*  (at your option) any later version.                                   *}
-{*                                                                        *}
-{*  This program is distributed in the hope that it will be useful,       *}
-{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
-{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
-{*  GNU General Public License for more details.                          *}
-{*                                                                        *}
-{*  You should have received a copy of the GNU General Public License     *}
-{*  along with this program; if not, write to the Free Software           *}
-{*  Foundation, Inc.,                                                     *}
-{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
-{*                                                                        *}
-{**************************************************************************}
-
-<?xml version="1.0" encoding="utf-8"?>
-{if $alternates}
-  <small>({$alternates})</small>
-{else}
-  <small class="erreur">Il faut renseigner les 3 champs concernant le secteur
-    pour que celui-ci soit pris en compte lors de la validation.</small>
-{/if}
-
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/profile/jobs.sector.tpl b/templates/profile/jobs.sector.tpl
deleted file mode 100644 (file)
index f22a6ff..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-{**************************************************************************}
-{*                                                                        *}
-{*  Copyright (C) 2003-2010 Polytechnique.org                             *}
-{*  http://opensource.polytechnique.org/                                  *}
-{*                                                                        *}
-{*  This program is free software; you can redistribute it and/or modify  *}
-{*  it under the terms of the GNU General Public License as published by  *}
-{*  the Free Software Foundation; either version 2 of the License, or     *}
-{*  (at your option) any later version.                                   *}
-{*                                                                        *}
-{*  This program is distributed in the hope that it will be useful,       *}
-{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
-{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
-{*  GNU General Public License for more details.                          *}
-{*                                                                        *}
-{*  You should have received a copy of the GNU General Public License     *}
-{*  along with this program; if not, write to the Free Software           *}
-{*  Foundation, Inc.,                                                     *}
-{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
-{*                                                                        *}
-{**************************************************************************}
-
-<?xml version="1.0" encoding="utf-8"?>
-<select name="jobs[{$id}][subSector]" {if ($change)}onchange="updateJobSubSector({$id}, ''); emptyJobAlternates({$id});"{/if}>
-  <option value="0">&nbsp;</option>
-  {iterate from=$subSectors item=subSector}
-  {if $subSector.optgroup}
-  {if $gp}
-  </optgroup>
-  {/if}
-  <optgroup label="{$subSector.name}">
-  {assign var=1 name=gp}
-  {else}
-  <option value="{$subSector.id}" {if $subSector.id eq $sel}selected="selected"{/if}>{$subSector.name}</option>
-  {/if}
-  {if $gp}
-  </optgroup>
-  {/if}
-  {/iterate}
-</select>
-
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/profile/jobs.sub_sector.tpl b/templates/profile/jobs.sub_sector.tpl
deleted file mode 100644 (file)
index c332f11..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-{**************************************************************************}
-{*                                                                        *}
-{*  Copyright (C) 2003-2010 Polytechnique.org                             *}
-{*  http://opensource.polytechnique.org/                                  *}
-{*                                                                        *}
-{*  This program is free software; you can redistribute it and/or modify  *}
-{*  it under the terms of the GNU General Public License as published by  *}
-{*  the Free Software Foundation; either version 2 of the License, or     *}
-{*  (at your option) any later version.                                   *}
-{*                                                                        *}
-{*  This program is distributed in the hope that it will be useful,       *}
-{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
-{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
-{*  GNU General Public License for more details.                          *}
-{*                                                                        *}
-{*  You should have received a copy of the GNU General Public License     *}
-{*  along with this program; if not, write to the Free Software           *}
-{*  Foundation, Inc.,                                                     *}
-{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
-{*                                                                        *}
-{**************************************************************************}
-
-<?xml version="1.0" encoding="utf-8"?>
-<select name="jobs[{$id}][subSubSector]" onchange="updateJobAlternates({$id})">
-  <option value="0">&nbsp;</option>
-  {iterate from=$subSubSectors item=subSubSector}
-  <option value="{$subSubSector.id}" {if $subSubSector.id eq $sel}selected="selected"{/if}>{$subSubSector.name}</option>
-  {/iterate}
-</select>
-
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index f4010ea..e791cbe 100644 (file)
@@ -1,5 +1,10 @@
 ALTER TABLE profile_job DROP COLUMN sectorid;
 ALTER TABLE profile_job DROP COLUMN subsectorid;
 ALTER TABLE profile_job DROP COLUMN subsubsectorid;
+DROP TABLE profile_mentor_sector;
+DROP TABLE profile_job_sector_enum;
+DROP TABLE profile_job_subsector_enum;
+DROP TABLE profile_job_subsubsector_enum;
+DROP TABLE profile_job_alternates;
 
 -- vim:set syntax=mysql:
index 90b05de..47b30f2 100644 (file)
@@ -102,9 +102,6 @@ class CheckDB extends PlTestCase
             'profile_education_enum'        => 'name',
             'profile_education_field_enum'  => 'field',
             'profile_job_enum'              => 'name',
-            'profile_job_sector_enum'       => 'name',
-            'profile_job_subsector_enum'    => 'name',
-            'profile_job_subsubsector_enum' => 'name',
             'profile_langskill_enum'        => 'langue_fr',
             'profile_medal_enum'            => 'text',
             'profile_name_enum'             => 'name',