Compare commits

...

26 Commits

Author SHA1 Message Date
20c09d8b0a 1.14.04 Fix methode name usersReportExport 2024-10-21 21:20:09 +02:00
4c88d7a71d Revert "Fix bug parametre de langue inutile dans RFM"
This reverts commit 889e2754fc.
2024-10-20 16:13:29 +02:00
bb9b8b086f 1.14.03 et non 1.14.04 2024-10-20 16:10:04 +02:00
61752a9a51 Optimisation récupérationstatistiques individuelle, la méthode getReports peut retourner les stats d'un utilisateur 2024-10-20 16:07:58 +02:00
889e2754fc Fix bug parametre de langue inutile dans RFM 2024-10-20 16:06:56 +02:00
77b241c69f 1.14.04 TEST Empêche qu'un espace réservé aux membres ne reste ouvert après une déconnexion de la session 2024-10-17 10:40:50 +02:00
442b84a99d Commente un test de validation de la consultation d'un espace 2024-10-16 12:27:32 +02:00
09f9f6bdd6 Optimisation setData 2024-10-12 11:16:44 +02:00
5eace20e26 Fix position d'un bouton 2024-10-12 11:10:58 +02:00
18df3848f8 Update Blog and News 2024-10-12 11:02:08 +02:00
7b9d145533 supprime console.log 2024-10-12 08:15:54 +02:00
75ad5853cf 1.14.03 fix subword 2024-10-10 19:59:53 +02:00
7862815f1f 1.14.02 Module blog bug de présentation, version 7.12 2024-10-08 15:23:51 +02:00
a87d439282 fix update store 2024-10-03 12:01:59 +02:00
509c1d6365 Bug de changement de mot de passe 2024-10-02 19:00:05 +02:00
e641ec1c03 Fix module checkup 2024-10-02 12:40:51 +02:00
3dec8a8ce5 Points virgules !! 2024-10-02 12:18:36 +02:00
54f0b0c6e3 redondance de déclaration de charset 2024-10-02 12:12:52 +02:00
931e59db2e Merge branch 'master' of https://forge.chapril.org/ZwiiCMS-Team/ZwiiCampus 2024-10-02 11:54:16 +02:00
cae0e6c8fb fix reset password key check 2024-10-02 11:54:11 +02:00
afee77b1e7 fix reset password key check 2024-10-02 11:50:19 +02:00
cf8963248e Merge branch 'reste_user_message' of https://forge.chapril.org/ZwiiCMS-Team/ZwiiCampus into reste_user_message 2024-10-02 07:56:09 +02:00
22af8ac751 message rest password 2024-10-02 07:56:04 +02:00
2d4385f038 :q 2024-10-02 07:52:40 +02:00
c4bb124bea Init 2024-09-30 19:22:08 +02:00
a474a41402 init 2024-09-30 18:50:31 +02:00
34 changed files with 610 additions and 292 deletions

View File

@ -1,4 +1,4 @@
# ZwiiCampus 1.13.00
# ZwiiCampus 1.14.00
ZwiiCampus (Learning Management System) est logiciel auteur destiné à mettre en ligne des tutoriels. Il dispose de plusieurs modalités d'ouverture et d'accès des contenus. Basé sur la version 13 du CMS Zwii, la structure logicielle est solide, le framework de Zwii est éprouvé.

View File

