projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixes jobs edition, in particular forbids jobs without an entreprise name.
[platal.git]
/
modules
/
profile
/
decos.inc.php
diff --git
a/modules/profile/decos.inc.php
b/modules/profile/decos.inc.php
index
ebd8f12
..
10305bf
100644
(file)
--- a/
modules/profile/decos.inc.php
+++ b/
modules/profile/decos.inc.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-20
07
Polytechnique.org *
+ * Copyright (C) 2003-20
10
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* 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 *
***************************************************************************/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-class ProfileDeco implements ProfileSetting
+class Profile
Setting
Deco implements ProfileSetting
{
public function value(ProfilePage &$page, $field, $value, &$success)
{
{
public function value(ProfilePage &$page, $field, $value, &$success)
{
@@
-27,13
+27,13
@@
class ProfileDeco implements ProfileSetting
if (is_null($value)) {
// Fetch already attributed medals
$res = XDB::iterRow("SELECT m.id AS id, s.gid AS grade
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_medal
s
AS m ON ( s.mid = m.id )
- WHERE s.
u
id = {?}",
-
S::i('uid'
));
+ FROM profile_medals AS s
+ INNER JOIN profile_medal
_enum
AS m ON ( s.mid = m.id )
+ WHERE s.
p
id = {?}",
+
$page->pid(
));
$value = array();
while (list($id, $grade) = $res->next()) {
$value = array();
while (list($id, $grade) = $res->next()) {
- $value[$id] = array('grade' => $grade,
+ $value[$id] = array('grade' => $grade,
'valid' => '1');
}
'valid' => '1');
}
@@
-61,9
+61,9
@@
class ProfileDeco implements ProfileSetting
foreach ($orig as $id=>&$val) {
if (!isset($value[$id]) || $val['grade'] != $value[$id]['grade']) {
if ($val['valid']) {
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
u
id = {?} AND mid = {?}",
-
S::i('uid'
), $id);
+ XDB::execute("DELETE FROM profile_medals
+ WHERE
p
id = {?} AND mid = {?}",
+
$page->pid(
), $id);
} else {
$req = MedalReq::get_request(S::i('uid'), $id);
if ($req) {
} else {
$req = MedalReq::get_request(S::i('uid'), $id);
if ($req) {
@@
-76,66
+76,55
@@
class ProfileDeco implements ProfileSetting
// Add new ones
foreach ($value as $id=>&$val) {
if (!isset($orig[$id]) || $orig[$id]['grade'] != $val['grade']) {
// 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();
$req->submit();
+ sleep(1);
}
}
}
}
}
}
}
}
-class ProfileDecos extends ProfilePage
+class Profile
Setting
Decos extends ProfilePage
{
protected $pg_template = 'profile/deco.tpl';
public function __construct(PlWizard &$wiz)
{
parent::__construct($wiz);
{
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;
}
}
- protected function fetchData()
+ protected function
_
fetchData()
{
{
- $res = XDB::query("SELECT
profile_
medals_pub
- FROM
auth_user_quick
- WHERE
user_
id = {?}",
-
S::i('uid'
));
+ $res = XDB::query("SELECT medals_pub
+ FROM
profiles
+ WHERE
p
id = {?}",
+
$this->pid(
));
$this->values['medals_pub'] = $res->fetchOneCell();
$this->values['medals_pub'] = $res->fetchOneCell();
- parent::fetchData();
}
}
- protected function saveData()
+ protected function
_
saveData()
{
{
- parent::saveData();
if ($this->changed['medals_pub']) {
if ($this->changed['medals_pub']) {
- XDB::execute("UPDATE
auth_user_quick
- SET
profile_
medals_pub = {?}
- WHERE
user_
id = {?}",
- $this->values['medals_pub'],
S::i('uid'
));
+ XDB::execute("UPDATE
profiles
+ SET medals_pub = {?}
+ WHERE
p
id = {?}",
+ $this->values['medals_pub'],
$this->pid(
));
}
}
}
}
- public function
prepare(PlatalPage &$page
)
+ public function
_prepare(PlPage &$page, $id
)
{
{
- parent::prepare($page);
- $res = XDB::iterator("SELECT *
- FROM profile_medals_grades
- ORDER BY mid, pos");
- $grades = array();
- while ($tmp = $res->next()) {
- $grades[$tmp['mid']][] = $tmp;
- }
- $page->assign('grades', $grades);
-
$res = XDB::iterator("SELECT *, FIND_IN_SET('validation', flags) AS validate
$res = XDB::iterator("SELECT *, FIND_IN_SET('validation', flags) AS validate
- FROM profile_medal
s
+ FROM profile_medal
_enum
ORDER BY type, text");
$mlist = array();
while ($tmp = $res->next()) {
$mlist[$tmp['type']][] = $tmp;
}
$page->assign('medal_list', $mlist);
ORDER BY type, text");
$mlist = array();
while ($tmp = $res->next()) {
$mlist[$tmp['type']][] = $tmp;
}
$page->assign('medal_list', $mlist);
-
$trad = Array('ordre' => 'Ordres',
'croix' => 'Croix',
'militaire' => 'Médailles militaires',
$trad = Array('ordre' => 'Ordres',
'croix' => 'Croix',
'militaire' => 'Médailles militaires',