Enables emails for other types of users.
[platal.git] / modules / profile / mentor.inc.php
index b34b6e8..7a14e2d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -22,7 +22,7 @@
 /** Terms associated to profile mentoring */
 class ProfileSettingTerms implements ProfileSetting
 {
-    public function value(ProfilePage &$page, $field, $value, &$success)
+    public function value(ProfilePage $page, $field, $value, &$success)
     {
         $success = true;
         if (is_null($value)) {
@@ -63,7 +63,7 @@ class ProfileSettingTerms implements ProfileSetting
         return $value;
     }
 
-    public function save(ProfilePage &$page, $field, $value)
+    public function save(ProfilePage $page, $field, $value)
     {
 
         XDB::execute("DELETE FROM  profile_mentor_term
@@ -92,12 +92,12 @@ class ProfileSettingTerms implements ProfileSetting
 
 class ProfileSettingCountry implements ProfileSetting
 {
-    public function value(ProfilePage &$page, $field, $value, &$success)
+    public function value(ProfilePage $page, $field, $value, &$success)
     {
         $success = true;
         if (is_null($value)) {
             $value = array();
-            $res = XDB::iterRow("SELECT  m.country, gc.countryFR
+            $res = XDB::iterRow("SELECT  m.country, gc.country
                                    FROM  profile_mentor_country AS m
                              INNER JOIN  geoloc_countries       AS gc ON (m.country = gc.iso_3166_1_a2)
                                   WHERE  m.pid = {?}",
@@ -115,7 +115,7 @@ class ProfileSettingCountry implements ProfileSetting
         return $value;
     }
 
-    public function save(ProfilePage &$page, $field, $value)
+    public function save(ProfilePage $page, $field, $value)
     {
         XDB::execute("DELETE FROM  profile_mentor_country
                             WHERE  pid = {?}",
@@ -137,7 +137,7 @@ class ProfilePageMentor extends ProfilePage
 {
     protected $pg_template = 'profile/mentor.tpl';
 
-    public function __construct(PlWizard &$wiz)
+    public function __construct(PlWizard $wiz)
     {
         parent::__construct($wiz);
         $this->settings['expertise'] = null;
@@ -164,19 +164,20 @@ class ProfilePageMentor extends ProfilePage
                              $this->pid());
                 $this->values['expertise'] = null;
             } else {
-                XDB::execute("REPLACE INTO  profile_mentor (pid, expertise)
-                                    VALUES  ({?}, {?})",
+                XDB::execute('INSERT INTO  profile_mentor (pid, expertise)
+                                   VALUES  ({?}, {?})
+                  ON DUPLICATE KEY UPDATE  expertise = VALUES(expertise)',
                              $this->pid(), $expertise);
                 $this->values['expertise'] = $expertise;
             }
         }
     }
 
-    public function _prepare(PlPage &$page, $id)
+    public function _prepare(PlPage $page, $id)
     {
-        $page->assign('countryList', XDB::iterator("SELECT  iso_3166_1_a2, countryFR
+        $page->assign('countryList', XDB::iterator("SELECT  iso_3166_1_a2, country
                                                       FROM  geoloc_countries
-                                                  ORDER BY  countryFR"));
+                                                  ORDER BY  country"));
         $page->assign('hrpid', $this->profile->hrpid);
     }
 }