LEFT JOIN auth_user_md5 AS u ON u.user_id=a.id
WHERE (a.type='alias' OR a.type='a_vie') AND u.prenom is null");
-/* validite de applis_ins */
-check("select a.* from applis_ins as a left join auth_user_md5 as u on u.user_id=a.uid where u.prenom is null");
-check("select a.* from applis_ins as a left join applis_def as ad on ad.id=a.aid where ad.text is null");
+/* validite de profile_education */
+check("select a.* from profile_education as a left join auth_user_md5 as u on u.user_id=a.uid where u.prenom is null");
+check("select a.* from profile_education as a left join profile_education_enum as ad on ad.id=a.eduid where ad.name is null");
/* validite de binet_users */
check("select b.* from binets_ins as b left join auth_user_md5 as u on u.user_id=b.user_id where u.prenom is null");
query("DELETE FROM register_pending WHERE hash = 'INSCRIT'");
// quelques tables sont triées pour que la lecture triée soit plus facile
-query("ALTER TABLE applis_def ORDER BY text");
+query("ALTER TABLE profile_education_enum ORDER BY name");
query("ALTER TABLE binets_def ORDER BY text");
query("ALTER TABLE groupesx_def ORDER BY text");
query("ALTER TABLE secteur ORDER BY text");
{
switch (id) {
case 'general':
- fillType(document.forms.prof_annu['edu_0[type]'], document.forms.prof_annu['edu_0[id]'].selectedIndex-1);
- selectType(document.forms.prof_annu['edu_0[type]'], document.forms.prof_annu['edu_0_tmp'].value);
- fillType(document.forms.prof_annu['edu_1[type]'], document.forms.prof_annu['edu_1[id]'].selectedIndex-1);
- selectType(document.forms.prof_annu['edu_1[type]'], document.forms.prof_annu['edu_1_tmp'].value);
+ var i = 0;
+ var prefix = 'edu_';
+ while (document.getElementById(prefix + i) != null) {
+ i++;
+ }
+ for (var j = 0; j < i; j++) {
+ prepareType(j);
+ }
break;
case 'poly':
updateGroupSubLink(document.forms.prof_annu.groupesx_sub);
var applisType;
var applisTypeAll;
+var applisTypeName;
// General
function fillType(selectCtrl, appli, fill)
{
var i;
- var i0=0;
+ var i0 = 0;
- for (i = selectCtrl.options.length; i >=0; i--) {
+ for (i = selectCtrl.options.length; i >= 0; i--) {
selectCtrl.options[i] = null;
}
- if (fill || appli <0) {
+ if (fill || appli < 0) {
selectCtrl.options[0] = new Option(' ');
- i0=1;
+ i0 = 1;
+ }
+ if (appli >= 0) {
+ for (i = 0; i < applisType[appli].length; i++) {
+ selectCtrl.options[i0 + i] = new Option(applisTypeName[applisType[appli][i] - 1], applisType[appli][i]);
+ }
+ } else if (fill) {
+ for (i = 0; i < applisTypeAll.length; i++) {
+ selectCtrl.options[i0 + i] = new Option(applisTypeName[applisTypeAll[i] - 1], applisTypeAll[i]);
+ }
}
- if (appli>=0)
- for (i=0; i < applisType[appli].length; i++)
- selectCtrl.options[i0+i] = new Option(applisType[appli][i]);
- else if (fill)
- for (i=0; i < applisTypeAll.length; i++)
- selectCtrl.options[i0+i] = new Option(applisTypeAll[i]);
}
function selectType(selectCtrl, type)
{
for (i = 0; i < selectCtrl.options.length; i++) {
- if (selectCtrl.options[i].text == type)
- selectCtrl.selectedIndex=i;
+ if (selectCtrl.options[i].value == type) {
+ selectCtrl.selectedIndex = i;
+ }
}
}
+function prepareType(i)
+{
+ fillType(document.forms.prof_annu["edus[" + i + "][degreeid]"], document.forms.prof_annu["edus[" + i + "][eduid]"].selectedIndex - 1);
+ selectType(document.forms.prof_annu["edus[" + i + "][degreeid]"], document.forms.prof_annu["edu_" + i + "_tmp"].value);
+}
+
function addSearchName()
{
var i = 0;
Ajax.update_html('addresses_' + i + '_cont', 'profile/ajax/address/' + i, checkCurrentAddress);
}
+function addEdu()
+{
+ var i = 0;
+ var prefix = 'edu_';
+ while (document.getElementById(prefix + i) != null) {
+ i++;
+ }
+ $('#edu_add').before('<div id="' + prefix + i + '"></div>');
+ $.get(platal_baseurl + 'profile/ajax/edu/' + i,
+ function(data) {
+ $("#" + prefix + i).html(data);
+ prepareType(i);
+ });
+}
+
+function removeEdu(id)
+{
+ $('#' + id).remove();
+}
+
function addTel(prefid, prefname)
{
var i = 0;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-function applis_options($current=0) {
- $html = '<option value="-1"></option>';
- $res = XDB::iterator("select * from applis_def order by text");
+function applis_options($current=0)
+{
+ $html = '<option value = "-1"></option>';
+ $res = XDB::iterator("SELECT *
+ FROM profile_education_enum
+ ORDER BY name");
while ($arr_appli = $res->next()) {
- $html .= '<option value="'.$arr_appli["id"].'"';
- if ($arr_appli["id"]==$current) $html .= " selected='selected'";
- $html .= '>'.htmlspecialchars($arr_appli["text"])."</option>\n";
+ $html .= '<option value="' . $arr_appli["id"] . '"';
+ if ($arr_appli["id"]==$current) {
+ $html .= " selected='selected'";
+ }
+ $html .= '>' . htmlspecialchars($arr_appli["name"]) . "</option>\n";
}
return $html;
}
+
/** pour appeller applis_options depuis smarty
*/
-function _applis_options_smarty($params){
- if(!isset($params['selected']))
+function _applis_options_smarty($params)
+{
+ if(!isset($params['selected'])) {
$params['selected'] = 0;
+ }
return applis_options($params['selected']);
}
-Platal::page()->register_function('applis_options','_applis_options_smarty');
-
+Platal::page()->register_function('applis_options', '_applis_options_smarty');
/** affiche un Array javascript contenant les types de chaque appli
*/
-function applis_type(){
+function applis_type()
+{
$html = "";
- $res=XDB::iterRow("select type from applis_def order by text");
- if (list($appli_type) = $res->next()) {
- $html .= "new Array('".str_replace(",","','",$appli_type)."')";
+ $res = XDB::iterRow("SELECT eduid, degreeid
+ FROM profile_education_degree AS d
+ INNER JOIN profile_education_enum AS e ON (e.id = d.eduid)
+ ORDER BY e.name");
+ if ($appli_type = $res->next()) {
+ $eduid = $appli_type['0'];
+ $html .= "[";
+ $html .= $appli_type['1'];
+ $appli_type = $res->next();
+ while ($appli_type['0'] == $eduid) {
+ $html .= "," . $appli_type['1'];
+ $appli_type = $res->next();
+ }
+ $html .= "]";
}
- while (list($appli_type) = $res->next()) {
- $html .= ",\nnew Array('".str_replace(",","','",$appli_type)."')";
+ while ($appli_type) {
+ $eduid = $appli_type['0'];
+ $html .= ",\n[";
+ $html .= $appli_type['1'];
+ $appli_type = $res->next();
+ while ($appli_type['0'] == $eduid) {
+ $html .= "," . $appli_type['1'];
+ $appli_type = $res->next();
+ }
+ $html .= "]";
}
return $html;
}
-Platal::page()->register_function('applis_type','applis_type');
+Platal::page()->register_function('applis_type', 'applis_type');
/** affiche tous les types possibles d'applis
*/
-function applis_type_all(){
- $res = XDB::query("show columns from applis_def like 'type'");
- $arr_appli = $res->fetchOneAssoc();
- return str_replace(")","",str_replace("set(","",$arr_appli["Type"]));
+function applis_type_all()
+{
+ $html = "";
+ $res = XDB::query("SELECT id
+ FROM profile_education_degree_enum
+ ORDER BY id");
+ return implode(',', $res->fetchColumn());
+}
+Platal::page()->register_function('applis_type_all', 'applis_type_all');
+
+/** affiche les noms de tous les types possibles d'applis
+ */
+function applis_type_name()
+{
+ $html = "";
+ $res = XDB::query("SELECT degree
+ FROM profile_education_degree_enum
+ ORDER BY id");
+ return '\'' . implode('\',\'', $res->fetchColumn()) . '\'';
}
-Platal::page()->register_function('applis_type_all','applis_type_all');
+Platal::page()->register_function('applis_type_name', 'applis_type_name');
/** formatte une ecole d'appli pour l'affichage
*/
-function applis_fmt($type, $text, $url) {
- $txt="";
- if (($type != "Ingénieur") && ($type != "Diplôme"))
- $txt .= $type;
- if ($text != "Université") {
- if ($txt) $txt .= ' ';
- if ($url)
- $txt .= "<a href=\"$url\" onclick=\"return popup(this)\">$text</a>";
- else
- $txt .= $text;
+function applis_fmt($name, $url, $degree, $grad_year, $field, $sexe, $long)
+{
+ $field = strtolower($field);
+ $txt = "";
+
+ if ($grad_year || $field) {
+ $txt .= "<span title=\"(";
+ if ($grad_year) {
+ if ($sexe) {
+ $txt .= "diplômée en $grad_year";
+ } else {
+ $txt .= "diplômé en $grad_year";
+ }
+ if ($field) {
+ $txt .= ", ";
+ }
+ }
+ if ($field) {
+ $txt .= "domaine : $field)\">";
+ }
}
- if (!$txt) {
- $txt .= $text;
+
+ if (($degree != "Licence") || ($long)) {
+ if (($degree != "Ingénieur") && ($degree != "Diplôme")) {
+ $txt .= $degree;
+ }
+ if ($name != "Université") {
+ if ($name) {
+ $txt .= ' ';
+ }
+ if ($url != ' ') {
+ $txt .= "<a href=\"$url\" onclick=\"return popup(this)\">$name</a>";
+ } else {
+ $txt .= $name;
+ }
+ }
}
+ $txt .= "</span>";
+
return $txt;
}
-function _applis_fmt($params, &$smarty) {
+
+function _applis_fmt($params, &$smarty)
+{
extract($params);
- return applis_fmt($type, $text, $url);
+ return applis_fmt($name, $url, $degree, $grad_year, $field, $sexe, $long);
}
-Platal::page()->register_function('applis_fmt','_applis_fmt');
+Platal::page()->register_function('applis_fmt', '_applis_fmt');
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
'nationalite3' => 'Sa troisième nationalité',
'nick' => 'Son surnom',
'networking' => 'La liste de ses adresses de networking',
- 'appli1' => 'Son école d\'application',
- 'appli2' => 'Son école de post-application',
+ 'edus' => 'Ses formations',
'addresses' => 'Ses adresses',
'section' => 'Sa section sportive',
'binets' => 'La liste de ses binets',
*/
function user_clear_all_subs($user_id, $really_del=true)
{
- // keep datas in : aliases, adresses, tels, applis_ins, binets_ins, contacts, groupesx_ins, homonymes, identification_ax, photo
+ // keep datas in : aliases, adresses, tels, profile_education, binets_ins, contacts, groupesx_ins, homonymes, identification_ax, photo
// delete in : auth_user_md5, auth_user_quick, competences_ins, emails, entreprises, langues_ins, mentor,
// mentor_pays, mentor_secteurs, newsletter_ins, perte_pass, requests, user_changes, virtual_redirect, watch_sub
// + delete maillists
$user['gpxs_join'] = join(', ', $user['gpxs']);
}
- $res = XDB::iterRow("SELECT applis_def.text, applis_def.url, applis_ins.type
- FROM applis_ins
- INNER JOIN applis_def ON applis_def.id = applis_ins.aid
+ $res = XDB::iterRow("SELECT en.name AS name, en.url AS url, d.degree AS degree, ed.grad_year AS grad_year, f.field AS field
+ FROM profile_education AS ed
+ INNER JOIN profile_education_enum AS en ON (en.id = ed.eduid)
+ INNER JOIN profile_education_degree_enum AS d ON (d.id = ed.degreeid)
+ INNER JOIN profile_education_field_enum AS f ON (f.id = ed.fieldid)
WHERE uid={?}
- ORDER BY ordre", $uid);
+ ORDER BY ed.grad_year", $uid);
- $user['applis_fmt'] = Array();
- $user['formation'] = Array();
- while (list($txt, $url, $type) = $res->next()) {
- $user['formation'][] = $txt." ".$type;
- require_once('applis.func.inc.php');
- $user['applis_fmt'][] = applis_fmt($type, $txt, $url);
+ $user['education'] = "";
+ require_once('applis.func.inc.php');
+ if (list($name, $url, $degree, $grad_year, $field) = $res->next()) {
+ $user['education'] .= applis_fmt($name, $url, $degree, $grad_year, $field, $user['sexe'], true);
+ }
+ while (list($name, $url, $degree, $grad_year, $field) = $res->next()) {
+ $user['education'] .= ", " . applis_fmt($name, $url, $degree, $grad_year, $field, $user['sexe'], true);
}
- $user['applis_join'] = join(', ', $user['applis_fmt']);
if (has_user_right($user['medals_pub'], $view)) {
$res = XDB::iterator("SELECT m.id, m.text AS medal, m.type, s.gid, g.text AS grade
global $globals;
@$globals->search->result_where_statement = '
- LEFT JOIN applis_ins AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0)
- LEFT JOIN applis_def AS ad0 ON (ad0.id = ai0.aid)
- LEFT JOIN applis_ins AS ai1 ON (u.user_id = ai1.uid AND ai1.ordre = 1)
- LEFT JOIN applis_def AS ad1 ON (ad1.id = ai1.aid)
+ LEFT JOIN profile_education AS edu ON (u.user_id = edu.uid)
+ LEFT JOIN profile_education_enum AS ede ON (ede.id = edu.eduid)
LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id)
LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id)
LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id)
IF(n1.nat='',n1.pays,n1.nat) AS nat1, n1.a2 AS iso3166_1,
IF(n2.nat='',n2.pays,n2.nat) AS nat2, n2.a2 AS iso3166_2,
IF(n3.nat='',n3.pays,n3.nat) AS nat3, n3.a2 AS iso3166_3,
- ad0.text AS app0text, ad0.url AS app0url, ai0.type AS app0type,
- ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type,
+ ede0.name AS eduname0, ede0.url AS eduurl0, edd0.degree AS edudegree0, edu0.grad_year AS edugrad_year0, f0.field AS edufield0,
+ ede1.name AS eduname1, ede1.url AS eduurl1, edd1.degree AS edudegree1, edu1.grad_year AS edugrad_year1, f1.field AS edufield1,
+ ede2.name AS eduname2, ede2.url AS eduurl2, edd2.degree AS edudegree2, edu2.grad_year AS edugrad_year2, f2.field AS edufield2,
+ ede3.name AS eduname3, ede3.url AS eduurl3, edd3.degree AS edudegree3, edu3.grad_year AS edugrad_year3, f3.field AS edufield3,
adr.city, gp.a2, gp.pays AS countrytxt, gr.name AS region,
(COUNT(em.email) > 0 OR FIND_IN_SET('googleapps', u.mail_storage) > 0) AS actif,
nd.display AS name_display, nd.tooltip AS name_tooltip, nd.sort AS name_sort" .
LEFT JOIN geoloc_pays AS n1 ON (u.nationalite = n1.a2)
LEFT JOIN geoloc_pays AS n2 ON (u.nationalite2 = n2.a2)
LEFT JOIN geoloc_pays AS n3 ON (u.nationalite3 = n3.a2)
- LEFT JOIN applis_ins AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0)
- LEFT JOIN applis_def AS ad0 ON (ad0.id = ai0.aid)
- LEFT JOIN applis_ins AS ai1 ON (u.user_id = ai1.uid AND ai1.ordre = 1)
- LEFT JOIN applis_def AS ad1 ON (ad1.id = ai1.aid)
+ LEFT JOIN profile_education AS edu0 ON (u.user_id = edu0.uid AND edu0.id = 0)
+ LEFT JOIN profile_education_enum AS ede0 ON (ede0.id = edu0.eduid)
+ LEFT JOIN profile_education_degree_enum AS edd0 ON (edd0.id = edu0.degreeid)
+ LEFT JOIN profile_education_field_enum AS f0 ON (f0.id = edu0.fieldid)
+ LEFT JOIN profile_education AS edu1 ON (u.user_id = edu1.uid AND edu1.id = 1)
+ LEFT JOIN profile_education_enum AS ede1 ON (ede1.id = edu1.eduid)
+ LEFT JOIN profile_education_degree_enum AS edd1 ON (edd1.id = edu1.degreeid)
+ LEFT JOIN profile_education_field_enum AS f1 ON (f1.id = edu1.fieldid)
+ LEFT JOIN profile_education AS edu2 ON (u.user_id = edu2.uid AND edu2.id = 2)
+ LEFT JOIN profile_education_enum AS ede2 ON (ede2.id = edu2.eduid)
+ LEFT JOIN profile_education_degree_enum AS edd2 ON (edd2.id = edu2.degreeid)
+ LEFT JOIN profile_education_field_enum AS f2 ON (f2.id = edu2.fieldid)
+ LEFT JOIN profile_education AS edu3 ON (u.user_id = edu3.uid AND edu3.id = 3)
+ LEFT JOIN profile_education_enum AS ede3 ON (ede3.id = edu3.eduid)
+ LEFT JOIN profile_education_degree_enum AS edd3 ON (edd3.id = edu3.degreeid)
+ LEFT JOIN profile_education_field_enum AS f3 ON (f3.id = edu3.fieldid)
LEFT JOIN adresses AS adr ON (u.user_id = adr.uid
AND FIND_IN_SET('active', adr.statut)".(S::logged() ? "" : " AND adr.pub = 'public'").")
LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2)
'profile/edit' => $this->make_hook('p_edit', AUTH_MDP),
'profile/ajax/address' => $this->make_hook('ajax_address', AUTH_COOKIE, 'user', NO_AUTH),
'profile/ajax/tel' => $this->make_hook('ajax_tel', AUTH_COOKIE, 'user', NO_AUTH),
+ 'profile/ajax/edu' => $this->make_hook('ajax_edu', AUTH_COOKIE, 'user', NO_AUTH),
'profile/ajax/medal' => $this->make_hook('ajax_medal', AUTH_COOKIE, 'user', NO_AUTH),
'profile/networking' => $this->make_hook('networking', AUTH_PUBLIC),
'profile/ajax/job' => $this->make_hook('ajax_job', AUTH_COOKIE, 'user', NO_AUTH),
'vcard' => $this->make_hook('vcard', AUTH_COOKIE, 'user', NO_HTTPS),
'admin/binets' => $this->make_hook('admin_binets', AUTH_MDP, 'admin'),
'admin/medals' => $this->make_hook('admin_medals', AUTH_MDP, 'admin'),
- 'admin/formations' => $this->make_hook('admin_formations', AUTH_MDP, 'admin'),
+ 'admin/education' => $this->make_hook('admin_education', AUTH_MDP, 'admin'),
+ 'admin/education_field' => $this->make_hook('admin_education_field', AUTH_MDP, 'admin'),
+ 'admin/education_degree' => $this->make_hook('admin_education_degree', AUTH_MDP, 'admin'),
+ 'admin/education_degree_set' => $this->make_hook('admin_education_degree_set', AUTH_MDP, 'admin'),
'admin/sections' => $this->make_hook('admin_sections', AUTH_MDP, 'admin'),
'admin/secteurs' => $this->make_hook('admin_secteurs', AUTH_MDP, 'admin'),
'admin/networking' => $this->make_hook('admin_networking', AUTH_MDP, 'admin'),
$page->assign('tel', array());
}
+ function handler_ajax_edu(&$page, $eduid)
+ {
+ header('Content-Type: text/html; charset=utf-8');
+ $page->changeTpl('profile/edu.tpl', NO_SKIN);
+ $res = XDB::iterator("SELECT id, field
+ FROM profile_education_field_enum
+ ORDER BY field");
+ $page->assign('edu_fields', $res->fetchAllAssoc());
+ $page->assign('eduid', $eduid);
+ require_once "applis.func.inc.php";
+ }
+
function handler_ajax_medal(&$page, $id)
{
header('Content-Type: text/html; charset=utf-8');
$table_editor->describe('text','intitulé',true);
$table_editor->apply($page, $action, $id);
}
- function handler_admin_formations(&$page, $action = 'list', $id = null) {
+ function handler_admin_education(&$page, $action = 'list', $id = null) {
$page->setTitle('Administration - Formations');
$page->assign('title', 'Gestion des formations');
- $table_editor = new PLTableEditor('admin/formations','applis_def','id');
- $table_editor->add_join_table('applis_ins','aid',true);
- $table_editor->describe('text','intitulé',true);
- $table_editor->describe('url','site web',false);
+ $table_editor = new PLTableEditor('admin/education', 'profile_education_enum', 'id');
+ $table_editor->add_join_table('profile_education', 'eduid', true);
+ $table_editor->add_join_table('profile_education_degree', 'eduid', true);
+ $table_editor->describe('name', 'intitulé', true);
+ $table_editor->describe('url', 'site web', false);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_admin_education_field(&$page, $action = 'list', $id = null) {
+ $page->setTitle('Administration - Domaines de formation');
+ $page->assign('title', 'Gestion des domaines de formation');
+ $table_editor = new PLTableEditor('admin/education_field', 'profile_education_field_enum', 'id', true);
+ $table_editor->add_join_table('profile_education', 'fieldid', true);
+ $table_editor->describe('field', 'domaine', true);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_admin_education_degree(&$page, $action = 'list', $id = null) {
+ $page->setTitle('Administration - Niveau de formation');
+ $page->assign('title', 'Gestion des niveau de formation');
+ $table_editor = new PLTableEditor('admin/education_degree', 'profile_education_degree_enum', 'id', true);
+ $table_editor->add_join_table('profile_education_degree', 'degreeid', true);
+ $table_editor->add_join_table('profile_education', 'degreeid', true);
+ $table_editor->describe('degree', 'niveau', true);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_admin_education_degree_set(&$page, $action = 'list', $id = null) {
+ $page->setTitle('Administration - Correspondances formations - niveau de formation');
+ $page->assign('title', 'Gestion des correspondances formations - niveau de formation');
+ $table_editor = new PLTableEditor('admin/education_degree_set', 'profile_education_degree', 'eduid', true);
+ $table_editor->describe('eduid', 'formation', true);
+ $table_editor->describe('degreeid', 'niveau', true);
$table_editor->apply($page, $action, $id);
}
function handler_admin_sections(&$page, $action = 'list', $id = null) {
}
}
-class ProfileAppli implements ProfileSetting
+class ProfileEdu implements ProfileSetting
{
+ public function __construct()
+ {
+ }
+
public function value(ProfilePage &$page, $field, $value, &$success)
{
$success = true;
- if (is_null($value)) {
- return $page->values[$field];
+ if (is_null($value) || !is_array($value)) {
+ $value = array();
+ $res = XDB::iterator("SELECT eduid, degreeid, fieldid, grad_year
+ FROM profile_education
+ WHERE uid = {?}
+ ORDER BY id",
+ S::v('uid'));
+ while($edu = $res->next()) {
+ $value[] = $edu;
+ }
+ } else {
+ $i = 0;
+ foreach ($value as $key=>&$edu) {
+ if (($edu['grad_year'] < 1921) || ($edu['grad_year'] > (date('Y') + 4))) {
+ Platal::page()->trigError('L\'année d\'obtention du diplôme est mal renseignée, elle doit être du type : 2004.');
+ $edu['error'] = true;
+ $success = false;
+ }
+ if ($key != $i) {
+ $value[$i] = $edu;
+ unset($value[$key]);
+ }
+ $i++;
+ }
}
return $value;
}
- public function save(ProfilePage &$page, $field, $new_value)
+ public function save(ProfilePage &$page, $field, $value)
{
- $index = ($field == 'edu_0' ? 0 : 1);
- if ($new_value['id'] > 0) {
- XDB::execute("REPLACE INTO applis_ins
- SET uid = {?}, aid = {?}, type = {?}, ordre = {?}",
- S::i('uid'), $new_value['id'], $new_value['type'], $index);
- } else {
- XDB::execute("DELETE FROM applis_ins
- WHERE uid = {?} AND ordre = {?}",
- S::i('uid'), $index);
+ XDB::execute("DELETE FROM profile_education
+ WHERE uid = {?}",
+ S::i('uid'));
+ foreach ($value as $eduid=>&$edu) {
+ if ($edu['eduid'] != '') {
+ XDB::execute("INSERT INTO profile_education
+ SET id = {?}, uid = {?}, eduid = {?}, degreeid = {?}, fieldid = {?}, grad_year = {?}",
+ $eduid, S::i('uid'), $edu['eduid'], $edu['degreeid'], $edu['fieldid'], $edu['grad_year']);
+ }
}
}
+
}
class ProfileEmailDirectory implements ProfileSetting
{
- private $email;
-
public function __construct()
{
}
$this->settings['email_directory_new']
= new ProfileEmailDirectory();
$this->settings['networking'] = new ProfileNetworking();
- $this->settings['tels'] = new ProfilePhones('user', 0);
- $this->settings['edu_0']
- = $this->settings['edu_1']
- = new ProfileAppli();
+ $this->settings['tels'] = new ProfilePhones('user', 0);
+ $this->settings['edus'] = new ProfileEdu();
$this->watched= array('nom' => true, 'freetext' => true, 'tels' => true,
- 'networking' => true, 'edu_0' => true, 'edu_1' => true,
+ 'networking' => true, 'edus' => true,
'nationalite' => true, 'nationalite2' => true,
'nationalite3' => true, 'nick' => true);
}
d.email_directory as email_directory,
q.profile_freetext as freetext, q.profile_freetext_pub as freetext_pub,
q.profile_nick as nick, q.profile_from_ax as synchro_ax, u.matricule_ax,
- IF(a1.aid IS NULL, -1, a1.aid) as edu_id1, a1.type as edu_type1,
- IF(a2.aid IS NULL, -1, a2.aid) as edu_id2, a2.type as edu_type2,
n.yourself, n.display AS display_name, n.sort AS sort_name,
n.tooltip AS tooltip_name
FROM auth_user_md5 AS u
INNER JOIN profile_names_display AS n ON(n.user_id = u.user_id)
LEFT JOIN profile_phones AS t ON(u.user_id = t.uid AND link_type = 'user')
LEFT JOIN profile_directory AS d ON(d.uid = u.user_id)
- LEFT JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0)
- LEFT JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)
WHERE u.user_id = {?}", S::v('uid', -1));
$this->values = $res->fetchOneAssoc();
- // Reformat formation data
- $this->values['edu_0'] = array('id' => $this->values['edu_id1'],
- 'type' => $this->values['edu_type1']);
- unset($this->values['edu_id1']);
- unset($this->values['edu_type1']);
- $this->values['edu_1'] = array('id' => $this->values['edu_id2'],
- 'type' => $this->values['edu_type2']);
- unset($this->values['edu_id2']);
- unset($this->values['edu_type2']);
-
// Retreive photo informations
$res = XDB::query("SELECT pub
FROM photo
{
require_once "applis.func.inc.php";
+ $res = XDB::iterator("SELECT id, field
+ FROM profile_education_field_enum
+ ORDER BY field");
+ $page->assign('edu_fields', $res->fetchAllAssoc());
+
require_once "emails.combobox.inc.php";
fill_email_combobox($page);
}
if (!is_null($school)) {
- $sql = 'SELECT type FROM applis_def WHERE id=' . $school;
+ $sql = 'SELECT name FROM profile_education_enum WHERE id=' . $school;
} else {
- $sql = 'DESCRIBE applis_def type';
+ $sql = 'DESCRIBE profile_education_enum name';
}
$res = XDB::query($sql);
'text' => "(a.cat = 'GroupesX' OR a.cat = 'Institutions') AND pub = 'public' AND nom",
'exact' => false),
'section' => array('field' => 'id', 'table' => 'sections', 'text' => 'text', 'exact' => false),
- 'school' => array('field' => 'id', 'table' => 'applis_def', 'text' => 'text', 'exact' => false),
+ 'school' => array('field' => 'id', 'table' => 'profile_education_enum', 'text' => 'name', 'exact' => false),
'city' => array('table' => 'geoloc_city', 'text' => 'name', 'exact' => false)
);
if (!Env::has('page')) {
$unique='`uid`';
break;
case 'schoolTxt':
- $db = '`applis_def` INNER JOIN
- `applis_ins` ON(`applis_def`.`id` = `applis_ins`.`aid`)';
- $field='`applis_def`.`text`';
- $unique = '`uid`';
- $realid = '`applis_def`.`id`';
+ $db = 'profile_education_enum INNER JOIN
+ profile_education ON (profile_education_enum.id = profile_education.eduid)';
+ $field = 'profile_education_enum.name';
+ $unique = 'uid';
+ $realid = 'profile_education_enum.id';
if (strlen($q) > 2)
$beginwith = false;
break;
}
break;
case 'school':
- $db = '`applis_def`';
+ $db = 'profile_education_enum';
$page->assign('onchange', 'changeSchool(this.value)');
break;
case 'section':
u.perms != \'pending\' AS wasinscrit,
FIND_IN_SET(\'femme\', u.flags) AS sexe,
a.alias AS forlife,
- ad0.text AS app0text, ad0.url AS app0url, ai0.type AS app0type,
- ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type,
+ ede0.name AS eduname0, ede0.url AS eduurl0, edd0.degree AS edudegree0, edu0.grad_year AS edugrad_year0, f0.field AS edufield0,
+ ede1.name AS eduname1, ede1.url AS eduurl1, edd1.degree AS edudegree1, edu1.grad_year AS edugrad_year1, f1.field AS edufield1,
+ ede2.name AS eduname2, ede2.url AS eduurl2, edd2.degree AS edudegree2, edu2.grad_year AS edugrad_year2, f2.field AS edufield2,
+ ede3.name AS eduname3, ede3.url AS eduurl3, edd3.degree AS edudegree3, edu3.grad_year AS edugrad_year3, f3.field AS edufield3,
es.label AS secteur, ef.fonction_fr AS fonction,
IF(n1.nat=\'\',n1.pays,n1.nat) AS nat1, n1.a2 AS iso3166_1,
IF(n2.nat=\'\',n2.pays,n2.nat) AS nat2, n2.a2 AS iso3166_2,
IF(nw.pub='public', nw.address, '') AS networking_address,
IF(nw.pub='public', nwe.name, '') AS networking_name,";
@$globals->search->result_where_statement = '
- LEFT JOIN applis_ins AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0)
- LEFT JOIN applis_def AS ad0 ON (ad0.id = ai0.aid)
- LEFT JOIN applis_ins AS ai1 ON (u.user_id = ai1.uid AND ai1.ordre = 1)
- LEFT JOIN applis_def AS ad1 ON (ad1.id = ai1.aid)
+ LEFT JOIN profile_education AS edu0 ON (u.user_id = edu0.uid AND edu0.id = 0)
+ LEFT JOIN profile_education_enum AS ede0 ON (ede0.id = edu0.eduid)
+ LEFT JOIN profile_education_degree_enum AS edd0 ON (edd0.id = edu0.degreeid)
+ LEFT JOIN profile_education_field_enum AS f0 ON (f0.id = edu0.fieldid)
+ LEFT JOIN profile_education AS edu1 ON (u.user_id = edu1.uid AND edu1.id = 1)
+ LEFT JOIN profile_education_enum AS ede1 ON (ede1.id = edu1.eduid)
+ LEFT JOIN profile_education_degree_enum AS edd1 ON (edd1.id = edu1.degreeid)
+ LEFT JOIN profile_education_field_enum AS f1 ON (f1.id = edu1.fieldid)
+ LEFT JOIN profile_education AS edu2 ON (u.user_id = edu2.uid AND edu2.id = 2)
+ LEFT JOIN profile_education_enum AS ede2 ON (ede2.id = edu2.eduid)
+ LEFT JOIN profile_education_degree_enum AS edd2 ON (edd2.id = edu2.degreeid)
+ LEFT JOIN profile_education_field_enum AS f2 ON (f2.id = edu2.fieldid)
+ LEFT JOIN profile_education AS edu3 ON (u.user_id = edu3.uid AND edu3.id = 3)
+ LEFT JOIN profile_education_enum AS ede3 ON (ede3.id = edu3.eduid)
+ LEFT JOIN profile_education_degree_enum AS edd3 ON (edd3.id = edu3.degreeid)
+ LEFT JOIN profile_education_field_enum AS f3 ON (f3.id = edu3.fieldid)
LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id)
LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id)
LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id)
array("(g.cat = 'GroupesX' OR g.cat = 'Institutions') AND g.pub = 'public'",
'gm.asso_id = g.id AND u.user_id=gm.uid'));
$sectionField = new RefSField('section',array('u.section'),'','','');
- $schoolField = new RefSField('school',array('as.aid'),'applis_ins','`as`','u.user_id=as.uid');
- $diplomaField = new RefSField('diploma',array('ad.type'),'applis_ins','ad','u.user_id=ad.uid');
+ $schoolField = new RefSField('school',array('as.eduid'),'profile_education','`as`','u.user_id=as.uid');
+ $diplomaField = new RefSField('diploma',array('ad.name'),'profile_education','ad','u.user_id=ad.uid');
$freeField = new RefSField('free',array('q.profile_freetext'),'','','',false);
<tr class="impair">
<td>
<strong>Champs profil :</strong>
- <a href="admin/formations">Formations</a>
+ <a href="admin/education">Formations</a>
+ |
+ <a href="admin/education_field">Domaines de formation</a>
+ |
+ <a href="admin/education_degree">Niveau de formation</a>
+ |
+ <a href="admin/education_degree_set">Niveau par formation</a>
|
<a href="admin/binets">Binets</a>
|
{if $c.iso3166_3}
<img src='images/flags/{$c.iso3166_3}.gif' alt='{$c.nat3}' height='11' title='{$c.nat3}' />
{/if}
- X {$c.promo}{if $c.app0text}, {applis_fmt type=$c.app0type text=$c.app0text url=$c.app0url}{*
- *}{/if}{if $c.app1text}, {applis_fmt type=$c.app1type text=$c.app1text url=$c.app1url}{/if}{*
- *}{if $c.dcd}, décédé{if $c.sexe}e{/if} le {$c.deces|date_format}{/if}
+ X {$c.promo}{if $c.eduname0}, {applis_fmt name=$c.eduname0 url=$c.eduurl0 degree=$c.edudegree0
+ grad_year=$c.edugrad_year0 field=$c.edufield0 sexe=$c.sexe}{*
+ *}{/if}{if $c.eduname1}, {applis_fmt name=$c.eduname1 url=$c.eduurl1 degree=$c.edudegree1
+ grad_year=$c.edugrad_year1 field=$c.edufield1 sexe=$c.sexe}{*
+ *}{/if}{if $c.eduname2}, {applis_fmt name=$c.eduname2 url=$c.eduurl2 degree=$c.edudegree2
+ grad_year=$c.edugrad_year2 field=$c.edufield2 sexe=$c.sexe}{*
+ *}{/if}{if $c.eduname3}, {applis_fmt name=$c.eduname3 url=$c.eduurl3 degree=$c.edudegree3
+ grad_year=$c.edugrad_year3 field=$c.edufield3 sexe=$c.sexe}{*
+ *}{/if}{if $c.dcd}, décédé{if $c.sexe}e{/if} le {$c.deces|date_format}{/if}
</div>
</div>
{* *}
{**************************************************************************}
-applisType = new Array({applis_type});
-applisTypeAll = new Array({applis_type_all});
+applisType = new Array({applis_type});
+applisTypeAll = new Array({applis_type_all});
+applisTypeName = new Array({applis_type_name});
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{* *}
{**************************************************************************}
-<!--
-{assign var=telpref value="`$prefname`[`$telid`]"}
-{assign var=id value="`$prefid`_`$telid`"}
-<div class="titre" style="float: left; width: 2.5em">N°{$telid+1}</div>
-<div style="float: left;">
- <select name="{$telpref}[type]">
- <option value="fixed"{if $tel.type eq 'fixed'} selected="selected"{/if}>Fixe</option>
- <option value="mobile"{if $tel.type eq 'mobile'} selected="selected"{/if}>Mobile</option>
- <option value="fax"{if $tel.type eq 'fax'} selected="selected"{/if}>Fax</option>
- </select>
- <input type="hidden" name="{$telpref}[removed]" value="0"/>
- <input type="text" size="19" maxlength="28" name="{$telpref}[tel]" {if $tel.error}class="error"{/if} value="{$tel.tel}" />
- <a href="javascript:removeTel('{$id}')">
- {icon name=cross title="Supprimer ce numéro de téléphone"}
- </a>
- <a id="{$id}_addComment" href="javascript:addPhoneComment('{$id}', '{$telpref}')" {if $tel.comment neq ''}style="display:none" {/if}>
- {icon name=comments title="Ajouter un commentaire"}
- </a>
-</div>
-<div style="float: right" class="flags">
- {include file="include/flags.radio.tpl" name="`$telpref`[pub]" val=$tel.pub}
-</div>
-<div id="{$id}_comment" style="clear: both;{if $tel.comment eq ''} display:none{/if}">
- Commentaire :
- <input type="text" size="45" maxlength="80" name="{$telpref}[comment]" {if $tel.error}class="error"{/if} value="{$tel.comment}"/>
- <a href="javascript:removePhoneComment('{$id}', '{$telpref}')">
- {icon name=cross title="Supprimer le commentaire"}
- </a>
-</div>
-{assign var=edu value="edu_`$eduid`"}
--->
-{assign var=edu value="$edus"}
-{assign var=eduname value="edu_`$eduid`"}
-{$edu} {$edu.id} {$edu.type} {$eduname}[id]
-<div>
- <select name="{$eduname}[id]" onchange="fillType(this.form['{$eduname}[type]'], this.selectedIndex-1);">
- {applis_options selected=$edu.id}
- </select>
- <br />
- <input type="hidden" name="{$eduname}_tmp" value="{$edu.type}" />
- <select name="{$eduname}[type]">
- <option value=""></option>
- </select>
-</div>
+{assign var=eduname value="edus[`$eduid`]"}
+<select name="{$eduname}[eduid]" onchange="fillType(this.form['{$eduname}[degreeid]'], this.selectedIndex-1);">
+ {applis_options selected=$edu.eduid}
+</select>
+<input type="hidden" name="edu_{$eduid}_tmp" value="{$edu.degreeid}" />
+<select name="{$eduname}[degreeid]">
+ <option value=""></option>
+</select>
+<br />
+Domaine de formation :
+<select name="{$eduname}[fieldid]">
+ {foreach from=$edu_fields item=field}
+ <option value="{$field.id}" {if $field.id eq $edu.fieldid}selected="selected"{/if}>{$field.field}</option>
+ {/foreach}
+</select>
+<a href="javascript:removeEdu('edu_{$eduid}')">
+ {icon name=cross title="Supprimer cette formation"}
+</a>
+<br />
+Année d'obtention du diplôme :
+<input type="text" {if $edu.error}class="error"{/if} name="{$eduname}[grad_year]" value="{$edu.grad_year}" size="4" maxlength="4" />
+<small>(par exemple : 2008)</small>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
</td>
</tr>
<tr>
- <td colspan="2">
- <span class="titre">Application</span>
+ <td>
+ <span class="titre">Formation</span>
</td>
<td></td>
</tr>
+ {foreach from=$edus key=eduid item=edu}
<tr>
- <!--<td colspan="2">
- {foreach from=$tels key=telid item=tel}
- <div id="tels_{$telid}" style="clear: both; padding-top: 4px; padding-bottom: 4px">
- {include file="profile/phone.tpl" prefname='tels' prefid='tels' telid=$telid tel=$tel}
- </div>
- {/foreach}
- {if $tels|@count eq 0}
- <div id="tels_0" style="clear: both; padding-top: 4px; padding-bottom: 4px">
- {include file="profile/phone.tpl" prefname='tels' preid='tels' telid=0 tel=0}
- </div>
- {/if}
- <div id="tels_add" class="center" style="clear: both; padding-top: 4px;">
- <a href="javascript:addTel('tels', 'tels');">
- {icon name=add title="Ajouter un téléphone"}Ajouter un téléphone
- </a>
+ <td colspan="2">
+ <div id="edu_{$eduid}">
+ {include file="profile/edu.tpl" eduid="$eduid" edu="$edu" edu_fields=$edu_fields}
</div>
- </td>-->
+ </td>
+ </tr>
+ {/foreach}
+ {if $edus|@count eq 0}
+ <tr>
<td colspan="2">
- <!--{foreach from=$edus key=eduid item=edu}
- <div id="edus_{$eduid}" style="clear: both; padding-top: 4px; padding-bottom: 4px">
- {include file="profile/phone.tpl" prefname='edus' prefid='edus' eduid=$eduid edu=$edu}
- </div>
- {/foreach}
- {if $edus|@count eq 0}
- <div id="edus_0" style="clear: both; padding-top: 4px; padding-bottom: 4px">
- {include file="profile/phone.tpl" prefname='edus' preid='edus' eduid=0 edu=0}
- </div>
- {/if}-->
- <div id="edus_0" style="clear: both; padding-top: 4px; padding-bottom: 4px">
- {include file="profile/edu.tpl" eduid=0 edus=$edu_0}
- </div>
- <div id="edus_1" style="clear: both; padding-top: 4px; padding-bottom: 4px">
- {include file="profile/edu.tpl" eduid=1 edus=$edu_1}
- </div>
-
- <div id="edus_add" class="center" style="clear: both; padding-top: 4px;">
- <a href="javascript:addEdu('edus', 'edus');">
- {icon name=add title="Ajouter une formation"}Ajouter une formation
+ <div id="edu_0">
+ {include file="profile/edu.tpl" eduid=0 edu=0}
+ </div>
+ </td>
+ </tr>
+ {/if}
+ <tr>
+ <td colspan="2">
+ <div id="edu_add" class="center" style="clear: both; padding-top: 4px;">
+ <a href="javascript:addEdu();">
+ {icon name=add title="Ajouter une formation"} Ajouter une formation
</a>
</div>
</td>
</tr>
- <tr class="pair">
+ <tr class="impair">
<td class="center" colspan="2">
<small>Si ta formation ne figure pas dans la liste,
<a href="mailto:support@{#globals.mail.domain#}">contacte-nous</a>.</small>
{if ($x.promo_sortie-3 > $x.promo)}
- X {math equation="a-b" a=$x.promo_sortie b=3}
{/if}
- {if $x.applis_join}
- - Formation : {$x.applis_join|smarty:nodefaults}
+ {if $x.education}
+ - Formation : {$x.education|smarty:nodefaults}
{/if}
{if $logged && $x.is_referent}
[<a href="referent/{$x.forlife}" class='popup2'>Ma fiche référent</a>]
--- /dev/null
+CREATE TABLE IF NOT EXISTS profile_education_field_enum (
+ id INT(2) NOT NULL AUTO_INCREMENT,
+ field VARCHAR(255) DEFAULT NULL,
+ PRIMARY KEY(id),
+ UNIQUE KEY(field)
+) CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS profile_education_degree_enum (
+ id INT(2) NOT NULL AUTO_INCREMENT,
+ degree VARCHAR(255) DEFAULT NULL,
+ PRIMARY KEY(id),
+ UNIQUE KEY(degree)
+) CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS profile_education_degree (
+ eduid INT(4) NOT NULL DEFAULT 0,
+ degreeid INT(2) NOT NULL DEFAULT 0,
+ PRIMARY KEY(eduid, degreeid)
+) CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS profile_education_enum (
+ id INT(4) NOT NULL AUTO_INCREMENT,
+ name VARCHAR(255) DEFAULT NULL,
+ url VARCHAR(255) DEFAULT NULL,
+ country CHAR(2) NOT NULL DEFAULT 'FR',
+ PRIMARY KEY(id),
+ UNIQUE KEY(name)
+) CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS profile_education (
+ id INT(2) NOT NULL DEFAULT 0,
+ uid INT(11) NOT NULL DEFAULT 0,
+ eduid INT(4) NOT NULL DEFAULT 0,
+ degreeid INT(4) NOT NULL DEFAULT 0,
+ fieldid INT(2) NOT NULL DEFAULT 0,
+ grad_year INT(4) NOT NULL DEFAULT 0,
+ PRIMARY KEY(id, uid)
+) CHARSET=utf8;
+
+INSERT INTO profile_education_field_enum (field)
+ VALUES ('Aéronautique'), ('Agronomie'), ('Assurance'), ('Biologie'),
+ ('Chimie'), ('Droit'), ('Économie'), ('Électronique/électricité'),
+ ('Environnement/développement durable'), ('Finance'), ('Géographie'),
+ ('Histoire'), ('Informatique'), ('Langues'), ('Mathématiques'),
+ ('Mathématiques appliquées'), ('Mécanique'), ('Médecine'),
+ ('Philosophie'), ('Physique'), ('Sciences politiques');
+
+INSERT INTO profile_education_degree_enum (degree)
+ VALUES ('Diplôme'), ('Ingénieur'), ('Corps'), ('MS'), ('PhD'),
+ ('DEA'), ('ME'), ('MBA'), ('MiF'), ('MPA'), ('Licence');
+
+INSERT INTO profile_education_degree (eduid, degreeid)
+ SELECT a.id, d.id
+ FROM applis_def AS a
+ INNER JOIN profile_education_degree_enum AS d ON (FIND_IN_SET(d.degree, a.type));
+
+INSERT INTO profile_education_enum (id, name, url)
+ SELECT id, text, url
+ FROM applis_def;
+
+INSERT INTO profile_education (id, uid, eduid, degreeid)
+ SELECT a.ordre, a.uid, a.aid, d.id
+ FROM applis_ins AS a
+ INNER JOIN profile_education_degree_enum AS d ON (a.type = d.degree);
+
+
+# vim:set syntax=mysql:
+