Nom génériques de variables

This commit is contained in:
Fred Tempez 2023-09-13 18:29:25 +02:00
parent 2dcae34d29
commit 8c49908598
8 changed files with 41 additions and 41 deletions

View File

@ -896,9 +896,9 @@ class layout extends common
// Sélecteur de cours
if ($this->getUser('group') >= self::GROUP_TEACHER) {
$leftItems .= '<li><select id="barSelectCourse" >';
$leftItems .= '<option name="' . helper::translate('Accueil') . '" value="' . helper::baseUrl(true) . 'course/swap/home" ' . ('home' === self::$courseContent ? 'selected' : '') . '>' . helper::translate('Accueil') . '</option>';
$leftItems .= '<option name="' . helper::translate('Accueil') . '" value="' . helper::baseUrl(true) . 'course/swap/home" ' . ('home' === self::$siteContent ? 'selected' : '') . '>' . helper::translate('Accueil') . '</option>';
foreach ($this->getData(['course']) as $key => $value) {
$leftItems .= '<option name="' . $value['shortTitle'] . '" value="' . helper::baseUrl(true) . 'course/swap/' . $key . '" ' . ($key === self::$courseContent ? 'selected' : '') . '>' . $value['shortTitle'] . '</option>';
$leftItems .= '<option name="' . $value['shortTitle'] . '" value="' . helper::baseUrl(true) . 'course/swap/' . $key . '" ' . ($key === self::$siteContent ? 'selected' : '') . '>' . $value['shortTitle'] . '</option>';
}
$leftItems .= '</select></li>';
}

View File

