require 'class.diary.php';
$base_instance = new base();
$html_instance = new html();
$diary_instance = new diary();
$userid = $base_instance->get_userid();
if (empty($_GET['month'])) {
    $month = date('n');
} else {
    $month = (int) $_GET['month'];
}
if (empty($_GET['year'])) {
    $year = date('Y');
} else {
    $year = (int) $_GET['year'];
}
$days = $diary_instance->get_days_in_month($month, $year);
$all = '<br><div align="center" class="header">Monthly Reminder Overview &nbsp;&nbsp; <a href="show-reminder-monthly-overview.php">[Normal View]</a></div><p>';
for ($day = 1; $day <= $days; $day++) {
    $timestamp = mktime(0, 0, 0, $month, $day, $year);
    $day_of_the_week = date('w', $timestamp) + 1;
    $day_of_the_week_text = date('l', $timestamp);
    $all .= '<table width="80%" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF" class="pastel2"><tr><td colspan="5" style="background-image: url(\'pics/gradient.jpg\');border-bottom:1px solid ' . _BLOCK_LINE_COLOR . '">&nbsp;<b>' . $day_of_the_week_text . ', ' . $day . '.' . $month . '.' . $year . '</b></td></tr>';
    $data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['REMINDER']['DATE']} WHERE user={$userid} AND day={$day} AND (month={$month} OR month=0) AND (year={$year} OR year=0)");
    for ($index = 1; $index <= sizeof($data); $index++) {
        $ID = $data[$index]->ID;
        $title = $data[$index]->title;
        $all .= '<tr bgcolor="#ffffff"><td width="40"><a href="javascript:void(window.open(\'edit-reminder-date.php?reminder_id=' . $ID . '\',\'\',\'width=600,height=620,top=100,left=100\'))">[Edit]</a></td><td width="50"><a href="javascript:void(window.open(\'delete-reminder-date.php?reminder_id=' . $ID . '\',\'\',\'width=450,height=200,top=100,left=100\'))">[Delete]</a></td><td>' . $title . '</td></tr>';
    }
    #
    $data2 = $base_instance->get_data("SELECT * FROM {$base_instance->entity['REMINDER']['WEEKDAY']} WHERE day_of_the_week LIKE '%{$day_of_the_week}%' AND user={$userid}");
    $dotw_total = sizeof($data2);