Inscription par l'enseignant

This commit is contained in:
Fred Tempez 2023-11-25 14:36:49 +01:00
parent b73963d5df
commit e4647c0702
5 changed files with 21 additions and 16 deletions

View File

@ -69,7 +69,7 @@ class common
const COURSE_ENROLMENT_GUEST = 0; const COURSE_ENROLMENT_GUEST = 0;
const COURSE_ENROLMENT_SELF = 1; // Ouvert à tous les membres const COURSE_ENROLMENT_SELF = 1; // Ouvert à tous les membres
const COURSE_ENROLMENT_SELF_KEY = 2; // Ouvert à tous les membres disposant de la clé const COURSE_ENROLMENT_SELF_KEY = 2; // Ouvert à tous les membres disposant de la clé
const COURSE_ENROLMENT_MANUAL = 3; const COURSE_ENROLMENT_MANDATORY = 3;
public static $actions = []; public static $actions = [];

View File

@ -47,7 +47,7 @@ class course extends common
self::COURSE_ENROLMENT_GUEST => 'Anonyme', self::COURSE_ENROLMENT_GUEST => 'Anonyme',
self::COURSE_ENROLMENT_SELF => 'Inscription libre', self::COURSE_ENROLMENT_SELF => 'Inscription libre',
self::COURSE_ENROLMENT_SELF_KEY => 'Inscription avec clé', self::COURSE_ENROLMENT_SELF_KEY => 'Inscription avec clé',
//self::COURSE_ENROLMENT_MANUAL => 'Manuelle' self::COURSE_ENROLMENT_MANDATORY => 'Imposée'
]; ];
public static $courseTeachers = []; public static $courseTeachers = [];
@ -893,7 +893,7 @@ class course extends common
if ($this->getUser('id')) { if ($this->getUser('id')) {
$redirect = helper::baseUrl() . 'course/suscribe/' . $courseId; $redirect = helper::baseUrl() . 'course/suscribe/' . $courseId;
} else { } else {
$message = helper::translate('Vous devez disposer d\'un compte pour accéder à ce contenu '); $message = helper::translate('Vous devez disposer d\'un compte pour accéder à ce contenu');
$state = false; $state = false;
} }
break; break;
@ -902,18 +902,16 @@ class course extends common
if ($this->getUser('id')) { if ($this->getUser('id')) {
$redirect = helper::baseUrl() . 'course/suscribe/' . $courseId; $redirect = helper::baseUrl() . 'course/suscribe/' . $courseId;
} else { } else {
$message = helper::translate('Vous devez disposer d\'un compte et d\'une clé pour accéder à ce contenu '); $message = helper::translate('Vous devez disposer d\'un compte et d\'une clé pour accéder à ce contenu');
$state = false; $state = false;
} }
break; break;
// Par le prof // Par le prof
/* case self::COURSE_ENROLMENT_MANDATORY:
case self::COURSE_ENROLMENT_MANUAL: $message = helper::translate('L\'enseignant doit vous inscrire');
$message = helper::translate('L\'enseignant ne vous a pas inscrit dans ce contenu !');
$state = false; $state = false;
break; break;
default: default:
*/
} }
} }
@ -1168,8 +1166,8 @@ class course extends common
]); ]);
} }
break; break;
case self::COURSE_ENROLMENT_MANUAL: case self::COURSE_ENROLMENT_MANDATORY:
self::$swapMessage['enrolmentMessage'] = helper::translate('L\'enseignant inscrit les étudiants dans le contenu, vous ne pouvez pas vous inscrire vous-même.'); self::$swapMessage['enrolmentMessage'] = helper::translate('Vous ne pouvez pas vous inscrire par vous-même.');
break; break;
} }
// Valeurs en sortie // Valeurs en sortie

View File

