include('include_files.php');
include('klase/calendar.inc.php');
$db = new MySQL(true, $database, $hostname, $username, $password);
if ($db->Error()) $db->Kill();
$db_slike = new MySQL(true, $database, $hostname, $username, $password);
if ($db_slike->Error()) $db_slike->Kill();
$dodatakcss = '';
$dodatak_script = '';
$oblast = 'kalendar';
if ($jezik == 'sr') {
$title = 'Centar za razvoj Jablaničkog i Pčinjskog okruga - Kalendar aktivnosti';
$header_naslov = 'KALENDAR AKTIVNOSTI';
} else {
$title = 'Center for the Development of Jablanica and Pcinja Districts - Calendar';
$header_naslov = 'CALENDAR';
}
if (! $db->Query("select * from vesti".$nastavak." where naslov <> '' and oblast = '".$oblast."' and odobreno = 1")) $db->Kill();
include('header_all.php');
?>
//Define a new calendar
$cal = new calendar;
/*
Show links to access the previous and next months for month calendar formats, and
links to access the previous and next years for full year calendars.
*/
$cal->displayPrevNextLinks = true;
/*
This section is used when $cal->displayPrevNextLinks is set to true. The month
section is only needed when displaying month calendars.
*/
if (!empty($_GET['mon'])) {
if(is_numeric($_GET['mon'])) {
$cal->calMonth = $_GET['mon'];
$mesec = $_GET['mon'];
} else {
$mesec = date("n");
}
} else {
$mesec = date("n");
}
if (!empty($_GET['yr'])) {
if(is_numeric($_GET['yr'])) {
$cal->calYear = $_GET['yr'];
$godina = $_GET['yr'];
} else {
$godina = date("Y");
}
} else {
$godina = date("Y");
}
//Set the calendar format to large month.
$cal->calFormat = "largeMonth";
/*
Show the small calendars for the previous and next months in the header. This is
only used for large month calendars.
*/
$cal->displayPrevNext = false;
/*
This determines weather events are displayed in the calendar. For large month
calendars this will display a list of events in the calendar cell for the event
date. For small month and full year calendars, the date will be highlighted and
the dates will be displayed when you hover the mouse over the day of the event.
*/
$cal->displayEvents = true;
//Tell the class that the week starts on Sunday
$cal->startingDOW = 1;
//Tell the class to show the week numbers.
$cal->showWeek = false;
if ($jezik=='sr') {
$cal->jezik = "sr";
} else {
$cal->jezik = "en";
}
/*
This will set a few events to test the display. Any number of events can be added for display in the calendar.
*/
// $prvidan je prvi dan u mesecu, a $zadnjidan je zadnji. Potrebo da bi se našli događaji iz tog perioda.
$prvidan = mktime(0, 0, 0, $mesec, 1, $godina);
$brojdanam = date("t", $prvidan);
$zadnjidan = mktime(0, 0, 0, $mesec, $brojdanam+1, $godina);
$db_kal = new MySQL(true, $database, $hostname, $username, $password);
if ($db_kal->Error()) $db_kal->Kill();
if (! $db_kal->Query("select * from vesti".$nastavak." where oblast = 'kalendar' and odobreno = 1 and kreirano between $prvidan and $zadnjidan order by kreirano asc")) $db_kal->Kill();
if ($db_kal->RowCount() > 0) {
while ($row_kal = $db_kal->Row()) {
$datum = $row_kal->kreirano;
$cal->addEvent(strtotime(date("Y-m-d", $datum)), $row_kal->naslov.'[prelom]'.$row_kal->tekst);
}
}
//Finally, call the function that will display the calendar based on the given options.
$cal->display();
?>