- // Checkout the CV
- $res = XDB::query("SELECT cv
- FROM profiles
- WHERE pid = {?}",
- $this->pid());
- $this->values['cv'] = $res->fetchOneCell();
-
- // Build the jobs tree
- $res = XDB::iterRow("SELECT j.id, j.jobid, je.name, 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 profile_job_subsubsector_enum AS s ON (s.id = j.subsubsectorid)
- LEFT JOIN profile_addresses AS aw ON (aw.pid = j.pid 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.pid = {?}
- ORDER BY j.id",
- $this->pid());
- $this->values['jobs'] = array();
-
- if ($res->numRows() > 0) {
- while (list($id, $jobid, $name, $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,
- 'sector' => $sector,
- 'subSector' => $subSector,
- 'subSubSector' => $subSubSector,
- 'subSubSectorName' => $subSubSectorName,
- 'description' => $description,
- 'pub' => $pub,
- 'w_email' => $w_email,
- 'w_email_pub' => $w_emailPub,
- '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_updateTime,
- '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_updateTime,
- '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 pid = {?} AND link_type = 'pro'
- ORDER BY link_id",
- $this->pid());
- $i = 0;
- $jobNb = count($this->values['jobs']);
- while ($phone = $res->next()) {
- $jobid = $phone['jobid'];
- while ($i < $jobNb && $this->values['jobs'][$i]['id'] < $jobid) {
- $i++;
- }
- if ($i >= $jobNb) {
- break;
- }
- $job =& $this->values['jobs'][$i];
- if (!isset($job['w_phone'])) {
- $job['w_phone'] = array();
- }
- if ($job['id'] == $jobid) {
- $job['w_phone'][] = $phone;
- }
- }
- foreach ($this->values['jobs'] as $id => &$job) {
- if (!isset($job['w_phone'])) {
- $job['w_phone'] = array(
- 0 => array(
- 'type' => 'fixed',
- 'tel' => '',
- 'pub' => 'private',
- 'comment' => '',
- )
- );
- }
- }
-
- $job['w_email_new'] = '';
- if (!isset($job['hq_phone'])) {
- $job['hq_phone'] = '';
- }
- if (!isset($job['hq_fax'])) {
- $job['hq_fax'] = '';
- }
- if (!isset($job['w_email_pub'])) {
- $job['w_email_pub'] = 'private';
- }
- if (!$job['hq_address']['text']) {
- $job['hq_address'] = array(
- 'text' => '',
- 'accuracy' => '',
- 'postalText' => '',
- 'postalCode' => '',
- 'administrativeAreaId' => '',
- 'subAdministrativeAreaId' => '',
- 'localityId' => '',
- 'countryId' => '',
- 'latitude' => '',
- 'longitude' => '',
- 'north' => '',
- 'south' => '',
- 'east' => '',
- 'west' => '',
- 'cedex' => '',
- 'updateTime' => '',
- 'changed' => '0',
- 'removed' => '0',
- );
- }
- $job['w_address']['cedex'] = '';
- $job['w_address']['changed'] = '0';
- $job['w_address']['removed'] = '0';
- } else {
- $this->values['jobs'][] = $this->settings['jobs']->emptyJob();