modules courses WIP
This commit is contained in:
parent
b88e99e31d
commit
93fc2f3aae
@ -64,7 +64,7 @@
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('courseEditAccess', $module::$courseAccess, [
|
||||
'label' => 'Accès',
|
||||
'label' => 'Modalités d\'ouverture',
|
||||
'selected' => $this->getdata(['course', $this->getUrl(2), 'access'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
103
module/courses/courses.php
Normal file
103
module/courses/courses.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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-2023, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class courses extends common
|
||||
{
|
||||
const VERSION = '1.0';
|
||||
const REALNAME = 'Liste des cours';
|
||||
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
|
||||
|
||||
public static $actions = [
|
||||
'config' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_VISITOR
|
||||
];
|
||||
|
||||
public static $courseCategories = [
|
||||
'all' => 'Toutes les catégories'
|
||||
];
|
||||
|
||||
public static $coursesLayout = [
|
||||
1 => 'Une colonne',
|
||||
2 => 'Deux colonnes',
|
||||
3 => 'Trois colonnes',
|
||||
4 => 'Quatre colonnes',
|
||||
5 => 'Cinq colonnes',
|
||||
6 => 'Six colonnes',
|
||||
];
|
||||
|
||||
public static $coursesDetails = [];
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData([
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'config',
|
||||
[
|
||||
'category' => $this->getInput('coursesConfigCategories'),
|
||||
'title' => $this->getInput('coursesConfigShowTitle', helper::FILTER_BOOLEAN),
|
||||
'shortTitle' => $this->getInput('coursesConfigShowShortTitle', helper::FILTER_BOOLEAN),
|
||||
'author' => $this->getInput('coursesConfigShowAuthor', helper::FILTER_BOOLEAN),
|
||||
'description' => $this->getInput('coursesConfigShowDescription', helper::FILTER_BOOLEAN),
|
||||
'access' => $this->getInput('coursesConfigShowAccess', helper::FILTER_BOOLEAN),
|
||||
'opening' => $this->getInput('coursesConfigShowOpening', helper::FILTER_BOOLEAN),
|
||||
'closing' => $this->getInput('coursesConfigShowClosing', helper::FILTER_BOOLEAN),
|
||||
'enrolment' => $this->getInput('coursesConfigShowEnrolment', helper::FILTER_BOOLEAN),
|
||||
'urlText' => $this->getInput('coursesConfigUrlText', helper::FILTER_STRING_SHORT),
|
||||
'layout' => $this->getInput('coursesConfigLayout', helper::FILTER_INT),
|
||||
'template' => $this->getInput('coursesConfigTemplate', helper::FILTER_BOOLEAN),
|
||||
]
|
||||
]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||
'notification' => helper::translate('Modifications enregistrées'),
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Liste des catégories de cours
|
||||
self::$courseCategories = array_merge(self::$courseCategories, $this->getData(['category']));
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => helper::translate('Configuration du module'),
|
||||
'view' => 'config'
|
||||
]);
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'view' => 'index'
|
||||
]);
|
||||
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'view' => 'index',
|
||||
]);
|
||||
}
|
||||
}
|
19
module/courses/view/config/config.css
Normal file
19
module/courses/view/config/config.css
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
/**
|
||||
* 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-2023, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
||||
|
123
module/courses/view/config/config.php
Normal file
123
module/courses/view/config/config.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php echo template::formOpen('coursesConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('coursesConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('coursesConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col8">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo helper::translate('Elements à afficher'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('coursesConfigShowTitle', true, 'Titre', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'title'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('coursesConfigShowShortTitle', true, 'Titre court', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'shortTitle'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('coursesConfigShowAuthor', true, 'Nom de l\'auteur', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'author'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('coursesConfigShowDescription', true, 'Description', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'description'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('coursesConfigShowAccess', true, 'Modalités d\'ouverture', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'access'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('coursesConfigShowOpening', true, 'Date d\'ouverture', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'opening']),
|
||||
'help' => 'Affiché si l\'accès est limité dans le temps',
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('coursesConfigShowClosing', true, 'Date de fermeture', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'closing']),
|
||||
'help' => 'Affiché si l\'accès est limité dans le temps',
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('coursesConfigShowEnrolment', true, 'Modalités d\'inscription', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'enrolment'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('coursesConfigUrlText', [
|
||||
'label' => 'Texte du lien vers le cours',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'urlText'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo helper::translate('Paramètres'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::select('coursesConfigCategories', $module::$courseCategories, [
|
||||
'label' => 'Catégorie à afficher',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'category'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::select('coursesConfigLayout', $module::$coursesLayout, [
|
||||
'label' => 'Présentation en colonnes',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout']),
|
||||
'help' => 'Chaque cours est présenté dans une colonne'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('coursesConfigTemplate', true, 'Bordure', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'template']),
|
||||
'help' => 'Template bordure de TinyMCE, le titre en évidence'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
30
module/courses/view/index/index.php
Normal file
30
module/courses/view/index/index.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php foreach ($this->getData(['course']) as $courseId => $courseValue): ?>
|
||||
<!-- Layout en colonnes -->
|
||||
<div class="col<?php echo $this->getData(['module', $this->getUrl(0), 'config', 'layout']) ?>">
|
||||
|
||||
<!-- Affchage par bloc et bordure -->
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'template']) === true): ?>
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Insère le titre ou le titre court dans tous les cas -->
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'title']) === true): ?>
|
||||
<?php echo $courseValue['title'] ?>
|
||||
<?php else: ?>
|
||||
<?php echo $courseValue['shortTitle'] ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Fin du bloc et bordure titre 4 -->
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'template']) === true): ?>
|
||||
</h4>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
<!-- Fin du bloc et bordure -->
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'template']) === true): ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
Loading…
Reference in New Issue
Block a user