<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
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.uid = {?}",
+ WHERE m.pid = {?}",
$page->pid());
while (list($s, $ss, $ssname) = $res->next()) {
if (!isset($value[$s])) {
$value[$s][$ss] = $ssname;
}
}
- } else if (!is_array($value)) {
+ } elseif (!is_array($value)) {
$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;
}
{
XDB::execute("DELETE FROM profile_mentor_sector
- WHERE uid = {?}",
+ WHERE pid = {?}",
$page->pid());
if (!count($value)) {
return;
}
- foreach ($value as $id=>&$sect) {
- foreach ($sect as $sid=>&$name) {
- XDB::execute("INSERT INTO profile_mentor_sector (uid, sectorid, subsectorid)
+ foreach ($value as $id => $sect) {
+ foreach ($sect as $sid => $name) {
+ XDB::execute("INSERT INTO profile_mentor_sector (pid, sectorid, subsectorid)
VALUES ({?}, {?}, {?})",
$page->pid(), $id, $sid);
}
$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.uid = {?}",
+ WHERE m.pid = {?}",
$page->pid());
while (list($id, $name) = $res->next()) {
$value[$id] = $name;
public function save(ProfilePage &$page, $field, $value)
{
XDB::execute("DELETE FROM profile_mentor_country
- WHERE uid = {?}",
+ WHERE pid = {?}",
$page->pid());
foreach ($value as $id=>&$name) {
- XDB::execute("INSERT INTO profile_mentor_country (uid, country)
+ XDB::execute("INSERT INTO profile_mentor_country (pid, country)
VALUES ({?}, {?})",
$page->pid(), $id);
}
protected function _fetchData()
{
$res = XDB::query("SELECT expertise
- FROM mentor
- WHERE uid = {?}",
+ FROM profile_mentor
+ WHERE pid = {?}",
$this->pid());
$this->values['expertise'] = $res->fetchOneCell();
}
if ($this->changed['expertise']) {
$expertise = trim($this->values['expertise']);
if (empty($expertise)) {
- XDB::execute("DELETE FROM mentor
- WHERE uid = {?}",
+ XDB::execute("DELETE FROM profile_mentor
+ WHERE pid = {?}",
$this->pid());
$this->values['expertise'] = null;
} else {
- XDB::execute("REPLACE INTO mentor (uid, expertise)
+ XDB::execute("REPLACE INTO profile_mentor (pid, expertise)
VALUES ({?}, {?})",
$this->pid(), $expertise);
$this->values['expertise'] = $expertise;
public function _prepare(PlPage &$page, $id)
{
- $page->assign('sectors', XDB::iterator("SELECT id, name
- FROM profile_job_sector_enum"));
+ $page->assign('sectorList', XDB::iterator('SELECT id, name
+ FROM profile_job_sector_enum'));
$page->assign('countryList', XDB::iterator("SELECT iso_3166_1_a2, countryFR
FROM geoloc_countries