[Php-calendar-discussion] changes - show in navbar whether any
Brought to you by:
sproctor
From: Jim M. <jmi...@ya...> - 2003-02-22 08:30:18
|
The following changes will brighten the look and feel. - On ie5.5, the month buttons were full page width and took up most of the screen. Now they all fit on one line so I can see the calendar. - The nav buttons now show lime-green whenever that month or year has any events in it. index.inc.php ------------- function navbar($year, $month, $day) { global $BName; $nextmonth = $month + 1; $lastmonth = $month - 1; $nextyear = $year + 1; $lastyear = $year - 1; $output = "<div id=\"navbar\"> <a "; if (get_events_cnt_by_year($lastyear) > 0) { $output .= "style=\"background-color: Lime;\" "; } $output .= "href=\"?month=$month&year=$lastyear\">" . _('last year') . "</a> <a "; if (get_events_cnt_by_month($lastmonth, $year) > 0) { $output .= "style=\"background-color: Lime;\" "; } $output .= "href=\"?month=$lastmonth&year=$year\">" . _('last month') . "</a> "; for($i = 1; $i <= 12; $i++) { $output .= "<a class=\"month\" "; if (get_events_cnt_by_month($i, $year) > 0) { $output .= "style=\"background-color: Lime;\" "; } $output .= "href=\"?month=$i&year=$year\">" . short_month_name($i) . "</a>\n "; } $output .= "<a "; if (get_events_cnt_by_month($nextmonth, $year) > 0) { $output .= "style=\"background-color: Lime;\" "; } $output .= "href=\"?month=$nextmonth&year=$year\">" . _('next month') . "</a> <a "; if (get_events_cnt_by_year($nextyear) > 0) { $output .= "style=\"background-color: Lime;\" "; } $output .= "href=\"?month=$month&year=$nextyear\">" . _('next year') . "</a> </div> <div> <a class=\"box\" href=\"add.php?month=$month&year=$year&day=$day\">" . _('Add Item') . '</a> </div>'; return $output; } calendar.inc.php ---------------- function get_events_cnt_by_month($month, $year) { global $sql_tableprefix; $database = connect_to_database(); $result = mysql_query('SELECT count(*) AS cnt FROM ' . $sql_tableprefix . "events WHERE (stamp >= \"$year-$month-1 00:00:00\" AND stamp <= \"$year-$month-31 23:59:59\") OR (duration >= \"$year-$month-1 00:00:00\" AND duration <= \"$year-$month-31 23:59:59\")", $database) or soft_error("get_events_cnt_by_month failed:" . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); return $row['cnt']; } function get_events_cnt_by_year($year) { global $sql_tableprefix; $database = connect_to_database(); $result = mysql_query('SELECT count(*) AS cnt FROM ' . $sql_tableprefix . "events WHERE (stamp >= \"$year-1-1 00:00:00\" AND stamp <= \"$year-12-31 23:59:59\") OR (duration >= \"$year-1-1 00:00:00\" AND duration <= \"$year-12-31 23:59:59\")", $database) or soft_error("get_events_cnt_by_month failed:" . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); return $row['cnt']; } style0.css ---------- body { color: Black; background-color: White; } a { color: Black; background-color: inherit; } a:hover { color: ffddee; background-color: inherit; } h1 { background-color: Gray; color: White; } #calendar { background-color: black; color: white; } caption { background-color: #ddffee; color: black; } th { background-color: #ffeedd; color: black; } #navbar a { background-color: #ffeedd; color: black; } #navbar a:hover { color: silver; background-color: black; } .past, .past td { color: inherit; background-color: #ffeedd; } .future, .future td { color: inherit; background-color: white; } .none { background-color: gray; color: inherit; } #calendar table { background-color: black; color: inherit; } #calendar table a:hover { background-color: gray; color: inherit; } #display { background-color: black; color: white; } #display td { background-color: silver; color: black; } .box { background-color: silver; border-color: black; color: black; } a.box:hover { background-color: black; color: silver; } style-ie.css ------------ #navbar a { } generic.css ----------- a.month { } .past, .future { text-align: left; } ===== ---------------- Jim Michaels jmi...@ya... __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ |