From: Florent Bruneau Date: Sun, 8 Mar 2009 18:54:52 +0000 (+0100) Subject: Merge commit 'origin/fusionax' into account X-Git-Tag: xorg/1.0.0~332^2~342 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=a6391000e89c59f3c26d1a62bb06857df706bf50;p=platal.git Merge commit 'origin/fusionax' into account Conflicts: include/userset.inc.php modules/profile.php modules/profile/addresses.inc.php modules/profile/jobs.inc.php templates/include/minifiche.tpl Signed-off-by: Florent Bruneau --- a6391000e89c59f3c26d1a62bb06857df706bf50 diff --cc modules/profile.php index 97c5ddf,31677e4..2f6c4a4 --- a/modules/profile.php +++ b/modules/profile.php @@@ -615,24 -630,23 +613,25 @@@ class ProfileModule extends PLModul ///// recuperations infos referent //expertise - $res = XDB::query("SELECT expertise FROM profile_mentor WHERE uid = {?}", $user->id()); + $res = XDB::query('SELECT expertise + FROM profile_mentor + WHERE uid = {?}', $user->id()); $page->assign('expertise', $res->fetchOneCell()); - //secteurs - $secteurs = $ss_secteurs = 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 uid = {?}', $user->id()); - while (list($sec, $ssec) = $res->next()) { - $secteurs[] = $sec; - $ss_secteurs[] = $ssec; + // 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 uid = {?}", $user->id()); + while (list($sector, $subSector) = $res->next()) { + $sectors[] = $sector; + $subSectors[] = $subSector; } - $page->assign_by_ref('secteurs', $secteurs); - $page->assign_by_ref('ss_secteurs', $ss_secteurs); + $page->assign_by_ref('sectors', $sectors); + $page->assign_by_ref('subSectors', $subSectors); // Countries. $res = XDB::query( diff --cc modules/profile/addresses.inc.php index 3105bf1,49b7f95..2744aa8 --- a/modules/profile/addresses.inc.php +++ b/modules/profile/addresses.inc.php @@@ -83,7 -83,17 +83,7 @@@ class ProfileAddress extends ProfileGeo return $value; } - private function saveAddress($pid, $addrid, array &$address) - private function saveTel($addrid, $telid, array &$tel) - { - XDB::execute("INSERT INTO profile_phones (uid, link_type, link_id, tel_id, tel_type, - search_tel, display_tel, pub) - VALUES ({?}, 'address', {?}, {?}, {?}, - {?}, {?}, {?})", - S::i('uid'), $addrid, $telid, $tel['type'], - format_phone_number($tel['tel']), $tel['tel'], $tel['pub']); - } - - public function saveAddress($addrid, array &$address, $type) ++ private function saveAddress($pid, $addrid, array &$address, $type) { require_once "geocoding.inc.php"; @@@ -103,9 -123,9 +103,9 @@@ subAdministrativeAreaId, administrativeAreaId, countryId, latitude, longitude, updateTime, pub, comment, north, south, east, west) - VALUES ({?}, 'home', {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, FROM_UNIXTIME({?}), {?}, {?}, {?}, {?}, {?}, {?})", - $pid, $addrid, $flags, $address['accuracy'], - S::i('uid'), $type, $addrid, $flags, $address['accuracy'], ++ $pid, $type, $addrid, $flags, $address['accuracy'], $address['text'], $address['postalText'], $address['postalCode'], $address['localityId'], $address['subAdministrativeAreaId'], $address['administrativeAreaId'], $address['countryId'], $address['latitude'], $address['longitude'], @@@ -117,14 -137,14 +117,14 @@@ { XDB::execute("DELETE FROM profile_addresses WHERE pid = {?} AND type = 'home'", - S::i('uid')); + $page->pid()); XDB::execute("DELETE FROM profile_phones WHERE uid = {?} AND link_type = 'address'", - S::i('uid')); + $page->pid()); foreach ($value as $addrid => &$address) { - $this->saveAddress($page->pid(), $addrid, $address); - $this->saveAddress($addrid, $address, 'home'); ++ $this->saveAddress($page->pid(), $addrid, $address, 'home'); $profiletel = new ProfilePhones('address', $addrid); - $profiletel->saveTels('tel', $address['tel']); + $profiletel->saveTels($page->pid(), 'tel', $address['tel']); } } } diff --cc modules/profile/jobs.inc.php index cafc7c6,0ee5d3a..1564c6d --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@@ -207,65 -208,101 +208,101 @@@ class ProfileJobs extends ProfilePag $this->values['corps'] = $res->fetchOneAssoc(); // Build the jobs tree - $res = XDB::iterRow("SELECT j.id, je.name, j.functionid, j.sectorid, j.subsectorid, - j.subsubsectorid, j.description, e.adr1, e.adr2, e.adr3, - e.postcode, e.city, e.cityid, e.region, e.regiontxt, - e.country, gc.countryFR, - j.email, j.url, j.pub, - e.adr_pub, j.email_pub, - e.glat, e.glng, s.name + $res = XDB::iterRow("SELECT j.id, j.jobid, je.name, j.functionid, j.sectorid, j.subsectorid, j.subsubsectorid, + s.name, j.description, j.email, j.email_pub, j.url, j.pub, + je.acronym, je.url, je.email, + aw.accuracy, aw.text, aw.postalText, aw.postalCode, aw.localityId, + aw.subAdministrativeAreaId, aw.administrativeAreaId, aw.countryId, + aw.latitude, aw.longitude, aw.pub, aw.updateTime, + aw.north, aw.south, aw.east, aw.west, + ah.accuracy, ah.text, ah.postalText, ah.postalCode, ah.localityId, + ah.subAdministrativeAreaId, ah.administrativeAreaId, ah.countryId, + ah.latitude, ah.longitude, ah.pub, ah.updateTime, + ah.north, ah.south, ah.east, ah.west FROM profile_job AS j LEFT JOIN profile_job_enum AS je ON (j.jobid = je.id) - LEFT JOIN entreprises AS e ON (j.uid = e.uid AND j.id = e.entrid) - LEFT JOIN geoloc_countries AS gc ON (gc.iso_3166_1_a2 = e.country) LEFT JOIN profile_job_subsubsector_enum AS s ON (s.id = j.subsubsectorid) + LEFT JOIN profile_addresses AS aw ON (aw.pid = j.uid AND aw.type = 'job' + AND aw.id = j.id) + LEFT JOIN profile_addresses AS ah ON (ah.jobid = j.jobid AND ah.type = 'hq') WHERE j.uid = {?} - ORDER BY entrid", $this->pid()); + ORDER BY j.id", - S::i('uid')); ++ $this->pid()); $this->values['jobs'] = array(); - while (list($id, $name, $function, $secteur, $ss_secteur, $sss_secteur, $description, - $w_adr1, $w_adr2, $w_adr3, $w_postcode, $w_city, $w_cityid, - $w_region, $w_regiontxt, $w_country, $w_countrytxt, - $w_email, $w_web, - $pub, $w_adr_pub, $w_email_pub, $w_glat, $w_glng, $sss_secteur_name + while (list($id, $jobid, $name, $function, $sector, $subSector, $subSubSector, + $subSubSectorName, $description, $w_email, $w_emailPub, $w_url, $pub, + $hq_acronym, $hq_url, $hq_email, + $w_accuracy, $w_text, $w_postalText, $w_postalCode, $w_localityId, + $w_subAdministrativeAreaId, $w_administrativeAreaId, $w_countryId, + $w_latitude, $w_longitude, $w_pub, $w_updateTime, + $w_north, $w_south, $w_east, $w_west, + $hq_accuracy, $hq_text, $hq_postalText, $hq_postalCode, $hq_localityId, + $hq_subAdministrativeAreaId, $hq_administrativeAreaId, $hq_countryId, + $hq_latitude, $hq_longitude, $hq_pub, $hq_updateTime, + $hq_north, $hq_south, $hq_east, $hq_west, ) = $res->next()) { $this->values['jobs'][] = array('id' => $id, + 'jobid' => $jobid, 'name' => $name, - 'fonction' => $function, - 'secteur' => $secteur, - 'ss_secteur' => $ss_secteur, - 'sss_secteur' => $sss_secteur, - 'sss_secteur_name' => $sss_secteur_name, + 'function' => $function, + 'sector' => $sector, + 'subSector' => $subSector, + 'subSubSector' => $subSubSector, + 'subSubSectorName' => $subSubSectorName, 'description' => $description, - 'w_adr' => array('adr1' => $w_adr1, - 'adr2' => $w_adr2, - 'adr3' => $w_adr3, - 'postcode' => $w_postcode, - 'city' => $w_city, - 'cityid' => $w_cityid, - 'region' => $w_region, - 'regiontxt' => $w_regiontxt, - 'country' => $w_country, - 'countrytxt' => $w_countrytxt, - 'pub' => $w_adr_pub, - 'checked' => (($w_checked == 0)? true : false), - 'precise_lat' => $w_glat, - 'precise_lon' => $w_glng), - 'w_email' => $w_email, - 'w_web' => $w_web, 'pub' => $pub, - 'w_email_pub' => $w_email_pub); + 'w_email' => $w_email, + 'w_email_pub' => $w_email_pub, + 'w_url' => $w_url, + 'hq_acronym' => $hq_acronym, + 'hq_url' => $hq_url, + 'hq_email' => $hq_email, + 'w_address' => array('accuracy' => $w_accuracy, + 'text' => $w_text, + 'postalText' => $w_postalText, + 'postalCode' => $w_postalCode, + 'localityId' => $w_localityId, + 'subAdministrativeAreaId' => $w_subAdministrativeAreaId, + 'administrativeAreaId' => $w_administrativeAreaId, + 'countryId' => $w_countryId, + 'latitude' => $w_latitude, + 'longitude' => $w_longitude, + 'pub' => $w_pub, + 'updateTime' => $w_update, + 'north' => $w_north, + 'south' => $w_south, + 'east' => $w_east, + 'west' => $w_west, + ), + 'hq_address' => array('accuracy' => $hq_accuracy, + 'text' => $hq_text, + 'postalText' => $hq_postalText, + 'postalCode' => $hq_postalCode, + 'localityId' => $hq_localityId, + 'subAdministrativeAreaId' => $hq_subAdministrativeAreaId, + 'administrativeAreaId' => $hq_administrativeAreaId, + 'countryId' => $hq_countryId, + 'latitude' => $hq_latitude, + 'longitude' => $hq_longitude, + 'pub' => $hq_pub, + 'updateTime' => $hq_update, + 'north' => $hq_north, + 'south' => $hq_south, + 'east' => $hq_east, + 'west' => $hq_west, + ), + ); } $res = XDB::iterator("SELECT link_id AS jobid, tel_type AS type, pub, display_tel AS tel, comment FROM profile_phones WHERE uid = {?} AND link_type = 'pro' ORDER BY link_id", - S::i('uid')); + $this->pid()); $i = 0; $jobNb = count($this->values['jobs']); - while ($tel = $res->next()) { - $jobid = $tel['jobid']; - unset($tel['jobid']); + while ($phone = $res->next()) { + $jobid = $phone['jobid']; while ($i < $jobNb && $this->values['jobs'][$i]['id'] < $jobid) { $i++; }