END; } function print_calendar_menu() { global $me, $user, $menu, $puser, $pcardid; $is_player_user = 0; if (isset($puser)) if ($puser != "") $is_player_user = 1; if (isset($user)) $home_url = "javascript:document.forms['form1'].submit()"; else $home_url = "http://www.hbf.gr"; if ($is_player_user) { $logout_url = "javascript:document.forms['form1'].menu.value='$menu';document.forms['form1'].action.value='player_logout';document.forms['form1'].submit()"; $login_menu = " ΕΞΟΔΟΣ |"; } else { $login_url = "javascript:document.forms['form1'].menu.value='player_login';document.forms['form1'].submit()"; $login_menu = " ΕΙΣΟΔΟΣ |"; } if ($menu == "apotel_sum") { $apotel_url = "javascript:document.forms['form1'].menu.value='apotel';document.forms['form1'].submit()"; $apotel_menu = " ΑΠΟΤΕΛΕΣΜΑΤΑ |"; } else { $apotel_url = "javascript:document.forms['form1'].menu.value='apotel_sum';document.forms['form1'].submit()"; $apotel_menu = " ΣΥΝΟΛΙΚΑ ΑΠΟΤΕΛΕΣΜΑΤΑ |"; } print <<


ΑΡΧΙΚΗ | ΠΡΟΚΗΡΥΞΕΙΣ | $apotel_menu ΒΟΗΘΕΙΑ | $login_menu


END; } function get_tourn() { global $CFG; $result = array(); $dbid = mysql_connect($CFG->dbhost, $CFG->dbuser, $CFG->dbpass); if (! $dbid) exit("mysql_connect() failed!"); if (! mysql_select_db($CFG->dbname, $dbid)) { mysql_close($dbid); exit("mysql_select_db($CFG->dbname) failed!"); } mysql_query("set names greek"); $qry = "select * from " . $CFG->t_tournaments . " order by StartDate"; $res = mysql_query($qry); if (! $res) exit("[$qry] query failed !"); $i = 0; while ($row = mysql_fetch_array($res)) { $result[$i]['ID'] = $row["ID"]; $result[$i]['Name'] = $row["Name"]; $result[$i]['StartDate'] = $row["StartDate"]; $result[$i]['EndDate'] = $row["EndDate"]; $result[$i]['City'] = $row["City"]; $result[$i]['BowlingCentre'] = $row["BowlingCentre"]; $result[$i]['RegStart'] = $row["RegStart"]; $result[$i]['RegEnd'] = $row["RegEnd"]; $result[$i]['EndDate'] = $row["EndDate"]; $result[$i]['energo'] = $row["energo"]; $i++; } mysql_free_result($res); mysql_close($dbid); return $result; } function print_calendar_body() { global $me; include_once("dbtools.php"); $max_tourns = 105; $tourns = get_tourn(); $fin_tourns = get_tournaments_with_results2(); print <<
 Αγωνιστικό Πρόγραμμα 2015-2016
END; for ($i=0; $i<$max_tourns; $i++) { if ($i < count($tourns)) { $id = $tourns[$i]["ID"]; $tname = $tourns[$i]['Name']; $dd1 = $tourns[$i]['StartDate']; $d1 = formatDate1($dd1); $dd2 = $tourns[$i]['EndDate']; $d2 = formatDate1($dd2); $city = $tourns[$i]['City']; $center = $tourns[$i]['BowlingCentre']; $rd1 = $tourns[$i]['RegStart']; $rd2 = $tourns[$i]['RegEnd']; $dt = date("Y-m-d H:i:s"); $dd = date("Y-m-d"); $energo = $tourns[$i]['energo']; if (!strstr($rd1, "0000-00-00")) $dd1 = substr($rd1, 0, 10); $has_result = 0; $found = 0; print << END; } else print << END; } print <<
Ημερομηνία Διοργάνωση Πόλη Αίθουσα Ενεργό
$d1 - $d2 $tname $city $center $energo
         
END; } function print_calendar_footer() { print << 

END; } include_once("globals.php"); $me = $_SERVER['PHP_SELF']; if (strstr($me, "calendar.php")) $me = str_replace("calendar.php", "index.php", $me); if (!isset($menu)) $menu = "calendar"; print_calendar_header(); print_calendar_menu(); print_calendar_body(); print_calendar_footer(); ?>