@ -673,10 +673,30 @@ class helper
public static function subword($text, $start, $length)
{
$text = trim($text);
if (strlen($text) > $length) {
// Vérifier si la longueur du texte sans les balises dépasse la longueur souhaitée
if (mb_strlen(strip_tags($text)) > $length) {
// Utiliser mb_substr pour couper le texte
$text = mb_substr($text, $start, $length);
$text = mb_substr($text, 0, min(mb_strlen($text), mb_strrpos($text, ' ')));
// S'assurer que le texte ne se termine pas au milieu d'un mot
$lastSpace = mb_strrpos($text, ' ');
if ($lastSpace !== false) {
$text = mb_substr($text, 0, $lastSpace);
}
// Fermer les balises HTML ouvertes
$dom = new DOMDocument();
@$dom->loadHTML('<div>' . $text . '</div>', LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$text = $dom->saveHTML();
// Retirer la balise de conteneur ajoutée
$text = preg_replace('~^<div>(.*)</div>$~s', '$1', $text);
// Ajouter des points de suspension si le texte a été coupé
$text .= '...';
}
return $text;
}

View File

@ -1123,20 +1123,23 @@ class layout extends common
) {
$this->setData(['core', 'updateAvailable', true], false);
}
// Modules installés
$infoModules = helper::getModules();
// Recherche de mise à jour des modules
$store = plugin::getStore();
if (is_array($store)) {
// Modules installés
$infoModules = helper::getModules();
// Clés moduleIds dans les pages
$inPages = helper::arrayColumn($this->getData(['page']), 'moduleId', 'SORT_DESC');
// Parcourir les données des modules
// Parcourir les données des modules du store
foreach ($store as $key => $value) {
if (empty($key)) {
continue;
}
// Mise à jour d'un module
if (array_key_exists($key, $infoModules) === true) {
// Le module est installé et une mise à jour est en ligne
if (
isset($infoModules[$key])
&&
version_compare($infoModules[$key]['version'], $value['version'], '<')
) {
$this->setData(['core', 'updateModuleAvailable', true], false);
}
}

View File

@ -503,6 +503,22 @@ class core extends common
) {
$access = false;
}
/** Empêche la consultation d'un espace laissé ouvert après la déconnexion et redirige vers home
* L'utilisateur n'est pas connecté
* ET l'accueil n'est pas affiché
* ET l'espace affiché nécessite un compte d'accès, enrolment vaut 1,2 ou 3
* */
if (
$this->isConnected() === false
and self::$siteContent !== 'home'
and $this->getData(['course', self::$siteContent, 'enrolment']) > 0
) {
$_SESSION['ZWII_SITE_CONTENT'] = 'home';
header(header: 'Location:' . helper::baseUrl(true) . 'swap/' . self::$siteContent);
exit();
}
}
/**

View File

@ -51,7 +51,7 @@ class common
const ACCESS_TIMER = 1800;
// Numéro de version
const ZWII_VERSION = '1.13.00';
const ZWII_VERSION = '1.14.04';
// URL autoupdate
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';
@ -320,12 +320,31 @@ class common
public function __construct()
{
// Construct cache
if (isset($GLOBALS['common_construct'])) {
$this->input['_POST'] = $GLOBALS['common_construct']['input']['_POST'];
$this->input['_COOKIE'] = $GLOBALS['common_construct']['input']['_COOKIE'];
self::$siteContent = $GLOBALS['common_construct']['siteContent'];
$this->dataFiles = $GLOBALS['common_construct']['dataFiles'];
$this->configFiles = $GLOBALS['common_construct']['configFiles'];
$this->user = $GLOBALS['common_construct']['user'];
self::$i18nUI = $GLOBALS['common_construct']['i18nUI'];
$this->hierarchy = $GLOBALS['common_construct']['hierarchy'];
$this->url = $GLOBALS['common_construct']['url'];
self::$dialog = $GLOBALS['common_construct']['dialog'];
return;
}
// Extraction des données http
if (isset($_POST)) {
$this->input['_POST'] = $_POST;
// Cache
$GLOBALS['common_construct']['input']['_POST'] = $this->input['_POST'];
}
if (isset($_COOKIE)) {
$this->input['_COOKIE'] = $_COOKIE;
// Cache
$GLOBALS['common_construct']['input']['_COOKIE'] = $this->input['_COOKIE'];
}
// Déterminer le contenu du site
@ -336,16 +355,23 @@ class common
$_SESSION['ZWII_SITE_CONTENT'] = 'home';
self::$siteContent = 'home';
}
// Cache
$GLOBALS['common_construct']['siteContent'] = self::$siteContent;
// Instanciation de la classe des entrées / sorties
// Les fichiers de configuration
foreach ($this->configFiles as $module => $value) {
$this->initDB($module);
}
// Cache
$GLOBALS['common_construct']['configFiles'] = $this->configFiles;
// Les fichiers des contenus
foreach ($this->contentFiles as $module => $value) {
$this->initDB($module, self::$siteContent);
}
// Cache
$GLOBALS['common_construct']['dataFiles'] = $this->dataFiles;
// Installation fraîche, initialisation de la configuration inexistante
// Nécessaire pour le constructeur
@ -371,6 +397,8 @@ class common
if ($this->user === []) {
$this->user = $this->getData(['user', $this->getInput('ZWII_USER_ID')]);
}
// Cache
$GLOBALS['common_construct']['user'] = $this->user;
// Langue de l'administration si le user est connecté
if ($this->getData(['user', $this->getUser('id'), 'language'])) {
@ -395,11 +423,15 @@ class common
// Stocker l'courseId pour le thème de TinyMCE
//setcookie('ZWII_SITE_CONTENT', self::$siteContent, time() + 3600, '', '', false, false);
setlocale(LC_ALL, self::$i18nUI);
// Cache
$GLOBALS['common_construct']['i18nUI'] = self::$i18nUI;
// Construit la liste des pages parents/enfants
if ($this->hierarchy['all'] === []) {
$this->buildHierarchy();
}
// Cache
$GLOBALS['common_construct']['hierarchy'] = $this->hierarchy;
// Construit l'url
if ($this->url === '') {
@ -409,6 +441,8 @@ class common
$this->url = $this->homePageId();
}
}
// Cache
$GLOBALS['common_construct']['url'] = $this->url;
// Chargement des dialogues
if (!file_exists(self::I18N_DIR . self::$i18nUI . '.json')) {
@ -428,6 +462,8 @@ class common
self::$dialog = array_merge(self::$dialog, $d);
}
}
// Cache
$GLOBALS['common_construct']['dialog'] = self::$dialog;
// Données de proxy
$proxy = $this->getData(['config', 'proxyType']) . $this->getData(['config', 'proxyUrl']) . ':' . $this->getData(['config', 'proxyPort']);
@ -451,7 +487,7 @@ class common
}
// Mise à jour des données core
include ('core/include/update.inc.php');
include('core/include/update.inc.php');
}
@ -511,44 +547,44 @@ class common
return is_object($success);
}
/**
* Sauvegarde des données
* @param array $keys Clé(s) des données
* @param bool $save Indique si le fichier doit être sauvegardé après modification (par défaut true)
* @return bool Succès de l'opération
*/
public function setData($keys = [], $save = true)
{
// Pas d'enregistrement lorsqu'une notice est présente ou tableau transmis vide
if (
!empty(self::$inputNotices)
or empty($keys)
) {
return false;
}
// Empêcher la sauvegarde d'une donnée nulle.
if (gettype($keys[count($keys) - 1]) === NULL) {
return false;
}
// Initialisation du retour en cas d'erreur de descripteur
$success = false;
// Construire la requête dans la base inf à 1 retourner toute la base
if (count($keys) >= 1) {
// Descripteur de la base
$db = $this->dataFiles[$keys[0]];
$query = $keys[0];
// Construire la requête
// Ne pas tenir compte du dernier élément qui une une value donc <
for ($i = 1; $i < count($keys) - 1; $i++) {
$query .= '.' . $keys[$i];
/**
* Sauvegarde des données
* @param array $keys Clé(s) des données
* @param bool $save Indique si le fichier doit être sauvegardé après modification (par défaut true)
* @return bool Succès de l'opération
*/
public function setData($keys = [], $save = true)
{
// Pas d'enregistrement lorsqu'une notice est présente ou tableau transmis vide
if (
!empty(self::$inputNotices)
or empty($keys)
) {
return false;
}
// Appliquer la modification, le dernier élément étant la donnée à sauvegarder
$success = is_object($db->set($query, $keys[count($keys) - 1], $save));
// Empêcher la sauvegarde d'une donnée nulle.
if (gettype($keys[count($keys) - 1]) === NULL) {
return false;
}
// Initialisation du retour en cas d'erreur de descripteur
$success = false;
// Construire la requête dans la base inf à 1 retourner toute la base
if (count($keys) >= 1) {
// Descripteur de la base
$db = $this->dataFiles[$keys[0]];
$query = $keys[0];
// Construire la requête
// Ne pas tenir compte du dernier élément qui une une value donc <
for ($i = 1; $i < count($keys) - 1; $i++) {
$query .= '.' . $keys[$i];
}
// Appliquer la modification, le dernier élément étant la donnée à sauvegarder
$success = is_object($db->set($query, $keys[count($keys) - 1], $save));
}
return $success;
}
return $success;
}
/**
@ -639,7 +675,7 @@ public function setData($keys = [], $save = true)
$write_result = file_put_contents($filename, $data, LOCK_EX | $flags);
// $now = \DateTime::createFromFormat('U.u', microtime(true));
// file_put_contents("tmplog.txt", '[SecurePut][' . $now->format('H:i:s.u') . ']' . "\r\n", FILE_APPEND);
// file_put_contents("tmplog.txt", '[SecurePut][' . $now->format('H:i:s.u') . ']' . "\r\n", FILE_APPEND);
// Vérifie si l'écriture a réussi
if ($write_result !== false && $write_result === $data_length) {
@ -665,12 +701,12 @@ public function setData($keys = [], $save = true)
'backup' => file_exists('site/data/.backup'),
'update' => false,
];
// Instanciation de l'objet et stockage dans dataFiles
$this->dataFiles[$module] = new \Prowebcraft\JsonDb($config);
}
/**
* Cette fonction est liée à saveData
@ -679,7 +715,7 @@ public function setData($keys = [], $save = true)
*/
public function saveDB($module): void
{
$db = $this->dataFiles[$module];
$db = $this->dataFiles[$module];
$db->save();
}
@ -695,7 +731,7 @@ public function setData($keys = [], $save = true)
{
// Tableau avec les données vierges
require_once ('core/module/install/ressource/defaultdata.php');
require_once('core/module/install/ressource/defaultdata.php');
// L'arborescence
if (!file_exists(self::DATA_DIR . $path)) {
@ -730,7 +766,7 @@ public function setData($keys = [], $save = true)
public function saveConfig($module)
{
// Tableau avec les données vierges
require_once ('core/module/install/ressource/defaultdata.php');
require_once('core/module/install/ressource/defaultdata.php');
// Installation des données des autres modules cad theme profil font config, admin et core
$this->setData([$module, init::$defaultData[$module]]);
common::$coreNotices[] = $module;
@ -1036,9 +1072,10 @@ public function setData($keys = [], $save = true)
/**
* @return bool l'utilisateur est connecté true sinon false
*/
public function isConnected() {
return (
*/
public function isConnected()
{
return (
!empty($this->getUser('authKey'))
&&
$this->getUser('authKey') === $this->getInput('ZWII_AUTH_KEY'));

View File

@ -2,7 +2,7 @@
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type" content="text/html;">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php $layout->showMetaTitle(); ?>
<?php $layout->showMetaDescription(); ?>

View File

@ -2,7 +2,7 @@
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type" content="text/html;">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php $layout->showMetaTitle(); ?>
<?php $layout->showMetaDescription(); ?>

View File

@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr_FR">
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type" content="text/html;">
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="x-apple-disable-message-reformatting">

View File

@ -2,7 +2,7 @@
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type" content="text/html;">
<meta meta="description=" content="ZwiiCMS le CMS multilingue sans base de données">
<meta name="generator" content="ZiiCMS https://forge.chapril.org/ZwiiCMS-Team/ZwiiCMS">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -669,17 +669,12 @@ class course extends common
// Liste des pages contenues dans cet espace et exclure les barres et les pages masquées
$sumPages = 0;
$pages = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true);
$pages = $pages['page'];
foreach ($pages as $pageId => $pageData) {
if ($pageData['position'] > 0) {
$sumPages++;
}
}
$sumPages = $this->countPages($pages['page']);
// Liste des inscrits dans le contenu sélectionné.
$users = $this->getData(['enrolment', $courseId]);
// Obtient les statistiques de l'ensemble de la cohorte
$reports = $this->getReport($courseId);
if (is_array($users)) {
@ -802,7 +797,7 @@ class course extends common
}
}
// Sauvegarde la base manuellement
$this->saveDB('enrolment');
$this->saveDB('enrolment');
}
// Liste des groupes et des profils
@ -2024,7 +2019,7 @@ class course extends common
/**
* Autorise l'accès à un contenu
* @param @return bool le user a le droit d'entrée dans le contenu
* @return bool le user a le droit d'entrée dans le contenu
* @param string $courseId identifiant du contenu sollicité
*/
public function courseIsAvailable($courseId)
@ -2052,17 +2047,23 @@ class course extends common
time() <= $this->getData(['course', $courseId, 'closingDate'])
);
case self::COURSE_ACCESS_CLOSE:
default:
return false;
}
}
/**
*
* Compte les pages d'un espace
* @param mixed $array Tableau des pages de l'espace
* @return int Nombre de pages
*/
private function countPages($array)
{
$count = 0;
foreach ($array as $key => $value) {
$count++; // Incrémente le compteur pour chaque clé associative trouvée
if (is_array($value)) {
$count += $this->countPages($value); // Appelle récursivement la fonction si la valeur est un tableau
foreach ($array as $pageId => $pageData) {
if ($pageData['position'] > 0) {
$count++;
}
}
return $count;
@ -2082,7 +2083,7 @@ class course extends common
/**
* Autorise l'accès à un contenu
* @param @return bool le user a le droit d'entrée dans le contenu
* @return bool le user a le droit d'entrée dans le contenu
* @param string $userId identifiant de l'utilisateur
* @param string $courseId identifiant du contenu sollicité
*/
@ -2115,7 +2116,7 @@ class course extends common
/**
* Lit le contenu des fichiers de traces au format CS et renvoie un tableau associatif
*/
private function getReport($courseId, $userId = null)
public function getReport($courseId, $userId = null)
{
$data = [];
@ -2131,14 +2132,19 @@ class course extends common
$pageId = $line[1];
$timestamp = $line[2];
// Filtre userId
// if (!is_null($userId) && $name === $userId) {
if (
is_null($userId) === false
&& $name !== $userId
) {
continue;
}
// Initialiser le tableau si nécessaire
if (!isset($data[$name][$pageId])) {
$data[$name][$pageId] = array();
}
// Ajouter le timestamp
$data[$name][$pageId][] = $timestamp;
//}
}
// Fermer le fichier
@ -2155,6 +2161,4 @@ class course extends common
// Afficher le JSON;
return $data;
}
}

View File

@ -8,7 +8,7 @@
</div>
<div class="col1 offset10">
<?php echo template::button('userDeleteAll', [
'href' => helper::baseUrl() . 'course/userHistoryExport/' . $this->getUrl(2) . '/' . $this->getUrl(3),
'href' => helper::baseUrl() . 'course/userReportExport/' . $this->getUrl(2) . '/' . $this->getUrl(3),
'value' => template::ico('download'),
'help' => 'Exporter',
]) ?>

View File

@ -8,7 +8,7 @@
</div>
<div class="col1 offset8">
<?php echo template::button('userDeleteAll', [
'href' => helper::baseUrl() . 'course/usersHistoryExport/' . $this->getUrl(2),
'href' => helper::baseUrl() . 'course/usersReportExport/' . $this->getUrl(2),
'value' => template::ico('download'),
'help' => 'Exporter',
]) ?>

View File

@ -246,7 +246,7 @@ class init extends common
'manage' => false,
'users' => false,
'userHistory' => false,
'userHistoryExport' => false,
'userReportExport' => false,
'usersAdd' => false,
'userDelete' => false,
'usersDelete' => false,
@ -343,7 +343,7 @@ class init extends common
'manage' => false,
'users' => false,
'userHistory' => false,
'userHistoryExport' => false,
'userReportExport' => false,
'usersAdd' => false,
'userDelete' => false,
'usersDelete' => false,
@ -445,7 +445,7 @@ class init extends common
'manage' => true,
'users' => true,
'userHistory' => true,
'userHistoryExport' => true,
'userReportExport' => true,
'usersAdd' => true,
'userDelete' => false,
'usersDelete' => false,
@ -543,7 +543,7 @@ class init extends common
'manage' => true,
'users' => true,
'userHistory' => true,
'userHistoryExport' => true,
'userReportExport' => true,
'usersAdd' => true,
'userDelete' => true,
'usersDelete' => true,

View File

@ -119,14 +119,16 @@ class page extends common
$page
]);
// Ecriture
$this->setData(['page', $pageId, $data]);
$this->setData(['page', $pageId, $data], false);
$notification = helper::translate('Page dupliquée');
// Duplication du module présent
if ($this->getData(['page', $page, 'moduleId'])) {
$data = $this->getData(['module', $page]);
$this->setData(['module', $pageId, $data]);
$this->setData(['module', $pageId, $data], false);
$notification = helper::translate('Page et module dupliqués');
}
// Force la sauvegarde
$this->saveDB('page');
// Valeurs en sortie
$this->addOutput([

View File

@ -575,7 +575,7 @@ class user extends common
// Enregistre la date de la demande dans le compte utilisateur
$this->setData(['user', $userId, 'forgot', time()]);
// Crée un id unique pour la réinitialisation
$uniqId = md5(json_encode($this->getData(['user', $userId])));
$uniqId = md5(json_encode($this->getData(['user', $userId, 'forgot'])));
// Envoi le mail
$sent = $this->sendMail(
$this->getData(['user', $userId, 'mail']),
@ -898,7 +898,7 @@ class user extends common
// Droits spécifiques
'users' => $this->getInput('profilEditCourseUsers', helper::FILTER_BOOLEAN),
'userHistory' => $this->getInput('profilEditCourseUserHistory', helper::FILTER_BOOLEAN),
'userHistoryExport' => $this->getInput('profilEditCourseUserHistoryExport', helper::FILTER_BOOLEAN),
'userReportExport' => $this->getInput('profilEditCourseuserReportExport', helper::FILTER_BOOLEAN),
'export' => $this->getInput('profilEditCourseExport', helper::FILTER_BOOLEAN),
'userAdd' => $this->getInput('profilEditCourseUserAdd', helper::FILTER_BOOLEAN),
'usersAdd' => $this->getInput('profilEditCourseUsersAdd', helper::FILTER_BOOLEAN),
@ -1095,7 +1095,7 @@ class user extends common
// La suite
'users' => $this->getInput('profilAddCourseUsers', helper::FILTER_BOOLEAN),
'userHistory' => $this->getInput('profilAddCourseUserHistory', helper::FILTER_BOOLEAN),
'userHistoryExport' => $this->getInput('profilAddCourseUserHistoryExport', helper::FILTER_BOOLEAN),
'userReportExport' => $this->getInput('profilAddCourseuserReportExport', helper::FILTER_BOOLEAN),
'export' => $this->getInput('profilAddCourseExport', helper::FILTER_BOOLEAN),
'userAdd' => $this->getInput('profilAddCourseUserAdd', helper::FILTER_BOOLEAN),
'usersAdd' => $this->getInput('profilAddCourseUsersAdd', helper::FILTER_BOOLEAN),
@ -1150,12 +1150,12 @@ class user extends common
// Exclure les espaces des cours
/*
foreach (array_keys($this->getData(['course'])) as $courseId) {
self::$sharePath = array_filter(self::$sharePath, function ($key) use ($courseId) {
return strpos($key, $courseId) === false;
});
}
*/
foreach (array_keys($this->getData(['course'])) as $courseId) {
self::$sharePath = array_filter(self::$sharePath, function ($key) use ($courseId) {
return strpos($key, $courseId) === false;
});
}
*/
self::$sharePath = array_flip(self::$sharePath);
self::$sharePath = array_merge(['none' => 'Aucun Accès'], self::$sharePath);
@ -1436,13 +1436,29 @@ class user extends common
// Lien de réinitialisation trop vieux
or $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time()
// Id unique incorrecte
or $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2)])))
or $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2), 'forgot'])))
) {
$this->saveLog(
' Erreur de réinitialisation de mot de passe ' . $this->getUrl(2) .
' Compte : ' . $this->getData(['user', $this->getUrl(2)]) .
' Temps : ' . $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time() .
' Clé : ' . $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2), 'forgot'])))
);
// Message d'erreur en cas de problème de réinitialisation de mot de passe
$message = $this->getData(['user', $this->getUrl(2)]) === null
? ' Utilisateur inconnu '
: '';
$message = $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time()
? ' Temps dépassé '
: $message;
$message = $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2)])))
? ' Clé invalide '
: $message;
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseurl(),
'notification' => helper::translate('Impossible de réinitialiser le mot de passe de ce compte !'),
'notification' => helper::translate('Impossible de réinitialiser le mot de passe de ce compte !') . $message,
'state' => false
//'access' => false
]);

