- // Checkout the CV
- $res = XDB::query("SELECT cv
- FROM auth_user_md5
- WHERE user_id = {?}",
- S::i('uid'));
- $this->values['cv'] = $res->fetchOneCell();
-
- // Checkout the corps
- $res = XDB::query("SELECT original_corpsid AS original, current_corpsid AS current,
- rankid AS rank, corps_pub AS pub
- FROM profile_corps
- WHERE uid = {?}",
- S::i('uid'));
- $this->values['corps'] = $res->fetchOneAssoc();
-
- // Build the jobs tree
- $res = XDB::iterRow("SELECT e.entrid, e.entreprise, e.secteur, e.ss_secteur,
- 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.email, e.web, e.pub,
- e.adr_pub, e.email_pub,
- e.glat AS precise_lat, e.glng AS precise_lon
- FROM entreprises AS e
- LEFT JOIN geoloc_pays AS gp ON(gp.a2 = e.country)
- WHERE e.uid = {?} AND entreprise != ''
- ORDER BY entrid", S::i('uid'));
- $this->values['jobs'] = array();
- while (list($id, $name, $secteur, $ss_secteur, $fonction, $poste,
- $adr1, $adr2, $adr3, $postcode, $city, $cityid,
- $region, $regiontxt, $country, $countrytxt, $display,
- $checked, $email, $web,
- $pub, $adr_pub, $email_pub, $glat, $glng
- ) = $res->next()) {
- $this->values['jobs'][] = array('id' => $id,
- 'name' => $name,
- 'secteur' => $secteur,
- 'ss_secteur' => $ss_secteur,
- 'fonction' => $fonction,
- 'poste' => $poste,
- 'adr' => array('adr1' => $adr1,
- 'adr2' => $adr2,
- 'adr3' => $adr3,
- 'postcode' => $postcode,
- 'city' => $city,
- 'cityid' => $cityid,
- 'region' => $region,
- 'regiontxt' => $regiontxt,
- 'country' => $country,
- 'countrytxt' => $countrytxt,
- 'display' => $display,
- 'pub' => $adr_pub,
- 'checked' => $checked,
- 'precise_lat'=> $glat,
- 'precise_lon'=> $glng),
- 'email' => $email,
- 'web' => $web,
- 'pub' => $pub,
- 'email_pub' => $email_pub);
- }
-
- $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'));
- $i = 0;
- $jobNb = count($this->values['jobs']);
- while ($tel = $res->next()) {
- $jobid = $tel['jobid'];
- unset($tel['jobid']);
- while ($i < $jobNb && $this->values['jobs'][$i]['id'] < $jobid) {
- $i++;
- }
- if ($i >= $jobNb) {
- break;
- }
- $job =& $this->values['jobs'][$i];
- if (!isset($job['tel'])) {
- $job['tel'] = array();
- }
- if ($job['id'] == $jobid) {
- $job['tel'][] = $tel;
- }
- }
- foreach ($this->values['jobs'] as $id=>&$job) {
- if (!isset($job['tel'])) {
- $job['tel'] = array();
- }
- unset($job['id']);