function display_date_selector($p_year = null, $p_month = null, $p_day = null) { $cur_year = get_current_year(); $cur_month = get_current_month(); $cur_day = get_current_day(); $sel_year = $p_year == null ? $cur_year : $p_year; $sel_month = $p_month == null ? $cur_month : $p_month; $sel_day = $p_day == null ? $cur_day : $p_day; echo "<select name=\"fm_year\">\n"; for ($year = $cur_year; $year <= $cur_year + 10; $year++) { $selected = $year == $sel_year ? "selected" : ""; echo "<option value=\"{$year}\" {$selected}>{$year}</option>\n"; } echo "</select>\n"; echo "<select name=\"fm_month\">\n"; for ($month = 1; $month <= 12; $month++) { $selected = $month == $sel_month ? "selected" : ""; $month = sprintf("%02d", $month); echo "<option value=\"{$month}\" {$selected}>{$month}</option>\n"; } echo "</select>\n"; echo "<select name=\"fm_day\">\n"; for ($day = 1; $day <= 31; $day++) { $selected = $day == $sel_day ? "selected" : ""; $day = sprintf("%02d", $day); echo "<option value=\"{$day}\" {$selected}>{$day}</option>\n"; } echo "</select>\n"; }
$template->setCurrentBlock("NAVIGATION"); $template->setVariable("DATE", $date->format("%A %b %e, %Y")); $template->setVariable("GREETING", setupGreeting()); $displayName = getUserFirstName($connection, $userID); if (!$displayName) { $displayName = $_SESSION["loggedinUserName"]; } $template->setVariable("USER", $displayName . "!"); $template->parseCurrentBlock(); // Setup and load the quickentry calendar for actual workout data entry. $template->setCurrentBlock("WEEKLY"); loadQuickEntry($template, $Month, $connection); // Setup the weekly graphs for actual and planned workout volumes. get_weekly_volume_graph($userID, $connection); // Setup current month, current year and prior year volume/dist blocks get_current_month($template, $userID, $connection); get_current_year($template, $userID, $connection); get_prior_month($template, $userID, $connection); get_prior_year($template, $userID, $connection); } else { //Seems the user has attempted to navigate directly to the dashboard without //logging in. Send them to the logout page with an error message. $_SESSION["headerMessage"] = "Error!!"; $_SESSION["message"] = "You must first log into the system before you can view the page."; // Send user to the logout page. header("Location: logout.php"); exit; } //Show the user's Dashboard page. $template->show(); /********************************* Helper Functions ******************************************/