AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 18.191.28.200


Current Path : /var/www/lhjmq-records.qc.ca/public_html/administration/op_calendriers/
Upload File :
Current File : /var/www/lhjmq-records.qc.ca/public_html/administration/op_calendriers/main.php

<?
//Modules information
$moduleclassid = "{6s11-5s7jms8}-(24takit-dfq7v05)";
$permission = 1;

//Load the standard includes
include('../includes/contants.php');
include("../includes/secur_isloggedin.php");
include("../includes/mysql_connect.php");
include("../includes/secur_accessverify.php");

//Load the components & libraries
include('../lib/common.php');
include('../lib/saisons.php');
include('../lib/calendar.php');

//Current season
$current_season = season_get_on_date_or_lower($mysql_link, date('Y-m-d'));
//Set the year from params
if(!isset($_GET['start_date'])){
	$_GET['start_date'] = date('Y-m-d');
}
//Validate the date
if(checkdate(substr($_GET['start_date'],5,2),substr($_GET['start_date'],8,2),substr($_GET['start_date'],0,4)) == false){
	$_GET['start_date'] = date('Y-m-d');
}
//Transform the date into a timestamp
$mdate = substr($_GET['start_date'],5,2);
$ddate = substr($_GET['start_date'],8,2);
$ydate = substr($_GET['start_date'],0,4);
$tstamp_start = mktime(0,0,0,$mdate,$ddate,$ydate);
$tstamp_end = mktime(0,0,0,$mdate+4,$ddate,$ydate);
$tstamp_pyear = mktime(0,0,0,$mdate,$ddate,$ydate-1);
$tstamp_nyear = mktime(0,0,0,$mdate,$ddate,$ydate+1);
$date_start = date('Y-m-d', $tstamp_start);
$date_end = date('Y-m-d', $tstamp_end);
//Build the calendar for a whole year
$istamp=$tstamp_start;
for($i=0;$i<=4;$i++){
	$span_date = date('Y-m-d', mktime(0,0,0,$mdate+$i,1,$ydate));
	$icaldates[] = array(
		'date' => $span_date,
		'showselection' => (str_pad($mdate+$i,2,'0',STR_PAD_LEFT) == date('m') ? true : false)
	);
}

//Build an alter span by getting the seasons for a certain date
$alterspans = array();
$legendtable = array();
$seasons = season_list($mysql_link, -1, 'ASC');
foreach($seasons as $key => $season){
	if($key != 'currentseason' && (
			($season['date_start'] >= $date_start && $season['date_start'] <= $date_end) || 
			($season['date_end'] >= $date_start && $season['date_end'] <= $date_end)
		)){
		//Create the calendar alter span
		if($season['actif'] == 1){
			switch($season['season_type']){
				case SEASON_TYPE_PRE:
					$alterspans[] = calendar_create_span($season['date_start'], $season['date_end'], 'calendar_alter_pre');
					break;
				case SEASON_TYPE_REG:
					$alterspans[] = calendar_create_span($season['date_start'], $season['date_end'], 'calendar_alter_reg');
					break;
				case SEASON_TYPE_PYF:
					$alterspans[] = calendar_create_span($season['date_start'], $season['date_end'], 'calendar_alter_pyf');
					break;
				case SEASON_TYPE_MCP:
					$alterspans[] = calendar_create_span($season['date_start'], $season['date_end'], 'calendar_alter_mcp');
					break;
			}
		}
		//Add this season to the legend of editable seasons
		$legendtable[] = $season;
	}
}

