Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function canShowFieldToday($fieldId, $userId, $submissionInterval)
- {
- $date = date("d.m.Y", $submissionInterval);
- list($day, $month, $year) = explode(".", $date);
- $sql = DB::query()
- ->select("e.entryDate")
- ->from("entries", "e")
- ->join("e", "userInput", "ui", "ui.entryId = e.entryId")
- ->where("ui.fieldId = ?")
- ->andWhere("e.userId = ?")
- ->andWhere("e.entryDate > ?")
- ->setMaxResults(1)
- ->getSQL();
- $stmt = DB::prepare($sql);
- $stmt->bindValue(1, $fieldId);
- $stmt->bindValue(2, $userId);
- $stmt->bindValue(3, time() - mktime(0, 0, 0, $month, $day, $year));
- $stmt->execute();
- $counter = $stmt->rowCount();
- $stmt->closeCursor();
- return $counter == 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement