Fixes jobs edition, in particular forbids jobs without an entreprise name.
[platal.git] / modules / profile / decos.inc.php
index 418ad69..10305bf 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -19,7 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-class ProfileDeco implements ProfileSetting
+class ProfileSettingDeco implements ProfileSetting
 {
     public function value(ProfilePage &$page, $field, $value, &$success)
     {
@@ -27,9 +27,9 @@ class ProfileDeco implements ProfileSetting
         if (is_null($value)) {
             // Fetch already attributed medals
             $res = XDB::iterRow("SELECT  m.id AS id, s.gid AS grade
-                                   FROM  profile_medals_sub    AS s
-                             INNER JOIN  profile_medals        AS m ON ( s.mid = m.id )
-                                  WHERE  s.uid = {?}",
+                                   FROM  profile_medals    AS s
+                             INNER JOIN  profile_medal_enum        AS m ON ( s.mid = m.id )
+                                  WHERE  s.pid = {?}",
                                 $page->pid());
             $value = array();
             while (list($id, $grade) = $res->next()) {
@@ -61,8 +61,8 @@ class ProfileDeco implements ProfileSetting
         foreach ($orig as $id=>&$val) {
             if (!isset($value[$id]) || $val['grade'] != $value[$id]['grade']) {
                 if ($val['valid']) {
-                    XDB::execute("DELETE FROM  profile_medals_sub
-                                        WHERE  uid = {?} AND mid = {?}",
+                    XDB::execute("DELETE FROM  profile_medals
+                                        WHERE  pid = {?} AND mid = {?}",
                                  $page->pid(), $id);
                 } else {
                     $req = MedalReq::get_request(S::i('uid'), $id);
@@ -84,15 +84,15 @@ class ProfileDeco implements ProfileSetting
     }
 }
 
-class ProfileDecos extends ProfilePage
+class ProfileSettingDecos extends ProfilePage
 {
     protected $pg_template = 'profile/deco.tpl';
 
     public function __construct(PlWizard &$wiz)
     {
         parent::__construct($wiz);
-        $this->settings['medals'] = new ProfileDeco();
-        $this->settings['medals_pub'] = new ProfilePub();
+        $this->settings['medals'] = new ProfileSettingDeco();
+        $this->settings['medals_pub'] = new ProfileSettingPub();
         $this->watched['medals'] = true;
     }
 
@@ -118,7 +118,7 @@ class ProfileDecos extends ProfilePage
     public function _prepare(PlPage &$page, $id)
     {
         $res    = XDB::iterator("SELECT  *, FIND_IN_SET('validation', flags) AS validate
-                                   FROM  profile_medals
+                                   FROM  profile_medal_enum
                                ORDER BY  type, text");
         $mlist  = array();
         while ($tmp = $res->next()) {