From 4887be786601a4a130dd34394772ca87a9edb5e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 10 Aug 2008 16:04:13 +0200 Subject: [PATCH] Improves educations\'s implementation --- htdocs/javascript/profile.js | 8 ++--- modules/profile/general.inc.php | 28 ++++++++-------- templates/profile/general.tpl | 72 +++++++++++++++++++++++++---------------- 3 files changed, 63 insertions(+), 45 deletions(-) diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js index dafdeae..3ce7b6a 100644 --- a/htdocs/javascript/profile.js +++ b/htdocs/javascript/profile.js @@ -24,10 +24,10 @@ function wizPage_onLoad(id) { switch (id) { case 'general': - fillType(document.forms.prof_annu['appli1[type]'], document.forms.prof_annu['appli1[id]'].selectedIndex-1); - selectType(document.forms.prof_annu['appli1[type]'], document.forms.prof_annu['appli1_tmp'].value); - fillType(document.forms.prof_annu['appli2[type]'], document.forms.prof_annu['appli2[id]'].selectedIndex-1); - selectType(document.forms.prof_annu['appli2[type]'], document.forms.prof_annu['appli2_tmp'].value); + 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); break; case 'poly': updateGroupSubLink(document.forms.prof_annu.groupesx_sub); diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index c64f3a3..5d4135e 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -93,7 +93,7 @@ class ProfileAppli implements ProfileSetting public function save(ProfilePage &$page, $field, $new_value) { - $index = ($field == 'appli1' ? 0 : 1); + $index = ($field == 'edu_0' ? 0 : 1); if ($new_value['id'] > 0) { XDB::execute("REPLACE INTO applis_ins SET uid = {?}, aid = {?}, type = {?}, ordre = {?}", @@ -250,11 +250,11 @@ class ProfileGeneral extends ProfilePage = new ProfileEmailDirectory(); $this->settings['networking'] = new ProfileNetworking(); $this->settings['tels'] = new ProfilePhones('user', 0); - $this->settings['appli1'] - = $this->settings['appli2'] + $this->settings['edu_0'] + = $this->settings['edu_1'] = new ProfileAppli(); $this->watched= array('nom' => true, 'freetext' => true, 'tels' => true, - 'networking' => true, 'appli1' => true, 'appli2' => true, + 'networking' => true, 'edu_0' => true, 'edu_1' => true, 'nationalite' => true, 'nationalite2' => true, 'nationalite3' => true, 'nick' => true); } @@ -268,8 +268,8 @@ class ProfileGeneral extends ProfilePage 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 appli_id1, a1.type as appli_type1, - IF(a2.aid IS NULL, -1, a2.aid) as appli_id2, a2.type as appli_type2, + 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 @@ -283,14 +283,14 @@ class ProfileGeneral extends ProfilePage $this->values = $res->fetchOneAssoc(); // Reformat formation data - $this->values['appli1'] = array('id' => $this->values['appli_id1'], - 'type' => $this->values['appli_type1']); - unset($this->values['appli_id1']); - unset($this->values['appli_type1']); - $this->values['appli2'] = array('id' => $this->values['appli_id2'], - 'type' => $this->values['appli_type2']); - unset($this->values['appli_id2']); - unset($this->values['appli_type2']); + $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 diff --git a/templates/profile/general.tpl b/templates/profile/general.tpl index 90c9356..4804bbf 100644 --- a/templates/profile/general.tpl +++ b/templates/profile/general.tpl @@ -104,35 +104,53 @@ {icon name=cross title="Supprimer cette nationalité"} - - - Application
- (4e année de l'X) - - - -
- - + + + Application + - - - Post-application - - - -
- - + + + + +
+ {include file="profile/edu.tpl" eduid=0 edus=$edu_0} +
+
+ {include file="profile/edu.tpl" eduid=1 edus=$edu_1} +
+ +
+ + {icon name=add title="Ajouter une formation"}Ajouter une formation + +
-- 2.1.4