} $userId = $_SESSION['userId']; $timeWindowName = $_SESSION['timeWindowName']; $userFirstName = $_SESSION['userFirstName']; $userLastLogin = date("Y.m.d.", strtotime($_SESSION['userLastLogin'])) . " nap " . date("H", strtotime($_SESSION['userLastLogin'])) . " óra " . date("i", strtotime($_SESSION['userLastLogin'])) . " perckor"; if (pregMatch_oneNumberFromString($timeWindowName)) { $numberOfLecke = pregMatch_oneNumberFromString($timeWindowName); } else { $numberOfLecke = ""; } $daysFromStart = db_getNumberOfDaysFromStart($userId, null, null, null); $daysToEnd = db_getNumberOfDaysToProgramEnd($userId, null, null, null); $daysToNextTimeWindow = db_getDaysToNextTimeWindow($userId, null, null, null, $timeWindowName); $TimeWindowDescription = db_getTimeWindowDescription($timeWindowName); $NextTimeWindowDescription = db_getNextTimeWindowDescription($timeWindowName); $numberOfFilledOutTests = db_getHowManyTestsFilledOut($userId); $numberOfTestsThatAreLeft = db_getHowManyTestsAreLeft($userId); include 'includes/header.php'; ?> <script type="text/javascript" src="../js/jquery.min.js"></script> <script type="text/javascript" src="js/jquery-ui.js"></script> <div class="flexbox-container"> <div class="content-left"> <div class="line-magenta"></div> </div> <div class="content-right vertical-padding-10"></div> </div> <div class="flexbox-container"> <div class="content-left">
/** * Returns the number of how many tests are left for the corresponding user. * @param int $userId * @return int containing the number of tests that are not filled out yet, or FALSE if it cannot be found the user. */ function db_getHowManyTestsAreLeft($userId = -1) { $teszt = "%teszt%"; $numberOfFilledOutTests = db_getHowManyTestsFilledOut($userId); global $conn; $stmt = $conn->prepare("SELECT COUNT(*)\n FROM aktivitas\n WHERE leiras LIKE :test AND suly > 0"); $stmt->bindParam(':test', $teszt); $stmt->execute(); $maxTests = $stmt->fetchColumn(); return $maxTests - $numberOfFilledOutTests; }