forked from ZwiiCMS-Team/ZwiiCampus
manque la fonction de désincription
This commit is contained in:
parent
9a21f8c5d1
commit
851f6421d6
@ -12,21 +12,101 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col8">
|
<div class="col6">
|
||||||
|
<?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">
|
||||||
|
<div class="block">
|
||||||
|
<h4>
|
||||||
|
<?php echo helper::translate('Disponibilité du cours'); ?>
|
||||||
|
</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::text('coursesCaptionAccessOpen', [
|
||||||
|
'label' => 'Ouvert',
|
||||||
|
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'accessopen'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::text('coursesCaptionAccessDate', [
|
||||||
|
'label' => 'Période',
|
||||||
|
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'accessdate'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::text('coursesCaptionAccessClose', [
|
||||||
|
'label' => 'Fermé',
|
||||||
|
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'accessclose'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col12">
|
||||||
|
<h4>
|
||||||
|
<?php echo helper::translate('Modalité d\'accès'); ?>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::text('coursesCaptionGuest', [
|
||||||
|
'label' => 'Anonyme',
|
||||||
|
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'enrolguest'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::text('coursesCaptionSelf', [
|
||||||
|
'label' => 'Membre',
|
||||||
|
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'enrolself'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::text('coursesCaptionSelfKey', [
|
||||||
|
'label' => 'Membre avec clé',
|
||||||
|
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'enrolselfkey'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::text('coursesCaptionUrl', [
|
||||||
|
'label' => 'Lien vers le cours',
|
||||||
|
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'url'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::text('coursesCaptionUnsuscribe', [
|
||||||
|
'label' => 'Désinscription',
|
||||||
|
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'unsuscribe'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col6">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>
|
<h4>
|
||||||
<?php echo helper::translate('Elements à afficher'); ?>
|
<?php echo helper::translate('Elements à afficher'); ?>
|
||||||
</h4>
|
</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php echo template::checkbox('coursesConfigShowTitle', true, 'Titre Long', [
|
<?php echo template::checkbox('coursesConfigShowTitle', true, 'Titre', [
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'title'])
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'title'])
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php echo template::checkbox('coursesConfigShowAuthor', true, 'Nom de l\'auteur', [
|
<?php echo template::checkbox('coursesConfigShowAuthor', true, 'Signature de l\'auteur', [
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'author'])
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'author'])
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
@ -64,29 +144,14 @@
|
|||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col12">
|
|
||||||
<?php echo template::text('coursesConfigCaption', [
|
|
||||||
'label' => 'Texte du lien vers le cours',
|
|
||||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'caption'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col6">
|
||||||
</div>
|
|
||||||
<div class="col4">
|
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>
|
<h4>
|
||||||
<?php echo helper::translate('Paramètres'); ?>
|
<?php echo helper::translate('Thème'); ?>
|
||||||
</h4>
|
</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="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php echo template::select('coursesConfigLayout', $module::$coursesLayout, [
|
<?php echo template::select('coursesConfigLayout', $module::$coursesLayout, [
|
||||||
|
@ -49,23 +49,34 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- Modalité d'inscription -->
|
<!-- Modalité d'inscription -->
|
||||||
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'enrolment']) === true): ?>
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'enrolment']) === true ): ?>
|
||||||
<p>
|
<p>
|
||||||
<?php echo sprintf(helper::translate('Inscription : %s '), $module::$coursesEnrolment[$courseValue['enrolment']]); ?>
|
<?php echo sprintf(helper::translate('Inscription : %s '), $module::$coursesEnrolment[$courseValue['enrolment']]); ?>
|
||||||
</p>
|
</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- Lien -->
|
<!-- Lien accès au cours-->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col6">
|
||||||
<?php if (
|
<?php if (
|
||||||
$courseValue['access'] === self::COURSE_ACCESS_OPEN
|
$courseValue['access'] === self::COURSE_ACCESS_OPEN
|
||||||
||
|
||
|
||||||
($courseValue['access'] === self::COURSE_ACCESS_DATE && time() >= $courseValue['openingDate'] && time() <= $courseValue['closingDate'])
|
($courseValue['access'] === self::COURSE_ACCESS_DATE && time() >= $courseValue['openingDate'] && time() <= $courseValue['closingDate'])
|
||||||
): ?>
|
): ?>
|
||||||
<a href="<?php echo helper::baseUrl(); ?>course/swap/<?php echo $courseId; ?>">
|
<a href="<?php echo helper::baseUrl(); ?>course/swap/<?php echo $courseId; ?>">
|
||||||
<?php echo $this->getData(['module', $this->getUrl(0), 'config', 'caption']); ?>
|
<?php echo $this->getData(['module', $this->getUrl(0), 'caption', 'url']); ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="col6 textAlignRight">
|
||||||
|
<!-- Lien désinscription-->
|
||||||
|
<?php if ($this->getData(['enrolment', $courseId, $this->getUser('id')])): ?>
|
||||||
|
<a href="<?php echo helper::baseUrl(); ?>course/unsuscribe/<?php echo $courseId; ?>">
|
||||||
|
<?php echo $this->getData(['module', $this->getUrl(0), 'caption', 'unsuscribe']); ?>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Fin du bloc et bordure -->
|
<!-- Fin du bloc et bordure -->
|
||||||
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'template']) === true): ?>
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'template']) === true): ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,26 +36,44 @@ class workshop extends common
|
|||||||
2 => 'Six cours par ligne',
|
2 => 'Six cours par ligne',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public static $coursesAccess = [];
|
||||||
|
|
||||||
public static $coursesAccess = [
|
public static $coursesEnrolment = [];
|
||||||
self::COURSE_ACCESS_OPEN => 'ouvert',
|
|
||||||
self::COURSE_ACCESS_DATE => 'période d\'ouverture',
|
public static $default = [
|
||||||
self::COURSE_ACCESS_CLOSE => 'fermé',
|
"config" => array(
|
||||||
|
"category" => "general",
|
||||||
|
"title" => true,
|
||||||
|
"author" => true,
|
||||||
|
"description" => true,
|
||||||
|
"access" => true,
|
||||||
|
"openingdate" => true,
|
||||||
|
"closingdate" => true,
|
||||||
|
"enrolment" => true,
|
||||||
|
"layout" => 6,
|
||||||
|
"template" => true
|
||||||
|
),
|
||||||
|
"caption" => array(
|
||||||
|
"accessopen" => "ouvert",
|
||||||
|
"accessdate" => "période d'ouverture",
|
||||||
|
"accessclose" => "fermé",
|
||||||
|
"enrolguest" => "anonyme",
|
||||||
|
"enrolself" => "membres",
|
||||||
|
"enrolselfkey" => "membres avec clé",
|
||||||
|
"url" => "Accéder au cours",
|
||||||
|
"unsuscribe" => "Me désinscrire"
|
||||||
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $coursesEnrolment = [
|
|
||||||
self::COURSE_ENROLMENT_GUEST => 'anonyme, sans inscription',
|
|
||||||
self::COURSE_ENROLMENT_SELF => 'réservée aux membres inscrits',
|
|
||||||
self::COURSE_ENROLMENT_SELF_KEY => 'réservé aux membres et avec une clé d\'inscription ',
|
|
||||||
//self::COURSE_ENROLMENT_MANUAL => 'Manuelle'
|
|
||||||
];
|
|
||||||
|
|
||||||
public static $coursesDetails = [];
|
|
||||||
/**
|
/**
|
||||||
* Configuration
|
* Configuration
|
||||||
*/
|
*/
|
||||||
public function config()
|
public function config()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Contrôle de la configuration par défaut
|
||||||
|
$this->update();
|
||||||
|
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if (
|
if (
|
||||||
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
|
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
|
||||||
@ -79,6 +97,21 @@ class workshop extends common
|
|||||||
'template' => $this->getInput('coursesConfigTemplate', helper::FILTER_BOOLEAN),
|
'template' => $this->getInput('coursesConfigTemplate', helper::FILTER_BOOLEAN),
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
$this->setData([
|
||||||
|
'module',
|
||||||
|
$this->getUrl(0),
|
||||||
|
'caption',
|
||||||
|
[
|
||||||
|
'accessopen' => $this->getInput('coursesCaptionAccessOpen', helper::FILTER_STRING_SHORT),
|
||||||
|
'accessdate' => $this->getInput('coursesCaptionAccessDate', helper::FILTER_STRING_SHORT),
|
||||||
|
'accessclose' => $this->getInput('coursesCaptionAccessClose', helper::FILTER_STRING_SHORT),
|
||||||
|
'enrolguest' => $this->getInput('coursesCaptionGuest', helper::FILTER_STRING_SHORT),
|
||||||
|
'enrolself' => $this->getInput('coursesCaptionSelf', helper::FILTER_STRING_SHORT),
|
||||||
|
'enrolselfkey' => $this->getInput('coursesCaptionSelfKey', helper::FILTER_STRING_SHORT),
|
||||||
|
'url' => $this->getInput('coursesCaptionUrl', helper::FILTER_STRING_SHORT),
|
||||||
|
'unsuscribe' => $this->getInput('coursesCaptionUnsuscribe', helper::FILTER_STRING_SHORT),
|
||||||
|
]
|
||||||
|
]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||||
@ -97,6 +130,17 @@ class workshop extends common
|
|||||||
}
|
}
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
// Contrôle de la configuration par défaut
|
||||||
|
$this->update();
|
||||||
|
|
||||||
|
// Mise à jour des étiquettes
|
||||||
|
self::$coursesAccess[self::COURSE_ACCESS_OPEN] = $this->getData(['module', $this->getUrl(0), 'caption', 'accessopen']);
|
||||||
|
self::$coursesAccess[self::COURSE_ACCESS_DATE] = $this->getData(['module', $this->getUrl(0), 'caption', 'accessdate']);
|
||||||
|
self::$coursesAccess[self::COURSE_ACCESS_CLOSE] = $this->getData(['module', $this->getUrl(0), 'caption', 'accessclose']);
|
||||||
|
self::$coursesEnrolment[self::COURSE_ENROLMENT_GUEST] = $this->getData(['module', $this->getUrl(0), 'caption', 'enrolguest']);
|
||||||
|
self::$coursesEnrolment[self::COURSE_ENROLMENT_SELF] = $this->getData(['module', $this->getUrl(0), 'caption', 'enrolself']);
|
||||||
|
self::$coursesEnrolment[self::COURSE_ENROLMENT_SELF_KEY] = $this->getData(['module', $this->getUrl(0), 'caption', 'enrolselfkey']);
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'showBarEditButton' => true,
|
'showBarEditButton' => true,
|
||||||
@ -112,4 +156,25 @@ class workshop extends common
|
|||||||
'view' => 'index',
|
'view' => 'index',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialise avec des valeurs par défaut
|
||||||
|
private function update()
|
||||||
|
{
|
||||||
|
$check = false;
|
||||||
|
foreach (self::$default['config'] as $key => $value) {
|
||||||
|
if (is_null($this->getData(['module', $this->getUrl(0), 'config', $key]))) {
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config', $key, $value]);
|
||||||
|
$check = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (self::$default['caption'] as $key => $value) {
|
||||||
|
if (is_null($this->getData(['module', $this->getUrl(0), 'caption', $key]))) {
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'caption', $key, $value]);
|
||||||
|
$check = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($check) {
|
||||||
|
header('refresh:0');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user