if (isset($_GET['strLang'])) { if ($_GET['strLang'] != '') { $_SESSION['strLangue'] = strtoupper($_GET['strLang']); setcookie('strLang', $_SESSION['strLangue'], time()+60*60*24*365); } } if ($_SESSION['strLangue'] == '') { if (isset($_COOKIE['strLang'])) $_SESSION['strLangue'] = strtoupper(trim($_COOKIE['strLang'])); else { $rsIfLangExist = ''; $strBufLng = ''; $strBufLng = strtoupper(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)); $rsIfLangExist = $objConnMySQLCA->Execute("SELECT * FROM scm_langues WHERE NAPublic = 0 AND CodeLangue = '" . $strBufLng . "'"); if ($rsIfLangExist->EOF == true) $_SESSION['strLangue'] = CstrDefaultLanguage; else $_SESSION['strLangue'] = $strBufLng; } } $bPagePreviewBeforeSave = false; if (isset($_GET['bpagepreview'])) { if ($_GET['bpagepreview'] == '1') $bPagePreviewBeforeSave = true; } /********* Récupère les traductions de texte (contenu de page au format HTML, longs textes) *********/ function GetContent($strCodeText) { $strSQLContent = ''; $rsContent = ''; $strReturn = ''; $bNA = 0; global $objConnMySQLCA; global $bPagePreviewBeforeSave; if ($bPagePreviewBeforeSave == true) { if (isset($_POST['cbContentNA_' . $strCodeText . '_' . $_SESSION['strLangue']])) $bNA = 0; else $bNA = 1; if ($bNA == 0 && isset($_POST['txtContent_' . $strCodeText . '_' . $_SESSION['strLangue']])) $strReturn = stripslashes($_POST['txtContent_' . $strCodeText . '_' . $_SESSION['strLangue']]); else $strReturn = ''; } else { $strSQLContent = ''; $strSQLContent .= 'SELECT Content FROM scm_contenttexts t INNER JOIN scm_pages p '; $strSQLContent .= 'ON t.IDPage = p.IDPage '; $strSQLContent .= "WHERE NonActif = 0 AND UCASE(t.CodeLangue) = '" . strtoupper($_SESSION['strLangue']) . "' "; $strSQLContent .= "AND UCASE(p.PageName) = '" . fctSQLSlashes(strtoupper(CstrCurrentPageName)) . "' "; $strSQLContent .= "AND t.CodeText = '" . fctSQLSlashes($strCodeText) . "' "; $rsContent = $objConnMySQLCA->Execute($strSQLContent); if ($rsContent != false) $strReturn = $rsContent->fields['Content']; else $strReturn = ''; } return $strReturn; } /********* Récupère les traductions de messages d'informations ou d'erreurs *********/ function GetMessage($strCodeMessage) { $strSQLMessage = ''; $rsMessage = ''; $strReturn = ''; global $objConnMySQLCA; $strSQLMessage = ''; $strSQLMessage .= 'SELECT Message FROM scm_transmessages '; $strSQLMessage .= "WHERE UCASE(CodeLangue) = '" . strtoupper($_SESSION['strLangue']) . "' "; $strSQLMessage .= "AND CodeMessage = '" . fctSQLSlashes($strCodeMessage) . "' "; $rsMessage = $objConnMySQLCA->Execute($strSQLMessage); if ($rsMessage != false) $strReturn = $rsMessage->fields['Message']; else $strReturn = ''; return $strReturn; } /********* Récupère les traductions de libellé (textes succincts) *********/ function Label($strLabel) { $strSQLLabel = ''; $rsLabel = ''; $strReturn = ''; global $objConnMySQLCA; $strSQLLabel = ''; $strSQLLabel .= 'SELECT Label FROM scm_translabels '; $strSQLLabel .= "WHERE UCASE(CodeLangue) = '" . strtoupper($_SESSION['strLangue']) . "' "; $strSQLLabel .= "AND CodeLabel = '" . fctSQLSlashes($strLabel) . "' "; $rsLabel = $objConnMySQLCA->Execute($strSQLLabel); if ($rsLabel != false) { if ($rsLabel->fields['Label'] != '') $strReturn = $rsLabel->fields['Label']; else $strReturn = $strLabel; } else $strReturn = $strLabel; return $strReturn; } /********* Récupère le texte de référencement de la page en cours et l'affiche dans le tag TITLE *********/ function GetTitle() { $strSQLTitle = ''; $rsTitle = ''; $strReturn = ''; global $objConnMySQLCA; $strSQLTitle = ''; $strSQLTitle .= 'SELECT PageReference FROM scm_pages '; $strSQLTitle .= "WHERE UCASE(CodeLangue) = '" . strtoupper($_SESSION['strLangue']) . "' "; $strSQLTitle .= "AND UCASE(PageName) = '" . fctSQLSlashes(strtoupper(CstrCurrentPageName)) . "'"; $rsTitle = $objConnMySQLCA->Execute($strSQLTitle); if ($rsTitle != false) $strReturn = $rsTitle->fields['PageReference']; else $strReturn = ''; return $strReturn; } /********* Récupère les images pour une page *********/ function GetImage($strCodeImage) { $strSQLImage = ''; $rsImage = ''; $strReturn = ''; global $objConnMySQLCA; $strSQLImage = ''; $strSQLImage .= 'SELECT Image FROM scm_contentimages t INNER JOIN scm_pages p '; $strSQLImage .= 'ON t.IDPage = p.IDPage '; $strSQLImage .= "WHERE NonActif = 0 AND UCASE(t.CodeLangue) = '" . strtoupper($_SESSION['strLangue']) . "' "; $strSQLImage .= "AND UCASE(p.PageName) = '" . fctSQLSlashes(strtoupper(CstrCurrentPageName)) . "' "; $strSQLImage .= "AND t.CodeImage = '" . fctSQLSlashes($strCodeImage) . "' "; $rsImage = $objConnMySQLCA->Execute($strSQLImage); if ($rsImage != false) $strReturn = $rsImage->fields['Image']; else $strReturn = ''; return $strReturn; } /********* Récupère les traductions de texte (contenu de page au format HTML, longs textes) *********/ function GetFooterText($strCodeText) { $strSQLContent = ''; $rsContent = ''; $strReturn = ''; global $objConnMySQLCA; global $bPagePreviewBeforeSave; if ($bPagePreviewBeforeSave == true) { if (isset($_POST['txtContent_' . $strCodeText . '_' . $_SESSION['strLangue']])) $strReturn = stripslashes($_POST['txtContent_' . $strCodeText . '_' . $_SESSION['strLangue']]); else $strReturn = ''; } else { $strSQLContent = ''; $strSQLContent .= 'SELECT Content FROM scm_footer_texts '; $strSQLContent .= "WHERE UCASE(CodeLangue) = '" . strtoupper($_SESSION['strLangue']) . "' "; $strSQLContent .= "AND CodeText = '" . fctSQLSlashes($strCodeText) . "' "; $rsContent = $objConnMySQLCA->Execute($strSQLContent); if ($rsContent != false) $strReturn = $rsContent->fields['Content']; else $strReturn = ''; } return $strReturn; } ?> //------------------------------------------------------------------- // Description : Page Agenda // Author : GR Development //------------------------------------------------------------------- //------Liste des variables-------- $strSQL = ''; $strSQLCondition = ''; $rsAct = ''; $strClass = ''; $dSelectedMonth = 0; $dSelectedYear = 0; $strAgendaSelect = ''; $bIsFirstVisit = 0; // Pour définir s'il s'agit de la 1ère visite de la page $bIsDate = 0; // Pour filtrer les activités/événements programmés uniquement (qui contiennent des dates) if (isset($_GET['m'])) $dSelectedMonth = $_GET['m']; elseif (isset($_POST['hidMonth'])) $dSelectedMonth = $_POST['hidMonth']; if (isset($_GET['y'])) $dSelectedYear = $_GET['y']; elseif (isset($_POST['hidYear'])) $dSelectedYear = $_POST['hidYear']; if (isset($_POST['hidIsDate'])) $bIsDate = $_POST['hidIsDate']; if ($bIsDate == '') $bIsDate = 0; $strSQL = 'SELECT act.IDActivite, act.Activite' . $_SESSION['strLangue'] . ' AS Activite, SubTitle' . $_SESSION['strLangue'] . ' AS SubTitle, '; $strSQL .= 'act.Lieu' . $_SESSION['strLangue'] . ' AS Lieu, '; $strSQL .= 'act.Introduction' . $_SESSION['strLangue'] . ' AS Intro, act.Description' . $_SESSION['strLangue'] . ' AS Description, '; $strSQL .= 'cat.IDCategorie, Categorie' . $_SESSION['strLangue'] . ' AS Categorie, Groupe' . $_SESSION['strLangue'] . ' AS Groupe, g.Page AS PageTo, '; $strSQL .= '(SELECT Image FROM scm_images i INNER JOIN scm_rel_act_images ri ON i.IDImage = ri.IDImage WHERE ri.IDActivite = act.IDActivite AND i.NonActif = 0 ORDER BY ri.Ordre LIMIT 1) as Photo, '; $strSQL .= "COALESCE(dDateDebut,COALESCE(dDate1,'')) AS DateDebut, DATE_FORMAT(dDateDebut,'%d') AS dDayDebut, MONTH(dDateDebut) AS dMonthDebut, DATE_FORMAT(dDateDebut,'%Y') AS dYearDebut, "; $strSQL .= "COALESCE(dDateFin,'') AS DateFin, DATE_FORMAT(dDateFin,'%d') AS dDayFin, MONTH(dDateFin) AS dMonthFin, DATE_FORMAT(dDateFin,'%Y') AS dYearFin, "; $strSQL .= 'bSeparateDates, '; $strSQL .= "COALESCE(dDate1,'') AS Date1, DATE_FORMAT(dDate1,'%d') AS dDay1, MONTH(dDate1) AS dMonth1, DATE_FORMAT(dDate1,'%Y') AS dYear1, "; $strSQL .= "COALESCE(dDate2,'') AS Date2, DATE_FORMAT(dDate2,'%d') AS dDay2, MONTH(dDate2) AS dMonth2, DATE_FORMAT(dDate2,'%Y') AS dYear2, "; $strSQL .= "COALESCE(dDate3,'') AS Date3, DATE_FORMAT(dDate3,'%d') AS dDay3, MONTH(dDate3) AS dMonth3, DATE_FORMAT(dDate3,'%Y') AS dYear3, "; $strSQL .= "COALESCE(dDate4,'') AS Date4, DATE_FORMAT(dDate4,'%d') AS dDay4, MONTH(dDate4) AS dMonth4, DATE_FORMAT(dDate4,'%Y') AS dYear4, "; $strSQL .= "COALESCE(dDate5,'') AS Date5, DATE_FORMAT(dDate5,'%d') AS dDay5, MONTH(dDate5) AS dMonth5, DATE_FORMAT(dDate5,'%Y') AS dYear5 "; $strSQL .= 'FROM scm_activites act LEFT OUTER JOIN scm_rel_act_categories rel ON act.IDActivite = rel.IDActivite '; $strSQL .= 'LEFT OUTER JOIN scm_act_categories cat ON rel.IDCategorie = cat.IDCategorie '; //$strSQL .= 'LEFT OUTER JOIN scm_rel_act_catgroupes rcg ON cat.IDCategorie = rcg.IDCategorie '; $strSQL .= 'LEFT OUTER JOIN scm_rel_act_catgroupes rcg ON (cat.IDCategorie = rcg.IDCategorie OR cat.IDParent = rcg.IDCategorie) '; $strSQL .= 'LEFT OUTER JOIN scm_act_groupes g ON g.IDGroupe = rcg.IDGroupe '; $strSQL .= 'WHERE act.IDActivite > 0 '; if($dSelectedMonth == 0 && $dSelectedYear == 0 && $bIsDate == 0) { // 1st visit on the page $bIsFirstVisit = 1; $strAgendaSelect = ''; $dSelectedMonth = intval(date('m')); $dSelectedYear = intval(date('Y')); $strSQLCondition .= 'AND (MONTH(dDateDebut) = ' . $dSelectedMonth . ' OR MONTH(dDate1) = ' . $dSelectedMonth . ' OR MONTH(dDateFin) = ' . $dSelectedMonth . ') '; $strSQLCondition .= 'AND (YEAR(dDateDebut) = ' . $dSelectedYear . ' OR YEAR(dDate1) = ' . $dSelectedYear . ' OR YEAR(dDateFin) = ' . $dSelectedYear . ') '; } else { if($bIsDate == 0) // Si on veut voir un mois ou une année en particulier { if($dSelectedMonth > 0) { $strSQLCondition .= 'AND (MONTH(dDateDebut) = ' . $dSelectedMonth . ' OR MONTH(dDate1) = ' . $dSelectedMonth . ' OR MONTH(dDateFin) = ' . $dSelectedMonth . ') '; $strAgendaSelect .= ' - ' . fctTranslateFullMonth($dSelectedMonth); if($dSelectedYear > 0) $strAgendaSelect .= ' ' . $dSelectedYear; } else if($dSelectedYear > 0) $strAgendaSelect .= ' - ' . $dSelectedYear; if($dSelectedYear > 0) $strSQLCondition .= 'AND (YEAR(dDateDebut) = ' . $dSelectedYear . ' OR YEAR(dDate1) = ' . $dSelectedYear . ' OR YEAR(dDateFin) = ' . $dSelectedYear . ') '; } } $strSQLCondition .= "AND ((dDateDebut IS NULL AND (dDate1 <> '0000-00-00' AND dDate1 >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) OR (dDate1 IS NULL AND (dDateDebut <> '0000-00-00' AND dDateDebut >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) OR (dDateFin <> '0000-00-00' AND dDateFin >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) "; $strSQLCondition .= 'AND act.NonActif = 0 AND cat.NonActif = 0 '; $strSQLCondition .= 'ORDER BY dDateDebut, rel.Ordre, Activite'; $rsAct = $objConnMySQLCA->Execute($strSQL . $strSQLCondition); if (is_object($rsAct)){ if($rsAct->EOF == true && $bIsFirstVisit == 1) $rsAct = fctGoToNextMonth($rsAct, 1); } /*******************************************************************************/ function fctGoToNextMonth($rsAct, $iNbBoucles) { $iNbBoucles ++; global $bIsFirstVisit; global $dSelectedMonth; global $dSelectedYear; global $objConnMySQLCA; global $strSQL; global $rsAct; if($rsAct->EOF == true && $bIsFirstVisit == 1) { if($dSelectedMonth < 12) $dSelectedMonth = $dSelectedMonth + 1; else { $dSelectedMonth = 1; $dSelectedYear = $dSelectedYear + 1; } $strSQLCondition = ''; $strSQLCondition .= 'AND MONTH(dDateDebut) = ' . $dSelectedMonth . ' '; $strSQLCondition .= 'AND YEAR(dDateDebut) = ' . $dSelectedYear . ' '; $strSQLCondition .= "AND ((dDateDebut <> '0000-00-00' && dDateDebut >= DATE_FORMAT(NOW(), '%Y/%m/%d')) OR (dDateFin <> '0000-00-00' && dDateFin >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) "; $strSQLCondition .= 'AND act.NonActif = 0 AND cat.NonActif = 0 '; $strSQLCondition .= 'ORDER BY dDateDebut ASC'; $rsAct = $objConnMySQLCA->Execute($strSQL . $strSQLCondition); if (is_object($rsAct)){ if($rsAct->EOF == true && $bIsFirstVisit == 1 && $iNbBoucles < 13) { fctGoToNextMonth($rsAct, $iNbBoucles); } elseif($dSelectedMonth < 2) $dSelectedYear --; // condition à mettre sinon bug en janvier et recul d'un an dans les filtres (17-01-19) } } return $rsAct; } ?>
$strSQLInfo = ''; $rsTitlePage = ''; $rsImageBanner = ''; $strTitlePage = ''; $strDescriptionPage = ''; if(CstrCurrentPageName != 'index.php') $strImageBackground = 'url(Images/Background/Pages/' . CstrBGDefaultImg . ') no-repeat center fixed'; /*******************************************************/ $strSQLInfo = ''; $strSQLInfo .= "SELECT MetaTitle" . strtoupper($_SESSION['strLangue']) . " AS MetaTitle, MetaDescription" . strtoupper($_SESSION['strLangue']) . " AS MetaDesc, COALESCE(img.Image,'') AS Image "; $strSQLInfo .= "FROM scm_pages pg "; $strSQLInfo .= "LEFT OUTER JOIN (SELECT IDPage, Image FROM scm_images i INNER JOIN scm_rel_pages_images ri ON i.IDImage = ri.IDImage WHERE ri.IDPage = IDPage AND i.NonActif = 0 AND ri.Ordre = 1) AS img ON pg.IDPage = img.IDPage "; $strSQLInfo .= "WHERE UCASE(PageName) = '" . strtoupper(CstrCurrentPageName) . "'"; $rsTitlePage = $objConnMySQLCA->Execute($strSQLInfo); if ($rsTitlePage->EOF != true) { $strTitlePage = $rsTitlePage->fields['MetaTitle']; $strDescriptionPage = $rsTitlePage->fields['MetaDesc']; if($rsTitlePage->fields['Image'] != '' && CstrCurrentPageName != 'index.php') $strImageBackground = 'url(Images/Background/Pages/' . $rsTitlePage->fields['Image'] . ') no-repeat center fixed'; } else $strTitlePage = CstrTitlePage; ?>