From: Stéphane Jacob Date: Wed, 5 Jan 2011 17:17:46 +0000 (+0100) Subject: Updates language table for better compatibility with iso codes. X-Git-Tag: xorg/1.1.0~226 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=43c653a10a1c75be317696bf4c66db555606d39e;p=platal.git Updates language table for better compatibility with iso codes. Signed-off-by: Stéphane Jacob --- diff --git a/bin/cron/clean.php b/bin/cron/clean.php index add5458..5925900 100755 --- a/bin/cron/clean.php +++ b/bin/cron/clean.php @@ -48,7 +48,7 @@ query('ALTER TABLE profile_education_field_enum query('ALTER TABLE profile_job_enum ORDER BY name'); query('ALTER TABLE profile_langskill_enum - ORDER BY langue_fr'); + ORDER BY language'); query('ALTER TABLE profile_medal_enum ORDER BY text'); query('ALTER TABLE profile_networking_enum diff --git a/modules/profile/skills.inc.php b/modules/profile/skills.inc.php index 21e3aa6..2ad367e 100644 --- a/modules/profile/skills.inc.php +++ b/modules/profile/skills.inc.php @@ -22,12 +22,14 @@ class ProfileSettingSkill implements ProfileSetting { private $table; + private $id; private $skill_field; private $text_field; - public function __construct($table, $skill, $text) + public function __construct($table, $id, $skill, $text) { $this->table = $table; + $this->id = $id; $this->skill_field = $skill; $this->text_field = $text; } @@ -36,9 +38,9 @@ class ProfileSettingSkill implements ProfileSetting { if (is_null($value)) { $value = array(); - $res = XDB::iterRow("SELECT s.id, s.{$this->text_field}, i.level + $res = XDB::iterRow("SELECT s.{$this->id}, s.{$this->text_field}, i.level FROM profile_{$this->table}_enum AS s - INNER JOIN profile_{$this->table}s AS i ON(s.id = i.{$this->skill_field}) + INNER JOIN profile_{$this->table}s AS i ON (s.{$this->id} = i.{$this->skill_field}) WHERE i.pid = {?}", $page->pid()); while (list($sid, $text, $level) = $res->next()) { @@ -52,7 +54,7 @@ class ProfileSettingSkill implements ProfileSetting if (!isset($skill['text']) || empty($skill['text'])) { $res = XDB::query("SELECT {$this->text_field} FROM profile_{$this->table}_enum - WHERE id = {?}", $id); + WHERE {$this->id} = {?}", $id); $skill['text'] = $res->fetchOneCell(); } } @@ -109,8 +111,8 @@ class ProfilePageSkills extends ProfilePage public function __construct(PlWizard &$wiz) { parent::__construct($wiz); - $this->settings['competences'] = new ProfileSettingSkill('skill', 'cid', 'text_fr'); - $this->settings['langues'] = new ProfileSettingSkill('langskill', 'lid', 'langue_fr'); + $this->settings['competences'] = new ProfileSettingSkill('skill', 'id', 'cid', 'text_fr'); + $this->settings['langues'] = new ProfileSettingSkill('langskill', 'iso_639_2b', 'lid', 'language'); } public function _prepare(PlPage &$page, $id) @@ -120,9 +122,9 @@ class ProfilePageSkills extends ProfilePage $page->assign('comp_level', array('initié' => 'initié', 'bonne connaissance' => 'bonne connaissance', 'expert' => 'expert')); - $page->assign('lang_list', XDB::iterator("SELECT id, langue_fr + $page->assign('lang_list', XDB::iterator('SELECT iso_639_2b, language FROM profile_langskill_enum - ORDER BY langue_fr")); + ORDER BY language')); $page->assign('lang_level', array(1 => 'connaissance basique', 2 => 'maîtrise des bases', 3 => 'maîtrise limitée', diff --git a/templates/profile/skill.tpl b/templates/profile/skill.tpl index 280aa92..7b423a8 100644 --- a/templates/profile/skill.tpl +++ b/templates/profile/skill.tpl @@ -76,7 +76,7 @@