Fonction avec formulaire change pour se connecter ou s'inscrire à un cours + fix type access et enrolment
This commit is contained in:
parent
7e7d4cfce3
commit
0e6b843b1d
@ -22,6 +22,7 @@ class course extends common
|
||||
'add' => self::GROUP_ADMIN,
|
||||
'delete' => self::GROUP_ADMIN,
|
||||
'swap' => self::GROUP_VISITOR,
|
||||
'change' => self::GROUP_VISITOR,
|
||||
];
|
||||
|
||||
public static $courseAccess = [
|
||||
@ -95,10 +96,10 @@ class course extends common
|
||||
'shortTitle' => $this->getInput('courseAddShortTitle', helper::FILTER_STRING_SHORT, true),
|
||||
'author' => $author,
|
||||
'description' => $this->getInput('courseAddDescription', helper::FILTER_STRING_SHORT, true),
|
||||
'access' => $this->getInput('courseAddAccess'),
|
||||
'access' => $this->getInput('courseAddAccess', helper::FILTER_INT),
|
||||
'openingDate' => $this->getInput('courseOpeningDate', helper::FILTER_DATETIME),
|
||||
'closingDate' => $this->getInput('courseClosingDate', helper::FILTER_DATETIME),
|
||||
'enrolment' => $this->getInput('courseAddEnrolment'),
|
||||
'enrolment' => $this->getInput('courseAddEnrolment', helper::FILTER_INT),
|
||||
'enrolmentKey' => $this->getInput('courseAddEnrolmentKey'),
|
||||
]
|
||||
]);
|
||||
@ -238,6 +239,30 @@ class course extends common
|
||||
]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Affiche un écran de connexion à un cours
|
||||
*/
|
||||
|
||||
public function change()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if (
|
||||
$this->isPost() ||
|
||||
$this->getUrl(2) === 'home'
|
||||
|
||||
) {
|
||||
$this->swap();
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => sprintf(helper::translate('Accéder au cours %s'), $this->getData(['course', $this->getUrl(2), 'shortTitle' ])),
|
||||
'view' => 'change',
|
||||
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Traitement du changement de langue
|
||||
* Fonction utilisée par le noyau
|
||||
@ -248,7 +273,7 @@ class course extends common
|
||||
$courseId = $this->getUrl(2);
|
||||
|
||||
if (
|
||||
// home n'est pas présent dans la base de donénes des cours
|
||||
// home n'est pas présent dans la base de données des cours
|
||||
$courseId === 'home' ||
|
||||
// Contrôle la validité du cours demandé
|
||||
(is_dir(self::DATA_DIR . $courseId) &&
|
||||
@ -264,4 +289,6 @@ class course extends common
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
16
core/module/course/view/change/change.css
Normal file
16
core/module/course/view/change/change.css
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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 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/
|
||||
*/
|
||||
|
||||
/** @import url("site/data/admin.css"); */
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
26
core/module/course/view/change/change.php
Normal file
26
core/module/course/view/change/change.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php echo template::formOpen('courseChangeForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo "<h3>Auteur : " . $this->getData(['course', $this->getUrl(2), 'author' ]) . "</h3>"; ?>
|
||||
<?php echo "<p> Description : " . $this->getData(['course', $this->getUrl(2), 'description' ]) . "</p>"; ?>
|
||||
<?php echo "<p> Disponibilité : " . $module::$courseAccess[$this->getData(['course', $this->getUrl(2), 'access' ])]. "</p>";?>
|
||||
<?php echo "<p> Inscription : " . $module::$courseEnrolment[$this->getData(['course', $this->getUrl(2), 'enrolment' ])]. "</p>";?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('courseChangeBack', [
|
||||
'href' => helper::baseUrl(),
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 offset7">
|
||||
<?php echo template::submit('courseChangeSubmit', [
|
||||
'value' => 'Se connecter',
|
||||
'ico' => ''
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo template::formClose(); ?>
|
Loading…
Reference in New Issue
Block a user