From 98fe79e2a2ef5d4fa206f32a24b019b3fa783523 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Wed, 2 Dec 2015 23:32:28 +0300 Subject: [PATCH] =?UTF-8?q?ADD=20=D0=BE=D0=B3=D1=80=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B0=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BB-=D0=B2=D0=BE=20=D1=82=D0=BE=D1=87=D0=B5=D0=BA=20=D0=B2?= =?UTF-8?q?=20=D0=B4=D0=B5=D0=BD=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/Point.php | 12 ++++++++++++ views/modals/addPoint.php | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/models/Point.php b/models/Point.php index a6a25e6..dfae86a 100644 --- a/models/Point.php +++ b/models/Point.php @@ -113,4 +113,16 @@ class Point extends Model 'order' => '`id` ASC', )); } + + public function getCountMyPointsToday() + { + if (!App::$user->id) { + return 0; + } + + $time = strtotime(date('Y-m-d')); + $userId = App::$user->id; + $res = App::DB()->query('SELECT count(`id`) AS `cnt` FROM ' . $this->_tableName_ . ' WHERE `author` = ' . $userId . ' AND `date` >= ' . $time . ';')->fetch(PDO::FETCH_ASSOC); + return (int)$res['cnt']; + } } diff --git a/views/modals/addPoint.php b/views/modals/addPoint.php index 81830ea..c505cb2 100644 --- a/views/modals/addPoint.php +++ b/views/modals/addPoint.php @@ -6,6 +6,12 @@ +