projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix error while requesting an invalid alias.
[platal.git]
/
modules
/
profile
/
jobs.inc.php
diff --git
a/modules/profile/jobs.inc.php
b/modules/profile/jobs.inc.php
index
18a8f6a
..
7a48ceb
100644
(file)
--- a/
modules/profile/jobs.inc.php
+++ b/
modules/profile/jobs.inc.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-20
09
Polytechnique.org *
+ * Copyright (C) 2003-20
10
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-19,7
+19,7
@@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-class Profile
Job extends Profile
Geocoding
+class Profile
SettingJob extends ProfileSetting
Geocoding
{
private $pub;
private $email_new;
{
private $pub;
private $email_new;
@@
-30,12
+30,12
@@
class ProfileJob extends ProfileGeocoding
public function __construct()
{
public function __construct()
{
- $this->pub = new ProfilePub();
+ $this->pub = new Profile
Setting
Pub();
$this->email
= $this->email_new
$this->email
= $this->email_new
- = new ProfileEmail();
- $this->url = new ProfileWeb();
- $this->bool = new ProfileBool();
+ = new Profile
Setting
Email();
+ $this->url = new Profile
Setting
Web();
+ $this->bool = new Profile
Setting
Bool();
$this->checks = array('url' => array('w_url'),
'email' => array('w_email'),
'pub' => array('pub', 'w_email_pub'),
$this->checks = array('url' => array('w_url'),
'email' => array('w_email'),
'pub' => array('pub', 'w_email_pub'),
@@
-153,7
+153,7
@@
class ProfileJob extends ProfileGeocoding
WHERE name = {?}",
$job['name']);
if ($res->numRows() != 1) {
WHERE name = {?}",
$job['name']);
if ($res->numRows() != 1) {
- $user =
S::user()
;
+ $user =
$page->profile->owner
;
$this->geocodeAddress($job['hq_address'], $s);
if (!$s) {
$gmapsGeocoder = new GMapsGeocoder();
$this->geocodeAddress($job['hq_address'], $s);
if (!$s) {
$gmapsGeocoder = new GMapsGeocoder();
@@
-171,7
+171,7
@@
class ProfileJob extends ProfileGeocoding
if (!isset($job['w_phone'])) {
$job['w_phone'] = array();
}
if (!isset($job['w_phone'])) {
$job['w_phone'] = array();
}
- $profiletel = new ProfilePhones('pro', $jobid);
+ $profiletel = new Profile
Setting
Phones('pro', $jobid);
$job['w_phone'] = $profiletel->value($page, 'tel', $job['w_phone'], $s);
unset($job['removed']);
$job['w_phone'] = $profiletel->value($page, 'tel', $job['w_phone'], $s);
unset($job['removed']);
@@
-180,8
+180,8
@@
class ProfileJob extends ProfileGeocoding
public function value(ProfilePage &$page, $field, $value, &$success)
{
public function value(ProfilePage &$page, $field, $value, &$success)
{
- require_once
('validations.inc.php')
;
- $entreprise = Validate::get_typed_requests(
S::i('uid'
), 'entreprise');
+ require_once
'validations.inc.php'
;
+ $entreprise = Validate::get_typed_requests(
$page->profile->owner->id(
), 'entreprise');
$entr_val = 0;
$init = false;
$entr_val = 0;
$init = false;
@@
-190,17
+190,20
@@
class ProfileJob extends ProfileGeocoding
$init = true;
}
$success = true;
$init = true;
}
$success = true;
- foreach ($value as $key
=>
&$job) {
+ foreach ($value as $key
=>
&$job) {
$job['name'] = trim($job['name']);
$job['name'] = trim($job['name']);
- if (
!$job['name']
&& $entreprise) {
+ if (
$job['name'] == ''
&& $entreprise) {
$job['tmp_name'] = $entreprise[$entr_val]->name;
$job['tmp_name'] = $entreprise[$entr_val]->name;
- $entr_val ++;
+ ++$entr_val;
+ } else if ($job['name'] == '') {
+ $job['name_error'] = true;
+ $success = false;
}
if (isset($job['removed']) && $job['removed']) {
unset($value[$key]);
}
}
}
if (isset($job['removed']) && $job['removed']) {
unset($value[$key]);
}
}
- foreach ($value as $key
=>
&$job) {
+ foreach ($value as $key
=>
&$job) {
$ls = true;
$this->geocodeAddress($job['w_address'], $s);
$ls = ($ls && $s);
$ls = true;
$this->geocodeAddress($job['w_address'], $s);
$ls = ($ls && $s);
@@
-217,43
+220,43
@@
class ProfileJob extends ProfileGeocoding
{
// TODO: use address and phone classes to update profile_job_enum and profile_phones once they are done.
{
// 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')
;
+ require_once
'profil.func.inc.php'
;
+ require_once
'validations.inc.php'
;
XDB::execute("DELETE FROM profile_job
XDB::execute("DELETE FROM profile_job
- WHERE
u
id = {?}",
-
S::i('uid'
));
+ WHERE
p
id = {?}",
+
$page->pid(
));
XDB::execute("DELETE FROM profile_addresses
WHERE pid = {?} AND type = 'job'",
XDB::execute("DELETE FROM profile_addresses
WHERE pid = {?} AND type = 'job'",
-
S::i('uid'
));
+
$page->pid(
));
XDB::execute("DELETE FROM profile_phones
XDB::execute("DELETE FROM profile_phones
- WHERE
u
id = {?} AND link_type = 'pro'",
-
S::i('uid'
));
- foreach ($value as $id
=>
&$job) {
+ WHERE
p
id = {?} AND link_type = 'pro'",
+
$page->pid(
));
+ foreach ($value as $id
=>
&$job) {
if (isset($job['name']) && $job['name']) {
if (isset($job['jobid']) && $job['jobid']) {
if (isset($job['name']) && $job['name']) {
if (isset($job['jobid']) && $job['jobid']) {
- XDB::execute("INSERT INTO profile_job (
u
id, id, description, sectorid, subsectorid,
+ XDB::execute("INSERT INTO profile_job (
p
id, id, description, sectorid, subsectorid,
subsubsectorid, email, url, pub, email_pub, jobid)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
subsubsectorid, email, url, pub, email_pub, jobid)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
-
S::i('uid'
), $id, $job['description'], $job['sector'], $job['subSector'],
+
$page->pid(
), $id, $job['description'], $job['sector'], $job['subSector'],
$job['subSubSector'], $job['w_email'], $job['w_url'], $job['pub'], $job['w_email_pub'], $job['jobid']);
} else {
$job['subSubSector'], $job['w_email'], $job['w_url'], $job['pub'], $job['w_email_pub'], $job['jobid']);
} else {
- XDB::execute("INSERT INTO profile_job (
u
id, id, description, sectorid, subsectorid,
+ XDB::execute("INSERT INTO profile_job (
p
id, id, description, sectorid, subsectorid,
subsubsectorid, email, url, pub, email_pub)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
subsubsectorid, email, url, pub, email_pub)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
-
S::i('uid'
), $id, $job['description'], $job['sector'], $job['subSector'],
+
$page->pid(
), $id, $job['description'], $job['sector'], $job['subSector'],
$job['subSubSector'], $job['w_email'], $job['w_url'], $job['pub'], $job['w_email_pub']);
}
$job['subSubSector'], $job['w_email'], $job['w_url'], $job['pub'], $job['w_email_pub']);
}
- $address = new ProfileAddress();
- $address->saveAddress($id, $job['w_address'], 'job');
- $profiletel = new ProfilePhones('pro', $id);
+ $address = new Profile
Setting
Address();
+ $address->saveAddress($
page->pid(), $
id, $job['w_address'], 'job');
+ $profiletel = new Profile
Setting
Phones('pro', $id);
$profiletel->saveTels('tel', $job['w_phone']);
}
}
}
}
$profiletel->saveTels('tel', $job['w_phone']);
}
}
}
}
-class ProfileJobs extends ProfilePage
+class Profile
Setting
Jobs extends ProfilePage
{
protected $pg_template = 'profile/jobs.tpl';
{
protected $pg_template = 'profile/jobs.tpl';
@@
-262,7
+265,7
@@
class ProfileJobs extends ProfilePage
parent::__construct($wiz);
$this->settings['cv'] = null;
$this->settings['corps'] = null;
parent::__construct($wiz);
$this->settings['cv'] = null;
$this->settings['corps'] = null;
- $this->settings['jobs'] = new ProfileJob();
+ $this->settings['jobs'] = new Profile
Setting
Job();
$this->watched = array('cv' => true, 'jobs' => true, 'corps' => true);
}
$this->watched = array('cv' => true, 'jobs' => true, 'corps' => true);
}
@@
-279,7
+282,7
@@
class ProfileJobs extends ProfilePage
$res = XDB::query("SELECT original_corpsid AS original, current_corpsid AS current,
rankid AS rank, corps_pub AS pub
FROM profile_corps
$res = XDB::query("SELECT original_corpsid AS original, current_corpsid AS current,
rankid AS rank, corps_pub AS pub
FROM profile_corps
- WHERE
u
id = {?}",
+ WHERE
p
id = {?}",
$this->pid());
$this->values['corps'] = $res->fetchOneAssoc();
$this->pid());
$this->values['corps'] = $res->fetchOneAssoc();
@@
-298,10
+301,10
@@
class ProfileJobs extends ProfilePage
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)
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.
u
id AND aw.type = 'job'
+ LEFT JOIN profile_addresses AS aw ON (aw.pid = j.
p
id AND aw.type = 'job'
AND aw.id = j.id)
LEFT JOIN profile_addresses AS ah ON (ah.jobid = j.jobid AND ah.type = 'hq')
AND aw.id = j.id)
LEFT JOIN profile_addresses AS ah ON (ah.jobid = j.jobid AND ah.type = 'hq')
- WHERE j.
u
id = {?}
+ WHERE j.
p
id = {?}
ORDER BY j.id",
$this->pid());
$this->values['jobs'] = array();
ORDER BY j.id",
$this->pid());
$this->values['jobs'] = array();
@@
-376,9
+379,9
@@
class ProfileJobs extends ProfilePage
$res = XDB::iterator("SELECT link_id AS jobid, tel_type AS type, pub, display_tel AS tel, comment
FROM profile_phones
$res = XDB::iterator("SELECT link_id AS jobid, tel_type AS type, pub, display_tel AS tel, comment
FROM profile_phones
- WHERE
u
id = {?} AND link_type = 'pro'
+ WHERE
p
id = {?} AND link_type = 'pro'
ORDER BY link_id",
ORDER BY link_id",
-
S::i('uid'
));
+
$this->pid(
));
$i = 0;
$jobNb = count($this->values['jobs']);
while ($phone = $res->next()) {
$i = 0;
$jobNb = count($this->values['jobs']);
while ($phone = $res->next()) {
@@
-463,7
+466,7
@@
class ProfileJobs extends ProfilePage
XDB::execute("UPDATE profile_corps
SET original_corpsid = {?}, current_corpsid = {?},
rankid = {?}, corps_pub = {?}
XDB::execute("UPDATE profile_corps
SET original_corpsid = {?}, current_corpsid = {?},
rankid = {?}, corps_pub = {?}
- WHERE
u
id = {?}",
+ WHERE
p
id = {?}",
$this->values['corps']['original'], $this->values['corps']['current'],
$this->values['corps']['rank'], $this->values['corps']['pub'], $this->pid());
}
$this->values['corps']['original'], $this->values['corps']['current'],
$this->values['corps']['rank'], $this->values['corps']['pub'], $this->pid());
}
@@
-471,7
+474,7
@@
class ProfileJobs extends ProfilePage
public function _prepare(PlPage &$page, $id)
{
public function _prepare(PlPage &$page, $id)
{
- require_once
"emails.combobox.inc.php"
;
+ require_once
'emails.combobox.inc.php'
;
fill_email_combobox($page, $this->owner, $this->profile);
$res = XDB::query("SELECT id, name AS label
fill_email_combobox($page, $this->owner, $this->profile);
$res = XDB::query("SELECT id, name AS label