View File

@ -196,7 +196,7 @@
<?php echo template::checkbox('profilAddCourseUserHistory', true, 'Voir historique d\'un participant'); ?>
</div>
<div class="col3">
<?php echo template::checkbox('profilAddCourseUserHistoryExport', true, 'Exporter historique d\'un participant'); ?>
<?php echo template::checkbox('profilAddCourseuserReportExport', true, 'Exporter historique d\'un participant'); ?>
</div>
<div class="col3">
<?php echo template::checkbox('profilAddCourseUserDelete', true, 'Désinscrire un participant'); ?>

View File

@ -56,10 +56,10 @@ $(document).ready(function () {
if ($('#profilEditCourseUsers').is(':checked')) {
// Activer les autres checkboxes
$('#profilEditCourseUserHistory, #profilEditCourseUserHistoryExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('disabled', false);
$('#profilEditCourseUserHistory, #profilEditCourseuserReportExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('disabled', false);
} else {
// Désactiver les autres checkboxes
$('#profilEditCourseUserHistory, #profilEditCourseUserHistoryExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('checked', false).prop('disabled', true);
$('#profilEditCourseUserHistory, #profilEditCourseuserReportExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('checked', false).prop('disabled', true);
// Désactiver les modules et tout décocher
$(".courseContainer").slideUp();
$('.courseContainer input[type="checkbox"]').prop('checked', false);
@ -135,11 +135,11 @@ $(document).ready(function () {
$('#profilEditCourseUsers').change(function () {
if ($(this).is(':checked')) {
// Activer les autres checkboxes
$('#profilEditCourseUserHistory, #profilEditCourseUserHistoryExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('disabled', false);
$('#profilEditCourseUserHistory, #profilEditCourseuserReportExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('disabled', false);
} else {
// Désactiver les autres checkboxes
$('#profilEditCourseUserHistory, #profilEditCourseUserHistoryExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('checked', false).prop('disabled', true);
$('#profilEditCourseUserHistory, #profilEditCourseuserReportExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('checked', false).prop('disabled', true);
// Désactiver les modules et tout décocher
$(".courseContainer").slideUp();
$('.courseContainer input[type="checkbox"]').prop('checked', false);

View File

@ -291,8 +291,8 @@
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('profilEditCourseUserHistoryExport', true, 'Exporter historique d\'un participant', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'userHistoryExport']),
<?php echo template::checkbox('profilEditCourseuserReportExport', true, 'Exporter historique d\'un participant', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'userReportExport']),
]); ?>
</div>
<div class="col3">

View File

@ -7,7 +7,7 @@
'value' => template::ico('left')
]); ?>
</div>
<div class="col1">
<div class="col1 offset10">
<?php echo template::submit('usersDeleteSubmit', [
'class' => 'buttonRed',
'ico' => '',

View File

@ -25,6 +25,9 @@ $siteId = md5($_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_FILENAME']); // Ou util
// Change le nom de la session en fonction de cet identifiant
session_name('zwii_session_' . $siteId);
// Récupère dynamiquement le chemin du dossier dans lequel le script est exécuté
$scriptPath = dirname($_SERVER['SCRIPT_NAME']);
// Si le chemin est vide (ce qui peut arriver si le site est à la racine), définis-le comme '/'
if ($scriptPath === '/' || $scriptPath === '\\' || $scriptPath === '.') {
$scriptPath = '/';

View File

@ -16,7 +16,7 @@
class blog extends common
{
const VERSION = '7.11';
const VERSION = '8.0';
const REALNAME = 'Blog';
const DELETE = true;
const UPDATE = '0.0';
@ -174,10 +174,12 @@ class blog extends common
$this->setData(['module', $this->getUrl(0), 'config', 'timeFormat', '%H:%M']);
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '6.5']);
}
// Version 7.4
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '7.4', '<')) {
// Version 8.0
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '8.0', '<')) {
$this->setData(['module', $this->getUrl(0), 'config', 'buttonBack', true]);
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '7.4']);
$this->setData(['module', $this->getUrl(0), 'config', 'showTime', true]);
$this->setData(['module', $this->getUrl(0), 'config', 'showDate', true]);
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '8.0']);
}
}
@ -578,7 +580,9 @@ class blog extends common
'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT, true),
'dateFormat' => $this->getInput('blogOptionDateFormat'),
'timeFormat' => $this->getInput('blogOptionTimeFormat'),
'buttonBack' => $this->getInput('newsOptionButtonBack'),
'buttonBack' => $this->getInput('blogOptionButtonBack', helper::FILTER_BOOLEAN),
'showDate' => $this->getInput('blogOptionShowDate', helper::FILTER_BOOLEAN),
'showTime' => $this->getInput('blogOptionShowTime', helper::FILTER_BOOLEAN),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
]
]);
@ -596,7 +600,6 @@ class blog extends common
]);
}
/**
* Suppression
*/

View File

@ -1,6 +1,11 @@
# Versions 7.11
# Version 8.00
- Ajoute deux nouvelles options pour afficher ou masquer la date et l'heure de l'article.
- Corrige un bug d'affichage des articles lorsque le thème Moderne est sélectionné.
- Corrige un bug dans la méthode de tronquage de l'article, nécessite Zwii 13.5
- Corrige un mauvais format de la propriété buttonBack non stockée au type booléen.
# Version 7.11
- Le sélecteur de fichier affiche par défaut le chemin vers le fichier présent dans le champ.
# Versions 7.10
# Version 7.10
- Empêche la validation d'un commentaire lorsque le contenu est vide.
# Versions 7.8 - 7.9
- Le flux RSS ne fonctionne pas si les méta de la page sont vides.

View File

@ -1 +1 @@
{"name":"blog","realName":"Blog","version":"7.10","update":"0.0","delete":true,"dataDirectory":""}
{"name":"blog","realName":"Blog","version":"7.12","update":"0.0","delete":true,"dataDirectory":""}

View File

@ -18,11 +18,28 @@
<?php endif; ?>
</div>
<div class="col6 newsDate textAlignRight">
<!-- bloc signature et date -->
<!-- bloc signature -->
<?php echo template::ico('user'); ?>
<?php echo $module::$articleSignature; ?>
<?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI) . ' ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<!-- bloc date -->
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<!-- Bloc edition -->
<?php if (
$this->isConnected() === true

View File

@ -24,11 +24,28 @@
</div>
<div class="row">
<div class="col6 blogEdit">
<!-- bloc signature et date -->
<!-- bloc signature -->
<?php echo template::ico('user'); ?>
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
<?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI) . '&nbsp;' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
<!-- bloc Date -->
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
</div>
</div>
<div class="row">
@ -103,18 +120,19 @@
file_exists(self::FILE_DIR . 'source/' . $article['picture'])
): ?>
<div class="col3">
<?php // Déterminer le nom de la miniature
$parts = pathinfo($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']));
$thumb = 'mini_' . $parts['basename'];
// Créer la miniature si manquante
if (!file_exists(self::FILE_DIR . 'thumb/' . $thumb)) {
$this->makeThumb(
self::FILE_DIR . 'source/' . $article['picture'],
self::FILE_DIR . 'thumb/' . $thumb,
self::THUMBS_WIDTH
);
}
?>
<?php
// Déterminer le nom de la miniature
$parts = pathinfo($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']));
$thumb = 'mini_' . $parts['basename'];
// Créer la miniature si manquante
if (!file_exists(self::FILE_DIR . 'thumb/' . $thumb)) {
$this->makeThumb(
self::FILE_DIR . 'source/' . $article['picture'],
self::FILE_DIR . 'thumb/' . $thumb,
self::THUMBS_WIDTH
);
}
?>
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>" class="blogPicture">
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>"
alt="<?php echo $article['picture']; ?>">
@ -138,21 +156,43 @@
</a>
</div>
<div class="blogDate">
<!-- bloc signature et date -->
<!-- bloc signature -->
<?php echo template::ico('user'); ?>
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
<?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI) . '&nbsp;' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
</div>
<div class="blogContent">
<?php $lenght = $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) : 500 ?>
<?php echo helper::subword(strip_tags($article['content'], '<br><p>'), 0, $lenght); ?>...
<div class="readMoreContainer">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">
<button class="readMoreButton">
<?php echo helper::translate('Lire la suite'); ?>
</button>
</a>
<!-- bloc date -->
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<div class="blogContent">
<?php $lenght = $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']); ?>
<?php if ($lenght > 0): ?>
<?php ?>
<?php echo helper::subword($article['content'], 0, $lenght); ?>...
<div class="readMoreContainer">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">
<button class="readMoreButton">
<?php echo helper::translate('Lire la suite'); ?>
</button>
</a>
</div>
<?php else: ?>
<?php echo $article['content']; ?>
<?php endif; ?>
</div>
</div>
</div>

