WHERE name = {?}",
$job['name']);
if ($res->numRows() != 1) {
- $user = $page->profile->owner;
$this->geocodeAddress($job['hq_address'], $s);
if (!$s) {
$gmapsGeocoder = new GMapsGeocoder();
$job['hq_address'] = $gmapsGeocoder->stripGeocodingFromAddress($job['hq_address']);
}
- $req = new EntrReq($user, $jobid, $job['name'], $job['hq_acronym'], $job['hq_url'],
+ $req = new EntrReq(S::user(), $page->profile, $jobid, $job['name'], $job['hq_acronym'], $job['hq_url'],
$job['hq_email'], $job['hq_fixed'], $job['hq_fax'], $job['hq_address']);
$req->submit();
$job['jobid'] = null;
+ sleep(1);
} else {
$job['jobid'] = $res->fetchOneCell();
}
public function value(ProfilePage &$page, $field, $value, &$success)
{
require_once 'validations.inc.php';
- $entreprise = Validate::get_typed_requests($page->profile->owner->id(), 'entreprise');
+ $entreprise = ProfileValidate::get_typed_requests($page->pid(), 'entreprise');
$entr_val = 0;
$init = false;
$job['tmp_name'] = $entreprise[$entr_val]->name;
++$entr_val;
} else if ($job['name'] == '') {
+ if ($job['subSubSectorName'] == '' && $job['description'] == '' && $job['w_url'] == ''
+ && $job['w_address']['text'] == '' && $job['w_email'] == ''
+ && count($job['w_phone']) == 1 && $job['w_phone']['tel'] == '') {
+ array_splice($value, $key, 1);
+ continue;
+ }
+
$job['name_error'] = true;
$success = false;
}
+
if (isset($job['removed']) && $job['removed']) {
+ if ($job['name'] == '' && $entreprise) {
+ $entreprise[$entr_val - 1]->clean();
+ }
array_splice($value, $key, 1);
}
}
// TODO: use address and phone classes to update profile_job_enum and profile_phones once they are done.
require_once 'profil.func.inc.php';
- require_once 'validations.inc.php';
XDB::execute("DELETE FROM profile_job
WHERE pid = {?}",
}
}
}
+
+ public function getText($value) {
+ $jobs = array();
+ foreach ($value as $id => $job) {
+ $address = new ProfileSettingAddress();
+ $phones = new ProfileSettingPhones('pro', $id);
+ $jobs[] = 'Entreprise : ' . $job['name'] . ', secteur : ' . $job['subSubSectorName']
+ . ', description : ' . $job['description'] . ', web : ' . $job['w_url']
+ . ', email : ' . $job['w_email']
+ . ', ' . $phones->getText($job['w_phone']) . ', ' . $address->getText($job['w_address']);
+ }
+ return implode(' ; ' , $jobs);
+ }
}
class ProfileSettingJobs extends ProfilePage
{
parent::__construct($wiz);
$this->settings['cv'] = null;
+ /* TODO: ProfileSettingCorps, required for notifications. */
$this->settings['corps'] = null;
$this->settings['jobs'] = new ProfileSettingJob();
$this->watched = array('cv' => true, 'jobs' => true, 'corps' => true);