<?php
function new_month($calendar) {
$calendar->clear_marks();
$selected = $calendar->get_date();
$month = ($selected[1]+1);
$year = $selected[0];
if(file_exists("diary/$year/marked_dates_$month.txt")) {
$dates = fopen("diary/$year/marked_dates_$month.txt", 'r');
$string = explode(',', fgets($dates));
$calendar->freeze();
for($i = 0; $i < 31; $i++) {
if($string[$i]==true) $calendar->mark_day($i+1);
}
$calendar->thaw();
fclose($dates);
}
}
$calendar->connect('month-changed', 'new_month');
?>
|