prepare();
$query = "SELECT name FROM $table_agenda_name WHERE id ='" . $a . "'";
$result = mysql_query($query);
$agenda_name = mysql_result($result, 0);
$tpl->assign("agenda_name", $agenda_name);
$title = str_replace("%week%", $week, $sas_lang['agenda_week_title']);
$tpl->assign("w", $title);
$query_date_first = date('Y-m-d', datefromweeknr($year, $week, 1));
$day_number = substr($query_date_first, 8, 10);
$query_date_last = date('Y-m-d', datefromweeknr($year, $week +1, 1));
$week_day = date("w", mktime(12, 0, 0, $month, $day_number, $year));
//print $query_date_first." ".$query_date_last." ".$week_day;
$query = "SELECT adate, timeslot, descr, agenda FROM $table_agenda_events
WHERE adate >= '$query_date_first' AND adate <= '$query_date_last' AND agenda = '" . $a . "' ORDER BY adate";
$result = mysql_query($query);
//print $query;
$numRows = mysql_num_rows($result);
if ($numRows > 0)
{
while ($time_list = mysql_fetch_array($result))
{ //fill the description from table
$day_number = substr($time_list[0], 8, 10); //get the day of the date
$week_day = date("w", mktime(12, 0, 0, $month, $day_number, $year)); //get the day n umber monday =1
//print $time_list[0]." ".$time_list[1]."
$week_day" ;
$tpl->assign("app$time_list[1]$week_day", $time_list[2]);
}
}
fill_time_slots(); //fill the timeslots text
for ($i = 0; $i < 7; $i++)
{
if ($i == 0)
{
$tpl->assign("day$i", $lang_week[$i] . "
" . date('d-m-Y', datefromweeknr($year, $week, 7)));
}
else
{
$tpl->assign("day$i", $lang_week[$i] . "
" . date('d-m-Y', datefromweeknr($year, $week, $i)));
}
}
$tpl->printToScreen();
?>