X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fskills.inc.php;h=4a8c579214b4fb5beb6cff984256381dfd7d3120;hb=7996ae8cd41fbb3ccd748eaed71a50f866269c6e;hp=c3da4f94e3b6832ea358185dafe75c79a1766b0f;hpb=55546c0db778c2d8f9d7debd30117931dc39ff16;p=platal.git diff --git a/modules/profile/skills.inc.php b/modules/profile/skills.inc.php index c3da4f9..4a8c579 100644 --- a/modules/profile/skills.inc.php +++ b/modules/profile/skills.inc.php @@ -1,6 +1,6 @@ text_field}, i.level - FROM {$this->table}_def AS s - INNER JOIN {$this->table}_ins AS i ON(s.id = i.{$this->skill_field}) - WHERE i.uid = {?}", - S::i('uid')); + FROM profile_{$this->table}_enum AS s + INNER JOIN profile_{$this->table}s AS i ON(s.id = i.{$this->skill_field}) + WHERE i.pid = {?}", + $page->pid()); while (list($sid, $text, $level) = $res->next()) { $value[$sid] = array('text' => $text, 'level' => $level); } @@ -51,7 +51,7 @@ class ProfileSkill implements ProfileSetting foreach ($value as $id=>&$skill) { if (!isset($skill['text']) || empty($skill['text'])) { $res = XDB::query("SELECT {$this->text_field} - FROM {$this->table}_def + FROM profile_{$this->table}_enum WHERE id = {?}", $id); $skill['text'] = $res->fetchOneCell(); } @@ -64,40 +64,41 @@ class ProfileSkill implements ProfileSetting public function save(ProfilePage &$page, $field, $value) { - XDB::execute("DELETE FROM {$this->table}_ins - WHERE uid = {?}", - S::i('uid')); + XDB::execute("DELETE FROM profile_{$this->table}s + WHERE pid = {?}", + $page->pid()); if (!count($value)) { return; } foreach ($value as $id=>&$skill) { - XDB::execute("INSERT INTO {$this->table}_ins (uid, {$this->skill_field}, level) + XDB::execute("INSERT INTO profile_{$this->table}s (pid, {$this->skill_field}, level) VALUES ({?}, {?}, {?})", - S::i('uid'), $id, $skill['level']); + $page->pid(), $id, $skill['level']); } } } -class ProfileSkills extends ProfilePage +class ProfileSettingSkills extends ProfilePage { protected $pg_template = 'profile/skill.tpl'; public function __construct(PlWizard &$wiz) { parent::__construct($wiz); - $this->settings['competences'] = new ProfileSkill('competences', 'cid', 'text_fr'); - $this->settings['langues'] = new ProfileSkill('langues', 'lid', 'langue_fr'); + $this->settings['competences'] = new ProfileSettingSkill('skill', 'cid', 'text_fr'); + $this->settings['langues'] = new ProfileSettingSkill('langskill', 'lid', 'langue_fr'); } public function _prepare(PlPage &$page, $id) { $page->assign('comp_list', XDB::iterator("SELECT id, text_fr, FIND_IN_SET('titre',flags) AS title - FROM competences_def")); + FROM profile_skill_enum")); $page->assign('comp_level', array('initié' => 'initié', 'bonne connaissance' => 'bonne connaissance', 'expert' => 'expert')); $page->assign('lang_list', XDB::iterator("SELECT id, langue_fr - FROM langues_def")); + FROM profile_langskill_enum + ORDER BY langue_fr")); $page->assign('lang_level', array(1 => 'connaissance basique', 2 => 'maîtrise des bases', 3 => 'maîtrise limitée',