X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fskills.inc.php;h=1f18133988824d2aaa9aaf474be8f87a2b6b693b;hb=ed92ea696e042eb9b2d0efcc4731fdf89fb17924;hp=144fe5078b040b4fd5fd8980b9a22c7e794ecbdc;hpb=5c8a71f241dd24c84a7e23093482fc2c23a04958;p=platal.git diff --git a/modules/profile/skills.inc.php b/modules/profile/skills.inc.php index 144fe50..1f18133 100644 --- a/modules/profile/skills.inc.php +++ b/modules/profile/skills.inc.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -class ProfileSkill implements ProfileSetting +class ProfileSettingSkill implements ProfileSetting { private $table; private $skill_field; @@ -39,7 +39,7 @@ class ProfileSkill implements ProfileSetting $res = XDB::iterRow("SELECT s.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}) - WHERE i.uid = {?}", + WHERE i.pid = {?}", $page->pid()); while (list($sid, $text, $level) = $res->next()) { $value[$sid] = array('text' => $text, 'level' => $level); @@ -65,28 +65,36 @@ class ProfileSkill implements ProfileSetting public function save(ProfilePage &$page, $field, $value) { XDB::execute("DELETE FROM profile_{$this->table}s - WHERE uid = {?}", + WHERE pid = {?}", $page->pid()); if (!count($value)) { return; } foreach ($value as $id=>&$skill) { - XDB::execute("INSERT INTO profile_{$this->table}s (uid, {$this->skill_field}, level) + XDB::execute("INSERT INTO profile_{$this->table}s (pid, {$this->skill_field}, level) VALUES ({?}, {?}, {?})", $page->pid(), $id, $skill['level']); } } + + public function getText($value) { + $skills = array(); + foreach ($value as $skill) { + $skills[] = 'Compétance : ' . $skill['text'] . ', niveau : ' . $skill['level']; + } + return implode(' ; ' , $skills); + } } -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('skill', 'cid', 'text_fr'); - $this->settings['langues'] = new ProfileSkill('langskill', '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) @@ -97,7 +105,8 @@ class ProfileSkills extends ProfilePage 'bonne connaissance' => 'bonne connaissance', 'expert' => 'expert')); $page->assign('lang_list', XDB::iterator("SELECT id, langue_fr - FROM profile_langskill_enum")); + 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',