forked from ZwiiCMS-Team/ZwiiCMS
News WIP
This commit is contained in:
parent
c3d95644f0
commit
f159f0b304
@ -1,3 +1,5 @@
|
|||||||
|
# Version 4.4
|
||||||
|
- Intl date Formats
|
||||||
# Version 4.3
|
# Version 4.3
|
||||||
- Multilinguisme
|
- Multilinguisme
|
||||||
# Version 4.23
|
# Version 4.23
|
||||||
|
@ -18,12 +18,14 @@ class news extends common
|
|||||||
|
|
||||||
const VERSION = '4.3';
|
const VERSION = '4.3';
|
||||||
const REALNAME = 'News';
|
const REALNAME = 'News';
|
||||||
const DATADIRECTORY = self::DATA_DIR . 'news/';
|
const DATADIRECTORY = self::DATA_DIR . 'news/';
|
||||||
|
|
||||||
public static $actions = [
|
public static $actions = [
|
||||||
'add' => self::GROUP_MODERATOR,
|
'add' => self::GROUP_MODERATOR,
|
||||||
'config' => self::GROUP_MODERATOR, // Edition des news
|
'config' => self::GROUP_MODERATOR,
|
||||||
'option' => self::GROUP_MODERATOR, // paramétrage des news
|
// Edition des news
|
||||||
|
'option' => self::GROUP_MODERATOR,
|
||||||
|
// paramétrage des news
|
||||||
'delete' => self::GROUP_MODERATOR,
|
'delete' => self::GROUP_MODERATOR,
|
||||||
'edit' => self::GROUP_MODERATOR,
|
'edit' => self::GROUP_MODERATOR,
|
||||||
'index' => self::GROUP_VISITOR,
|
'index' => self::GROUP_VISITOR,
|
||||||
@ -61,24 +63,24 @@ class news extends common
|
|||||||
public static $nbrCol = 1;
|
public static $nbrCol = 1;
|
||||||
|
|
||||||
public static $height = [
|
public static $height = [
|
||||||
-1 => 'Article complet',
|
-1 => 'Article complet',
|
||||||
1000 => '1000 caractères',
|
1000 => '1000 caractères',
|
||||||
800 => '800 caractères',
|
800 => '800 caractères',
|
||||||
600 => '600 caractères',
|
600 => '600 caractères',
|
||||||
400 => '400 caractères',
|
400 => '400 caractères',
|
||||||
200 => '200 caractères',
|
200 => '200 caractères',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $borderWidth = [
|
public static $borderWidth = [
|
||||||
0 => 'Aucune',
|
0 => 'Aucune',
|
||||||
'0.1em' => 'Très fine',
|
'0.1em' => 'Très fine',
|
||||||
'0.15em' => 'Fine',
|
'0.15em' => 'Fine',
|
||||||
'0.2em' => 'Très petite',
|
'0.2em' => 'Très petite',
|
||||||
'0.25em' => 'Petite',
|
'0.25em' => 'Petite',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $borderStyle = [
|
public static $borderStyle = [
|
||||||
'none' => 'Aucune',
|
'none' => 'Aucune',
|
||||||
'solid' => 'Tiret'
|
'solid' => 'Tiret'
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -87,6 +89,25 @@ class news extends common
|
|||||||
// Nombre d'articles dans la page de config:
|
// Nombre d'articles dans la page de config:
|
||||||
public static $itemsperPage = 8;
|
public static $itemsperPage = 8;
|
||||||
|
|
||||||
|
public static $dateFormats = [
|
||||||
|
'%d %B %Y' => 'DD MMMM YYYY',
|
||||||
|
'%d/%m/%Y' => 'DD/MM/YYYY',
|
||||||
|
'%m/%d/%Y' => 'MM/DD/YYYY',
|
||||||
|
'%d/%m/%y' => 'DD/MM/YY',
|
||||||
|
'%m/%d/%y' => 'MM/DD/YY',
|
||||||
|
'%d-%m-%Y' => 'DD-MM-YYYY',
|
||||||
|
'%m-%d-%Y' => 'MM-DD-YYYY',
|
||||||
|
'%d-%m-%y' => 'DD-MM-YY',
|
||||||
|
'%m-%d-%y' => 'MM-DD-YY',
|
||||||
|
];
|
||||||
|
public static $timeFormats = [
|
||||||
|
'%H:%M' => 'HH:MM',
|
||||||
|
'%I:%M %p' => "HH:MM tt",
|
||||||
|
];
|
||||||
|
|
||||||
|
public static $timeFormat = '';
|
||||||
|
public static $dateFormat = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flux RSS
|
* Flux RSS
|
||||||
*/
|
*/
|
||||||
@ -115,11 +136,11 @@ class news extends common
|
|||||||
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();
|
||||||
$author = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'userId']));
|
$author = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'userId']));
|
||||||
$newsArticle->addElementArray([
|
$newsArticle->addElementArray([
|
||||||
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'title']),
|
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'title']),
|
||||||
'link' => helper::baseUrl() . $this->getUrl(0) . '/' . $newsId . '#' . $newsId,
|
'link' => helper::baseUrl() . $this->getUrl(0) . '/' . $newsId . '#' . $newsId,
|
||||||
'description' => $this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'content'])
|
'description' => $this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'content'])
|
||||||
]);
|
]);
|
||||||
$newsArticle->setAuthor($author, 'no@mail.com');
|
$newsArticle->setAuthor($author, 'no@mail.com');
|
||||||
$newsArticle->setId(helper::baseUrl() . $this->getUrl(0) . '/' . $newsId . '#' . $newsId);
|
$newsArticle->setId(helper::baseUrl() . $this->getUrl(0) . '/' . $newsId . '#' . $newsId);
|
||||||
@ -147,14 +168,19 @@ class news extends common
|
|||||||
$newsId = helper::increment($this->getInput('newsAddTitle', helper::FILTER_ID), (array) $this->getData(['module', $this->getUrl(0), 'posts']));
|
$newsId = helper::increment($this->getInput('newsAddTitle', helper::FILTER_ID), (array) $this->getData(['module', $this->getUrl(0), 'posts']));
|
||||||
$publishedOn = $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true);
|
$publishedOn = $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true);
|
||||||
$publishedOff = $this->getInput('newsAddPublishedOff') ? $this->getInput('newsAddPublishedOff', helper::FILTER_DATETIME) : '';
|
$publishedOff = $this->getInput('newsAddPublishedOff') ? $this->getInput('newsAddPublishedOff', helper::FILTER_DATETIME) : '';
|
||||||
$this->setData(['module', $this->getUrl(0), 'posts', $newsId, [
|
$this->setData([
|
||||||
'content' => $this->getInput('newsAddContent', null),
|
'module', $this->getUrl(0),
|
||||||
'publishedOn' => $publishedOn,
|
'posts',
|
||||||
'publishedOff' => $publishedOff,
|
$newsId,
|
||||||
'state' => $this->getInput('newsAddState', helper::FILTER_BOOLEAN),
|
[
|
||||||
'title' => $this->getInput('newsAddTitle', helper::FILTER_STRING_SHORT, true),
|
'content' => $this->getInput('newsAddContent', null),
|
||||||
'userId' => $this->getInput('newsAddUserId', helper::FILTER_ID, true)
|
'publishedOn' => $publishedOn,
|
||||||
]]);
|
'publishedOff' => $publishedOff,
|
||||||
|
'state' => $this->getInput('newsAddState', helper::FILTER_BOOLEAN),
|
||||||
|
'title' => $this->getInput('newsAddTitle', helper::FILTER_STRING_SHORT, true),
|
||||||
|
'userId' => $this->getInput('newsAddUserId', helper::FILTER_ID, true)
|
||||||
|
]
|
||||||
|
]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||||
@ -195,12 +221,15 @@ class news extends common
|
|||||||
$pagination = helper::pagination($newsIds, $this->getUrl(), self::$itemsperPage);
|
$pagination = helper::pagination($newsIds, $this->getUrl(), self::$itemsperPage);
|
||||||
// Liste des pages
|
// Liste des pages
|
||||||
self::$pages = $pagination['pages'];
|
self::$pages = $pagination['pages'];
|
||||||
|
// Format de temps
|
||||||
|
self::$dateFormat = $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']);
|
||||||
|
self::$timeFormat = $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']);
|
||||||
// News en fonction de la pagination
|
// News en fonction de la pagination
|
||||||
for ($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
for ($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||||
// Met en forme le tableau
|
// Met en forme le tableau
|
||||||
$dateOn = helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn']));
|
$dateOn = helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn'])) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn']));
|
||||||
if ($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff'])) {
|
if ($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff'])) {
|
||||||
$dateOff = helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff'])) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff']));
|
$dateOff = helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff'])) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff']));
|
||||||
} else {
|
} else {
|
||||||
$dateOff = 'Permanent';
|
$dateOff = 'Permanent';
|
||||||
}
|
}
|
||||||
@ -236,9 +265,9 @@ class news extends common
|
|||||||
if ($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
|
|
||||||
// Générer la feuille de CSS
|
// Générer la feuille de CSS
|
||||||
$style = '.newsFrame {';
|
$style = '.newsFrame {';
|
||||||
$style .= 'border-right:' . $this->getInput('newsThemeBorderStyle', helper::FILTER_STRING_SHORT) . ' ' . $this->getInput('newsThemeBorderColor') . ' ' . $this->getInput('newsThemeBorderWidth', helper::FILTER_STRING_SHORT) . ';';
|
$style .= 'border-right:' . $this->getInput('newsThemeBorderStyle', helper::FILTER_STRING_SHORT) . ' ' . $this->getInput('newsThemeBorderColor') . ' ' . $this->getInput('newsThemeBorderWidth', helper::FILTER_STRING_SHORT) . ';';
|
||||||
$style .= 'border-left:' . $this->getInput('newsThemeBorderStyle', helper::FILTER_STRING_SHORT) . ' ' . $this->getInput('newsThemeBorderColor') . ' ' . $this->getInput('newsThemeBorderWidth', helper::FILTER_STRING_SHORT) . ';';
|
$style .= 'border-left:' . $this->getInput('newsThemeBorderStyle', helper::FILTER_STRING_SHORT) . ' ' . $this->getInput('newsThemeBorderColor') . ' ' . $this->getInput('newsThemeBorderWidth', helper::FILTER_STRING_SHORT) . ';';
|
||||||
$style .= 'background-color:' . $this->getInput('newsThemeBackgroundColor') . ';';
|
$style .= 'background-color:' . $this->getInput('newsThemeBackgroundColor') . ';';
|
||||||
$style .= '}';
|
$style .= '}';
|
||||||
|
|
||||||
@ -251,22 +280,32 @@ class news extends common
|
|||||||
|
|
||||||
// Fin feuille de style
|
// Fin feuille de style
|
||||||
|
|
||||||
$this->setData(['module', $this->getUrl(0), 'theme', [
|
$this->setData([
|
||||||
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '',
|
'module', $this->getUrl(0),
|
||||||
'borderStyle' => $this->getInput('newsThemeBorderStyle', helper::FILTER_STRING_SHORT),
|
'theme',
|
||||||
'borderColor' => $this->getInput('newsThemeBorderColor'),
|
[
|
||||||
'borderWidth' => $this->getInput('newsThemeBorderWidth', helper::FILTER_STRING_SHORT),
|
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '',
|
||||||
'backgroundColor' => $this->getInput('newsThemeBackgroundColor')
|
'borderStyle' => $this->getInput('newsThemeBorderStyle', helper::FILTER_STRING_SHORT),
|
||||||
]]);
|
'borderColor' => $this->getInput('newsThemeBorderColor'),
|
||||||
|
'borderWidth' => $this->getInput('newsThemeBorderWidth', helper::FILTER_STRING_SHORT),
|
||||||
|
'backgroundColor' => $this->getInput('newsThemeBackgroundColor')
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', [
|
$this->setData([
|
||||||
'feeds' => $this->getInput('newsOptionShowFeeds', helper::FILTER_BOOLEAN),
|
'module', $this->getUrl(0),
|
||||||
'feedsLabel' => $this->getInput('newsOptionFeedslabel', helper::FILTER_STRING_SHORT),
|
'config',
|
||||||
'itemsperPage' => $this->getInput('newsOptionItemsperPage', helper::FILTER_INT, true),
|
[
|
||||||
'itemsperCol' => $this->getInput('newsOptionItemsperCol', helper::FILTER_INT, true),
|
'feeds' => $this->getInput('newsOptionShowFeeds', helper::FILTER_BOOLEAN),
|
||||||
'height' => $this->getInput('newsOptionHeight', helper::FILTER_INT, true),
|
'feedsLabel' => $this->getInput('newsOptionFeedslabel', helper::FILTER_STRING_SHORT),
|
||||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
'itemsperPage' => $this->getInput('newsOptionItemsperPage', helper::FILTER_INT, true),
|
||||||
]]);
|
'itemsperCol' => $this->getInput('newsOptionItemsperCol', helper::FILTER_INT, true),
|
||||||
|
'height' => $this->getInput('newsOptionHeight', helper::FILTER_INT, true),
|
||||||
|
'dateFormat' => $this->getInput('newsOptionDateFormat'),
|
||||||
|
'timeFormat' => $this->getInput('newsOptionTimeFormat'),
|
||||||
|
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
@ -334,7 +373,7 @@ class news extends common
|
|||||||
elseif ($this->getUrl(3) !== $_SESSION['csrf']) {
|
elseif ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||||
'notification' => helper::translate('Action interdite')
|
'notification' => helper::translate('Action interdite')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -384,14 +423,19 @@ class news extends common
|
|||||||
}
|
}
|
||||||
$publishedOn = $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true);
|
$publishedOn = $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true);
|
||||||
$publishedOff = $this->getInput('newsEditPublishedOff') ? $this->getInput('newsEditPublishedOff', helper::FILTER_DATETIME) : '';
|
$publishedOff = $this->getInput('newsEditPublishedOff') ? $this->getInput('newsEditPublishedOff', helper::FILTER_DATETIME) : '';
|
||||||
$this->setData(['module', $this->getUrl(0), 'posts', $newsId, [
|
$this->setData([
|
||||||
'content' => $this->getInput('newsEditContent', null),
|
'module', $this->getUrl(0),
|
||||||
'publishedOn' => $publishedOn,
|
'posts',
|
||||||
'publishedOff' => $publishedOff < $publishedOn ? '' : $publishedOff,
|
$newsId,
|
||||||
'state' => $this->getInput('newsEditState', helper::FILTER_BOOLEAN),
|
[
|
||||||
'title' => $this->getInput('newsEditTitle', helper::FILTER_STRING_SHORT, true),
|
'content' => $this->getInput('newsEditContent', null),
|
||||||
'userId' => $this->getInput('newsEditUserId', helper::FILTER_ID, true)
|
'publishedOn' => $publishedOn,
|
||||||
]]);
|
'publishedOff' => $publishedOff < $publishedOn ? '' : $publishedOff,
|
||||||
|
'state' => $this->getInput('newsEditState', helper::FILTER_BOOLEAN),
|
||||||
|
'title' => $this->getInput('newsEditTitle', helper::FILTER_STRING_SHORT, true),
|
||||||
|
'userId' => $this->getInput('newsEditUserId', helper::FILTER_ID, true)
|
||||||
|
]
|
||||||
|
]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||||
@ -442,11 +486,11 @@ class news extends common
|
|||||||
}
|
}
|
||||||
// L'article existe
|
// L'article existe
|
||||||
else {
|
else {
|
||||||
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'showBarEditButton' => true,
|
'showBarEditButton' => true,
|
||||||
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']),
|
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']),
|
||||||
'view' => 'article'
|
'view' => 'article'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -461,7 +505,7 @@ class news extends common
|
|||||||
if (
|
if (
|
||||||
$newsPublishedOn <= time() and
|
$newsPublishedOn <= time() and
|
||||||
$newsIdsStates[$newsId] and
|
$newsIdsStates[$newsId] and
|
||||||
// date de péremption tenant des champs non définis
|
// date de péremption tenant des champs non définis
|
||||||
(!is_integer($newsIdsPublishedOff) or
|
(!is_integer($newsIdsPublishedOff) or
|
||||||
$newsIdsPublishedOff > time()
|
$newsIdsPublishedOff > time()
|
||||||
)
|
)
|
||||||
@ -487,7 +531,7 @@ class news extends common
|
|||||||
$content = substr($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'content']), 0, $this->getData(['module', $this->getUrl(0), 'config', 'height']));
|
$content = substr($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'content']), 0, $this->getData(['module', $this->getUrl(0), 'config', 'height']));
|
||||||
// Ne pas couper un mot
|
// Ne pas couper un mot
|
||||||
$lastSpace = strrpos($content, ' ', -1);
|
$lastSpace = strrpos($content, ' ', -1);
|
||||||
self::$news[$newsIds[$i]]['content'] = substr(strip_tags($content, '<br><p><img>'), 0, $lastSpace);
|
self::$news[$newsIds[$i]]['content'] = substr(strip_tags($content, '<br><p><img>'), 0, $lastSpace);
|
||||||
}
|
}
|
||||||
// Mise en forme de la signature
|
// Mise en forme de la signature
|
||||||
self::$news[$newsIds[$i]]['userId'] = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'userId']));
|
self::$news[$newsIds[$i]]['userId'] = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'userId']));
|
||||||
@ -498,8 +542,8 @@ class news extends common
|
|||||||
'showPageContent' => true,
|
'showPageContent' => true,
|
||||||
'view' => 'index',
|
'view' => 'index',
|
||||||
'style' => file_exists($this->getData(['module', $this->getUrl(0), 'theme', 'style']))
|
'style' => file_exists($this->getData(['module', $this->getUrl(0), 'theme', 'style']))
|
||||||
? $this->getData(['module', $this->getUrl(0), 'theme', 'style'])
|
? $this->getData(['module', $this->getUrl(0), 'theme', 'style'])
|
||||||
: ''
|
: ''
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -538,7 +582,7 @@ class news extends common
|
|||||||
if (
|
if (
|
||||||
$this->getData(['module', $this->getUrl(0), 'config']) === NULL
|
$this->getData(['module', $this->getUrl(0), 'config']) === NULL
|
||||||
|| $this->getData(['module', $this->getUrl(0), 'theme']) === NULL
|
|| $this->getData(['module', $this->getUrl(0), 'theme']) === NULL
|
||||||
|| !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')
|
|| !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')
|
||||||
) {
|
) {
|
||||||
$this->init();
|
$this->init();
|
||||||
}
|
}
|
||||||
@ -562,7 +606,7 @@ class news extends common
|
|||||||
// Mettre à jour la version
|
// Mettre à jour la version
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.3']);
|
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.3']);
|
||||||
}
|
}
|
||||||
// Mise à jour 3.4
|
// Mise à jour 4.4
|
||||||
if (version_compare($versionData, '3.4', '<')) {
|
if (version_compare($versionData, '3.4', '<')) {
|
||||||
// Effacer le style précédent
|
// Effacer le style précédent
|
||||||
unlink(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css');
|
unlink(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css');
|
||||||
@ -572,6 +616,14 @@ class news extends common
|
|||||||
// Mettre à jour la version
|
// Mettre à jour la version
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.4']);
|
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.4']);
|
||||||
}
|
}
|
||||||
|
// Mise à jour 3.4
|
||||||
|
if (version_compare($versionData, '4.4', '<')) {
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config', 'dateFormat', '%d %B %Y']);
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config', 'timeFormat', '%H:%M']);
|
||||||
|
// Mettre à jour la version
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.4']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -590,7 +642,7 @@ class news extends common
|
|||||||
if ($this->getData(['module', $this->getUrl(0), 'theme']) === null) {
|
if ($this->getData(['module', $this->getUrl(0), 'theme']) === null) {
|
||||||
// Données de thème
|
// Données de thème
|
||||||
$this->setData(['module', $this->getUrl(0), 'theme', init::$defaultTheme]);
|
$this->setData(['module', $this->getUrl(0), 'theme', init::$defaultTheme]);
|
||||||
$this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']);
|
$this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dossier de l'instance
|
// Dossier de l'instance
|
||||||
@ -599,17 +651,17 @@ class news extends common
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check la présence de la feuille de style
|
// Check la présence de la feuille de style
|
||||||
if (!file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) {
|
if (!file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) {
|
||||||
// Générer la feuille de CSS
|
// Générer la feuille de CSS
|
||||||
$style = '.newsFrame {';
|
$style = '.newsFrame {';
|
||||||
$style .= 'border:' . $this->getData(['module', $this->getUrl(0), 'theme', 'borderStyle']) . ' ' . $this->getData(['module', $this->getUrl(0), 'theme', 'borderColor']) . ' ' . $this->getData(['module', $this->getUrl(0), 'theme', 'borderWidth']) . ';';
|
$style .= 'border:' . $this->getData(['module', $this->getUrl(0), 'theme', 'borderStyle']) . ' ' . $this->getData(['module', $this->getUrl(0), 'theme', 'borderColor']) . ' ' . $this->getData(['module', $this->getUrl(0), 'theme', 'borderWidth']) . ';';
|
||||||
$style .= 'background-color:' . $this->getData(['module', $this->getUrl(0), 'theme', 'backgroundColor']) . ';';
|
$style .= 'background-color:' . $this->getData(['module', $this->getUrl(0), 'theme', 'backgroundColor']) . ';';
|
||||||
$style .= '}';
|
$style .= '}';
|
||||||
|
|
||||||
// Sauver la feuille de style
|
// Sauver la feuille de style
|
||||||
file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $style);
|
file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $style);
|
||||||
// Stocker le nom de la feuille de style
|
// Stocker le nom de la feuille de style
|
||||||
$this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']);
|
$this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,7 +6,9 @@ class init extends news {
|
|||||||
'itemsperPage' => 8,
|
'itemsperPage' => 8,
|
||||||
'itemsperCol' => 12,
|
'itemsperCol' => 12,
|
||||||
'height' => -1,
|
'height' => -1,
|
||||||
'versionData' => '3.4'
|
'versionData' => '3.5',
|
||||||
|
'dateFormat' => '%d %B %Y',
|
||||||
|
'timeFormat' =>'%H:%M',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $defaultTheme = [
|
public static $defaultTheme = [
|
||||||
|
@ -14,7 +14,39 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>Paramètres du module</h4>
|
<h4><?php echo helper::translate('Paramètres'); ?></h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col2">
|
||||||
|
<?php echo template::select('newsOptionItemsperCol', $module::$columns, [
|
||||||
|
'label' => 'Nombre de colonnes',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col2">
|
||||||
|
<?php echo template::select('newsOptionItemsperPage', $module::$itemsList, [
|
||||||
|
'label' => 'Articles par page',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col2">
|
||||||
|
<?php echo template::select('newsOptionHeight', $module::$height, [
|
||||||
|
'label' => 'Abrégé de l\'article',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col3">
|
||||||
|
<?php echo template::select('newsOptionDateFormat', $module::$dateFormats, [
|
||||||
|
'label' => 'Format des dates',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col3">
|
||||||
|
<?php echo template::select('newsOptionTimeFormat', $module::$timeFormats, [
|
||||||
|
'label' => 'Format des heures',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col6">
|
<div class="col6">
|
||||||
<?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [
|
<?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [
|
||||||
@ -29,33 +61,13 @@
|
|||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col4">
|
|
||||||
<?php echo template::select('newsOptionItemsperCol', $module::$columns, [
|
|
||||||
'label' => 'Nombre de colonnes',
|
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col4">
|
|
||||||
<?php echo template::select('newsOptionItemsperPage', $module::$itemsList, [
|
|
||||||
'label' => 'Articles par page',
|
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col4">
|
|
||||||
<?php echo template::select('newsOptionHeight', $module::$height, [
|
|
||||||
'label' => 'Abrégé de l\'article',
|
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>Thème du module</h4>
|
<h4><?php echo helper::translate('Thème');?></h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
|
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
|
||||||
|
Loading…
Reference in New Issue
Block a user