@ -613,10 +613,10 @@ class core extends common
$inlineScript[] = $this->getData(['page', $this->getUrl(0), 'js']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'js']);
// Importe le contenu, le CSS et le script des barres
$contentRight = $this->getData(['page', $this->getUrl(0), 'barRight']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$courseContent) : '';
$contentRight = $this->getData(['page', $this->getUrl(0), 'barRight']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$siteContent) : '';
$inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']);
$inlineScript[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']);
$contentLeft = $this->getData(['page', $this->getUrl(0), 'barLeft']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$courseContent) : '';
$contentLeft = $this->getData(['page', $this->getUrl(0), 'barLeft']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$siteContent) : '';
$inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']);
$inlineScript[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']);
@ -634,7 +634,7 @@ class core extends common
$this->addOutput([
'title' => $title,
'content' => $this->getPage($this->getUrl(0), self::$courseContent),
'content' => $this->getPage($this->getUrl(0), self::$siteContent),
'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']),
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
@ -660,7 +660,7 @@ class core extends common
: $this->getData(['page', $this->getUrl(0), 'metaDescription']);
// Importe le CSS de la page principale
$pageContent = $this->getPage($this->getUrl(0), self::$courseContent);
$pageContent = $this->getPage($this->getUrl(0), self::$siteContent);
$this->addOutput([
'title' => $title,

View File

@ -170,7 +170,7 @@ class common
// Langue de l'interface sélectionnée
public static $i18nUI = 'fr_FR';
// Langues de contenu
public static $courseContent = 'home';
public static $siteContent = 'home';
public static $languages = [
'de' => 'Deutsch',
'en_EN' => 'English',
@ -220,7 +220,7 @@ class common
'profil' => '',
];
private $courseFiles = [
private $contentFiles = [
'page' => '',
'module' => '',
];
@ -324,7 +324,7 @@ class common
// Déterminer le contenu du site
if (isset($_SESSION['ZWII_COURSE'])) {
// Déterminé par la session présente
self::$courseContent = $_SESSION['ZWII_COURSE'];
self::$siteContent = $_SESSION['ZWII_COURSE'];
}
// Instanciation de la classe des entrées / sorties
// Les fichiers de configuration
@ -332,8 +332,8 @@ class common
$this->initDB($module);
}
// Les fichiers des cours
foreach ($this->courseFiles as $module => $value) {
$this->initDB($module, self::$courseContent);
foreach ($this->contentFiles as $module => $value) {
$this->initDB($module, self::$siteContent);
}
@ -347,10 +347,10 @@ class common
}
}
// Charge le site d'accueil
//if (self::$courseContent === 'home') {
foreach ($this->courseFiles as $stageId => $item) {
//if (self::$siteContent === 'home') {
foreach ($this->contentFiles as $stageId => $item) {
if (
file_exists(self::DATA_DIR . self::$courseContent . '/' . $stageId . '.json') === false
file_exists(self::DATA_DIR . self::$siteContent . '/' . $stageId . '.json') === false
) {
$this->initData($stageId);
}
@ -628,24 +628,24 @@ class common
require_once('core/module/install/ressource/defaultdata.php');
// L'arborescence
if (!file_exists(self::DATA_DIR . self::$courseContent)) {
mkdir(self::DATA_DIR . self::$courseContent, 0755);
if (!file_exists(self::DATA_DIR . self::$siteContent)) {
mkdir(self::DATA_DIR . self::$siteContent, 0755);
}
if (!file_exists(self::DATA_DIR . self::$courseContent . '/content')) {
mkdir(self::DATA_DIR . self::$courseContent . '/content', 0755);
if (!file_exists(self::DATA_DIR . self::$siteContent . '/content')) {
mkdir(self::DATA_DIR . self::$siteContent . '/content', 0755);
}
/*
* Le site d'accueil, home ne dispose pas des mêmes modèles
*/
$template = self::$courseContent === 'home' ? init::$siteTemplate :init:: $courseDefault;
$template = self::$siteContent === 'home' ? init::$siteTemplate :init:: $courseDefault;
// Création de page ou de module
$this->setData([$module, $template[$module]]);
// Création des pages
if ($module === 'page') {
$content = self::$courseContent === 'home' ? init::$siteContent : init::$courseContent;
$content = self::$siteContent === 'home' ? init::$siteContent : init::$courseContent;
foreach ($content as $key => $value) {
$this->setPage($key, $value, self::$courseContent);
$this->setPage($key, $value, self::$siteContent);
}
}

View File

@ -41,7 +41,7 @@ class maintenance extends common
? ''
: $this->getData(['page', $this->getData(['config', 'page302']), 'title']),
//'content' => $this->getdata(['page',$this->getData(['config','page302']),'content']),
'content' => $this->getPage($this->getData(['config', 'page302']), self::$courseContent),
'content' => $this->getPage($this->getData(['config', 'page302']), self::$siteContent),
'view' => 'index'
]);
} else {

View File

@ -174,11 +174,11 @@ class page extends common
]
]);
// Creation du contenu de la page
if (!is_dir(self::DATA_DIR . self::$courseContent . '/content')) {
mkdir(self::DATA_DIR . self::$courseContent . '/content', 0755);
if (!is_dir(self::DATA_DIR . self::$siteContent . '/content')) {
mkdir(self::DATA_DIR . self::$siteContent . '/content', 0755);
}
//file_put_contents(self::DATA_DIR . self::$courseContent . '/content/' . $pageId . '.html', '<p>Contenu de votre nouvelle page.</p>');
$this->setPage($pageId, '<p>Contenu de votre nouvelle page.</p>', self::$courseContent);
//file_put_contents(self::DATA_DIR . self::$siteContent . '/content/' . $pageId . '.html', '<p>Contenu de votre nouvelle page.</p>');
$this->setPage($pageId, '<p>Contenu de votre nouvelle page.</p>', self::$siteContent);
// Met à jour le sitemap
$this->updateSitemap();
@ -279,8 +279,8 @@ class page extends common
}
// Effacer la page
$this->deleteData(['page', $page]);
if (file_exists(self::DATA_DIR . self::$courseContent . '/content/' . $page . '.html')) {
unlink(self::DATA_DIR . self::$courseContent . '/content/' . $page . '.html');
if (file_exists(self::DATA_DIR . self::$siteContent . '/content/' . $page . '.html')) {
unlink(self::DATA_DIR . self::$siteContent . '/content/' . $page . '.html');
}
$this->deleteData(['module', $page]);
@ -369,8 +369,8 @@ class page extends common
// Supprime l'ancienne page si l'id a changée
if ($pageId !== $this->getUrl(2)) {
$this->deleteData(['page', $this->getUrl(2)]);
if (file_exists(self::DATA_DIR . self::$courseContent . '/content/' . $this->getUrl(2) . '.html')) {
unlink(self::DATA_DIR . self::$courseContent . '/content/' . $this->getUrl(2) . '.html');
if (file_exists(self::DATA_DIR . self::$siteContent . '/content/' . $this->getUrl(2) . '.html')) {
unlink(self::DATA_DIR . self::$siteContent . '/content/' . $this->getUrl(2) . '.html');
}
}
// Traitement des pages spéciales affectées dans la config :
@ -508,11 +508,11 @@ class page extends common
]);
// Creation du contenu de la page
if (!is_dir(self::DATA_DIR . self::$courseContent . '/content')) {
mkdir(self::DATA_DIR . self::$courseContent . '/content', 0755);
if (!is_dir(self::DATA_DIR . self::$siteContent . '/content')) {
mkdir(self::DATA_DIR . self::$siteContent . '/content', 0755);
}
$content = empty($this->getInput('pageEditContent', null)) ? '<p></p>' : str_replace('<p></p>', '<p>&nbsp;</p>', $this->getInput('pageEditContent', null));
$this->setPage($pageId, $content, self::$courseContent);
$this->setPage($pageId, $content, self::$siteContent);
// Met à jour le sitemap
$this->updateSitemap();

View File

@ -108,7 +108,7 @@
<div class="col12">
<?php echo template::textarea('pageEditContent', [
'class' => 'editorWysiwyg',
'value' => $this->getPage($this->getUrl(2), self::$courseContent)
'value' => $this->getPage($this->getUrl(2), self::$siteContent)
]); ?>
</div>
</div>

View File

@ -531,19 +531,19 @@ class plugin extends common
$infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']]['version'],
template::flag($keyi18n, '20px') . '&nbsp<a href ="' . helper::baseUrl() . $keyPage . '" target="_blank">' . $pagesInfos[$keyi18n][$keyPage]['title'] . ' (' . $keyPage . ')</a>',
template::button('dataExport' . $keyPage, [
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/filemanager/' . self::$courseContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/filemanager/' . self::$siteContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
// appel de fonction vaut exécution, utiliser un paramètre
'value' => template::ico('download-cloud'),
'help' => 'Sauvegarder les données du module dans le gestionnaire de fichiers'
]),
template::button('dataExport' . $keyPage, [
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/download/' . self::$courseContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/download/' . self::$siteContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
// appel de fonction vaut exécution, utiliser un paramètre
'value' => template::ico('download'),
'help' => 'Sauvegarder et télécharger les données du module'
]),
template::button('dataDelete' . $keyPage, [
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataDelete/' . self::$courseContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataDelete/' . self::$siteContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
// appel de fonction vaut exécution, utiliser un paramètre
'value' => template::ico('trash'),
'class' => 'buttonRed dataDelete',

View File

@ -213,8 +213,8 @@ class search extends common
) {
$url = $parentId;
$titre = $this->getData(['page', $parentId, 'title']);
//$content = file_get_contents(self::DATA_DIR . self::$courseContent . '/content/' . $this->getData(['page', $parentId, 'content']));
$content = $this->getPage($parentId, self::$courseContent);
//$content = file_get_contents(self::DATA_DIR . self::$siteContent . '/content/' . $this->getData(['page', $parentId, 'content']));
$content = $this->getPage($parentId, self::$siteContent);
$content = $titre . ' ' . $content;
// Pages sauf pages filles et articles de blog
$tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier);
@ -232,8 +232,8 @@ class search extends common
) {
$url = $childId;
$titre = $this->getData(['page', $childId, 'title']);
//$content = file_get_contents(self::DATA_DIR . self::$courseContent . '/content/' . $this->getData(['page', $childId, 'content']));
$content = $this->getPage($childId, self::$courseContent);
//$content = file_get_contents(self::DATA_DIR . self::$siteContent . '/content/' . $this->getData(['page', $childId, 'content']));
$content = $this->getPage($childId, self::$siteContent);
$content = $titre . ' ' . $content;
//Pages filles
$tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier);