From d3227d9b126076d125b5d23bb3b52bd573f4d540 Mon Sep 17 00:00:00 2001 From: "tristan.champomier" Date: Sun, 13 Dec 2020 22:01:25 +0100 Subject: [PATCH] Fixed template lcube6 for tool configuration of home object --- lib/object_coordination/home/home.php | 215 ++++++++++++++++---------- 1 file changed, 137 insertions(+), 78 deletions(-) diff --git a/lib/object_coordination/home/home.php b/lib/object_coordination/home/home.php index fcef082..236ac7e 100755 --- a/lib/object_coordination/home/home.php +++ b/lib/object_coordination/home/home.php @@ -448,27 +448,47 @@ Class Home extends CoordinationObj global $SERVER_NAME, $SCRIPT_NAME, $CONF_PERSISTANT_SECURE,$CONF_DATA_PATH; /* On inclus la template (voir package.template.php) */ - WithBlocPath("Home", "actionAdmin"); - $this->cssPath="data/template/".$GLOBALS["SYSTEM_USER_SESSION"]->getCurrentTemplate()."/object_coordination/comendatorenews/comendatorenews.css"; - if( !is_file( $this->cssPath ) ) - $this->cssPath="data/template/default/object_coordination/comendatorenews/comendatorenews.css"; - $GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("csspath",$this->cssPath); - /*Récupération des messages utilisateurs*/ addMessageFile("user.ini"); - + /* gestion du lib en fonction de la langue courante */ $currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode(); $defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"]; /* fin récupération des codes par defaut */ + mxPageTitle("pagetitle"); + + if( $GLOBALS["SYSTEM_USER_SESSION"]->getObjectIdByLabel(array(nid(), 'ComendatoreNews')) ) + { + $arrayCallCss = array(); + $arrayCallCss[] = "data/template/".$GLOBALS["SYSTEM_USER_SESSION"]->getCurrentTemplate()."/object_coordination/comendatorenews/comendatorenews.css"; + mxCallCss($arrayCallCss); + } + +// $arrayCallCss = array(); +// $arrayCallCss[] = ""; +// mxCallCss($arrayCallCss); +// +// $arrayCallJs = array(); +// $arrayCallJs[] = "s"; +// mxCallJs($arrayCallJs); + + WithBlocPath("Home", "actionAdmin"); +// $this->cssPath="data/template/".$GLOBALS["SYSTEM_USER_SESSION"]->getCurrentTemplate()."/object_coordination/comendatorenews/comendatorenews.css"; +// if( !is_file( $this->cssPath ) ) +// $this->cssPath="data/template/default/object_coordination/comendatorenews/comendatorenews.css"; +// $GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("csspath",$this->cssPath); + # On récupère la liste des objets pour le noeud +// var_dump($GLOBALS["SYSTEM_USER_SESSION"]->getObjectIdByLabel(array(nid(), 'ComendatoreNews'))); // $objIdForum = $GLOBALS["SYSTEM_USER_SESSION"]->getObjectIdByLabel(array(nid(), 'NHSystemesForum')); // $objIdNews = $GLOBALS["SYSTEM_USER_SESSION"]->getObjectIdByLabel(array(nid(), 'ComendatoreNews')); $text = getMessage("NoText"); $this->communityID=$this->recupCommunautyByDomain($_SERVER['SERVER_NAME']); $this->communityLib=$this->recupCommunauty('lib',$this->communityID,$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode()); + //Récupération de l'identifiant de la communauté : methode en fin de page + $nodeId = $this->recupCommunauty("id"); if( isset($_POST["rules"]) && $_POST["rules"]==1 ) { @@ -476,83 +496,120 @@ Class Home extends CoordinationObj $GLOBALS["SYSTEM_USER_SESSION"]->user->updateCharteStatus(1); } - - $GLOBALS['SYSTEM_TEMPLATE']->MxText("pagetitle", ""); - # Requete sur identifiant de l'objet de coordination correspondant - includeDep("comendatorenews/comendatorenewsmanager.php"); - $newsmanager = new ComendatoreNewsManager; - $lastnews = $newsmanager->getLastXNewsByComId(8, "all", $this->communityID, $this->communityLib, $currentCode); + # Requete sur identifiant de l objet de coordination correspondant + $sql="SELECT * FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_OBJECT_PREFIX."textentrynode WHERE node_id=".$nodeId; + # Exécution de Requete + $result=$GLOBALS['SYSTEM_DATABASE_CONN']->sql_query($sql); - includeDep("nhsystemesforum/nhsystemesforummanager.php"); - $subjectmanager = new NHSystemesForumManager($GLOBALS["SYSTEM_USER_SESSION"]->getObjectIdByLabel(array(nid(), 'LCubeForum')), 2, 2, 2); - $lastactivethreads = $subjectmanager->getLastsForumSubjects(8); - - if( $GLOBALS["SYSTEM_USER_SESSION"]->user->getCharteStatus() == 0) - { - $GLOBALS["SYSTEM_TEMPLATE"]->MxText("blocCharte".".textCharteLegion",file_get_contents('data/message/'.$currentCode.'/rules_'.$_SERVER["HTTP_HOST"].'.inc')); - $GLOBALS["SYSTEM_TEMPLATE"]->MxText("blocCharte".".loadcharte",".load()"); - } else { - $GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("blocCharte", "delete"); - } - - if( $lastnews ) - { - for ($i=0; $isql_numrows()>0) + { + $list = $GLOBALS['SYSTEM_DATABASE_CONN']->sql_fetchrow(); + $text = $list['textentrynode_text']; + $text_resume = $list['textentrynode_resume']; + } else - $dateFShortNews = date("m/d g:ia",$lastnews[$i][2]); - - $GLOBALS['SYSTEM_TEMPLATE']->MxText("slideshow".".slideshowlastnewsthreads".".newsBloc".".lastnews".".lastnewsdate", $dateFShortNews, "",""); - $chainsUtils = new Chaine($lastnews[$i][5]); - $title = $chainsUtils->chainCut(58); - $GLOBALS['SYSTEM_TEMPLATE']->MxText("slideshow".".slideshowlastnewsthreads".".newsBloc".".lastnews".".lastnewstitle", $title, "",""); - $GLOBALS['SYSTEM_TEMPLATE']->MxAttribut("slideshow".".slideshowlastnewsthreads".".newsBloc".".lastnews".".newslink", "#"); - $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("slideshow".".slideshowlastnewsthreads".".newsBloc".".lastnews", "loop"); - } - for ($i=0; $i<(count($lastnews) >= 8 ? 8 : count($lastnews)); $i++) - { - if( is_file("data/image/icons/news/".$lastnews[$i][4] ) ) - $GLOBALS['SYSTEM_TEMPLATE']->MxImage("news".".iconBloc".".icon", "data/image/icons/news/".$lastnews[$i][4], $lastnews[$i][5], "", 32); - else - $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("news".".iconBloc", "delete"); - if( $currentCode == "fr" ) { - setlocale(LC_TIME, "fr_FR"); -// $dateFLongNews = date("F, jS H:i",$lastnews[$i][2]); - $dateFLongNews = utf8_encode(strftime( "%a %d %b, %H:%M" , $lastnews[$i][2] )); - } else - $dateFLongNews = date("F, jS g:ia",$lastnews[$i][2]); - $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".newsdate", $dateFLongNews, "",""); - $chainsUtils = new Chaine($lastnews[$i][5]); - $title = $chainsUtils->chainCut(58); - $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".newstitle", $title, "",""); - $GLOBALS['SYSTEM_TEMPLATE']->MxAttribut("news".".newslink", "#"); - $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".newscontent", $lastnews[$i][6], "",""); - $nbComments = $newsmanager->getNumberComment($lastnews[$i][0]); - $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".lblnewscomments", $nbComments > 1?getMessage("lblnewscomments"):getMessage("lblnewscomment")); - $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".newscomments", $nbComments > 0?$nbComments:getMessage("lblnonewscomments")); - $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".lblnewscommentslink", getMessage("lblnewscommentslink")); - $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("news", "loop"); - } - } else { - $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("slideshow".".slideshowlastnewsthreads".".newsBloc", "delete"); - $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("news", "delete"); - } + { + $text = $text_resume = ""; + } + + # Récupération des étiquette du formulaire + $GLOBALS["SYSTEM_TEMPLATE"]->MxText("libelle", getMessage("textinfo")); + $GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("urlAction", formatUrl($this->getId(),"Home","execAdmin")); + + + # Destruction des éléments + $GLOBALS['SYSTEM_DATABASE_CONN']->sql_freeresult($result); + +// $wysiwyg = new wysi("text_resume", "fmtextinfo", $text_resume, "fck", "100%","200", ""); //Récupération du Webword + $wysiwyg = new Wysi("text_resume", "fmtextinfo", "fr_FR", "", $pref="summernote"); + $wysiwyg->includeDependancy(); + $GLOBALS["SYSTEM_TEMPLATE"]->MxText("text_resume", $wysiwyg->Display()); + +// $wysiwyg = new wysi("text", "fmtextinfo", $text, "fck", "99%","400", ""); //Récupération du Webword + $wysiwyg = new Wysi("text", "fmtextinfo", "fr_FR", "", $pref="summernote"); + $wysiwyg->includeDependancy(); + $GLOBALS["SYSTEM_TEMPLATE"]->MxText("wysiwyg", $wysiwyg->Display()); - if( isset($lastactivethreads) && $lastactivethreads != '' ) { - for ($i=0; $igetObjectIdByLabel(array(nid(), 'ComendatoreNews')) ) + { + # Requete sur identifiant de l'objet de coordination correspondant + includeDep("comendatorenews/comendatorenewsmanager.php"); + $newsmanager = new ComendatoreNewsManager; + $lastnews = $newsmanager->getLastXNewsByComId(8, "all", $this->communityID, $this->communityLib, $currentCode); + + includeDep("nhsystemesforum/nhsystemesforummanager.php"); + $subjectmanager = new NHSystemesForumManager($GLOBALS["SYSTEM_USER_SESSION"]->getObjectIdByLabel(array(nid(), 'LCubeForum')), 2, 2, 2); + $lastactivethreads = $subjectmanager->getLastsForumSubjects(8); + + if( $GLOBALS["SYSTEM_USER_SESSION"]->user->getCharteStatus() == 0) { - $GLOBALS['SYSTEM_TEMPLATE']->MxText("slideshow".".slideshowlastnewsthreads".".threadsBloc".".activethreads".".activethreadsdate", date("m/d H:i",$lastactivethreads[$i][6]), "",""); - $chainsUtils = new Chaine($lastactivethreads[$i][2]); - $title = $chainsUtils->chainCut(58); - $GLOBALS['SYSTEM_TEMPLATE']->MxText("slideshow".".slideshowlastnewsthreads".".threadsBloc".".activethreads".".activethreadstitle", $title, "",""); - $GLOBALS['SYSTEM_TEMPLATE']->MxAttribut("slideshow".".slideshowlastnewsthreads".".threadsBloc".".activethreads".".threadlink", formatUrl($objIdForum,"NHSystemesForum","adminViewSubject")."&c=".$lastactivethreads[$i][13]."&r=".$lastactivethreads[$i][12]."&s=".$lastactivethreads[$i][0]); - $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("slideshow".".slideshowlastnewsthreads".".threadsBloc".".activethreads", "loop"); + $GLOBALS["SYSTEM_TEMPLATE"]->MxText("blocCharte".".textCharteLegion",file_get_contents('data/message/'.$currentCode.'/rules_'.$_SERVER["HTTP_HOST"].'.inc')); + $GLOBALS["SYSTEM_TEMPLATE"]->MxText("blocCharte".".loadcharte",".load()"); + } else { + $GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("blocCharte", "delete"); + } + + if( $lastnews ) + { + for ($i=0; $iMxText("slideshow".".slideshowlastnewsthreads".".newsBloc".".lastnews".".lastnewsdate", $dateFShortNews, "",""); + $chainsUtils = new Chaine($lastnews[$i][5]); + $title = $chainsUtils->chainCut(58); + $GLOBALS['SYSTEM_TEMPLATE']->MxText("slideshow".".slideshowlastnewsthreads".".newsBloc".".lastnews".".lastnewstitle", $title, "",""); + $GLOBALS['SYSTEM_TEMPLATE']->MxAttribut("slideshow".".slideshowlastnewsthreads".".newsBloc".".lastnews".".newslink", "#"); + $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("slideshow".".slideshowlastnewsthreads".".newsBloc".".lastnews", "loop"); + } + for ($i=0; $i<(count($lastnews) >= 8 ? 8 : count($lastnews)); $i++) + { + if( is_file("data/image/icons/news/".$lastnews[$i][4] ) ) + $GLOBALS['SYSTEM_TEMPLATE']->MxImage("news".".iconBloc".".icon", "data/image/icons/news/".$lastnews[$i][4], $lastnews[$i][5], "", 32); + else + $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("news".".iconBloc", "delete"); + if( $currentCode == "fr" ) { + setlocale(LC_TIME, "fr_FR"); + // $dateFLongNews = date("F, jS H:i",$lastnews[$i][2]); + $dateFLongNews = utf8_encode(strftime( "%a %d %b, %H:%M" , $lastnews[$i][2] )); + } else + $dateFLongNews = date("F, jS g:ia",$lastnews[$i][2]); + $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".newsdate", $dateFLongNews, "",""); + $chainsUtils = new Chaine($lastnews[$i][5]); + $title = $chainsUtils->chainCut(58); + $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".newstitle", $title, "",""); + $GLOBALS['SYSTEM_TEMPLATE']->MxAttribut("news".".newslink", "#"); + $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".newscontent", $lastnews[$i][6], "",""); + $nbComments = $newsmanager->getNumberComment($lastnews[$i][0]); + $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".lblnewscomments", $nbComments > 1?getMessage("lblnewscomments"):getMessage("lblnewscomment")); + $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".newscomments", $nbComments > 0?$nbComments:getMessage("lblnonewscomments")); + $GLOBALS['SYSTEM_TEMPLATE']->MxText("news".".lblnewscommentslink", getMessage("lblnewscommentslink")); + $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("news", "loop"); + } + } else { + $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("slideshow".".slideshowlastnewsthreads".".newsBloc", "delete"); + $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("news", "delete"); + } + + if( isset($lastactivethreads) && $lastactivethreads != '' ) { + for ($i=0; $iMxText("slideshow".".slideshowlastnewsthreads".".threadsBloc".".activethreads".".activethreadsdate", date("m/d H:i",$lastactivethreads[$i][6]), "",""); + $chainsUtils = new Chaine($lastactivethreads[$i][2]); + $title = $chainsUtils->chainCut(58); + $GLOBALS['SYSTEM_TEMPLATE']->MxText("slideshow".".slideshowlastnewsthreads".".threadsBloc".".activethreads".".activethreadstitle", $title, "",""); + $GLOBALS['SYSTEM_TEMPLATE']->MxAttribut("slideshow".".slideshowlastnewsthreads".".threadsBloc".".activethreads".".threadlink", formatUrl($objIdForum,"NHSystemesForum","adminViewSubject")."&c=".$lastactivethreads[$i][13]."&r=".$lastactivethreads[$i][12]."&s=".$lastactivethreads[$i][0]); + $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("slideshow".".slideshowlastnewsthreads".".threadsBloc".".activethreads", "loop"); + } + } else { + $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("slideshow".".slideshowlastnewsthreads".".threadsBloc", "delete"); } - } else { - $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("slideshow".".slideshowlastnewsthreads".".threadsBloc", "delete"); } // $lastmovies = array(); // $lastmovies[0][2] = "01/20 7:48am"; @@ -3464,6 +3521,8 @@ Class Home extends CoordinationObj $nodeId = stripslashes($view['node_id']); # Destruction des resultats $GLOBALS['SYSTEM_DATABASE_CONN']->sql_freeresult(); + } else { + $nodeId = false; } // } /* -- Fin Recup Communauté */