Adds support for database tablename prefixs.
[platal.git] / modules / profile / decos.inc.php
index 1018e9b..31d68cd 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -76,8 +76,9 @@ class ProfileDeco implements ProfileSetting
         // Add new ones
         foreach ($value as $id=>&$val) {
             if (!isset($orig[$id]) || $orig[$id]['grade'] != $val['grade']) {
-                $req = new MedalReq(S::i('uid'), $id, $val['grade']);
+                $req = new MedalReq(S::user(), $id, $val['grade']);
                 $req->submit();
+                sleep(1);
             }
         }
     }
@@ -92,21 +93,20 @@ class ProfileDecos extends ProfilePage
         parent::__construct($wiz);
         $this->settings['medals'] = new ProfileDeco();
         $this->settings['medals_pub'] = new ProfilePub();
+        $this->watched['medals'] = true;
     }
 
-    protected function fetchData()
+    protected function _fetchData()
     {
         $res = XDB::query("SELECT  profile_medals_pub
                              FROM  auth_user_quick
                             WHERE  user_id = {?}",
                           S::i('uid'));
         $this->values['medals_pub'] = $res->fetchOneCell();
-        parent::fetchData();
     }
 
-    protected function saveData()
+    protected function _saveData()
     {
-        parent::saveData();
         if ($this->changed['medals_pub']) {
             XDB::execute("UPDATE  auth_user_quick
                              SET  profile_medals_pub = {?}
@@ -115,9 +115,8 @@ class ProfileDecos extends ProfilePage
         }
     }
 
-    public function prepare(PlatalPage &$page, $id)
+    public function _prepare(PlPage &$page, $id)
     {
-        parent::prepare($page, $id);
         $res    = XDB::iterator("SELECT  *, FIND_IN_SET('validation', flags) AS validate
                                    FROM  profile_medals
                                ORDER BY  type, text");