X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Freminder%2Fprofile_update.inc.php;h=460997722c27c7d02ab2f867a52473b29b511cf8;hb=96d80a35f4abef2b94d2f2b8f5442230141398d1;hp=5327b6c46a829c123d40ec9e243ca2ff252f7404;hpb=0e4b87b287fc40f2d33be0379980e16d6fa30055;p=platal.git diff --git a/include/reminder/profile_update.inc.php b/include/reminder/profile_update.inc.php index 5327b6c..4609977 100644 --- a/include/reminder/profile_update.inc.php +++ b/include/reminder/profile_update.inc.php @@ -45,35 +45,40 @@ class ReminderProfileUpdate extends Reminder } } - protected function GetDisplayText() {} - - public function Display(&$page) + public function Prepare(&$page) { - header('Content-Type: text/html; charset=utf-8'); - $page->changeTpl('reminder/profile_update.tpl', NO_SKIN); - $page->assign('baseurl', $this->GetBaseUrl()); - $user = S::user(); + parent::Prepare($page); $res = XDB::query('SELECT date < DATE_SUB(NOW(), INTERVAL 365 DAY) AS is_profile_old, - date AS profile_date, p.attach AS photo - FROM auth_user_md5 AS u - LEFT JOIN photo AS p ON (u.user_id = p.uid) + date AS profile_date, LENGTH(p.attach) > 0 AS has_photo + FROM auth_user_md5 AS u + LEFT JOIN photo AS p ON (u.user_id = p.uid) WHERE user_id = {?}', - $user->id()); + $this->user->id()); list($is_profile_old, $profile_date, $has_photo) = $res->fetchOneRow(); - $profile_date = $is_profile_old ? $profile_date : null; - $page->assign('profile_update', $profile_date); - $page->assign('needs_photo', $has_photo); + $page->assign('profile_incitation', $is_profile_old); + $page->assign('profile_last_update', $profile_date); + $page->assign('photo_incitation', !$has_photo); - require_once 'geoloc.inc.php'; - $res = localize_addresses($user->id()); - $page->assign('geocoding_incitation', count($res)); + $res = XDB::query('SELECT COUNT(*) + FROM profile_addresses + WHERE pid = {?} AND accuracy = 0' + $this->user->id()); + $page->assign('geocoding_incitation', $res->fetchOneCell()); + } - $page->assign('incitations_count', - ($is_profile_old ? 1 : 0) + - ($has_photo ? 1 : 0) + - (count($res) > 0 ? 1 : 0)); + public function template() + { + return 'reminder/profile_update.tpl'; + } + public function title() + { + return "Mise à jour de ton profil"; + } + public function warning() + { + return true; } public static function IsCandidate(User &$user, $candidate) @@ -85,10 +90,13 @@ class ReminderProfileUpdate extends Reminder WHERE user_id = {?}', $user->id()); list($is_profile_old, $has_photo) = $res->fetchOneRow(); - require_once 'geoloc.inc.php'; - $res = localize_addresses($user->id()); - return (count($res) || !$has_photo || $is_profile_old); + $res = XDB::query('SELECT COUNT(*) + FROM profile_addresses + WHERE pid = {?} AND accuracy = 0' + $this->user->id()); + + return ($res->fetchOneCell() || !$has_photo || $is_profile_old); } }