projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote branch 'origin/platal-1.0.0'
[platal.git]
/
modules
/
profile
/
mentor.inc.php
diff --git
a/modules/profile/mentor.inc.php
b/modules/profile/mentor.inc.php
index
a9690fd
..
17d9cdd
100644
(file)
--- a/
modules/profile/mentor.inc.php
+++ b/
modules/profile/mentor.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 ProfileSe
cteu
rs implements ProfileSetting
+class ProfileSe
ttingSecto
rs implements ProfileSetting
{
public function value(ProfilePage &$page, $field, $value, &$success)
{
{
public function value(ProfilePage &$page, $field, $value, &$success)
{
@@
-30,7
+30,7
@@
class ProfileSecteurs implements ProfileSetting
FROM profile_mentor_sector AS m
INNER JOIN profile_job_sector_enum AS s ON (m.sectorid = s.id)
INNER JOIN profile_job_subsector_enum AS ss ON (s.id = ss.sectorid AND m.subsectorid = ss.id)
FROM profile_mentor_sector AS m
INNER JOIN profile_job_sector_enum AS s ON (m.sectorid = s.id)
INNER JOIN profile_job_subsector_enum AS ss ON (s.id = ss.sectorid AND m.subsectorid = ss.id)
- WHERE m.
u
id = {?}",
+ WHERE m.
p
id = {?}",
$page->pid());
while (list($s, $ss, $ssname) = $res->next()) {
if (!isset($value[$s])) {
$page->pid());
while (list($s, $ss, $ssname) = $res->next()) {
if (!isset($value[$s])) {
@@
-39,9
+39,9
@@
class ProfileSecteurs implements ProfileSetting
$value[$s][$ss] = $ssname;
}
}
$value[$s][$ss] = $ssname;
}
}
- } else
if (!is_array($value)) {
+ } elseif (!is_array($value)) {
$value = array();
$value = array();
- } else
if (count($value) > 10) {
+ } elseif (count($value) > 10) {
Platal::page()->trigError("Le nombre de secteurs d'expertise est limité à 10.");
$success = false;
}
Platal::page()->trigError("Le nombre de secteurs d'expertise est limité à 10.");
$success = false;
}
@@
-56,22
+56,32
@@
class ProfileSecteurs implements ProfileSetting
{
XDB::execute("DELETE FROM profile_mentor_sector
{
XDB::execute("DELETE FROM profile_mentor_sector
- WHERE
u
id = {?}",
+ WHERE
p
id = {?}",
$page->pid());
if (!count($value)) {
return;
}
$page->pid());
if (!count($value)) {
return;
}
- foreach ($value as $id
=>&
$sect) {
- foreach ($sect as $sid
=>&
$name) {
- XDB::execute("INSERT INTO profile_mentor_sector (
u
id, sectorid, subsectorid)
+ foreach ($value as $id
=>
$sect) {
+ foreach ($sect as $sid
=>
$name) {
+ XDB::execute("INSERT INTO profile_mentor_sector (
p
id, sectorid, subsectorid)
VALUES ({?}, {?}, {?})",
$page->pid(), $id, $sid);
}
}
}
VALUES ({?}, {?}, {?})",
$page->pid(), $id, $sid);
}
}
}
+
+ public function getText($value) {
+ $sectors = array();
+ foreach ($value as $sector) {
+ foreach ($sector as $subsector) {
+ $sectors[] = $subsector;
+ }
+ }
+ return implode(', ', $sectors);
+ }
}
}
-class ProfileCountry implements ProfileSetting
+class Profile
Setting
Country implements ProfileSetting
{
public function value(ProfilePage &$page, $field, $value, &$success)
{
{
public function value(ProfilePage &$page, $field, $value, &$success)
{
@@
-81,7
+91,7
@@
class ProfileCountry implements ProfileSetting
$res = XDB::iterRow("SELECT m.country, gc.countryFR
FROM profile_mentor_country AS m
INNER JOIN geoloc_countries AS gc ON (m.country = gc.iso_3166_1_a2)
$res = XDB::iterRow("SELECT m.country, gc.countryFR
FROM profile_mentor_country AS m
INNER JOIN geoloc_countries AS gc ON (m.country = gc.iso_3166_1_a2)
- WHERE m.
u
id = {?}",
+ WHERE m.
p
id = {?}",
$page->pid());
while (list($id, $name) = $res->next()) {
$value[$id] = $name;
$page->pid());
while (list($id, $name) = $res->next()) {
$value[$id] = $name;
@@
-99,18
+109,22
@@
class ProfileCountry implements ProfileSetting
public function save(ProfilePage &$page, $field, $value)
{
XDB::execute("DELETE FROM profile_mentor_country
public function save(ProfilePage &$page, $field, $value)
{
XDB::execute("DELETE FROM profile_mentor_country
- WHERE
u
id = {?}",
+ WHERE
p
id = {?}",
$page->pid());
foreach ($value as $id=>&$name) {
$page->pid());
foreach ($value as $id=>&$name) {
- XDB::execute("INSERT INTO profile_mentor_country (
u
id, country)
+ XDB::execute("INSERT INTO profile_mentor_country (
p
id, country)
VALUES ({?}, {?})",
$page->pid(), $id);
}
}
VALUES ({?}, {?})",
$page->pid(), $id);
}
}
+
+ public function getText($value) {
+ return implode(', ', $value);
+ }
}
}
-class ProfileMentor extends ProfilePage
+class Profile
Setting
Mentor extends ProfilePage
{
protected $pg_template = 'profile/mentor.tpl';
{
protected $pg_template = 'profile/mentor.tpl';
@@
-118,15
+132,15
@@
class ProfileMentor extends ProfilePage
{
parent::__construct($wiz);
$this->settings['expertise'] = null;
{
parent::__construct($wiz);
$this->settings['expertise'] = null;
- $this->settings['sect
eurs'] = new ProfileSecteu
rs();
- $this->settings['countries'] = new ProfileCountry();
+ $this->settings['sect
ors'] = new ProfileSettingSecto
rs();
+ $this->settings['countries'] = new Profile
Setting
Country();
}
protected function _fetchData()
{
$res = XDB::query("SELECT expertise
}
protected function _fetchData()
{
$res = XDB::query("SELECT expertise
- FROM mentor
- WHERE
u
id = {?}",
+ FROM
profile_
mentor
+ WHERE
p
id = {?}",
$this->pid());
$this->values['expertise'] = $res->fetchOneCell();
}
$this->pid());
$this->values['expertise'] = $res->fetchOneCell();
}
@@
-136,12
+150,12
@@
class ProfileMentor extends ProfilePage
if ($this->changed['expertise']) {
$expertise = trim($this->values['expertise']);
if (empty($expertise)) {
if ($this->changed['expertise']) {
$expertise = trim($this->values['expertise']);
if (empty($expertise)) {
- XDB::execute("DELETE FROM mentor
- WHERE
u
id = {?}",
+ XDB::execute("DELETE FROM
profile_
mentor
+ WHERE
p
id = {?}",
$this->pid());
$this->values['expertise'] = null;
} else {
$this->pid());
$this->values['expertise'] = null;
} else {
- XDB::execute("REPLACE INTO
mentor (u
id, expertise)
+ XDB::execute("REPLACE INTO
profile_mentor (p
id, expertise)
VALUES ({?}, {?})",
$this->pid(), $expertise);
$this->values['expertise'] = $expertise;
VALUES ({?}, {?})",
$this->pid(), $expertise);
$this->values['expertise'] = $expertise;
@@
-151,12
+165,13
@@
class ProfileMentor extends ProfilePage
public function _prepare(PlPage &$page, $id)
{
public function _prepare(PlPage &$page, $id)
{
- $page->assign('sect
eurs_sel', XDB::iterator("SELECT id, name AS label
-
FROM profile_job_sector_enum"
));
+ $page->assign('sect
orList', XDB::iterator('SELECT id, name
+
FROM profile_job_sector_enum'
));
$page->assign('countryList', XDB::iterator("SELECT iso_3166_1_a2, countryFR
FROM geoloc_countries
ORDER BY countryFR"));
$page->assign('countryList', XDB::iterator("SELECT iso_3166_1_a2, countryFR
FROM geoloc_countries
ORDER BY countryFR"));
+ $page->assign('hrpid', $this->profile->hrpid);
}
}
}
}