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



Your IP : 3.149.243.29


Current Path : /var/www/lhjmq-records.qc.ca/public_html/xsl/functions/
Upload File :
Current File : /var/www/lhjmq-records.qc.ca/public_html/xsl/functions/functions.php

<?php

	// 20140210 simon: Load db config from includes/mysql_server_setup.php

	include("includes/mysql_server_setup.php");

	function team_get_data2($mysql_link, $id_equipe, $ondate) {
		if (is_array($id_equipe) && count($id_equipe) > 0) {
			$res = mysql_query($sql = 'SELECT * FROM equipes_hist AS eh WHERE hist_parent IN ('.implode(', ', $id_equipe).') AND sys_date <= "'.$ondate.'" and id <> 100 AND id <> 98 AND id <> 99 ORDER BY eh.sys_date asc, eh.id asc', $mysql_link);
		} else {
			$res = mysql_query($sql = 'SELECT * FROM equipes_hist AS eh WHERE hist_parent = "'.$id_equipe.'" AND sys_date <= "'.$ondate.'" and id <> 100 AND id <> 98 AND id <> 99 ORDER BY eh.sys_date asc, eh.id asc', $mysql_link);
			//SELECT * FROM equipes_hist AS eh WHERE hist_parent = "15" AND sys_date <= "2006-06-27" ORDER BY eh.sys_date, eh.id
			//echo $sql;
		}
	
		global $appSettings;
		if (isset($appSettings)) {
			$appSettings->logInfo( 'team_get_data(' . $id_equipe . ', \'' . $ondate . '\') [' . $sql . ']');
		}
	
		$data = $ids = array();
		while ($row = mysql_fetch_assoc($res)) {
			$data[$row['hist_parent']] = $row;
			if ($row['hist_arena'] > 0) {  $ids[] = $row['hist_arena']; }
		}
		$arenas = arena_get_data2($mysql_link, $ids);
		foreach ($data as $row) {
			$data[$row['hist_parent']]['sys_arena_data'] = $arenas[$row['hist_arena']];
		}
		return $data;
	}
	
	
	function arena_get_data2($mysql_link, $id_arena){
		if(is_array($id_arena) && count($id_arena) > 0){
			$res = mysql_query('SELECT * FROM arenas AS a WHERE id_arena IN ('.implode(', ', $id_arena).')', $mysql_link);
		}else{
			$res = mysql_query('SELECT * FROM arenas AS a WHERE id_arena = "'.$id_arena.'"', $mysql_link);
		}
		$data = array();
		while($row = mysql_fetch_assoc($res)){
			$data[$row['id_arena']] = $row;
		}
		return $data;
	}


	function get_team_logo_template_vis($mysql_link,$id_partie)
	{

		$partie = mysql_fetch_assoc(mysql_query("SELECT parties.*, c.id_calendrier, c.id_saison, c.id_arena, c.nom_arena, s.date_start AS seasonstart, s.season_type FROM parties LEFT JOIN calendriers AS c USING(id_calendrier) LEFT JOIN seasons AS s ON c.id_saison = s.id WHERE id_partie = $id_partie", $mysql_link));
		$idVis = $partie[id_equipe_vis];
		$equipe_vis = team_get_data2($mysql_link, $idVis, $partie['date_match']);
		return $equipe_vis[$idVis]['hist_pic56x62'];
	}



	function get_team_logo_template_dom($mysql_link,$id_partie)
	{
		$partie = mysql_fetch_assoc(mysql_query("SELECT parties.*, c.id_calendrier, c.id_saison, c.id_arena, c.nom_arena, s.date_start AS seasonstart, s.season_type FROM parties LEFT JOIN calendriers AS c USING(id_calendrier) LEFT JOIN seasons AS s ON c.id_saison = s.id WHERE id_partie = $id_partie", $mysql_link));
		//echo "SELECT parties.*, c.id_calendrier, c.id_saison, c.id_arena, c.nom_arena, s.date_start AS seasonstart, s.season_type FROM parties LEFT JOIN calendriers AS c USING(id_calendrier) LEFT JOIN seasons AS s ON c.id_saison = s.id WHERE id_partie = $id_partie";
		$idDom = $partie[id_equipe_dom];
		
		$equipe_dom = team_get_data2($mysql_link, $idDom, $partie['date_match']);
		return $equipe_dom[$idDom]['hist_pic56x62'];
	}
	
	
	

	
	
?>