section based on the information in config.php **********************************************************************/ function printCss() { global $dim; global $color; # bars printf(".dlbar {\n position: absolute; z-index: 2;\n height: %dpx; background: %s;\n border: solid 1px %s;\n}\n", $dim["rowheight"],$color["deadlinebar"],$color["deadlineborder"]); printf(".reviewbar {\n position: absolute; z-index: 2;\n height: %dpx; background: %s;\n border: solid 1px %s;\n}\n", $dim["rowheight"],$color["reviewbar"],$color["reviewborder"]); printf(".finalbar {\n position: absolute; z-index: 2;\n height: %dpx; background: %s;\n border: solid 1px %s;\n}\n", $dim["rowheight"],$color["finalbar"],$color["finalborder"]); printf(".confbar {\n position: absolute; z-index: 2;\n height: %dpx; background: %s;\n border: solid 1px %s;\n}\n", $dim["rowheight"],$color["confbar"],$color["confborder"]); #lines printf(".hline {\n border-top: solid 1px black;\n position: absolute; \n width: 100%%;\n font-size: 12px;\n}\n"); printf(".vline {\n border-left: solid 1px #A0A0A0;\n position: absolute; z-index: 1;\n height: 100%%;\n}\n"); printf(".redline {\n border-left: solid %dpx #C00000;\n position: absolute; z-index: 3;\n height: 100%%;\n}\n",$dim["ppd"]); #highlight helpers printf(".confinfo {\n font: 12px arial, sans-serif;\n position: absolute;\n border: solid 1px black;\n background-color: #E0E080;\n". " padding: 2px;\n text-align: left;\n vertical-align: middle;\n z-index: 10;\n line-height: 14px;\n}\n"); printf(".bararea {\n font: 14px arial, sans-serif;\n position: absolute;\n border: solid 1px black;\n z-index: 3;\n}\n"); printf(".mousebar {\n border: none;\n background: transparent;\n position: absolute;\n left: 0px; width: 100%%; height: 20px;\n z-index: 0;\n}\n"); printf(".mousesensorbar {\n border: none;\n background: transparent;\n position: absolute;\n left: 0px; width: 100%%; height: 25px;\n z-index: 5;\n}\n"); printf(".rowtext {\n left: 5px;\n z-index: 6;\n position: absolute;\n}\n"); #headline printf(".headline {\n font-size: 12px;\n border: none;\n position: absolute;\n top: 0px;\n text-align: center;\n}\n"); } /********************************************************************** * printHeader() * * Prints the html header and starts the section **********************************************************************/ function printHeader() { global $conf; echo "\n"; echo "\n"; echo "\n"; printf("%s\n",$conf["title"]); printf("\n",$conf["cssfile"]); echo "\n"; printf("\n",$conf["jsfile"]); echo "\n"; echo "\n"; } /********************************************************************** * printFooter() * * Prints a page footer and the final html tags * * $text: the text displayed in the footer * $firefox: flag, indicating whether the "Get Firefox", "Valid HTML", * and "Valid CSS" logos are displayed * * Change config.php to set a costum footer! **********************************************************************/ function printFooter($text,$firefox) { echo "

 

\n"; echo "
\n"; if ($text != NULL) { echo "

$text

"; } echo "

"; if ($firefox) { echo "". "\"Get\n"; echo ""; echo "\"Valid"; echo ""; echo ""; echo "\"Valid"; echo "\n"; } echo "

