module News
This commit is contained in:
parent
39e7dcd2f3
commit
5644caa0c0
|
@ -4,6 +4,7 @@
|
||||||
- Modifications :
|
- Modifications :
|
||||||
- Thème / bannière : nouvelle option : une bannière animée avec Swiper,
|
- Thème / bannière : nouvelle option : une bannière animée avec Swiper,
|
||||||
- Configuration / connexion : nouvelle option permettant de dévoiler le mot de passe,
|
- Configuration / connexion : nouvelle option permettant de dévoiler le mot de passe,
|
||||||
|
- Module News : amélioration de l'affichage de l'aperçu
|
||||||
- Corrections :
|
- Corrections :
|
||||||
- Theme / footer : sélection du template sur une colonne et différents aperçus.
|
- Theme / footer : sélection du template sur une colonne et différents aperçus.
|
||||||
|
|
||||||
|
|
|
@ -22,17 +22,19 @@ $text['news_view']['config'][19] = 'State';
|
||||||
$text['news_view']['config'][20] = 'No news';
|
$text['news_view']['config'][20] = 'No news';
|
||||||
$text['news_view']['config'][21] = 'Version no.';
|
$text['news_view']['config'][21] = 'Version no.';
|
||||||
$text['news_view']['config'][22] = 'Rounding of corners';
|
$text['news_view']['config'][22] = 'Rounding of corners';
|
||||||
$text['news_view']['config'][23] = 'Shadow on edges';
|
$text['news_view']['config'][23] = 'Shadow on edges';
|
||||||
$text['news_view']['config'][24] = 'Hide news titles';
|
$text['news_view']['config'][24] = 'Hide news titles';
|
||||||
$text['news_view']['config'][25] = 'Hidden titles';
|
$text['news_view']['config'][25] = 'Hidden titles';
|
||||||
$text['news_view']['config'][26] = 'Same height';
|
$text['news_view']['config'][26] = 'Same height';
|
||||||
$text['news_view']['config'][27] = 'Columns in the same row will have the same height';
|
$text['news_view']['config'][27] = 'Columns in the same row will have the same height';
|
||||||
$text['news_view']['config'][28] = "Are you sure you want to delete this news ?";
|
$text['news_view']['config'][28] = "Are you sure you want to delete this news ?";
|
||||||
$text['news_view']['config'][29] = "This setting only concerns paragraphs or groups of simple paragraphs (p tag). A title, an image or an iframe are not concerned. In a truncated paragraph all html tags disappear (no formatting, no links). For links use images or h2, h3,... ";
|
$text['news_view']['config'][29] = "This setting concerns the number of characters displayed in the news preview. In the last paragraph, which is often truncated, the different html tags are removed.";
|
||||||
$text['news_view']['config'][30] = "Image or iframe without margin";
|
$text['news_view']['config'][30] = "Media without margin";
|
||||||
$text['news_view']['config'][31] = "An image or iframe will appear without margin, otherwise the margins are identical to those of a paragraph";
|
$text['news_view']['config'][31] = "In the preview only the first media is displayed (image, iframe, video, figure). With this option the media will appear without margin.";
|
||||||
$text['news_view']['config'][32] = 'Help';
|
$text['news_view']['config'][32] = 'Help';
|
||||||
$text['news_view']['config'][33] = 'module/news/view/config/config.help_en.html';
|
$text['news_view']['config'][33] = 'module/news/view/config/config.help.html';
|
||||||
|
$text['news_view']['config'][34] = 'Media hidden in preview';
|
||||||
|
$text['news_view']['config'][35] = 'In the preview only the first media is displayed, this option hides it';
|
||||||
$text['news_view']['index'][0] = 'read more';
|
$text['news_view']['index'][0] = 'read more';
|
||||||
$text['news_view']['index'][1] = 'No news.';
|
$text['news_view']['index'][1] = 'No news.';
|
||||||
$text['news_view']['index'][2] = ' Edit';
|
$text['news_view']['index'][2] = ' Edit';
|
||||||
|
@ -123,4 +125,4 @@ $newsShadows = [
|
||||||
'5px 5px 10px' => 'Important',
|
'5px 5px 10px' => 'Important',
|
||||||
'10px 10px 20px' => 'Very important'
|
'10px 10px 20px' => 'Very important'
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -22,17 +22,19 @@ $text['news_view']['config'][19] = 'Etat';
|
||||||
$text['news_view']['config'][20] = 'Aucune news.';
|
$text['news_view']['config'][20] = 'Aucune news.';
|
||||||
$text['news_view']['config'][21] = 'Version n°';
|
$text['news_view']['config'][21] = 'Version n°';
|
||||||
$text['news_view']['config'][22] = 'Arrondi des angles';
|
$text['news_view']['config'][22] = 'Arrondi des angles';
|
||||||
$text['news_view']['config'][23] = 'Ombre sur les bords';
|
$text['news_view']['config'][23] = 'Ombre sur les bords';
|
||||||
$text['news_view']['config'][24] = 'Masquer le titre des nouvelles';
|
$text['news_view']['config'][24] = 'Masquer le titre des nouvelles';
|
||||||
$text['news_view']['config'][25] = 'Titres masqués';
|
$text['news_view']['config'][25] = 'Titres masqués';
|
||||||
$text['news_view']['config'][26] = 'Même hauteur';
|
$text['news_view']['config'][26] = 'Même hauteur';
|
||||||
$text['news_view']['config'][27] = 'Les colonnes sur une même ligne auront même hauteur';
|
$text['news_view']['config'][27] = 'Les colonnes sur une même ligne auront même hauteur';
|
||||||
$text['news_view']['config'][28] = "Êtes-vous sûr de vouloir supprimer cette news ?";
|
$text['news_view']['config'][28] = "Êtes-vous sûr de vouloir supprimer cette news ?";
|
||||||
$text['news_view']['config'][29] = "Ce réglage ne concerne que les paragraphes ou les groupes de paragraphes simples (balise p). Un titre, une image, un iframe ne sont pas concernés. Dans un paragraphe tronqué toutes les balises html disparaissent (pas de mise en forme, pas de liens). Pour les liens utilisez les images ou h2, h3,...";
|
$text['news_view']['config'][29] = "Ce réglage concerne le nombre de caractères affichés dans l'aperçu des nouvelles. Dans le dernier paragraphe, souvent tronqué, les différentes balises html sont supprimées.";
|
||||||
$text['news_view']['config'][30] = "Image ou iframe sans marge";
|
$text['news_view']['config'][30] = "Média sans marge";
|
||||||
$text['news_view']['config'][31] = "Une image ou un iframe apparaîtront sans marge, sinon les marges sont identiques à celles d'un paragraphe";
|
$text['news_view']['config'][31] = "Dans l'aperçu seul le premier média est affiché (image, iframe, video, figure). Avec cette option le média apparaîtra sans marge.";
|
||||||
$text['news_view']['config'][32] = 'Aide';
|
$text['news_view']['config'][32] = 'Aide';
|
||||||
$text['news_view']['config'][33] = 'module/news/view/config/config.help.html';
|
$text['news_view']['config'][33] = 'module/news/view/config/config.help.html';
|
||||||
|
$text['news_view']['config'][34] = 'Média caché dans l\'aperçu';
|
||||||
|
$text['news_view']['config'][35] = 'Dans l\'aperçu seul le premier média est affiché, cette option le cache.';
|
||||||
$text['news_view']['index'][0] = 'lire la suite';
|
$text['news_view']['index'][0] = 'lire la suite';
|
||||||
$text['news_view']['index'][1] = 'Aucune news.';
|
$text['news_view']['index'][1] = 'Aucune news.';
|
||||||
$text['news_view']['index'][2] = ' Editer';
|
$text['news_view']['index'][2] = ' Editer';
|
||||||
|
@ -122,4 +124,4 @@ $newsShadows = [
|
||||||
'5px 5px 10px' => 'Important',
|
'5px 5px 10px' => 'Important',
|
||||||
'10px 10px 20px' => 'Très important'
|
'10px 10px 20px' => 'Très important'
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
class news extends common {
|
class news extends common {
|
||||||
|
|
||||||
const VERSION = '4.4';
|
const VERSION = '4.5';
|
||||||
const REALNAME = 'News';
|
const REALNAME = 'News';
|
||||||
const DELETE = true;
|
const DELETE = true;
|
||||||
const UPDATE = '0.0';
|
const UPDATE = '0.0';
|
||||||
|
@ -194,6 +194,7 @@ class news extends common {
|
||||||
'height' => $this->getInput('newsConfigHeight', helper::FILTER_INT,true),
|
'height' => $this->getInput('newsConfigHeight', helper::FILTER_INT,true),
|
||||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
|
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
|
||||||
'hiddeTitle' => $this->getInput('newsThemeTitle',helper::FILTER_BOOLEAN),
|
'hiddeTitle' => $this->getInput('newsThemeTitle',helper::FILTER_BOOLEAN),
|
||||||
|
'hideMedia' => $this->getInput('newsThemeMedia',helper::FILTER_BOOLEAN),
|
||||||
'sameHeight' => $this->getInput('newsThemeSameHeight',helper::FILTER_BOOLEAN),
|
'sameHeight' => $this->getInput('newsThemeSameHeight',helper::FILTER_BOOLEAN),
|
||||||
'noMargin' => $this->getInput('newsThemeNoMargin',helper::FILTER_BOOLEAN)
|
'noMargin' => $this->getInput('newsThemeNoMargin',helper::FILTER_BOOLEAN)
|
||||||
]]);
|
]]);
|
||||||
|
@ -455,25 +456,29 @@ class news extends common {
|
||||||
}
|
}
|
||||||
$arrayContent = array_merge($arrayContent);
|
$arrayContent = array_merge($arrayContent);
|
||||||
$arrayType = array();
|
$arrayType = array();
|
||||||
// Détermination du type I : image ou iframe, P : paragraphe avec balises <p></p>, A : autre
|
// Détermination du type IM : image , IF : iframe, V: video, P : paragraphe avec balises <p></p>, A : autre
|
||||||
foreach($arrayContent as $key=>$value){
|
foreach($arrayContent as $key=>$value){
|
||||||
$arrayType[$key] = 'A';
|
// Type de contenu pour les paragraphes
|
||||||
//Paragraphe avec image ou iframe
|
if( strpos($value, '<img') !== false && strpos($value, '/>') !== false){
|
||||||
if( (strpos($value, '<img') !== false && strpos($value, '/>') !== false) || (strpos($value, '<iframe') !== false && strpos($value, '</iframe>') !== false)){
|
$arrayType[$key] = 'IM';
|
||||||
$arrayType[$key] = 'I';
|
} elseif( strpos($value, '<iframe') !== false && strpos($value, '</iframe>') !== false) {
|
||||||
|
$arrayType[$key] = 'IF';
|
||||||
|
} elseif( strpos($value, '<video') !== false && strpos($value, '</video>') !== false) {
|
||||||
|
$arrayType[$key] = 'V';
|
||||||
|
} elseif( strpos($value, '<figure') !== false && strpos($value, '</figure>') !== false) {
|
||||||
|
$arrayType[$key] = 'F';
|
||||||
|
} elseif( strpos($value, '<p') !== false && strpos($value, '</p>') !== false ){
|
||||||
|
$arrayType[$key] = 'P';
|
||||||
} else {
|
} else {
|
||||||
//Paragraphe simple avec possibilité d'abréviation
|
$arrayType[$key] = 'A';
|
||||||
if( strpos($value, '<p') !== false && strpos($value, '</p>') !== false ){
|
|
||||||
$arrayType[$key] = 'P';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self::$news[$newsIds[$i]]['content'] = '';
|
self::$news[$newsIds[$i]]['content'] = '';
|
||||||
|
$charDisplay = 0; $mediaDisplay=0;
|
||||||
for( $key=0; $key<count($arrayContent); $key++){
|
for( $key=0; $key<count($arrayContent); $key++){
|
||||||
$value = $arrayContent[$key];
|
//Paragraphe avec media autorisé ( img, iframe, video, figure)
|
||||||
$step = 0;
|
if( ($arrayType[$key] === 'IM' || $arrayType[$key] === 'IF' || $arrayType[$key] === 'V' || $arrayType[$key] === 'F' )
|
||||||
//Paragraphe avec image ou iframe
|
&& $mediaDisplay === 0 && $this->getData(['module', $this->getUrl(0), 'config', 'hideMedia']) === false ){
|
||||||
if( $arrayType[$key] === 'I'){
|
|
||||||
// Modification des balises pour supprimer les marges
|
// Modification des balises pour supprimer les marges
|
||||||
if( $this->getData(['module', $this->getUrl(0), 'config', 'noMargin']) === true){
|
if( $this->getData(['module', $this->getUrl(0), 'config', 'noMargin']) === true){
|
||||||
$arrayContent[$key] = str_replace('</p>', '', $arrayContent[$key]);
|
$arrayContent[$key] = str_replace('</p>', '', $arrayContent[$key]);
|
||||||
|
@ -488,30 +493,25 @@ class news extends common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];
|
self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];
|
||||||
|
$mediaDisplay++;
|
||||||
} elseif( $arrayType[$key] === 'P') {
|
} elseif( $arrayType[$key] === 'P') {
|
||||||
//Paragraphe à abréger
|
//Paragraphe à abréger
|
||||||
if ( $this->getData(['module', $this->getUrl(0), 'config', 'height']) !== -1){
|
if ( $this->getData(['module', $this->getUrl(0), 'config', 'height']) !== -1){
|
||||||
// Plusieurs paragraphes se suivent ?
|
$charRemain = $this->getData(['module', $this->getUrl(0), 'config', 'height']) - $charDisplay;
|
||||||
for( $ii = $key + 1; $ii < count($arrayContent); $ii++){
|
if( $charRemain > 0){
|
||||||
if( $arrayType[$ii] === 'P'){
|
if ( strlen( $arrayContent[$key] ) >= $charRemain ) {
|
||||||
$value .= $arrayContent[$ii];
|
// paragraphe trop long à abréger
|
||||||
$step++;
|
$arrayContent[$key] = strip_tags($arrayContent[$key]);
|
||||||
} else break;
|
$arrayContent[$key] = '<p>'.substr( $arrayContent[$key], 0, $charRemain).'</p>';
|
||||||
|
$arrayContent[$key] .= '<p> ... <a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsIds[$i] . '"><span class="newsSuite">'.$text['news_view']['index'][0].'</span></a></p>' ;
|
||||||
|
}
|
||||||
|
self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];
|
||||||
|
$charDisplay = $charDisplay + strlen( strip_tags( $arrayContent[$key]) );
|
||||||
}
|
}
|
||||||
if ( strlen( $value ) >= $this->getData(['module', $this->getUrl(0), 'config', 'height']) ) {
|
} else {
|
||||||
$arrayContent[$key] = substr( $value, 0, $this->getData(['module', $this->getUrl(0), 'config', 'height']));
|
self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];
|
||||||
$lastSpace = strrpos($arrayContent[$key], ' ', -1 );
|
}
|
||||||
$arrayContent[$key] = substr($arrayContent[$key], 0, $lastSpace);
|
}
|
||||||
$arrayContent[$key] = strip_tags($arrayContent[$key], '<p>'). '</p>';
|
|
||||||
$arrayContent[$key] .= '<p> ... <a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsIds[$i] . '"><span class="newsSuite">'.$text['news_view']['index'][0].'</span></a></p>' ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];
|
|
||||||
$key = $key + $step;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise en forme de la signature
|
// Mise en forme de la signature
|
||||||
|
|
|
@ -76,19 +76,25 @@ echo template::formOpen('newsConfig'); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col4">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('newsThemeTitle', true, $text['news_view']['config'][25], [
|
<?php echo template::checkbox('newsThemeTitle', true, $text['news_view']['config'][25], [
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'hiddeTitle']),
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'hiddeTitle']),
|
||||||
'help' => $text['news_view']['config'][24]
|
'help' => $text['news_view']['config'][24]
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col4">
|
<div class="col3">
|
||||||
|
<?php echo template::checkbox('newsThemeMedia', true, $text['news_view']['config'][34], [
|
||||||
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'hideMedia']),
|
||||||
|
'help' => $text['news_view']['config'][35]
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col3">
|
||||||
<?php echo template::checkbox('newsThemeSameHeight', true, $text['news_view']['config'][26], [
|
<?php echo template::checkbox('newsThemeSameHeight', true, $text['news_view']['config'][26], [
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'sameHeight']),
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'sameHeight']),
|
||||||
'help' => $text['news_view']['config'][27]
|
'help' => $text['news_view']['config'][27]
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col4">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('newsThemeNoMargin', true, $text['news_view']['config'][30], [
|
<?php echo template::checkbox('newsThemeNoMargin', true, $text['news_view']['config'][30], [
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'noMargin']),
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'noMargin']),
|
||||||
'help' => $text['news_view']['config'][31]
|
'help' => $text['news_view']['config'][31]
|
||||||
|
|
Loading…
Reference in New Issue