arraycollumn quand même pour éviter les problèmes

This commit is contained in:
Fred Tempez 2022-03-16 18:43:35 +01:00
parent aad80bc484
commit 7c6ca6c940
14 changed files with 45 additions and 45 deletions

View File

@ -290,7 +290,7 @@ class common {
// Construit la liste des pages parents/enfants // Construit la liste des pages parents/enfants
if($this->hierarchy['all'] === []) { if($this->hierarchy['all'] === []) {
$pages = helper::arrayColumn($this->getData(['page']), 'position', 'SORT_ASC'); $pages = helper::arraycollumn($this->getData(['page']), 'position', 'SORT_ASC');
// Parents // Parents
foreach($pages as $pageId => $pagePosition) { foreach($pages as $pageId => $pagePosition) {
if( if(

View File

@ -481,7 +481,7 @@ if ($this->getData(['core', 'dataVersion']) < 10400) {
foreach ($pageList as $parentKey => $parent) { foreach ($pageList as $parentKey => $parent) {
//La page est un blog //La page est un blog
if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) { if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) {
$articleIds = array_keys(helper::arrayColumn($this->getData(['module', $parent, 'posts']), 'publishedOn', 'SORT_DESC')); $articleIds = array_keys(helper::arraycollumn($this->getData(['module', $parent, 'posts']), 'publishedOn', 'SORT_DESC'));
foreach ($articleIds as $key => $article) { foreach ($articleIds as $key => $article) {
// Droits les deux groupes // Droits les deux groupes
$this->setData(['module', $parent, 'posts', $article,'editConsent', 3]); $this->setData(['module', $parent, 'posts', $article,'editConsent', 3]);

View File

@ -57,21 +57,21 @@
</h4> </h4>
<div class="row"> <div class="row">
<div class="col4"> <div class="col4">
<?php echo template::select('localeHomePageId', helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC'), [ <?php echo template::select('localeHomePageId', helper::arraycollumn($module::$pagesList, 'title', 'SORT_ASC'), [
'label' => 'Accueil du site', 'label' => 'Accueil du site',
'selected' =>$this->getData(['locale', 'homePageId']), 'selected' =>$this->getData(['locale', 'homePageId']),
'help' => 'La première page que vos visiteurs verront.' 'help' => 'La première page que vos visiteurs verront.'
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo template::select('localePage403', array_merge(['none' => 'Page par défaut'],helper::arrayColumn($module::$orphansList, 'title', 'SORT_ASC')), [ <?php echo template::select('localePage403', array_merge(['none' => 'Page par défaut'],helper::arraycollumn($module::$orphansList, 'title', 'SORT_ASC')), [
'label' => 'Accès interdit, erreur 403', 'label' => 'Accès interdit, erreur 403',
'selected' =>$this->getData(['locale', 'page403']), 'selected' =>$this->getData(['locale', 'page403']),
'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.' 'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.'
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo template::select('localePage404', array_merge(['none' => 'Page par défaut'],helper::arrayColumn($module::$orphansList, 'title', 'SORT_ASC')), [ <?php echo template::select('localePage404', array_merge(['none' => 'Page par défaut'],helper::arraycollumn($module::$orphansList, 'title', 'SORT_ASC')), [
'label' => 'Page inexistante, erreur 404', 'label' => 'Page inexistante, erreur 404',
'selected' =>$this->getData(['locale', 'page404']), 'selected' =>$this->getData(['locale', 'page404']),
'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.' 'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.'
@ -80,14 +80,14 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col4"> <div class="col4">
<?php echo template::select('localeLegalPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC') ) , [ <?php echo template::select('localeLegalPageId', array_merge(['none' => 'Aucune'] , helper::arraycollumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
'label' => 'Mentions légales', 'label' => 'Mentions légales',
'selected' => $this->getData(['locale', 'legalPageId']), 'selected' => $this->getData(['locale', 'legalPageId']),
'help' => 'Les mentions légales sont obligatoires en France. Une option du pied de page ajoute un lien discret vers cette page.' 'help' => 'Les mentions légales sont obligatoires en France. Une option du pied de page ajoute un lien discret vers cette page.'
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo template::select('localeSearchPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC') ) , [ <?php echo template::select('localeSearchPageId', array_merge(['none' => 'Aucune'] , helper::arraycollumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
'label' => 'Recherche dans le site', 'label' => 'Recherche dans le site',
'selected' => $this->getData(['locale', 'searchPageId']), 'selected' => $this->getData(['locale', 'searchPageId']),
'help' => 'Sélectionnez une page contenant le module \'Recherche\'. Une option du pied de page ajoute un lien discret vers cette page.' 'help' => 'Sélectionnez une page contenant le module \'Recherche\'. Une option du pied de page ajoute un lien discret vers cette page.'
@ -95,7 +95,7 @@
</div> </div>
<div class="col4"> <div class="col4">
<?php <?php
echo template::select('localePage302', array_merge(['none' => 'Page par défaut'],helper::arrayColumn($module::$orphansList, 'title', 'SORT_ASC')), [ echo template::select('localePage302', array_merge(['none' => 'Page par défaut'],helper::arraycollumn($module::$orphansList, 'title', 'SORT_ASC')), [
'label' => 'Site en maintenance', 'label' => 'Site en maintenance',
'selected' =>$this->getData(['locale', 'page302']), 'selected' =>$this->getData(['locale', 'page302']),
'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.' 'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.'

View File

@ -153,7 +153,7 @@ class install extends common {
// Récupération de la liste des thèmes // Récupération de la liste des thèmes
$dataThemes = file_get_contents('core/module/install/ressource/themes/themes.json'); $dataThemes = file_get_contents('core/module/install/ressource/themes/themes.json');
$dataThemes = json_decode($dataThemes, true); $dataThemes = json_decode($dataThemes, true);
self::$themes = helper::arrayColumn($dataThemes, 'name'); self::$themes = helper::arraycollumn($dataThemes, 'name');
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([

View File

@ -521,7 +521,7 @@ class page extends common {
} }
} }
} }
self::$moduleIds = array_merge( ['' => 'Aucun'] , helper::arrayColumn(helper::getModules(),'realName','SORT_ASC')); // Pages sans parent self::$moduleIds = array_merge( ['' => 'Aucun'] , helper::arraycollumn(helper::getModules(),'realName','SORT_ASC')); // Pages sans parent
foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) { foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
if($parentPageId !== $this->getUrl(2)) { if($parentPageId !== $this->getUrl(2)) {
self::$pagesNoParentId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']); self::$pagesNoParentId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);

View File

@ -301,7 +301,7 @@ class plugin extends common {
// Modules installés // Modules installés
$infoModules = helper::getModules(); $infoModules = helper::getModules();
// Clés moduleIds dans les pages // Clés moduleIds dans les pages
$inPages = helper::arraycolumn($this->getData(['page']),'moduleId', 'SORT_DESC'); $inPages = helper::arraycollumn($this->getData(['page']),'moduleId', 'SORT_DESC');
foreach( $inPages as $key=>$value){ foreach( $inPages as $key=>$value){
$pagesInfos[ $this->getData(['page', $key, 'title' ]) ] = $value; $pagesInfos[ $this->getData(['page', $key, 'title' ]) ] = $value;
} }
@ -386,7 +386,7 @@ class plugin extends common {
$pages = json_decode(file_get_contents(self::DATA_DIR . $keyi18n . '/' . 'page.json'), true); $pages = json_decode(file_get_contents(self::DATA_DIR . $keyi18n . '/' . 'page.json'), true);
// Extraire les clés des modules // Extraire les clés des modules
$pagesModules [$keyi18n] = array_filter(helper::arraycolumn($pages['page'],'moduleId', 'SORT_DESC'), 'strlen'); $pagesModules [$keyi18n] = array_filter(helper::arraycollumn($pages['page'],'moduleId', 'SORT_DESC'), 'strlen');
// Générer ls liste des pages avec module pour la sauvegarde ou le backup // Générer ls liste des pages avec module pour la sauvegarde ou le backup
foreach( $pagesModules [$keyi18n] as $key=>$value ) { foreach( $pagesModules [$keyi18n] as $key=>$value ) {

View File

@ -42,8 +42,8 @@ class sitemap extends common
!empty($this->getData(['module',$parentId, 'posts' ]))) { !empty($this->getData(['module',$parentId, 'posts' ]))) {
$items .= '<ul>'; $items .= '<ul>';
// Ids des articles par ordre de publication // Ids des articles par ordre de publication
$articleIdsPublishedOns = helper::arrayColumn($this->getData(['module', $parentId,'posts']), 'publishedOn', 'SORT_DESC'); $articleIdsPublishedOns = helper::arraycollumn($this->getData(['module', $parentId,'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayColumn($this->getData(['module', $parentId, 'posts']), 'state', 'SORT_DESC'); $articleIdsStates = helper::arraycollumn($this->getData(['module', $parentId, 'posts']), 'state', 'SORT_DESC');
$articleIds = []; $articleIds = [];
foreach ($articleIdsPublishedOns as $articleId => $articlePublishedOn) { foreach ($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) { if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) {
@ -78,8 +78,8 @@ class sitemap extends common
!empty($this->getData(['module', $childId, 'posts' ]))) { !empty($this->getData(['module', $childId, 'posts' ]))) {
$items .= '<ul>'; $items .= '<ul>';
// Ids des articles par ordre de publication // Ids des articles par ordre de publication
$articleIdsPublishedOns = helper::arrayColumn($this->getData(['module', $childId,'posts']), 'publishedOn', 'SORT_DESC'); $articleIdsPublishedOns = helper::arraycollumn($this->getData(['module', $childId,'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayColumn($this->getData(['module', $childId, 'posts']), 'state', 'SORT_DESC'); $articleIdsStates = helper::arraycollumn($this->getData(['module', $childId, 'posts']), 'state', 'SORT_DESC');
$articleIds = []; $articleIds = [];
foreach ($articleIdsPublishedOns as $articleId => $articlePublishedOn) { foreach ($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) { if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) {

View File

@ -133,7 +133,7 @@
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3">
<?php echo template::select('configLegalPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC') ) , [ <?php echo template::select('configLegalPageId', array_merge(['none' => 'Aucune'] , helper::arraycollumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
'label' => 'Page "Mentions légales" ' . template::flag('site', '20px'), 'label' => 'Page "Mentions légales" ' . template::flag('site', '20px'),
'selected' => $this->getData(['locale', 'legalPageId']) 'selected' => $this->getData(['locale', 'legalPageId'])
]); ?> ]); ?>
@ -147,7 +147,7 @@
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3">
<?php echo template::select('configSearchPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC') ) , [ <?php echo template::select('configSearchPageId', array_merge(['none' => 'Aucune'] , helper::arraycollumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
'label' => 'Page "Rechercher" ' . template::flag('site', '20px'), 'label' => 'Page "Rechercher" ' . template::flag('site', '20px'),
'selected' => $this->getData(['locale', 'searchPageId']) 'selected' => $this->getData(['locale', 'searchPageId'])
]); ?> ]); ?>

View File

@ -336,7 +336,7 @@ class user extends common {
* Liste des utilisateurs * Liste des utilisateurs
*/ */
public function index() { public function index() {
$userIdsFirstnames = helper::arrayColumn($this->getData(['user']), 'firstname'); $userIdsFirstnames = helper::arraycollumn($this->getData(['user']), 'firstname');
ksort($userIdsFirstnames); ksort($userIdsFirstnames);
foreach($userIdsFirstnames as $userId => $userFirstname) { foreach($userIdsFirstnames as $userId => $userFirstname) {
if ($this->getData(['user', $userId, 'group'])) { if ($this->getData(['user', $userId, 'group'])) {
@ -399,7 +399,7 @@ class user extends common {
] ]
]); ]);
// Verrouillage des IP // Verrouillage des IP
$ipBlackList = helper::arrayColumn($this->getData(['blacklist']), 'ip'); $ipBlackList = helper::arraycollumn($this->getData(['blacklist']), 'ip');
if ( $this->getData(['blacklist',$userId,'connectFail']) >= $this->getData(['config', 'connect', 'attempt']) if ( $this->getData(['blacklist',$userId,'connectFail']) >= $this->getData(['config', 'connect', 'attempt'])
AND in_array($this->getData(['blacklist',$userId,'ip']),$ipBlackList) ) { AND in_array($this->getData(['blacklist',$userId,'ip']),$ipBlackList) ) {
$logStatus = 'Compte inconnu verrouillé'; $logStatus = 'Compte inconnu verrouillé';

View File

@ -154,8 +154,8 @@ class blog extends common {
$feeds->setDate(date('r',time())); $feeds->setDate(date('r',time()));
$feeds->addGenerator(); $feeds->addGenerator();
// Corps des articles // Corps des articles
$articleIdsPublishedOns = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'); $articleIdsPublishedOns = helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayColumn($this->getData(['module', $this->getUrl(0),'posts']), 'state', 'SORT_DESC'); $articleIdsStates = helper::arraycollumn($this->getData(['module', $this->getUrl(0),'posts']), 'state', 'SORT_DESC');
foreach( $articleIdsPublishedOns as $articleId => $articlePublishedOn ) { foreach( $articleIdsPublishedOns as $articleId => $articlePublishedOn ) {
if( $articlePublishedOn <= time() AND $articleIdsStates[$articleId] ) { if( $articlePublishedOn <= time() AND $articleIdsStates[$articleId] ) {
// Miniature // Miniature
@ -244,7 +244,7 @@ class blog extends common {
]); ]);
} }
// Liste des utilisateurs // Liste des utilisateurs
self::$users = helper::arrayColumn($this->getData(['user']), 'firstname'); self::$users = helper::arraycollumn($this->getData(['user']), 'firstname');
ksort(self::$users); ksort(self::$users);
foreach(self::$users as $userId => &$userFirstname) { foreach(self::$users as $userId => &$userFirstname) {
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']); $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']);
@ -274,7 +274,7 @@ class blog extends common {
'value' => 'Tout effacer' 'value' => 'Tout effacer'
]); ]);
// Ids des commentaires par ordre de création // Ids des commentaires par ordre de création
$commentIds = array_keys(helper::arrayColumn($comments, 'createdOn', 'SORT_DESC')); $commentIds = array_keys(helper::arraycollumn($comments, 'createdOn', 'SORT_DESC'));
// Pagination // Pagination
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) ); $pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
// Liste des pages // Liste des pages
@ -415,7 +415,7 @@ class blog extends common {
public function config() { public function config() {
// Ids des articles par ordre de publication // Ids des articles par ordre de publication
$articleIds = array_keys(helper::arraycolumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC')); $articleIds = array_keys(helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Gestion des droits d'accès // Gestion des droits d'accès
$filterData=[]; $filterData=[];
foreach ($articleIds as $key => $value) { foreach ($articleIds as $key => $value) {
@ -447,7 +447,7 @@ class blog extends common {
// Articles en fonction de la pagination // Articles en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) { for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Nombre de commentaires à approuver et approuvés // Nombre de commentaires à approuver et approuvés
$approvals = helper::arraycolumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC'); $approvals = helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
if ( is_array($approvals) ) { if ( is_array($approvals) ) {
$a = array_values($approvals); $a = array_values($approvals);
$toApprove = count(array_keys($a,false)); $toApprove = count(array_keys($a,false));
@ -516,7 +516,7 @@ class blog extends common {
]); ]);
} else { } else {
// Ids des articles par ordre de publication // Ids des articles par ordre de publication
$articleIds = array_keys(helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC')); $articleIds = array_keys(helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Gestion des droits d'accès // Gestion des droits d'accès
$filterData=[]; $filterData=[];
foreach ($articleIds as $key => $value) { foreach ($articleIds as $key => $value) {
@ -548,7 +548,7 @@ class blog extends common {
// Articles en fonction de la pagination // Articles en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) { for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Nombre de commentaires à approuver et approuvés // Nombre de commentaires à approuver et approuvés
$approvals = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC'); $approvals = helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
if ( is_array($approvals) ) { if ( is_array($approvals) ) {
$a = array_values($approvals); $a = array_values($approvals);
$toApprove = count(array_keys($a,false)); $toApprove = count(array_keys($a,false));
@ -696,7 +696,7 @@ class blog extends common {
]); ]);
} }
// Liste des utilisateurs // Liste des utilisateurs
self::$users = helper::arrayColumn($this->getData(['user']), 'firstname'); self::$users = helper::arraycollumn($this->getData(['user']), 'firstname');
ksort(self::$users); ksort(self::$users);
foreach(self::$users as $userId => &$userFirstname) { foreach(self::$users as $userId => &$userFirstname) {
// Les membres ne sont pas éditeurs, les exclure de la liste // Les membres ne sont pas éditeurs, les exclure de la liste
@ -811,7 +811,7 @@ class blog extends common {
// Ligne suivante si affichage du nombre total de commentaires approuvés sous l'article // Ligne suivante si affichage du nombre total de commentaires approuvés sous l'article
self::$nbCommentsApproved = count($commentsApproved); self::$nbCommentsApproved = count($commentsApproved);
} }
$commentIds = array_keys(helper::arrayColumn($commentsApproved, 'createdOn', 'SORT_DESC')); $commentIds = array_keys(helper::arraycollumn($commentsApproved, 'createdOn', 'SORT_DESC'));
// Pagination // Pagination
$pagination = helper::pagination($commentIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']),'#comment'); $pagination = helper::pagination($commentIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']),'#comment');
// Liste des pages // Liste des pages
@ -851,8 +851,8 @@ class blog extends common {
// Liste des articles // Liste des articles
else { else {
// Ids des articles par ordre de publication // Ids des articles par ordre de publication
$articleIdsPublishedOns = helper::arrayColumn($this->getData(['module', $this->getUrl(0),'posts']), 'publishedOn', 'SORT_DESC'); $articleIdsPublishedOns = helper::arraycollumn($this->getData(['module', $this->getUrl(0),'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC'); $articleIdsStates = helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
$articleIds = []; $articleIds = [];
foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) { foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) { if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) {

View File

@ -107,7 +107,7 @@ class form extends common {
*/ */
public function config() { public function config() {
// Liste des utilisateurs // Liste des utilisateurs
$userIdsFirstnames = helper::arrayColumn($this->getData(['user']), 'firstname'); $userIdsFirstnames = helper::arraycollumn($this->getData(['user']), 'firstname');
ksort($userIdsFirstnames); ksort($userIdsFirstnames);
self::$listUsers [] = ''; self::$listUsers [] = '';
foreach($userIdsFirstnames as $userId => $userFirstname) { foreach($userIdsFirstnames as $userId => $userFirstname) {
@ -159,7 +159,7 @@ class form extends common {
public function option() { public function option() {
// Liste des utilisateurs // Liste des utilisateurs
$userIdsFirstnames = helper::arraycolumn($this->getData(['user']), 'firstname'); $userIdsFirstnames = helper::arraycollumn($this->getData(['user']), 'firstname');
ksort($userIdsFirstnames); ksort($userIdsFirstnames);
self::$listUsers [] = ''; self::$listUsers [] = '';
foreach ($userIdsFirstnames as $userId => $userFirstname) { foreach ($userIdsFirstnames as $userId => $userFirstname) {

View File

@ -78,7 +78,7 @@ function position() {
var inputUid = 0; var inputUid = 0;
var inputs = <?php echo json_encode($this->getData(['module', $this->getUrl(0), 'input'])); ?>; var inputs = <?php echo json_encode($this->getData(['module', $this->getUrl(0), 'input'])); ?>;
if(inputs) { if(inputs) {
var inputsPerPosition = <?php echo json_encode(helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'input']), 'position', 'SORT_ASC')); ?>; var inputsPerPosition = <?php echo json_encode(helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'input']), 'position', 'SORT_ASC')); ?>;
$.each(inputsPerPosition, function(id) { $.each(inputsPerPosition, function(id) {
add(inputUid, inputs[id]); add(inputUid, inputs[id]);
inputUid++; inputUid++;

View File

@ -320,7 +320,7 @@ class gallery extends common {
//Affichage de la galerie triée //Affichage de la galerie triée
$g = $this->getData(['module', $this->getUrl(0), 'content']); $g = $this->getData(['module', $this->getUrl(0), 'content']);
$p = helper::arrayColumn(helper::arrayColumn($g,'config'),'position'); $p = helper::arraycollumn(helper::arraycollumn($g,'config'),'position');
asort($p,SORT_NUMERIC); asort($p,SORT_NUMERIC);
$galleries = []; $galleries = [];
foreach ($p as $positionId => $item) { foreach ($p as $positionId => $item) {
@ -678,7 +678,7 @@ class gallery extends common {
else { else {
// Tri des galeries suivant l'ordre défini // Tri des galeries suivant l'ordre défini
$g = $this->getData(['module', $this->getUrl(0), 'content']); $g = $this->getData(['module', $this->getUrl(0), 'content']);
$p = helper::arrayColumn(helper::arrayColumn($g,'config'),'position'); $p = helper::arraycollumn(helper::arraycollumn($g,'config'),'position');
asort($p,SORT_NUMERIC); asort($p,SORT_NUMERIC);
$galleries = []; $galleries = [];
foreach ($p as $positionId => $item) { foreach ($p as $positionId => $item) {

View File

@ -114,8 +114,8 @@ class news extends common {
$feeds->setDate(date('r',time())); $feeds->setDate(date('r',time()));
$feeds->addGenerator(); $feeds->addGenerator();
// Corps des articles // Corps des articles
$newsIdsPublishedOns = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'); $newsIdsPublishedOns = helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
$newsIdsStates = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC'); $newsIdsStates = helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) { foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) {
if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) { if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) {
$newsArticle = $feeds->createNewItem(); $newsArticle = $feeds->createNewItem();
@ -166,7 +166,7 @@ class news extends common {
]); ]);
} }
// Liste des utilisateurs // Liste des utilisateurs
self::$users = helper::arrayColumn($this->getData(['user']), 'firstname'); self::$users = helper::arraycollumn($this->getData(['user']), 'firstname');
ksort(self::$users); ksort(self::$users);
foreach(self::$users as $userId => &$userFirstname) { foreach(self::$users as $userId => &$userFirstname) {
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']); $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']);
@ -192,7 +192,7 @@ class news extends common {
$this->update(); $this->update();
// Ids des news par ordre de publication // Ids des news par ordre de publication
$newsIds = array_keys(helper::arraycolumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC')); $newsIds = array_keys(helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Pagination fixe // Pagination fixe
$pagination = helper::pagination($newsIds, $this->getUrl(),self::$itemsperPage ); $pagination = helper::pagination($newsIds, $this->getUrl(),self::$itemsperPage );
// Liste des pages // Liste des pages
@ -291,7 +291,7 @@ class news extends common {
]); ]);
} else { } else {
// Ids des news par ordre de publication // Ids des news par ordre de publication
$newsIds = array_keys(helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC')); $newsIds = array_keys(helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Pagination // Pagination
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) ); $pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
// Liste des pages // Liste des pages
@ -424,7 +424,7 @@ class news extends common {
]); ]);
} }
// Liste des utilisateurs // Liste des utilisateurs
self::$users = helper::arrayColumn($this->getData(['user']), 'firstname'); self::$users = helper::arraycollumn($this->getData(['user']), 'firstname');
ksort(self::$users); ksort(self::$users);
foreach(self::$users as $userId => &$userFirstname) { foreach(self::$users as $userId => &$userFirstname) {
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']); $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']);
@ -477,8 +477,8 @@ class news extends common {
} else { } else {
// Affichage index // Affichage index
// Ids des news par ordre de publication // Ids des news par ordre de publication
$newsIdsPublishedOns = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'); $newsIdsPublishedOns = helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
$newsIdsStates = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC'); $newsIdsStates = helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
$newsIds = []; $newsIds = [];
foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) { foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) {
$newsIdsPublishedOff = $this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'publishedOff']); $newsIdsPublishedOff = $this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'publishedOff']);