X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fjobs.inc.php;h=4f0d4288a3790284952bd5591532bc1cf4fcf10a;hb=b715c1e1641250d75c3bf2d3bd951519ad3e1dcd;hp=c544ef9078d031cac83ae763ad80eed2813f388c;hpb=1879c7b22a1c881d6db01c867ca7853fbc49f35d;p=platal.git diff --git a/modules/profile/jobs.inc.php b/modules/profile/jobs.inc.php index c544ef9..4f0d428 100644 --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@ -1,6 +1,6 @@ pub = new ProfilePub(); - $this->mail = new ProfileEmail(); + $this->mail + = $this->mail_new + = new ProfileEmail(); $this->web = new ProfileWeb(); $this->tel = new ProfileTel(); + $this->bool = new ProfileBool(); $this->checks = array('web' => array('web'), + 'mail_new' => array('email_new'), 'mail' => array('email'), 'tel' => array('tel', 'fax', 'mobile'), 'pub' => array('pub', 'tel_pub', 'email_pub')); @@ -45,6 +51,12 @@ class ProfileJob extends ProfileGeoloc foreach ($this->checks as $obj=>&$fields) { $chk =& $this->$obj; foreach ($fields as $field) { + if ($field == "email_new") { + if ($job['email'] == "new@new.new") { + $job['email'] = $job[$field]; + } + continue; + } $job[$field] = $chk->value($page, $field, $job[$field], $s); if (!$s) { $success = false; @@ -52,6 +64,8 @@ class ProfileJob extends ProfileGeoloc } } } + $job['adr']['pub'] = $this->pub->value($page, 'adr_pub', @$job['adr']['pub'], $s); + $job['adr']['checked'] = $this->bool->value($page, 'adr_checked', @$job['adr']['checked'], $s); unset($job['removed']); unset($job['new']); unset($job['adr']['changed']); @@ -92,23 +106,31 @@ class ProfileJob extends ProfileGeoloc S::i('uid')); $i = 0; foreach ($value as &$job) { + if ($job['email'] == "new@new.new") { + $job['email'] = $job['email_new']; + } + XDB::execute("INSERT INTO entreprises (uid, entrid, entreprise, secteur, ss_secteur, fonction, poste, adr1, adr2, adr3, postcode, city, cityid, country, region, regiontxt, tel, fax, mobile, email, web, - pub, adr_pub, tel_pub, email_pub) + pub, adr_pub, tel_pub, email_pub, flags, + glat, glng) VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, - {?}, {?}, {?}, {?})", + {?}, {?}, {?}, {?}, {?}, + {?}, {?})", S::i('uid'), $i++, $job['name'], $job['secteur'], $job['ss_secteur'], $job['fonction'], $job['poste'], $job['adr']['adr1'], $job['adr']['adr2'], $job['adr']['adr3'], $job['adr']['postcode'], $job['adr']['city'], $job['adr']['cityid'], $job['adr']['country'], $job['adr']['region'], $job['adr']['regiontxt'], $job['tel'], $job['fax'], $job['mobile'], $job['email'], $job['web'], - $job['pub'], $job['adr']['pub'], $job['tel_pub'], $job['email_pub']); + $job['pub'], $job['adr']['pub'], $job['tel_pub'], $job['email_pub'], + $job['adr']['checked'] ? 'geoloc' : '', $job['adr']['precise_lat'], + $job['adr']['precise_lon']); } } } @@ -122,14 +144,11 @@ class ProfileJobs extends ProfilePage parent::__construct($wiz); $this->settings['cv'] = null; $this->settings['jobs'] = new ProfileJob(); + $this->watched['cv'] = $this->watched['jobs'] = true; } - protected function fetchData() + protected function _fetchData() { - if (count($this->orig) > 0) { - $this->values = $this->orig; - return; - } // Checkout the CV $res = XDB::query("SELECT cv FROM auth_user_md5 @@ -142,18 +161,20 @@ class ProfileJobs extends ProfilePage e.fonction, e.poste, e.adr1, e.adr2, e.adr3, e.postcode, e.city, e.cityid, e.region, e.regiontxt, e.country, gp.pays, gp.display, + FIND_IN_SET('geoloc', flags), e.tel, e.fax, e.mobile, e.email, e.web, e.pub, - e.adr_pub, e.tel_pub, e.email_pub + e.adr_pub, e.tel_pub, e.email_pub, + e.glat AS precise_lat, e.glng AS precise_lon FROM entreprises AS e - INNER JOIN geoloc_pays AS gp ON(gp.a2 = e.country) + LEFT JOIN geoloc_pays AS gp ON(gp.a2 = e.country) WHERE uid = {?} AND entreprise != '' ORDER BY entrid", S::i('uid')); $this->values['jobs'] = array(); while (list($name, $secteur, $ss_secteur, $fonction, $poste, $adr1, $adr2, $adr3, $postcode, $city, $cityid, $region, $regiontxt, $country, $countrytxt, $display, - $tel, $fax, $mobile, $email, $web, - $pub, $adr_pub, $tel_pub, $email_pub) = $res->next()) { + $checked, $tel, $fax, $mobile, $email, $web, + $pub, $adr_pub, $tel_pub, $email_pub, $glat, $glng) = $res->next()) { $this->values['jobs'][] = array('name' => $name, 'secteur' => $secteur, 'ss_secteur' => $ss_secteur, @@ -170,21 +191,22 @@ class ProfileJobs extends ProfilePage 'country' => $country, 'countrytxt' => $countrytxt, 'display' => $display, - 'pub' => $adr_pub), + 'pub' => $adr_pub, + 'checked' => $checked, + 'precise_lat'=> $glat, + 'precise_lon'=> $glng), 'tel' => $tel, 'fax' => $fax, 'mobile' => $mobile, 'email' => $email, 'web' => $web, 'pub' => $pub, - 'adr_pub' => $adr_pub, 'tel_pub' => $tel_pub, 'email_pub' => $email_pub); } - parent::fetchData(); } - protected function saveData() + protected function _saveData() { if ($this->changed['cv']) { XDB::execute("UPDATE auth_user_md5 @@ -192,12 +214,13 @@ class ProfileJobs extends ProfilePage WHERE user_id = {?}", $this->values['cv'], S::i('uid')); } - parent::saveData(); } - public function prepare(PlatalPage &$page) + public function _prepare(PlatalPage &$page, $id) { - parent::prepare($page); + require_once "emails.combobox.inc.php"; + fill_email_combobox($page); + $page->assign('secteurs', XDB::iterator("SELECT id, label FROM emploi_secteur")); $page->assign('fonctions', XDB::iterator("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) AS title