forked from ZwiiCMS-Team/ZwiiCampus
Enrolment OKAY
This commit is contained in:
parent
6b6ce19064
commit
b5eff6f9b8
@ -456,7 +456,6 @@ class course extends common
|
|||||||
break;
|
break;
|
||||||
// Auto avec ou sans clé
|
// Auto avec ou sans clé
|
||||||
case self::COURSE_ENROLMENT_SELF:
|
case self::COURSE_ENROLMENT_SELF:
|
||||||
$_SESSION['ZWII_SITE_CONTENT'] = $courseId;
|
|
||||||
$redirect .= 'course/enrol/' . $courseId;
|
$redirect .= 'course/enrol/' . $courseId;
|
||||||
$message = helper::translate('Veuillez vous inscrire');
|
$message = helper::translate('Veuillez vous inscrire');
|
||||||
break;
|
break;
|
||||||
@ -508,17 +507,18 @@ class course extends common
|
|||||||
switch ($this->getData(['course', $courseId, 'enrolment'])) {
|
switch ($this->getData(['course', $courseId, 'enrolment'])) {
|
||||||
case self::COURSE_ENROLMENT_SELF:
|
case self::COURSE_ENROLMENT_SELF:
|
||||||
$this->courseEnrolUser($courseId, $userId);
|
$this->courseEnrolUser($courseId, $userId);
|
||||||
|
// Stocker la sélection
|
||||||
|
$_SESSION['ZWII_SITE_CONTENT'] = $courseId;
|
||||||
break;
|
break;
|
||||||
case self::COURSE_ENROLMENT_SELF_KEY:
|
case self::COURSE_ENROLMENT_SELF_KEY:
|
||||||
if ($this->getInput('courseSwapEnrolmentKey') === $this->getData(['course', $courseId, 'enrolmentKey'])) {
|
if ($this->getInput('courseSwapEnrolmentKey') === $this->getData(['course', $courseId, 'enrolmentKey'])) {
|
||||||
$this->courseEnrolUser($courseId, $userId);
|
$this->courseEnrolUser($courseId, $userId);
|
||||||
|
// Stocker la sélection
|
||||||
|
$_SESSION['ZWII_SITE_CONTENT'] = $courseId;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stocker la sélection
|
|
||||||
$_SESSION['ZWII_SITE_CONTENT'] = $courseId;
|
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl()
|
'redirect' => helper::baseUrl()
|
||||||
@ -526,22 +526,26 @@ class course extends common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// L'étudiant est-il inscrit
|
// L'étudiant est-il inscrit
|
||||||
self::$swapMessage['submitLabel'] = 'Se connecter';
|
self::$swapMessage['submitLabel'] = helper::translate('M\'inscrire');
|
||||||
self::$swapMessage['enrolmentMessage'] = '';
|
self::$swapMessage['enrolmentMessage'] = '';
|
||||||
self::$swapMessage['enrolmentKey'] = '';
|
self::$swapMessage['enrolmentKey'] = '';
|
||||||
if ($this->courseIsUserEnroled($courseId) === false) {
|
if ($this->courseIsUserEnroled($courseId) === false) {
|
||||||
switch ($this->getData(['course', $courseId, 'enrolment'])) {
|
switch ($this->getData(['course', $courseId, 'enrolment'])) {
|
||||||
case self::COURSE_ENROLMENT_GUEST:
|
|
||||||
case self::COURSE_ENROLMENT_SELF:
|
case self::COURSE_ENROLMENT_SELF:
|
||||||
self::$swapMessage['submitLabel'] = helper::translate('M\'inscrire');
|
if ($userId == '') {
|
||||||
|
self::$swapMessage['enrolmentMessage'] = helper::translate('Connectez-vous pour accéder à ce cours.');
|
||||||
|
self::$swapMessage['submitLabel'] = helper::translate('Connexion');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case self::COURSE_ENROLMENT_SELF_KEY:
|
case self::COURSE_ENROLMENT_SELF_KEY:
|
||||||
if ($userId) {
|
if ($userId == '') {
|
||||||
|
self::$swapMessage['enrolmentMessage'] = helper::translate('Connectez-vous pour accéder à ce cours.');
|
||||||
|
self::$swapMessage['submitLabel'] = helper::translate('Connexion');
|
||||||
|
} else {
|
||||||
|
self::$swapMessage['submitLabel'] = helper::translate('Connexion');
|
||||||
self::$swapMessage['enrolmentKey'] = template::text('courseSwapEnrolmentKey', [
|
self::$swapMessage['enrolmentKey'] = template::text('courseSwapEnrolmentKey', [
|
||||||
'label' => helper::translate('Clé d\'inscription'),
|
'label' => helper::translate('Clé d\'inscription'),
|
||||||
]);
|
]);
|
||||||
} else {
|
|
||||||
self::$swapMessage['enrolmentMessage'] = helper::translate('Connectez-vous pour accéder à ce cours.');
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case self::COURSE_ENROLMENT_MANUAL:
|
case self::COURSE_ENROLMENT_MANUAL:
|
||||||
|
@ -32,13 +32,22 @@
|
|||||||
'value' => template::ico('left')
|
'value' => template::ico('left')
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3 offset7">
|
<?php if ($module::$swapMessage['submitLabel'] === 'Connexion'): ?>
|
||||||
|
<div class="col2 offset8">
|
||||||
|
<?php echo template::button('courseConnect', [
|
||||||
|
'href' => helper::baseUrl(true) . 'user/login',
|
||||||
|
'value' => template::ico('login'),
|
||||||
|
'help' => 'Connexion',
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="col3 offset6">
|
||||||
<?php echo template::submit('courseSwapSubmit', [
|
<?php echo template::submit('courseSwapSubmit', [
|
||||||
'value' => $module::$swapMessage['submitLabel'],
|
'value' => $module::$swapMessage['submitLabel'],
|
||||||
'disabled' => !$module->courseIsAvailable($this->getUrl(2)),
|
'disabled' => !$module->courseIsAvailable($this->getUrl(2)),
|
||||||
'ico' => ''
|
'ico' => ''
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
Loading…
Reference in New Issue
Block a user