//Build the cellalter
$altercells = array();
foreach($icaldates as $icaldatekey => $icaldate){
	//Create a timestamp from the first item
	$tstamp_altercell_start = mktime(0,0,0,substr($icaldate['date'], 5, 2),substr($icaldate['date'], 8, 2),substr($icaldate['date'], 0, 4));
	$tstamp_altercell_end = mktime(0,0,0,substr($icaldate['date'], 5, 2)+1,substr($icaldate['date'], 8, 2)-1,substr($icaldate['date'], 0, 4));
	//Setup and loop min to max date
	$tstamp_get_matches=$tstamp_altercell_start;
	while($tstamp_get_matches<=$tstamp_altercell_end){
		//Save the date
		$altercell_dates[] = '"'.date('Y-m-d', $tstamp_get_matches).'"';
		//Augment the time
		$tstamp_get_matches = mktime(0,0,0,date('m', $tstamp_get_matches),date('d', $tstamp_get_matches)+1,date('Y', $tstamp_get_matches));
	}
}
$matches = mysql_query($sql='SELECT * FROM calendriers WHERE date_match IN ('.implode(', ',$altercell_dates).') ORDER BY date_match, heure_match', $mysql_link);
while($match = mysql_fetch_assoc($matches)){
	$altercells[$match['date_match']][] = '<A href="match_change.php?start_date='.$_GET['start_date'].'&id_calendrier='.$match['id_calendrier'].'" class="lnkBase11px">'.$match['abrev_vis'].' vs '.$match['abrev_dom'].' #'.$match['id_match'].'</A>';
}
?>
<HTML>
<HEAD>
<TITLE>Administration - www.lhjmq.qc.ca</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK rel="stylesheet" href="../css/base.css" type="text/css">
<LINK rel="stylesheet" href="../css/admintheme.css" type="text/css">
<LINK rel="stylesheet" href="../css/tablespecials.css" type="text/css">
<LINK href="../../css/links.css" rel="stylesheet" type="text/css">
<LINK href="../../css/table.css" rel="stylesheet" type="text/css">
<LINK href="../../css/tags.css" rel="stylesheet" type="text/css">
<LINK href="../../css/text.css" rel="stylesheet" type="text/css">
<STYLE>
.calendarbase {
	background-color: #ffffff;
	padding: 1px;
	text-align: right;
}
.headerbase {
	background-color: #546085;
	font-weight: bold;
	padding: 3px 3px 3px 3px;
}
.day_weekday {
	background-color: #ffffff;
	padding: 3px 3px 3px 3px;
}
.day_weekend {
	background-color: #E8E9F5;
	padding: 3px 3px 3px 3px;
}
.calendar_alter_pre_weekday { background-image: url('/administration/images/calendar/pre_season_cont_weekday.jpg'); }
.calendar_alter_reg_weekday { background-image: url('/administration/images/calendar/reg_season_cont_weekday.jpg'); }
.calendar_alter_pyf_weekday { background-image: url('/administration/images/calendar/pyf_season_cont_weekday.jpg'); }
.calendar_alter_mcp_weekday { background-image: url('/administration/images/calendar/mcp_season_cont_weekday.jpg'); }
.calendar_alter_otr_weekday { background-image: url('/administration/images/calendar/otr_season_cont_weekday.jpg'); }
.calendar_alter_pre_weekend { background-image: url('/administration/images/calendar/pre_season_cont_weekend.jpg'); }
.calendar_alter_reg_weekend { background-image: url('/administration/images/calendar/reg_season_cont_weekend.jpg'); }
.calendar_alter_pyf_weekend { background-image: url('/administration/images/calendar/pyf_season_cont_weekend.jpg'); }
.calendar_alter_mcp_weekend { background-image: url('/administration/images/calendar/mcp_season_cont_weekend.jpg'); }
.calendar_alter_otr_weekend { background-image: url('/administration/images/calendar/otr_season_cont_weekend.jpg'); }
</STYLE>
<SCRIPT language="javascript" type="text/javascript">
function url_confirm(msg, url){
	if(confirm(msg)==true){
		window.location = url;
	}
}
</SCRIPT>
</HEAD>
<BODY bgcolor="#BBBFCE" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> 
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> 
	<TR> 
		<TD background="../images/scoreboard_top.gif"><IMG src="../images/spacer.gif" width="1" height="11"></TD> 
	</TR> 
	<TR> 
		<TD bgcolor="#E8E9F5" align="center"> 
			<table width="100%" border="0" cellspacing="0" cellpadding="0"> 
				<tr> 
					<td rowspan="2" align="left" valign="middle" nowrap><strong><font size="+2">&nbsp;Calendrier des matchs </font></strong></td> 
					<td align="right" nowrap><span class="blackText10px"><a href="../session/session_menu.php?currentmenu=ops" class="lnkBase10px">Retour au menu principal</a></span></td> 
					<td width="50" align="right">&nbsp;</td> 
				</tr> 
				<tr> 
					<td align="right">&nbsp;</td> 
					<td>&nbsp;</td> 
				</tr> 
			</table> 
		</TD> 
	</TR> 
	<TR> 
		<TD background="../images/scoreboard_bottom.gif"><IMG src="../images/spacer.gif" width="1" height="10"></TD> 
	</TR> 
	<TR> 
		<TD><IMG src="../images/spacer.gif" width="1" height="4"></TD> 
	</TR> 
	<TR> 
		<TD>
			<?php if(isset($sysmsg)){ ?> 
			<TABLE width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="outlinetab"> 
				<TR> 
					<TD bgcolor="#546085"> 
						<TABLE border="0" cellpadding="0" cellspacing="0"> 
							<TR> 
								<TD width="8" bgcolor="#546085"><IMG src="../images/spacer.gif" width="8" height="1"></TD> 
								<TD height="15" nowrap bgcolor="#546085"><SPAN class="orangeText9px"><STRONG> Message du syst&egrave;me</STRONG></SPAN></TD> 
							</TR> 
						</TABLE> 
					</TD> 
				</TR> 
				<TR align="center"> 
					<TD align="left" bgcolor="#FFFFFF" class="blackText10px" style="padding: 5px"> 
						<table width="100%" cellpadding=1 cellspacing=1> 
							<tr> 
								<td align="left" nowrap class="blackText11px"><?php echo $sysmsg; ?></td> 
							</tr> 
						</table> 
					</TD> 
				</TR> 
				<TR> 
					<TD bgcolor="#FFFFFF"><IMG src="../images/spacer.gif" width="1" height="8"></TD> 
				</TR> 
			</TABLE>
			<?php } ?>
			<FORM action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="get" name="calendar" id="calendar">
				<TABLE width="100%"  border="0" cellspacing="0" cellpadding="0">
        	<TR>
        		<TD width="10">&nbsp;</TD>
        		<TD><TABLE width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="outlinetab">
            	<TR>
            		<TD bgcolor="#546085">
            			<TABLE border="0" cellpadding="0" cellspacing="0">
            				<TR>
            					<TD width="8" bgcolor="#546085"><IMG src="../images/spacer.gif" width="8" height="1"></TD>
            					<TD height="15" nowrap bgcolor="#546085"><SPAN class="orangeText9px"><STRONG> Options du calendrier</STRONG></SPAN></TD>
            					</TR>
            				</TABLE></TD>
            		</TR>
            	<TR align="center">
            		<TD align="left" bgcolor="#FFFFFF" class="blackText10px" style="padding: 5px">
            			<table width="100%" cellpadding=1 cellspacing=1>
            				<tr>
            					<td align="left" nowrap class="blackText11px"><A href="season_new.php?start_date=<?php echo date('Y-m-d', $tstamp_start); ?>"><IMG src="../images/icons/redo.gif" width="12" height="13" border="0" align="absbottom"></A> <A href="match_new.php?start_date=<?php echo date('Y-m-d', $tstamp_start); ?>" class="lnkBase11px"><B>Ajouter un match</B></A></td>
            					<td align="right" valign="top" nowrap class="blackText11px"><B>Afficher le calendrier d&eacute;butant &agrave;</B>
												<INPUT name="start_date" type="text" class="blackText12px" id="start_date" value="<?php echo date('Y-m-d', $tstamp_start); ?>" size="15" maxlength="10">
												<INPUT name="Submit" type="submit" class="blackText12px" value="Afficher"></td>
            					<td rowspan="3" align="right" valign="top" nowrap class="blackText11px">&nbsp;</td>
            				</tr>
            				<tr>
            					<td align="left" nowrap class="blackText11px"><A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-01-d'); ?>" class="lnkBase11px">&gt;Janvier&lt;</A>, <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-02-d'); ?>" class="lnkBase11px">&gt;F&eacute;vrier&lt;</A>, <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-03-d'); ?>" class="lnkBase11px">&gt;Mars&lt;</A>, <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-04-d'); ?>" class="lnkBase11px">&gt;Avril&lt;</A>, <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-05-d'); ?>" class="lnkBase11px">&gt;Mai&lt;</A>, <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-06-d'); ?>" class="lnkBase11px">&gt;Juin&lt;</A>, </td>
            					<td align="right" valign="top" nowrap class="blackText11px"> <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-m-d', $tstamp_pyear); ?>" class="lnkBase11px">&lt;&lt;&lt; Reculer </A> | <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-06-01', $tstamp_start); ?>" class="lnkBase11px">&gt;&gt; Saison &lt;</A>&lt; | <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-m-d', $tstamp_nyear); ?>" class="lnkBase11px">Avancer &gt;&gt;&gt;</A></td>
            					</tr>
            				<tr>
            					<td align="left" nowrap class="blackText11px"><A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-07-d'); ?>" class="lnkBase11px">&gt;Juillet&lt;</A>, <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-08-d'); ?>" class="lnkBase11px">&gt;Ao&ucirc;t&lt;</A>, <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-09-d'); ?>" class="lnkBase11px">&gt;Septembre&lt;</A>, <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-10-d'); ?>" class="lnkBase11px">&gt;Octobre&lt;</A>, <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-11-d'); ?>" class="lnkBase11px">&gt;Novembre&lt;</A>, <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-12-d'); ?>" class="lnkBase11px">&gt;D&eacute;cembre&lt;</A> </td>
            					<td align="right" valign="top" nowrap class="blackText11px"><A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.substr($current_season['date_start'], 0, 4).'-06-01'; ?>" class="lnkBase11px"> &gt;&gt; Saison en cours &lt;&lt;</A> | <A href="<?php echo $_SERVER['PHP_SELF'].'?start_date='.date('Y-m-d'); ?>" class="lnkBase11px">&gt;&gt; Aujourd'hui &lt;&lt;</A></td>
            					</tr>
            				</table></TD>
            		</TR>
            	<TR>
            		<TD bgcolor="#FFFFFF"><IMG src="../images/spacer.gif" width="1" height="8"></TD>
            		</TR>
            	</TABLE></TD>
        		<TD width="10">&nbsp;</TD>
       		</TR>
        	<TR>
        		<TD>&nbsp;</TD>
        		<TD>&nbsp;</TD>
        		<TD>&nbsp;</TD>
       		</TR>
        	<TR>
        		<TD>&nbsp;</TD>
        		<TD>
							<TABLE cellpadding="0" cellspacing="0" border="0" width="100%">
								<TR>
									<TD align="left" valign="top">
										<?php 
										$caldate = $icaldates[0];
										echo calendar_make_month($caldate['date'], $caldate['showselection'], 'calendarbase blackText12px', 'headerbase orangeText12px', 'day_weekday', 'day_weekend', $alterspans, $_SERVER['PHP_SELF'].'?start_date=', $altercells);
										?>
									</TD>
									<TD width="10">&nbsp;</TD>
									<TD width="200" valign="top">
										<TABLE width="100%"  border="0" cellspacing="0" cellpadding="0">
											<?php 
											$cidx=0;
											for($icaldate=1; $icaldate<count($icaldates); $icaldate++){
												$caldate = $icaldates[$icaldate];
												?><TR><TD><?php 
												echo calendar_make_month($caldate['date'], $caldate['showselection'], 'calendarbase blackText12px', 'headerbase orangeText12px', 'day_weekday', 'day_weekend', $alterspans, $_SERVER['PHP_SELF'].'?start_date=');
												?></TD></TR><TR><TD colspan="2">&nbsp;</TD></TR><?php
											} 
											?>
										</TABLE>
									</TD>
								</TR>
							</TABLE>
						</TD>
        		<TD>&nbsp;</TD>
       		</TR>
        	<TR>
        		<TD>&nbsp;</TD>
        		<TD>&nbsp;</TD>
        		<TD>&nbsp;</TD>
       		</TR>
				</TABLE>
			</FORM>
		  <P>&nbsp;</P>
		</TD> 
	</TR> 
</TABLE> 
</BODY>
</HTML>
<?
//Load the standard includes footers
include("../includes/mysql_cleanup.php");
?>