Exemplo n.º 1
0
 }
 $week = get_dbWeeks($weekid);
 // get the week
 // if invalid week or unpublished week and not a manager
 if (!$week instanceof Week || $week->get_status() == "unpublished" && $_SESSION['access_level'] == 1) {
     echo 'This week\'s calendar is not available for viewing. ';
     if ($_SESSION['access_level'] >= 2) {
         echo '<a href="addWeek.php?archive=false&venue=' . $venue . '"> <br> Manage weeks</a>';
     }
 } else {
     $days = $week->get_dates();
     $year = date("Y", time());
     $doy = date("z", time()) + 1;
     // if notes were edited, processes notes
     if (array_key_exists('_submit_check_edit_notes', $_POST) && $_SESSION['access_level'] >= 1.5) {
         process_edit_notes($week, $venue, $_POST, $year, $doy);
         $week = get_dbWeeks($weekid);
     }
     // shows the previous week / next week navigation
     $week_nav = do_week_nav($week, $edit, $venue);
     echo $week_nav;
     // prevents archived weeks from being edited by anyone
     //    if ($week->get_status() == "archived")
     //        $edit = false;
     echo '<form method="POST">';
     show_week($days, $week, $edit, $year, $doy, $venue);
     if ($edit == true && !($days[6]->get_year() < $year || $days[6]->get_year() == $year && $days[6]->get_day_of_year() < $doy) && $_SESSION['access_level'] >= 1.5) {
         echo "<p align=\"center\"><input type=\"submit\" value=\"Save changes to all notes\" name=\"submit\">";
     }
     echo '</form>';
 }
$group = $_GET['group'];
$monthid = $_GET['month'] . "-" . $group;
$explode_month = explode("-", $_GET['month']);
$year = "20" . $explode_month[0];
$month = retrieve_dbMonths($monthid);
// get or create the month, as needed
include_once 'calendar.inc';
if ($_SESSION['type'] == "staff" || $_SESSION['type'] == "volunteer") {
    if ($month->get_status() == "unpublished" && $_SESSION['access_level'] < 2) {
        echo 'This month\'s calendar is not available for viewing. ';
        die;
    }
    $days = $month->get_dates();
    // if notes were edited, processes notes
    if (array_key_exists('_submit_check_edit_notes', $_POST) && $_SESSION['access_level'] >= 2) {
        process_edit_notes($month, $group, $_POST, $year);
        $month = get_dbMonths($monthid);
    }
    // prevents archived months from being edited by anyone
    $today = mktime();
    if ($month->get_status() == "archived") {
        $edit = false;
    }
    // shows the previous month / next month navigation
    $month_nav = do_month_nav($month, $edit, $group);
    echo $month_nav;
    ?>

                    <button id="printcal" onclick="printpage()">Print Calendar</button><script>function printpage(){window.print();}</script>

                    <?php