\n"; } /********************************************************************** * dbConnect() * * Connects to the MySQL database **********************************************************************/ function dbConnect() { global $conf; global $lang; $link = mysql_connect($conf["hostname"],$conf["user"],$conf["passwd"]) or die($lang["noconnection"] . mysql_error()); mysql_select_db($conf["database"]) or die($lang["selectingfailed"]); } /********************************************************************** * isLeapYear() * * Computes, whether $year is a leap year **********************************************************************/ function isLeapYear($year) { if ($year % 4 == 0) { if ( $jahr % 100 == 0 ) return ($jahr % 400 == 0); return true; } return false; } /********************************************************************** * daysOfYear() * * Computes the number of days of $year **********************************************************************/ function daysOfYear($year) { if (isLeapYear($year)) return 366; else return 365; } /********************************************************************** * printConfInfoBox() * * Generates the info box. The box is initially hidden and activated by * JavaScript. **********************************************************************/ function printConfInfoBox() { global $dim; $box = $dim["infopos"]; echo "
\n"; } /********************************************************************** * confBox() * * Prints a single bar in the calendar. * $firstday: first day of the bar * $lastday: last day of the bar * $year: the year * $offset: margin on the left side **********************************************************************/ function confBox($firstday,$lastday,$year,$offset) { global $MSIE; global $dim; $d1 = ($firstday["year"]==$year)? $firstday["yday"] : 0; $d2 = ($lastday["year"]==$year)? $lastday["yday"] : daysofyear($year); $x = ($d1*$dim["ppd"])+$offset; $w = (($d2-$d1+1)*$dim["ppd"]); if (!$MSIE) $x--; if (!$MSIE) $w--; return array($x,$w); } /********************************************************************** * daysOfYear() * * Computes the number of days of $year **********************************************************************/ function printConfBar($class,$x,$w) { # printf("%s
\n",indent(),$class,$x,$y,$w-1); printf("%s
\n",indent(),$class,$x,$w-1); } /********************************************************************** * formatDate($d) * * Converts a date $d which is formatted as MySQL date string, as a * string formatted according to the specification in config.php. * Returns "?" if there is no date given. **********************************************************************/ function formatDate($d) { global $lang; if (trim($d) != "") return strftime($lang["dateformat"],strtotime($d)); else return "?"; } /********************************************************************** * printConfRow($i,$y,$line,$year) * * Prints a row of the calendar, including first column, * meta-information for JavaScript, and the bars. **********************************************************************/ function printConfRow($i,$y,$line,$year) { global $dim; global $lang; $rowid = "r" . $year . $i; $text = "" . htmlentities($line["shortname"],ENT_QUOTES)."
" . htmlentities($line["place"],ENT_QUOTES) . "
" . $lang["info_deadline"] . formatDate($line["deadline"]) . "
". $lang["info_notification"] . formatDate($line["notification"]) . "
" . $lang["info_final"] . formatDate($line["final"]) . "
" . $lang["info_conf"] . formatDate($line["confstart"]) . " - " . formatDate($line["confend"]); $highlightstring = " onMouseOver=\"highlightItem(event,'$rowid',true,'$text')\"". " onMouseOut=\"highlightItem(event,'$rowid',false,'')\""; $infoboxstring = " onMouseDown=\"showInfoBox(true)\" onMouseUp=\"showInfoBox(false)\" onMouseMove=\"moveInfoBox(event)\""; printf("%s
\n", indent(),$y-2,$highlightstring,$infoboxstring); printf("%s
%s
\n", indent(),$y,$highlightstring,$line["url"],htmlentities($line["shortname"],ENT_QUOTES)); printf("%s
\n",indent(),$rowid,$y); // intended HTML output incIndent(); // convert dates $d_deadl = getdate(strtotime($line["deadline"])); $d_deadlprv = getdate(strtotime("-2 day",strtotime($line["deadline"]))); $d_deadlnxt = getdate(strtotime("+1 day",strtotime($line["deadline"]))); $d_notif = getdate(strtotime($line["notification"])); $d_notifnxt = getdate(strtotime("+1 day",strtotime($line["notification"]))); $d_final = getdate(strtotime($line["final"])); $d_start = getdate(strtotime($line["confstart"])); $d_end = getdate(strtotime($line["confend"])); // deadline bar if ($d_deadl["year"]==$year) { $box = confBox($d_deadlprv,$d_deadl,$year,$dim["firstcolsize"]); printConfBar("dlbar",$box[0],$box[1]); } // notification bar if ($line["deadline"]!= "" && $line["notification"]!="" && ($d_deadlnxt["year"]==$year || $d_notif["year"]==$year)) { $box = confBox($d_deadlnxt,$d_notif,$year,$dim["firstcolsize"]); printConfBar("reviewbar",$box[0],$box[1]); } // final version bar if ($line["notification"]!="" && $line["final"]!="" && ($d_notifnxt["year"]==$year || $d_final["year"]==$year)) { $box = confBox($d_notifnxt,$d_final,$year,$dim["firstcolsize"]); printConfBar("finalbar",$box[0],$box[1]); } // conference bar if ($line["confstart"]!="" && $line["confend"]!="" && ($d_start["year"]==$year || $d_start["year"]==$year)) { $box = confBox($d_start,$d_end,$year,$dim["firstcolsize"]); printConfBar("confbar",$box[0],$box[1]); } // intended HTML output decIndent(); printf("%s
\n",indent()); } /********************************************************************** * printLegend() * * Prints a little legend for the different types of bars **********************************************************************/ function printLegend() { echo "

"; echo "Deadline "; echo "Review process "; echo "Final Version "; echo "Conference "; echo "

"; } /********************************************************************** * printMonthRow($year) * * Prints a headline with the month names **********************************************************************/ function printMonthRow($year) { global $dim; global $lang; printf("%s
%d
\n", indent(),$p_offset,$dim["firstcolsize"]+$d_offset,$year); $x = $dim["firstcolsize"]; for ($i = 0; $i < 12; $i++) { printf("%s
%s
\n", indent(),$x+$p_offset,$dim["monthdays"][$i]*$dim["ppd"] + $d_offset ,$lang["monthname"][$i]); $x = $x + ($dim["monthdays"][$i]*$dim["ppd"]); } } /********************************************************************** * printMonthRow($year,$group) * * Prints the calendar for $year and ConfCal group $group. Queries * the database and calls all functions to display the calendar. **********************************************************************/ function printCalendar($year,$group) { global $dim; global $lang; global $show; global $MSIE; if (isLeapYear($year)) $dim["monthdays"][1] = 29; else $dim["monthdays"][1] = 28; $endquery = "AND confend >= NOW() "; switch ($show["from"]) { case 0: $endquery = ""; break; case 1: $endquery = "AND confend >= NOW() "; break; case 2: $endquery = "AND deadline >= NOW() "; break; } if ($show["categories"]) { $query = "SELECT conf_instance.*,conf_category.* FROM conf_instance INNER JOIN conf_series ON conf_instance.series = conf_series.id INNER JOIN conf_group_of_series ON ". "conf_group_of_series.series = conf_series.id LEFT JOIN conf_category_of_series ON conf_category_of_series.series = conf_series.id ". "LEFT JOIN conf_category ON conf_category_of_series.category = conf_category.id ". "WHERE conf_group_of_series.cgroup = $group ". $endquery . "AND (YEAR(deadline)=$year OR YEAR(confend)=$year) ". "ORDER BY conf_category_of_series.category,deadline"; } else { $query = "SELECT conf_instance.* FROM conf_instance INNER JOIN conf_series ON conf_instance.series = conf_series.id INNER JOIN conf_group_of_series ON ". "conf_group_of_series.series = conf_series.id ". "WHERE conf_group_of_series.cgroup = $group ". $endquery . "AND (YEAR(deadline)=$year OR YEAR(confend)=$year) ". "ORDER BY deadline"; } $result = mysql_query($query) or die($lang["queryfailed"] . mysql_error()); $num_rows = mysql_num_rows($result); $num_categories = 0; if ($show["categories"] && $num_rows > 0) { $prevcat = "___should_not_occur"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { if ($line["name"]!= $prevcat) { $prevcat = $line["name"]; $num_categories++; } } } if ($num_rows == 0) { $num_categories = 1; } $totalhsize = $dim["firstcolsize"] + $dim["ppd"]*daysofyear($year)+2; $totalvsize = $num_rows*25+$num_categories*20+$dim["headlineheight"]; echo "
\n"; incIndent(); if ($MSIE) $p_offset = 1; else $p_offset = -1; if ($MSIE) $d_offset = 1; else $d_offset = -1; printf("%s
\n", indent(),$p_offset,19,$totalhsize+$d_offset,$totalvsize); incIndent(); printMonthRow($year); $x = $dim["firstcolsize"]; for ($i = 0; $i < 12; $i++) { printf("%s
\n",indent(),$x+$p_offset,$i==0?" border-color: black;":""); $x = $x + ($dim["monthdays"][$i]*$dim["ppd"]); } $y = $dim["headlineheight"]; $prevcat = "___should_not_occur"; if ($num_rows != 0) { mysql_data_seek($result,0); for ($i = 0; $i < $num_rows; $i++) { $line = mysql_fetch_array($result, MYSQL_ASSOC); if ($show["categories"]) { if ($line["name"] != $prevcat) { if ($line["name"] == "") printf("%s
%s
\n",indent(),$y,$lang["nocat"]); else printf("%s
%s
\n",indent(),$y,$line["name"]); $y += 20; $prevcat = $line["name"]; } } else if ($i == 0) { printf("%s
\n",indent(),$y); $y += 3; } printConfRow($i,$y,$line,$year); $y = $y + 25; } } else { printf("%s
%s
\n",indent(),$y,$lang["noconf"]); $y += 20; } mysql_free_result($result); $now = getdate(); if ($now["year"]==$year) { printf("%s
\n",indent(),$now["yday"]*$dim["ppd"]+$dim["firstcolsize"]+$p_offset,$dim["headlineheight"],$totalvsize-$dim["headlineheight"]); } decIndent(); printf("%s
\n",indent()); decIndent(); printf("%s
\n",indent()); printf("%s
\n",indent(),$totalvsize + 45); } /********************************************************************** * printUpcoming * * Prints a section with a deadline prediction of conferences **********************************************************************/ function printUpcoming($preview,$group) { global $lang; echo "\n

%s

\n",$lang["previewinfo"]); } /********************************************************************** * printConfigArea() * * Prints switches to chance the display options of the calendar **********************************************************************/ function printConfigArea() { global $show; echo "
Grouping: "; $showstr = array ( 0 => "all", 1 => "confend", 2=> "deadline" ); if ($show["categories"]) printf("None ",$_SERVER['PHP_SELF'],$showstr[$show["from"]]); else printf("[None] "); if (!$show["categories"]) printf("Category ",$_SERVER['PHP_SELF'],$showstr[$show["from"]]); else printf("[Category] "); $sortstr = array ( true => "category" , false => "none" ); printf("
Show: "); if ($show["from"] != 0) printf("All ",$_SERVER['PHP_SELF'],$sortstr[$show["categories"]]); else printf("[All] "); if ($show["from"] != 1) printf("Active Conferences ",$_SERVER['PHP_SELF'],$sortstr[$show["categories"]]); else printf("[Active Conferences] "); if ($show["from"] != 2) printf("Open deadlines ",$_SERVER['PHP_SELF'],$sortstr[$show["categories"]]); else printf("[Open deadlines] "); echo "
\n"; } /********************************************************************** * main() * * Main function **********************************************************************/ function main() { global $conf; global $lang; printHeader(); printf("

%s

%s

",$conf["title"],$conf["subtitle"]); dbConnect(); printConfInfoBox(); $now = getdate(); printCalendar($now["year"],$conf["groupid"]); printCalendar($now["year"]+1,$conf["groupid"]); if ($conf["showupcoming"]) { printf("

Upcoming Conferences (%d month preview)

\n",$conf["preview"]); printUpcoming($conf["preview"],$conf["groupid"]); } if ($conf["showlegend"]) { echo "

Legend:

"; printLegend(); } if ($conf["showconfarea"]) { echo "

Configuration:

"; printConfigArea(); echo "

Admin area

"; } if ($conf["showdownloadsite"]) { echo "

Download

"; echo "

You like this calendar? You can download it here

"; } printFooter($lang["copyright"],true); } // here we call only main main(); ?>