if (0 <= $d2) { $days = $d2; } } return (int) ($days / 7) + 2; } $numDays = date("t", $currentTimeStamp); for ($i = 1; $i < $numDays + 1; $i++, $counter++) { $timeStamp = strtotime("{$year}-{$month}-{$i} 00:00:00"); if ($timeStamp == strtotime("{$year}-01-01 00:00:00")) { $week = 1; } elseif ($timeStamp == strtotime("{$year}-{$month}-01 00:00:00")) { $week = get_week_number($timeStamp); $week = $week - 1; } else { $week = get_week_number($timeStamp); } if ($i == 1) { $firstDay = date("w", $timeStamp); echo "</tr><tr class='showHideDiv' style=\"background-color:'{$color}';\" onmouseover=\"this.style.backgroundColor='#F6E497';\"this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='{$color}';\" onClick='display({$month},{$year},{$week});'><td> </td>"; for ($j = 0; $j < $firstDay; $j++, $counter++) { echo "<td> </td>"; } } if ($counter % 7 == 0 && $i > 1) { echo "</tr><tr><tr class='showHideDiv' style=\"background-color:'{$color}';\" onmouseover=\"this.style.backgroundColor='#F6E497';\"this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='{$color}';\" onClick='display({$month},{$year},{$week});'><td></td>"; } if (date("w", $timeStamp) == 0 || date("w", $timeStamp) == 6) { echo "<td class='weekend' width='50'>{$i}</td>"; } elseif ($i == date("d") && $month == date("m") && $year == date("Y")) { echo "<td class='today' width='50'>{$i}</td>";
function show_week_row($athlete_id, $date, $numcols) { $week_num = get_week_number(date("Y-m-d", $date)); $num = $numcols + 3; // Calculate weekly totals // and display totals for training done include_once "weekly_total_functions.php"; $weektotals = weekly_done_totals($athlete_id, $date); ksort($weektotals); echo "<TR><TD class=weekcell colspan={$num} > <font color=white ><b>Week {$week_num} </b>"; $total = $weektotals['Total Done']; echo "<br> <b>Total Done:</b> <font color=#ffdddd > <b>{$total}</b> </font> - \n"; foreach (array_keys($weektotals) as $ex_type) { if ($ex_type == "Total Done") { continue; } $total = $weektotals[$ex_type]; echo " <b>{$ex_type}:</b> {$total} "; } // Display training plan totals if there are any $weekplantotals = weekly_planned_totals($athlete_id, $date); if (count($weekplantotals) > 1) { ksort($weektotals); $total = $weekplantotals['Total To Do']; echo "<br> <b>Total To Do:</b> <font color=#ffdddd > <b>{$total}</b> </font> - \n"; foreach (array_keys($weekplantotals) as $ex_type) { if ($ex_type == "Total To Do") { continue; } $total = $weekplantotals[$ex_type]; echo " <b>{$ex_type}:</b> {$total} "; } #echo "<TR><TD class=weekcell colspan=$num > <font color=white > $weekplantotals </TD></TR>\n\n" ; } echo " </TD></TR>\n\n"; }