@ -338,7 +338,7 @@ class suscribe extends common
$check = false; $check = false;
$notification = 'La validité est dépassée'; $notification = 'La validité est dépassée';
} }
// La clé est incorrecte ou le compet a déjà été validé // La clé est incorrecte ou le compte a déjà été validé
if ( if (
$check && $check &&
($auth !== $this->getData(['module', $this->getUrl(0), 'user', $userId, 'auth']) ($auth !== $this->getData(['module', $this->getUrl(0), 'user', $userId, 'auth'])

View File

@ -113,7 +113,6 @@
'placeholder' => 'Ouvre le %s et ferme le %s' 'placeholder' => 'Ouvre le %s et ferme le %s'
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo template::text('coursesCaptionAccessClose', [ <?php echo template::text('coursesCaptionAccessClose', [
'label' => 'Fermé', 'label' => 'Fermé',
@ -129,25 +128,30 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col4"> <div class="col3">
<?php echo template::text('coursesCaptionGuest', [ <?php echo template::text('coursesCaptionGuest', [
'label' => 'Anonyme', 'label' => 'Anonyme',
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'enrolguest']) 'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'enrolguest'])
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col3">
<?php echo template::text('coursesCaptionSelf', [ <?php echo template::text('coursesCaptionSelf', [
'label' => 'Membre', 'label' => 'Membre',
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'enrolself']) 'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'enrolself'])
]); ?> ]); ?>
</div> </div>
<div class="col3">
<div class="col4">
<?php echo template::text('coursesCaptionSelfKey', [ <?php echo template::text('coursesCaptionSelfKey', [
'label' => 'Membre avec clé', 'label' => 'Membre avec clé',
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'enrolselfkey']) 'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'enrolselfkey'])
]); ?> ]); ?>
</div> </div>
<div class="col3">
<?php echo template::text('coursesCaptionMandatory', [
'label' => 'Imposée',
'value' => $this->getData(['module', $this->getUrl(0), 'caption', 'enrolMandatory'])
]); ?>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col4"> <div class="col4">

View File

@ -58,6 +58,7 @@ class workshop extends common
'enrolguest' => 'Anonyme', 'enrolguest' => 'Anonyme',
'enrolself' => 'Membres', 'enrolself' => 'Membres',
'enrolselfkey' => 'Membres avec cl&eacute;', 'enrolselfkey' => 'Membres avec cl&eacute;',
'enrolMandatory' => 'Inscription par l\'enseignant',
'url' => 'Acc&eacute;der au contenu', 'url' => 'Acc&eacute;der au contenu',
'unsuscribe' => 'Me d&eacute;sinscrire', 'unsuscribe' => 'Me d&eacute;sinscrire',
'enrolmentLimit' => 'Date limite des inscriptions', 'enrolmentLimit' => 'Date limite des inscriptions',
@ -107,6 +108,7 @@ class workshop extends common
'enrolguest' => $this->getInput('coursesCaptionGuest', helper::FILTER_STRING_SHORT), 'enrolguest' => $this->getInput('coursesCaptionGuest', helper::FILTER_STRING_SHORT),
'enrolself' => $this->getInput('coursesCaptionSelf', helper::FILTER_STRING_SHORT), 'enrolself' => $this->getInput('coursesCaptionSelf', helper::FILTER_STRING_SHORT),
'enrolselfkey' => $this->getInput('coursesCaptionSelfKey', helper::FILTER_STRING_SHORT), 'enrolselfkey' => $this->getInput('coursesCaptionSelfKey', helper::FILTER_STRING_SHORT),
'enrolMandatory' => $this->getInput('coursesCaptionMandatory', helper::FILTER_STRING_SHORT),
'url' => $this->getInput('coursesCaptionUrl', helper::FILTER_STRING_SHORT), 'url' => $this->getInput('coursesCaptionUrl', helper::FILTER_STRING_SHORT),
'unsuscribe' => $this->getInput('coursesCaptionUnsuscribe', helper::FILTER_STRING_SHORT), 'unsuscribe' => $this->getInput('coursesCaptionUnsuscribe', helper::FILTER_STRING_SHORT),
'enrolmentLimit' => $this->getInput('coursesCaptionEnrolmentLimit', helper::FILTER_STRING_SHORT), 'enrolmentLimit' => $this->getInput('coursesCaptionEnrolmentLimit', helper::FILTER_STRING_SHORT),
@ -140,6 +142,7 @@ class workshop extends common
self::$coursesEnrolment[self::COURSE_ENROLMENT_GUEST] = $this->getData(['module', $this->getUrl(0), 'caption', 'enrolguest']); 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] = $this->getData(['module', $this->getUrl(0), 'caption', 'enrolself']);
self::$coursesEnrolment[self::COURSE_ENROLMENT_SELF_KEY] = $this->getData(['module', $this->getUrl(0), 'caption', 'enrolselfkey']); self::$coursesEnrolment[self::COURSE_ENROLMENT_SELF_KEY] = $this->getData(['module', $this->getUrl(0), 'caption', 'enrolselfkey']);
self::$coursesEnrolment[self::COURSE_ENROLMENT_MANDATORY] = $this->getData(['module', $this->getUrl(0), 'caption', 'enrolMandatory']);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([