From 4d5946ac89c92849b1f953eeb2a891cbfbc84e1c Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 6 Dec 2010 15:38:25 +0100 Subject: [PATCH] List last profile modifications for secretary verifications (Closes #1362). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/admin.php | 32 ++++++++++++++++++++++++++++++++ modules/profile/page.inc.php | 3 ++- templates/admin/index.tpl | 2 ++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/modules/admin.php b/modules/admin.php index 30db8ef..0ef787e 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -51,6 +51,7 @@ class AdminModule extends PLModule 'admin/account/watch' => $this->make_hook('account_watch', AUTH_MDP, 'admin'), 'admin/account/types' => $this->make_hook('account_types', AUTH_MDP, 'admin'), 'admin/jobs' => $this->make_hook('jobs', AUTH_MDP, 'admin,edit_directory'), + 'admin/profile' => $this->make_hook('profile', AUTH_MDP, 'admin,edit_directory') ); } @@ -1539,6 +1540,37 @@ class AdminModule extends PLModule } } } + + function handler_profile(&$page) + { + $page->changeTpl('admin/profile.tpl'); + + if (Post::has('checked')) { + S::assert_xsrf_token(); + $res = XDB::iterator('SELECT DISTINCT(pm.pid), pd.public_name + FROM profile_modifications AS pm + INNER JOIN profile_display AS pd ON (pm.pid = pd.pid) + WHERE pm.type = \'self\''); + + while ($profile = $res->next()) { + if (Post::has('checked_' . $profile['pid'])) { + XDB::execute('DELETE FROM profile_modifications + WHERE type = \'self\' AND pid = {?}', $profile['pid']); + + $page->trigSuccess('Profil de ' . $profile['public_name'] . ' vérifié.'); + } + } + } + + $res = XDB::iterator('SELECT p.hrpid, pm.pid, pd.directory_name, GROUP_CONCAT(pm.field SEPARATOR \', \') AS field + FROM profile_modifications AS pm + INNER JOIN profiles AS p ON (pm.pid = p.pid) + INNER JOIN profile_display AS pd ON (pm.pid = pd.pid) + WHERE pm.type = \'self\' + GROUP BY pd.directory_name + ORDER BY pd.directory_name'); + $page->assign('updates', $res); + } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index becd6d1..5487bdf 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -310,7 +310,8 @@ abstract class ProfilePage implements PlWizardPage VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW()) ON DUPLICATE KEY UPDATE uid = VALUES(uid), oldText = IF(VALUES(type) != type, VALUES(oldText), oldText), newText = VALUES(newText), type = VALUES(type), timestamp = NOW()', - $this->pid(), $user->id(), $field, $values[0], $values[1], ($owner->id() == $user->id()) ? 'self' : 'third_party'); + $this->pid(), $user->id(), Profile::$descriptions[$field], $values[0], $values[1], + ($owner->id() == $user->id()) ? 'self' : 'third_party'); } } return true; diff --git a/templates/admin/index.tpl b/templates/admin/index.tpl index 48e621e..d5360c7 100644 --- a/templates/admin/index.tpl +++ b/templates/admin/index.tpl @@ -149,6 +149,8 @@ Noms   |   Networking +   |   + Modifications récentes -- 2.1.4