forked from ZwiiCMS-Team/ZwiiCampus
Autorise l'accè admin et auteur lorsque le cours est fermé, affiche plus d'infos sur le cours dans l'index des cours
This commit is contained in:
parent
d7f92477d4
commit
a53dc4983e
@ -57,10 +57,15 @@ class course extends common
|
|||||||
ksort($courseIdShortTitle);
|
ksort($courseIdShortTitle);
|
||||||
foreach ($courseIdShortTitle as $courseId => $courseTitle) {
|
foreach ($courseIdShortTitle as $courseId => $courseTitle) {
|
||||||
$categorieUrl = helper::baseUrl(!helper::checkRewrite()) . 'course/swap/' . $courseId;
|
$categorieUrl = helper::baseUrl(!helper::checkRewrite()) . 'course/swap/' . $courseId;
|
||||||
|
$authorId = $this->getData(['course', $courseId, 'author']);
|
||||||
|
$author = sprintf('%s %s', $this->getData(['user', $authorId, 'firstname']), $this->getData(['user', $authorId, 'lastname']));
|
||||||
|
$access = self::$courseAccess[$this->getData(['course', $courseId, 'access'])];
|
||||||
|
$enrolment = self::$courseEnrolment[$this->getData(['course', $courseId, 'enrolment'])];
|
||||||
|
$description = sprintf('%s<br />%s<br />%s<br />', $this->getData(['course', $courseId, 'description']), $access, $enrolment);
|
||||||
self::$courses[] = [
|
self::$courses[] = [
|
||||||
$courseTitle,
|
$courseTitle,
|
||||||
$this->getData(['course', $courseId, 'author']),
|
$author,
|
||||||
$this->getData(['course', $courseId, 'description']),
|
$description,
|
||||||
'<a href="' . $categorieUrl . '" target="_blank">' . $categorieUrl . '</a>',
|
'<a href="' . $categorieUrl . '" target="_blank">' . $categorieUrl . '</a>',
|
||||||
template::button('courseEdit' . $courseId, [
|
template::button('courseEdit' . $courseId, [
|
||||||
'href' => helper::baseUrl() . 'course/edit/' . $courseId,
|
'href' => helper::baseUrl() . 'course/edit/' . $courseId,
|
||||||
@ -311,7 +316,8 @@ class course extends common
|
|||||||
) {
|
) {
|
||||||
$_SESSION['ZWII_SITE_CONTENT'] = $courseId;
|
$_SESSION['ZWII_SITE_CONTENT'] = $courseId;
|
||||||
}
|
}
|
||||||
// l'étudiant est inscrit dans le cours ET le cours est ouvert
|
// l'étudiant est inscrit dans le cours ET le cours est ouvert
|
||||||
|
// ou un admin est connecté ou le prof du cours
|
||||||
elseif (
|
elseif (
|
||||||
$this->courseIsUserEnroled($courseId)
|
$this->courseIsUserEnroled($courseId)
|
||||||
&& $this->courseIsAvailable($courseId)
|
&& $this->courseIsAvailable($courseId)
|
||||||
@ -495,6 +501,9 @@ class course extends common
|
|||||||
if ($courseId === 'home') {
|
if ($courseId === 'home') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if ($this->getUser('group') === self::GROUP_ADMIN || $this->getUser('id') === $this->getData(['group', $courseId, 'author'])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
$access = $this->getData(['course', $courseId, 'access']);
|
$access = $this->getData(['course', $courseId, 'access']);
|
||||||
switch ($access) {
|
switch ($access) {
|
||||||
case self::COURSE_ACCESS_OPEN:
|
case self::COURSE_ACCESS_OPEN:
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php if($module::$courses): ?>
|
<?php if($module::$courses): ?>
|
||||||
<?php echo template::table([2, 2, 2, 4, 1, 1], $module::$courses, ['Titre court', 'Auteur', 'Description', 'Lien direct', '', '']); ?>
|
<?php echo template::table([2, 1, 3, 4, 1, 1], $module::$courses, ['Titre court', 'Auteur', 'Description', 'Lien direct', '', '']); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo template::speech('Aucun Cours'); ?>
|
<?php echo template::speech('Aucun Cours'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user