View File

@ -0,0 +1,40 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2024, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
$(document).ready(function() {
// Gestion du changement de la case "Afficher la date"
$('#blogOptionShowDate').change(function() {
var showDateChecked = $(this).is(':checked');
// Afficher ou masquer le wrapper de l'heure selon l'état de la date
if (showDateChecked) {
$('.timeWrapper').show();
} else {
$('.timeWrapper').hide();
// Désactiver l'option "Afficher l'heure" lorsque la date est désactivée
$('#blogOptionShowTime').prop('checked', false).trigger('change');
}
// Afficher ou masquer le format de la date
$('#blogOptionDateFormatWrapper').toggle(showDateChecked);
}).trigger('change'); // Déclenchement au chargement de la page
// Gestion du changement de la case "Afficher l'heure"
$('#blogOptionShowTime').change(function() {
var showTimeChecked = $(this).is(':checked');
// Afficher ou masquer le format de l'heure
$('#blogOptionTimeFormatWrapper').toggle(showTimeChecked);
}).trigger('change'); // Déclenchement au chargement de la page
});

View File

@ -19,30 +19,22 @@
</h4>
<div class="row">
<div class="col3">
<?php echo template::select('blogOptionArticlesLayout', $module::$articlesLayout, [
'label' => 'Disposition',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout'])
<?php echo template::checkbox('blogOptionShowDate', true, 'Afficher la date', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showDate']),
]); ?>
</div>
<div class="col3">
<?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [
'label' => 'Aperçus',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght'])
]); ?>
</div>
<div class="col2">
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
]); ?>
</div>
<div class="col2">
<?php echo template::select('blogOptionDateFormat', $module::$dateFormats, [
'label' => 'Format des dates',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
]); ?>
</div>
<div class="col2">
<div class="col3 timeWrapper">
<?php echo template::checkbox('blogOptionShowTime', true, 'Afficher l\'heure', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showTime']),
]); ?>
</div>
<div class="col3 timeWrapper">
<?php echo template::select('blogOptionTimeFormat', $module::$timeFormats, [
'label' => 'Format des heures',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat'])
@ -50,19 +42,39 @@
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::select('blogOptionArticlesLayout', $module::$articlesLayout, [
'label' => 'Disposition',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [
'label' => 'Aperçus',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
]); ?>
</div>
</div>
<div class="row">
<div class="col3">
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('blogOptionShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
]); ?>
</div>
<div class="col6">
<?php echo template::text('blogOptionFeedslabel', [
'label' => 'Texte de l\'étiquette',
'label' => 'Texte de l\'étiquette RSS',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>

View File

@ -27,8 +27,6 @@ $( document ).ready(function() {
serializeRegexp: ""
});
console.log($("#galleryEditSort").val());
if ($("#galleryEditSort").val() !== "SORT_HAND") {
$("#galleryTable tr").addClass("nodrag nodrop");
$(".zwiico-sort").hide();

View File

@ -1,3 +1,6 @@
# Versions 6.0
- Ajoute deux nouvelles options pour afficher ou masquer la date et l'heure de l'article.
- Corrige un mauvais format de la propriété buttonBack non stockée au type booléen.
# Versions 5.9
- Largeur d'un bouton de retour.
# Versions 5.7 - 5.8

View File

@ -16,7 +16,7 @@
class news extends common
{
const VERSION = '5.9';
const VERSION = '6.0';
const REALNAME = 'News';
const DATADIRECTORY = self::DATA_DIR . 'news/';
@ -124,11 +124,12 @@ class news extends common
$feeds = new \FeedWriter\RSS2();
// En-tête
$feeds->setTitle($this->getData(['page', $this->getUrl(0), 'title']) ? $this->getData(['page', $this->getUrl(0), 'title']): '');
$feeds->setTitle($this->getData(['page', $this->getUrl(0), 'title']) ? $this->getData(['page', $this->getUrl(0), 'title']) : '');
$feeds->setLink(helper::baseUrl() . $this->getUrl(0));
if ($this->getData(['page', $this->getUrl(0), 'metaDescription'])) {
$feeds->setDescription($this->getData(['page', $this->getUrl(0), 'metaDescription']));
};
}
;
$feeds->setChannelElement('language', 'fr-FR');
$feeds->setDate(date('r', time()));
$feeds->addGenerator();
@ -174,7 +175,8 @@ class news extends common
$publishedOn = $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true);
$publishedOff = $this->getInput('newsAddPublishedOff') ? $this->getInput('newsAddPublishedOff', helper::FILTER_DATETIME) : '';
$this->setData([
'module', $this->getUrl(0),
'module',
$this->getUrl(0),
'posts',
$newsId,
[
@ -288,7 +290,8 @@ class news extends common
// Fin feuille de style
$this->setData([
'module', $this->getUrl(0),
'module',
$this->getUrl(0),
'theme',
[
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '',
@ -300,7 +303,8 @@ class news extends common
]);
$this->setData([
'module', $this->getUrl(0),
'module',
$this->getUrl(0),
'config',
[
'feeds' => $this->getInput('newsOptionShowFeeds', helper::FILTER_BOOLEAN),
@ -310,7 +314,9 @@ class news extends common
'height' => $this->getInput('newsOptionHeight', helper::FILTER_INT, true),
'dateFormat' => $this->getInput('newsOptionDateFormat'),
'timeFormat' => $this->getInput('newsOptionTimeFormat'),
'buttonBack' => $this->getInput('newsOptionButtonBack'),
'buttonBack' => $this->getInput('newsOptionButtonBack', helper::FILTER_BOOLEAN),
'showDate' => $this->getInput('newsOptionShowDate', helper::FILTER_BOOLEAN),
'showTime' => $this->getInput('newsOptionShowTime', helper::FILTER_BOOLEAN),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
]
]);
@ -318,7 +324,7 @@ class news extends common
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option',
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => helper::translate('Modifications enregistrées'),
'state' => true
]);
@ -428,7 +434,8 @@ class news extends common
$publishedOn = $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true);
$publishedOff = $this->getInput('newsEditPublishedOff') ? $this->getInput('newsEditPublishedOff', helper::FILTER_DATETIME) : '';
$this->setData([
'module', $this->getUrl(0),
'module',
$this->getUrl(0),
'posts',
$newsId,
[
@ -490,6 +497,8 @@ class news extends common
}
// L'article existe
else {
self::$dateFormat = $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']);
self::$timeFormat = $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']);
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
// Valeurs en sortie
$this->addOutput([
@ -609,6 +618,14 @@ class news extends common
// Mettre à jour la version
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '5.3']);
}
// Mise à jour 6.0
if (version_compare($versionData, '6.0', '<')) {
$this->setData(['module', $this->getUrl(0), 'config', 'buttonBack', true]);
$this->setData(['module', $this->getUrl(0), 'config', 'showTime', true]);
$this->setData(['module', $this->getUrl(0), 'config', 'showDate', true]);
// Mettre à jour la version
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '6.0']);
}
}

View File

@ -12,12 +12,28 @@
<?php endif; ?>
</div>
<div class="col6 newsDate textAlignRight">
<!-- bloc signature et date -->
<!-- bloc signature -->
<?php echo template::ico('user'); ?>
<?php echo $module::$articleSignature . ' - '; ?>
<?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI) . '&nbsp' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<!-- Bloc edition -->
<?php echo $module::$articleSignature; ?>
<!-- bloc date -->
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?> <!-- Bloc edition -->
<?php if (
$this->isConnected() === true
and
@ -25,15 +41,13 @@
($this->getUser('group') === self::GROUP_ADMIN)
)
): ?>
&nbsp;-&nbsp;
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1); ?>">
<?php echo template::ico('pencil'); ?>
<?php echo template::ico('pencil', ['margin' => 'left']); ?>
<?php echo helper::translate('Éditer'); ?>
</a>
<?php endif; ?>
<!-- Bloc RSS-->
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?>
&nbsp;-&nbsp;
<div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>"
target="_blank">

View File

@ -1,5 +1,6 @@
<?php if ($module::$news): ?>
<link rel="stylesheet" type="text/css" href="<?php echo helper::baseUrl(false) . $this->getData(['module', $this->getUrl(0), 'theme', 'style']);?> "/>
<link rel="stylesheet" type="text/css"
href="<?php echo helper::baseUrl(false) . $this->getData(['module', $this->getUrl(0), 'theme', 'style']); ?> " />
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?>
<div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>" target="_blank">
@ -20,10 +21,28 @@
<?php echo '<a href="' . helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
</h2>
<div class="newsSignature">
<!-- bloc signature -->
<?php echo template::ico('user'); ?>
<?php echo $news['userId'] . ' - '; ?>
<?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8($module::$dateFormat, $news['publishedOn'], self::$i18nUI) . '&nbsp;' . helper::dateUTF8($module::$timeFormat, $news['publishedOn'], self::$i18nUI); ?>
<?php echo $news['userId']; ?>
<!-- bloc Date -->
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<!-- Bloc edition -->
<?php if (
$this->isConnected() === true
@ -32,10 +51,8 @@
($this->getUser('group') === self::GROUP_ADMIN)
)
): ?>
&nbsp;-&nbsp;
<a
href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId; ?>">
<?php echo template::ico('pencil'); ?> Éditer
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId; ?>">
<?php echo template::ico('pencil', ['margin' => 'left']); ?> Éditer
</a>
<?php endif; ?>
</div>
@ -51,7 +68,6 @@
</div>
</div>
<?php endforeach; ?>
</div>
</article>
<?php echo $module::$pages; ?>

