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 Projets
// Author : GR Development
//-------------------------------------------------------------------
//------Liste des variables--------
$strSQL = '';
$rsAct = '';
$rsDetail = '';
$rsFilter = '';
$rsFilter1 = '';
$rsTemp = '';
$rsImages = '';
$rsVideos = '';
$strSpan = '';
$iIDGroupe = 0;
$iIDCat = 0;
$iIDTheme = 0;
$iIDAct = 0;
$bIsDate = 0; // Pour filtrer les projets qui contiennent des dates uniquement
$strActTitle = Label("Nos projets");
$strPathImg = CstrURLGen . '/Images/Activites/';
$strContentText = '';
$strContentText2 = '';
$strInclude = '';
$bIsFirstVisit = 0; // Pour définir s'il s'agit de la 1ère visite de la page
$strSloganPage = ''; // Titre, slogan de la page
$strIntroPage = ''; // Petit texte d'intro sous le slogan
$strTitlePageComplement = '';
$strDescriptionPageComplement = '';
//---------------------------------
if (isset($_GET['iIDGroupe'])) $iIDGroupe = $_GET['iIDGroupe'];
elseif (isset($_POST['hidGroupe'])) $iIDGroupe = $_POST['hidGroupe'];
if ($iIDGroupe == '') $iIDGroupe = 0;
/*if (isset($_GET['c'])) {$strCat = $_GET['c'];
$iIDCat=2;}
else */
if (isset($_GET['idc'])) $iIDCat = $_GET['idc'];
elseif (isset($_POST['hidCat'])) $iIDCat = $_POST['hidCat'];
if ($iIDCat == '') $iIDCat = 0;
if (isset($_GET['idt'])) $iIDTheme = $_GET['idt'];
elseif (isset($_POST['hidTheme'])) $iIDTheme = $_POST['hidTheme'];
if ($iIDTheme == '') $iIDTheme = 0;
if (isset($_GET['ida'])) $iIDAct = $_GET['ida'];
elseif (isset($_POST['hidAct'])) $iIDAct = $_POST['hidAct'];
if ($iIDAct == '') $iIDAct = 0;
if (isset($_GET['bIsDate'])) $bIsDate = $_GET['bIsDate'];
elseif (isset($_POST['hidIsDate'])) $bIsDate = $_POST['hidIsDate'];
if ($bIsDate == '') $bIsDate = 0;
/**************************************************************************************************************/
function fctGetSubCategories($iIDCategory)
{
$strReturn = '';
$strSQL = '';
$rsSQL = '';
global $objConnMySQLCA;
$strSQL = '';
$strSQL .= 'SELECT IDCategorie FROM scm_act_categories ';
$strSQL .= 'WHERE IDParent = ' . intval($iIDCategory) . ' AND NonActif = 0 ';
$strSQL .= 'ORDER BY Ordre ';
$rsSQL = $objConnMySQLCA->Execute($strSQL);
while ($rsSQL->EOF != true)
{
$strReturn .= $rsSQL->fields['IDCategorie'] . ',';
$strReturn .= fctGetSubCategories($rsSQL->fields['IDCategorie']);
$rsSQL->MoveNext();
}
return $strReturn;
}
/**************************************************************************************************************/
$strSQL = '';
$strSQL .= "SELECT IDGroupe, Groupe" . $_SESSION['strLangue'] . " AS Groupe, ";
$strSQL .= "Slogan" . $_SESSION['strLangue'] . " AS Slogan, ";
$strSQL .= "COALESCE(IF(MetaTitle" . $_SESSION['strLangue'] . "='',NULL,MetaTitle" . $_SESSION['strLangue'] . "), Groupe" . $_SESSION['strLangue'] . ") AS MetaTitle, ";
$strSQL .= "COALESCE(IF(MetaDesc" . $_SESSION['strLangue'] . "='',NULL,MetaDesc" . $_SESSION['strLangue'] . "), Description" . $_SESSION['strLangue'] . ") AS MetaDesc ";
$strSQL .= 'FROM scm_act_groupes ';
if($iIDGroupe == 0) $strSQL .= "WHERE Page = '" . CstrCurrentPageName . "'";
else $strSQL .= 'WHERE IDGroupe = ' . $iIDGroupe;
$rsGroupe = $objConnMySQLCA->Execute($strSQL);
if($rsGroupe->EOF != true){
if($iIDGroupe == 0) $iIDGroupe = $rsGroupe->fields['IDGroupe'];
if($rsGroupe->fields['Slogan'] != '') $strSloganPage = $rsGroupe->fields['Slogan'];
if($rsGroupe->fields['Groupe'] != '') {
$strSpan = str_replace(" ","-",strtolower($rsGroupe->fields['Groupe'])); /* Pour highlight menu */
$strActTitle = $rsGroupe->fields['Groupe']; /* Pour titre principal si aucune catégorie sélectionnée */
}
// Référencement
if($rsGroupe->fields['MetaTitle'] != '') $strTitlePageComplement = $rsGroupe->fields['MetaTitle'];
if($rsGroupe->fields['MetaDesc'] != '') $strDescriptionPageComplement = html_entity_decode(strip_tags($rsGroupe->fields['MetaDesc']),ENT_QUOTES,'UTF-8');
}
if($iIDCat == 0 && $bIsDate == 0){
$bIsFirstVisit = 1; // 1ère visite de la page pour affichage du titre simplifié (on n'affiche pas la catégorie)
// Check si une catégorie doit être affichée par défaut au chargement de la page
$strSQL = '';
$rsDefaultCat = '';
$strSQL .= "SELECT cat.IDCategorie ";
$strSQL .= 'FROM scm_act_categories cat LEFT JOIN scm_rel_act_catgroupes rel ON cat.IDCategorie = rel.IDCategorie ';
$strSQL .= 'WHERE rel.IDGroupe = ' . intval($iIDGroupe) . ' AND cat.NonActif = 0 ';
$strSQL .= 'AND rel.bDefaultSelected = 1';
$rsDefaultCat = $objConnMySQLCA->Execute($strSQL);
if(is_object($rsDefaultCat)){
if($rsDefaultCat->EOF != true) $iIDCat = $rsDefaultCat->fields['IDCategorie'];
}
if ($iIDCat == 0){ // Si aucun point d'entrée sélectionné pour ce groupe de projets, on prend la 1ère catégorie dans l'ordre défini pour ce groupe (1er filtre)
$strSQL = '';
$rsDefaultCat = '';
$strSQL .= "SELECT cat.IDCategorie ";
$strSQL .= 'FROM scm_act_categories cat LEFT JOIN scm_rel_act_catgroupes rel ON cat.IDCategorie = rel.IDCategorie ';
$strSQL .= 'WHERE rel.IDGroupe = ' . intval($iIDGroupe) . ' AND cat.NonActif = 0 ';
$strSQL .= 'ORDER BY rel.Ordre LIMIT 1';
$rsDefaultCat = $objConnMySQLCA->Execute($strSQL);
if(is_object($rsDefaultCat)){
if($rsDefaultCat->EOF != true) $iIDCat = $rsDefaultCat->fields['IDCategorie'];
}
}
}
if($iIDCat > 0){
// Référencement
$strSQL = '';
$strSQL .= "SELECT COALESCE(IF(MetaTitle" . $_SESSION['strLangue'] . "='',NULL,MetaTitle" . $_SESSION['strLangue'] . "), Categorie" . $_SESSION['strLangue'] . ") AS Titre, ";
$strSQL .= "COALESCE(IF(MetaDesc" . $_SESSION['strLangue'] . "='',NULL,MetaDesc" . $_SESSION['strLangue'] . "), Description" . $_SESSION['strLangue'] . ") AS Description, ";
$strSQL .= "Categorie" . $_SESSION['strLangue'] . " AS Categorie, Intro" . $_SESSION['strLangue'] . " AS IntroPage, ";
$strSQL .= "Content" . $_SESSION['strLangue'] . " AS ContentText, IncludeName, ";
$strSQL .= "Content2" . $_SESSION['strLangue'] . " AS ContentText2 ";
$strSQL .= "FROM scm_act_categories ";
$strSQL .= 'WHERE IDCategorie = ' . $iIDCat;
$rsTemp = $objConnMySQLCA->Execute($strSQL);
if($rsTemp->EOF != true){
if($rsTemp->fields['IntroPage'] != '') $strIntroPage = $rsTemp->fields['IntroPage'];
if($rsTemp->fields['ContentText'] != '') $strContentText = $rsTemp->fields['ContentText'];
if($rsTemp->fields['ContentText2'] != '') $strContentText2 = $rsTemp->fields['ContentText2'];
if($rsTemp->fields['IncludeName'] != '') $strInclude = $rsTemp->fields['IncludeName'];
}
if($iIDTheme > 0){
// Référencement
$strSQL = '';
$strSQL .= "SELECT COALESCE(IF(MetaTitle" . $_SESSION['strLangue'] . "='',NULL,MetaTitle" . $_SESSION['strLangue'] . "), Categorie" . $_SESSION['strLangue'] . ") AS Titre, ";
$strSQL .= "COALESCE(IF(MetaDesc" . $_SESSION['strLangue'] . "='',NULL,MetaDesc" . $_SESSION['strLangue'] . "), Description" . $_SESSION['strLangue'] . ") AS Description, ";
$strSQL .= "Categorie" . $_SESSION['strLangue'] . " AS Categorie, Intro" . $_SESSION['strLangue'] . " AS IntroPage, ";
$strSQL .= "Content" . $_SESSION['strLangue'] . " AS ContentText, IncludeName, ";
$strSQL .= "Content2" . $_SESSION['strLangue'] . " AS ContentText2 ";
$strSQL .= "FROM scm_act_categories ";
$strSQL .= 'WHERE IDCategorie = ' . $iIDTheme;
$rsTemp = $objConnMySQLCA->Execute($strSQL);
if($rsTemp->EOF != true){
if($rsTemp->fields['IntroPage'] != '') $strIntroPage = $rsTemp->fields['IntroPage'];
if($rsTemp->fields['ContentText'] != '') $strContentText = $rsTemp->fields['ContentText'];
if($rsTemp->fields['ContentText2'] != '') $strContentText2 = $rsTemp->fields['ContentText2'];
if($rsTemp->fields['IncludeName'] != '') $strInclude = $rsTemp->fields['IncludeName'];
}
}
if($iIDAct > 0){ // Si on est dans le détail d'un projet
$strSQL = '';
$strSQL .= 'SELECT act.IDActivite, Activite' . $_SESSION['strLangue'] . ' AS Activite, SubTitle' . $_SESSION['strLangue'] . ' AS SubTitle, ';
$strSQL .= 'act.Lieu' . $_SESSION['strLangue'] . ' AS Lieu, ';
$strSQL .= 'act.Introduction' . $_SESSION['strLangue'] . ' AS Intro, ';
$strSQL .= 'act.Description' . $_SESSION['strLangue'] . ' AS Description, ';
$strSQL .= 'Partenariat' . $_SESSION['strLangue'] . ' AS Partenariat, ';
$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 .= 'c.IDCategorie, c.Categorie' . $_SESSION['strLangue'] . ' AS Categorie ';
$strSQL .= 'FROM (scm_activites act LEFT JOIN scm_rel_act_categories rel ON act.IDActivite = rel.IDActivite) ';
$strSQL .= 'LEFT JOIN scm_act_categories c ON c.IDCategorie = rel.IDCategorie ';
$strSQL .= 'LEFT JOIN scm_rel_act_catgroupes rg ON c.IDCategorie = rg.IDCategorie ';
$strSQL .= 'WHERE act.IDActivite = ' . $iIDAct . ' ';
$strSQL .= 'AND c.IDCategorie = ' . $iIDCat; // pour éviter doublon si un projet est associé à plusieurs catégories
$rsDetail = $objConnMySQLCA->Execute($strSQL);
if($rsDetail->EOF != true){
// if($rsDetail->fields['bSeparateDates'] == 0)
// {
// if($rsDetail->fields['DateDebut'] != '' && $rsDetail->fields['DateDebut'] < date('Y-m-d H:i:s')) header('Location: ' . CstrURLGen . '/' . CstrCurrentPageName . '?idc=' . intval($iIDCat));
// }
// else
// {
// if($rsDetail->fields['Date1'] != '' && $rsDetail->fields['Date1'] < date('Y-m-d H:i:s')) header('Location: ' . CstrURLGen . '/' . CstrCurrentPageName . '?idc=' . intval($iIDCat));
// }
if($rsDetail->fields['Activite'] != '') {
$strActTitle = $rsDetail->fields['Categorie'];
$strTitlePageComplement = $rsDetail->fields['Activite'];
}
$strTitlePage = '';
$strDescriptionPage = '';
if($rsDetail->fields['Description'] != '') $strDescriptionPageComplement = strip_tags($rsDetail->fields['Description']);
// Photo(s) du projet
$strSQL = '';
$strSQL = 'SELECT DISTINCT i.Image, i.Title' . $_SESSION['strLangue'] . ' AS ImgTitle, i.Description' . $_SESSION['strLangue'] . ' AS ImgDescription, ';
$strSQL .= 'i.AltTag' . $_SESSION['strLangue'] . ' AS AltTag ';
$strSQL .= 'FROM scm_images i INNER JOIN scm_rel_act_images ri ON i.IDImage = ri.IDImage ';
$strSQL .= 'WHERE ri.IDActivite = ' . intval($iIDAct) . ' ';
$strSQL .= 'AND i.NonActif = 0 ';
$strSQL .= 'ORDER BY ri.Ordre';
$rsImages = $objConnMySQLCA->Execute($strSQL);
$strPhoto = 'HomeDefault.jpg';
if($rsImages->EOF != true){
if($rsImages->fields['Image'] != '') $strPhoto = $rsImages->fields['Image'];
$strogPathImage = 'Activites/' . $strPhoto;
}
// Vidéo(s) du projet
$strSQL = '';
$strSQL = 'SELECT DISTINCT v.VideoPath, v.Title' . $_SESSION['strLangue'] . ' AS VideoTitle, v.Description' . $_SESSION['strLangue'] . ' AS VideoDescription, ';
$strSQL .= 'v.Link ';
$strSQL .= 'FROM scm_videos v INNER JOIN scm_rel_act_videos rv ON v.IDVideo = rv.IDVideo ';
$strSQL .= 'WHERE rv.IDActivite = ' . intval($iIDAct) . ' ';
$strSQL .= 'AND v.NonActif = 0 ';
$strSQL .= 'ORDER BY rv.Ordre';
$rsVideos = $objConnMySQLCA->Execute($strSQL);
}
}
else{ // Si on a sélectionné une catégorie ou un thème
if($rsTemp->EOF != true){
// Référencement
if($rsTemp->fields['Titre'] != '') $strTitlePageComplement = $rsTemp->fields['Titre'];
if($rsTemp->fields['Description'] != '') $strDescriptionPageComplement = html_entity_decode(strip_tags($rsTemp->fields['Description']),ENT_QUOTES,'UTF-8');
// Fil d'Ariane
if($rsTemp->fields['Categorie'] != '') {
if($bIsFirstVisit == 0) $strActTitle = $rsTemp->fields['Categorie'];
}
}
// Filtre catégories (actives) de 1er niveau du groupe
$strReturn = '';
$strSQL = '';
$strSQL .= "SELECT cat.IDCategorie, COALESCE(IF(cat.Filter" . $_SESSION['strLangue'] . "='',NULL,cat.Filter" . $_SESSION['strLangue'] . "), ";
$strSQL .= "cat.Categorie" . $_SESSION['strLangue'] . ") AS Categorie ";
$strSQL .= 'FROM scm_act_categories cat LEFT JOIN scm_rel_act_catgroupes rel ON cat.IDCategorie = rel.IDCategorie ';
$strSQL .= 'WHERE rel.IDGroupe = ' . intval($iIDGroupe) . ' AND cat.NonActif = 0 ';
$strSQL .= 'ORDER BY rel.Ordre ';
$rsFilter = $objConnMySQLCA->Execute($strSQL);
/* Filtres pour niveau suivant (thèmatiques) */
$strSQL = '';
$strSQL .= "SELECT IDCategorie, COALESCE(IF(Filter" . $_SESSION['strLangue'] . "='',NULL,Filter" . $_SESSION['strLangue'] . "), Categorie" . $_SESSION['strLangue'] . ") AS Categorie ";
$strSQL .= "FROM scm_act_categories ";
$strSQL .= 'WHERE IDParent = ' . intval($iIDCat) . ' AND NonActif = 0 ';
$strSQL .= 'ORDER BY Ordre ';
$rsFilter1 = $objConnMySQLCA->Execute($strSQL);
if($iIDTheme == 0){
// Projets à venir dans la catégorie sélectionnée
$strSQL = '';
$strSQL .= 'SELECT cat.IDCategorie, cat.Categorie' . $_SESSION['strLangue'] . ' AS Categorie, ';
$strSQL .= 'cat.Description' . $_SESSION['strLangue'] . ' AS CatDescription, ';
$strSQL .= 'act.IDActivite, act.Activite' . $_SESSION['strLangue'] . ' AS Activite, act.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 .= "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 .= '(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 .= 'FROM (scm_activites act LEFT JOIN scm_rel_act_categories rel ON act.IDActivite = rel.IDActivite) ';
$strSQL .= 'LEFT JOIN scm_act_categories cat ON cat.IDCategorie = rel.IDCategorie ';
$strSQL .= 'LEFT JOIN scm_rel_act_catgroupes rg ON cat.IDCategorie = rg.IDCategorie ';
$strSQL .= 'WHERE act.NonActif = 0 AND (cat.IDCategorie = ' . $iIDCat . ' or cat.IDParent = ' . $iIDCat . ') AND cat.NonActif = 0 ';
if($bIsDate == 1) $strSQL .= "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'))) ";
else $strSQL .= "AND ((dDateDebut IS NULL OR (dDateDebut <> '0000-00-00' AND dDateDebut >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) AND (dDate1 IS NULL OR (dDate1 <> '0000-00-00' AND dDate1 >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) OR (dDateFin <> '0000-00-00' AND dDateFin >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) ";
$strSQL .= 'ORDER BY DateDebut, rel.Ordre, Activite';
//echo $strSQL . "
";
//include(CstrRootPath . '/Includes/PaginationInitialisation.inc');
$rsAct = $objConnMySQLCA->Execute($strSQL);
}
else{
// Projets à venir dans le thème sélectionné (sous-catégorie)
$strSQL = '';
$strSQL .= 'SELECT cat.IDCategorie, cat.Categorie' . $_SESSION['strLangue'] . ' AS Categorie, ';
$strSQL .= 'cat.Description' . $_SESSION['strLangue'] . ' AS CatDescription, ';
$strSQL .= 'act.IDActivite, act.Activite' . $_SESSION['strLangue'] . ' AS Activite, act.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 .= "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 .= '(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 .= 'FROM (scm_activites act LEFT JOIN scm_rel_act_categories rel ON act.IDActivite = rel.IDActivite) ';
$strSQL .= 'LEFT JOIN scm_act_categories cat ON cat.IDCategorie = rel.IDCategorie ';
$strSQL .= 'LEFT JOIN scm_rel_act_catgroupes rg ON cat.IDCategorie = rg.IDCategorie ';
$strSQL .= 'WHERE act.NonActif = 0 AND (cat.IDCategorie = ' . $iIDTheme . ' or cat.IDParent = ' . $iIDTheme . ') AND cat.NonActif = 0 ';
if($bIsDate == 1) $strSQL .= "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'))) ";
//else $strSQL .= "AND ((dDateDebut IS NULL OR (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'))) ";
else $strSQL .= "AND ((dDateDebut IS NULL OR (dDateDebut <> '0000-00-00' AND dDateDebut >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) AND (dDate1 IS NULL OR (dDate1 <> '0000-00-00' AND dDate1 >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) OR (dDateFin <> '0000-00-00' AND dDateFin >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) ";
$strSQL .= 'ORDER BY DateDebut, rel.Ordre, Activite';
//include(CstrRootPath . '/Includes/PaginationInitialisation.inc');
$rsAct = $objConnMySQLCA->Execute($strSQL);
}
// On vérifie si 1 seul projet, alors on renvoie directement vers le détail...
/*if(is_object($rsAct)){
if($rsAct->EOF != true){
if($rsAct->RecordCount() == 1) {
//echo CstrURLGen . '/' . CstrCurrentPageName . '?iIDGroupe=' . $iIDGroupe . '&iIDCat=' . $iIDCat . '&iIDTheme=' . $iIDTheme . '&bIsDate=0&iIDAct=' . $rsAct->fields['IDActivite'];
header('Location: ' . CstrURLGen . '/' . CstrCurrentPageName . '?iIDGroupe=' . $iIDGroupe . '&iIDCat=' . $iIDCat . '&iIDTheme=' . $iIDTheme . '&bIsDate=0&iIDAct=' . $rsAct->fields['IDActivite']);
exit();
}
}
}*/
}
}
else // On affiche toutes les catégories de 1er niveau appartenant au groupe sélectionné (page), et tous les projets de ce groupe (toutes catégories, peu importe le niveau)
{
// Affichage de toutes les catégories (actives) de 1er niveau du groupe
$strReturn = '';
$strSQL = '';
$strSQL .= "SELECT cat.IDCategorie, COALESCE(IF(cat.Filter" . $_SESSION['strLangue'] . "='',NULL,cat.Filter" . $_SESSION['strLangue'] . "), ";
$strSQL .= "cat.Categorie" . $_SESSION['strLangue'] . ") AS Categorie ";
$strSQL .= 'FROM scm_act_categories cat LEFT JOIN scm_rel_act_catgroupes rel ON cat.IDCategorie = rel.IDCategorie ';
$strSQL .= 'WHERE rel.IDGroupe = ' . intval($iIDGroupe) . ' AND cat.NonActif = 0 ';
$strSQL .= 'ORDER BY rel.Ordre ';
$rsFilter = $objConnMySQLCA->Execute($strSQL);
if($rsFilter->EOF != true){
while($rsFilter->EOF != true){ // Récupération de toutes les catégories actives pour affichage des projets
$strReturn .= $rsFilter->fields['IDCategorie'] . ',';
$strReturn .= fctGetSubCategories($rsFilter->fields['IDCategorie']);
$rsFilter->MoveNext();
}
$rsFilter->MoveFirst();
}
// Projets du groupe sélectionné, toutes catégories confondues
if($strReturn != ''){
$strChaine = '';
$strChaine = substr($strReturn,0,strrpos($strReturn, ','));
$strSQL = '';
$strSQL .= 'SELECT cat.IDCategorie, cat.Categorie' . $_SESSION['strLangue'] . ' AS Categorie, ';
$strSQL .= 'act.IDActivite, act.Activite' . $_SESSION['strLangue'] . ' AS Activite, act.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 .= '(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 JOIN scm_rel_act_categories rel ON act.IDActivite = rel.IDActivite) ';
$strSQL .= 'LEFT JOIN scm_act_categories cat ON cat.IDCategorie = rel.IDCategorie ';
$strSQL .= 'LEFT JOIN scm_rel_act_catgroupes rg ON cat.IDCategorie = rg.IDCategorie ';
$strSQL .= 'LEFT JOIN scm_act_groupes g ON rg.IDGroupe = g.IDGroupe ';
$strSQL .= 'WHERE cat.IDCategorie IN (' . $strChaine . ') ';
$strSQL .= 'AND act.NonActif = 0 ';
if($bIsDate == 1) $strSQL .= "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'))) ";
else $strSQL .= "AND ((dDateDebut IS NULL OR (dDateDebut <> '0000-00-00' AND dDateDebut >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) AND (dDate1 IS NULL OR (dDate1 <> '0000-00-00' AND dDate1 >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) OR (dDateFin <> '0000-00-00' AND dDateFin >= DATE_FORMAT(NOW(), '%Y/%m/%d'))) ";
$strSQL .= 'ORDER BY DateDebut, rel.Ordre, Activite';
$rsAct = $objConnMySQLCA->Execute($strSQL);
}
//include(CstrRootPath . '/Includes/PaginationInitialisation.inc');
}
?>