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 @@