View File

@ -0,0 +1,40 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2024, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
$(document).ready(function() {
// Gestion du changement de la case "Afficher la date"
$('#newsOptionShowDate').change(function() {
var showDateChecked = $(this).is(':checked');
// Afficher ou masquer le wrapper de l'heure selon l'état de la date
if (showDateChecked) {
$('.timeWrapper').show();
} else {
$('.timeWrapper').hide();
// Désactiver l'option "Afficher l'heure" lorsque la date est désactivée
$('#newsOptionShowTime').prop('checked', false).trigger('change');
}
// Afficher ou masquer le format de la date
$('#newsOptionDateFormatWrapper').toggle(showDateChecked);
}).trigger('change'); // Déclenchement au chargement de la page
// Gestion du changement de la case "Afficher l'heure"
$('#newsOptionShowTime').change(function() {
var showTimeChecked = $(this).is(':checked');
// Afficher ou masquer le format de l'heure
$('#newsOptionTimeFormatWrapper').toggle(showTimeChecked);
}).trigger('change'); // Déclenchement au chargement de la page
});

View File

@ -1,111 +1,123 @@
<?php echo template::formOpen('newsOption'); ?>
<div class="row">
<div class="col1">
<?php echo template::button('newsOptionBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'value' => template::ico('left')
]); ?>
</div>
<div class="col2 offset9">
<?php echo template::submit('newsOptionSubmit'); ?>
</div>
<div class="col1">
<?php echo template::button('newsOptionBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'value' => template::ico('left')
]); ?>
</div>
<div class="row">
<div class="col12">
<div class="block">
<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 class="col2 offset9">
<?php echo template::submit('newsOptionSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate('Paramètres'); ?></h4>
<div class="row">
<div class="col3">
<?php echo template::checkbox('newsOptionShowDate', true, 'Afficher la date', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showDate']),
]); ?>
</div>
<div class="row">
<div class="col3">
<?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
'help' => 'Flux limité aux articles de la première page.'
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
]); ?>
</div>
<div class="col6">
<?php echo template::text('newsOptionFeedslabel', [
'label' => 'Étiquette RSS',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</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 timeWrapper">
<?php echo template::checkbox('newsOptionShowTime', true, 'Afficher l\'heure', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showTime']),
]); ?>
</div>
<div class="col3 timeWrapper">
<?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="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 class="row">
<div class="col3">
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
'help' => 'Flux limité aux articles de la première page.'
]); ?>
</div>
<div class="col6">
<?php echo template::text('newsOptionFeedslabel', [
'label' => 'Texte de l\'étiquette RSS',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate('Thème');?></h4>
<div class="row">
<div class="col3">
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
'label' => 'Bordure',
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle'])
]); ?>
</div>
<div class="col3">
<?php echo template::select('newsThemeBorderWidth', $module::$borderWidth, [
'label' => 'Épaisseur',
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('newsThemeBorderColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Couleur de la bordure',
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('newsThemeBackgroundColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Couleur du fond',
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor'])
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate('Thème'); ?></h4>
<div class="row">
<div class="col3">
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
'label' => 'Bordure',
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'borderStyle'])
]); ?>
</div>
<div class="col3">
<?php echo template::select('newsThemeBorderWidth', $module::$borderWidth, [
'label' => 'Épaisseur',
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'borderWidth'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('newsThemeBorderColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Couleur de la bordure',
'value' => $this->getData(['module', $this->getUrl(0), 'theme', 'borderColor'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('newsThemeBackgroundColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Couleur du fond',
'value' => $this->getData(['module', $this->getUrl(0), 'theme', 'backgroundColor'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version
<?php echo $module::VERSION; ?>