Gestion des isncrits WIP

This commit is contained in:
Fred Tempez 2023-10-04 22:04:18 +02:00
parent 038611b390
commit f15d317f02
6 changed files with 110 additions and 12 deletions

View File

@ -27,6 +27,7 @@ class course extends common
'categoryAdd' => self::GROUP_ADMIN, 'categoryAdd' => self::GROUP_ADMIN,
'categoryDelete' => self::GROUP_ADMIN, 'categoryDelete' => self::GROUP_ADMIN,
'user' => self::GROUP_ADMIN, 'user' => self::GROUP_ADMIN,
'userAdd' => self::GROUP_ADMIN,
]; ];
public static $courseAccess = [ public static $courseAccess = [
@ -46,6 +47,8 @@ class course extends common
public static $courseCategories = []; public static $courseCategories = [];
public static $courseUsers = [];
public static $courses = []; public static $courses = [];
public static $swapMessage = []; public static $swapMessage = [];
@ -69,6 +72,11 @@ class course extends common
$author, $author,
$description, $description,
'<a href="' . $categorieUrl . '" target="_blank">' . $categorieUrl . '</a>', '<a href="' . $categorieUrl . '" target="_blank">' . $categorieUrl . '</a>',
template::button('categoryUser' . $courseId, [
'href' => helper::baseUrl() . 'course/user/' . $courseId,
'value' => template::ico('users'),
'help' => 'Inscrits'
]),
template::button('courseEdit' . $courseId, [ template::button('courseEdit' . $courseId, [
'href' => helper::baseUrl() . 'course/edit/' . $courseId, 'href' => helper::baseUrl() . 'course/edit/' . $courseId,
'value' => template::ico('pencil'), 'value' => template::ico('pencil'),
@ -295,7 +303,7 @@ class course extends common
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => helper::translate('Catégorie'), 'title' => helper::translate('Catégorie de cours'),
'view' => 'category' 'view' => 'category'
]); ]);
} }
@ -351,6 +359,41 @@ class course extends common
]); ]);
} }
public function user()
{
$users = $this->getData(['enrolment', $this->getUrl(2)]);
ksort($users);
foreach ($users as $userId => $userValue) {
self::$courseUsers[] = [
$userId,
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
$userValue['lastPageId'],
helper::dateUTF8('%d %B %Y - %H:%M',$userValue['lastDateVisited']),
template::button('courseDelete' . $userId, [
'class' => 'categoryDelete buttonRed',
'href' => helper::baseUrl() . 'course/categoryDelete/' . $userId,
'value' => template::ico('trash'),
'help' => 'Supprimer'
])
];
}
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Inscrits'),
'view' => 'user'
]);
}
public function userAdd()
{
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Inscrire'),
'view' => 'userAdd'
]);
}
/* /*
* Traitement du changement de langue * Traitement du changement de langue
*/ */

View File

@ -1,13 +1,13 @@
<div class="row"> <div class="row">
<div class="col1"> <div class="col1">
<?php echo template::button('courseCategoryModulesBack', [ <?php echo template::button('categoryBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'course', 'href' => helper::baseUrl() . 'course',
'value' => template::ico('left') 'value' => template::ico('left')
]); ?> ]); ?>
</div> </div>
<div class="col1 offset10"> <div class="col1 offset10">
<?php echo template::button('courseCategoryModulesAdd', [ <?php echo template::button('categoryAdd', [
'class' => 'buttonGreen', 'class' => 'buttonGreen',
'href' => helper::baseUrl() . 'course/categoryAdd', 'href' => helper::baseUrl() . 'course/categoryAdd',
'value' => template::ico('plus') 'value' => template::ico('plus')

View File

@ -6,14 +6,7 @@
'value' => template::ico('left') 'value' => template::ico('left')
]); ?> ]); ?>
</div> </div>
<div class="col1 offset8"> <div class="col1 offset9">
<?php echo template::button('courseUser', [
'href' => helper::baseUrl() . 'course/user',
'value' => template::ico('users'),
'help' => 'Etudiants inscrits'
]); ?>
</div>
<div class="col1">
<?php echo template::button('courseCategory', [ <?php echo template::button('courseCategory', [
'href' => helper::baseUrl() . 'course/category', 'href' => helper::baseUrl() . 'course/category',
'value' => template::ico('table'), 'value' => template::ico('table'),
@ -29,7 +22,7 @@
</div> </div>
</div> </div>
<?php if($module::$courses): ?> <?php if($module::$courses): ?>
<?php echo template::table([2, 1, 3, 4, 1, 1], $module::$courses, ['Titre court', 'Auteur', 'Description', 'Lien direct', '', '']); ?> <?php echo template::table([2, 2, 2, 3, 1, 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; ?>

View File

@ -0,0 +1,22 @@
<div class="row">
<div class="col1">
<?php echo template::button('courseUserBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'course',
'value' => template::ico('left')
]); ?>
</div>
<div class="col1 offset10">
<?php echo template::button('courseUserAdd', [
'class' => 'buttonGreen',
'href' => helper::baseUrl() . 'course/userAdd',
'value' => template::ico('plus')
]); ?>
</div>
</div>
<?php if($module::$courseUsers): ?>
<?php echo template::table([2, 3, 3, 3, 1], $module::$courseUsers, ['Id', 'Nom Prénom', 'Id dernière page', 'Date - Heure', '']); ?>
<?php else: ?>
<?php echo template::speech('Aucun inscrit'); ?>
<?php endif; ?>

View File

@ -0,0 +1,18 @@
/**
* 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 Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @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/
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,22 @@
<?php echo template::formOpen('courseUserAddForm'); ?>
<div class="row">
<div class="col1">
<?php echo template::button('courseUserAddBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'course',
'value' => template::ico('left')
]); ?>
</div>
<div class="col2 offset9">
<?php echo template::submit('courseUserAddSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>
<?php echo helper::translate('Utilisateurs'); ?>
</h4>
</div>
</div>
</div>