Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64
Your IP : 3.23.103.203
<?php
//Display flags
define("SEASON_COMMON_FLAG_DISPLAY_ONE_LINE", 1);
define("SEASON_COMMON_FLAG_DISPLAY_TWO_LINE", 2);
define("SEASON_COMMON_FLAG_DISPLAY_MULTI_LINE", 3);
//Data flags
define("SEASON_COMMON_FLAG_DISPLAY_DATE_FLAG", 128);
define("SEASON_COMMON_FLAG_DISPLAY_ACTIVE_FLAG", 256);
/*Uses a season array to display a diggest of season information*/
function season_display(&$season_array, $lang = "fr", $flags = SEASON_COMMON_FLAG_DISPLAY_ONE_LINE){
//Check the langs
if($lang != "fr" && $lang != "en"){
$lang = "fr";
}
//Check the display flags
if(($flags & SEASON_COMMON_FLAG_DISPLAY_ONE_LINE) == SEASON_COMMON_FLAG_DISPLAY_ONE_LINE){
//Default
$data = $season_array["description_" . $lang];
//Show dates?
if(($flags & SEASON_COMMON_FLAG_DISPLAY_DATE_FLAG) == SEASON_COMMON_FLAG_DISPLAY_DATE_FLAG){
$data .= " (" . $season_array["annee_debut"] . " - " . $season_array["annee_fin"] . ")";
}
//Show active?
if(($flags & SEASON_COMMON_FLAG_DISPLAY_ACTIVE_FLAG) == SEASON_COMMON_FLAG_DISPLAY_ACTIVE_FLAG){
$data .= " [" . ($season_array["actif"] == 1 ? ($lang == "fr" ? "Saison en cours" : "Current season") : ($lang == "fr" ? "Saison inactive" : "Inactive season")) . "]";
}
}else{
$data = "";
}
//Return
return $data;
}
/*Returns an assoc array of the current season*/
function &season_get_current(&$db){
if(is_object($db)){
return mysql_fetch_assoc($db->send_result_sql("SELECT * FROM saisons WHERE actif = 1"));
}else{
return mysql_fetch_assoc(mysql_query("SELECT * FROM saisons WHERE actif = 1", $db));
}
}
/*Returns an assoc array of the current season*/
function &season_get(&$db, $id_saison){
if(is_object($db)){
return mysql_fetch_assoc($db->send_result_sql("SELECT * FROM saisons WHERE id_saison = " . $id_saison));
}else{
return mysql_fetch_assoc(mysql_query("SELECT * FROM saisons WHERE id_saison = " . $id_saison, $db));
}
}
?>
|