1.6.00 Espaces de l'auteur ou tous les espaces WIP
This commit is contained in:
parent
e9e39f5a03
commit
3c76bcdf4c
@ -24,8 +24,8 @@ class course extends common
|
||||
'edit' => self::GROUP_EDITOR, // Fait
|
||||
'manage' => self::GROUP_EDITOR, // Fait
|
||||
'users' => self::GROUP_EDITOR, // fait
|
||||
'usersAdd' => self::GROUP_EDITOR,//Fait
|
||||
'usersDelete' => self::GROUP_EDITOR,//Fait
|
||||
'usersAdd' => self::GROUP_EDITOR, //Fait
|
||||
'usersDelete' => self::GROUP_EDITOR, //Fait
|
||||
'usersHistoryExport' => self::GROUP_EDITOR, //fait
|
||||
'userDelete' => self::GROUP_EDITOR, //Fait
|
||||
'userHistory' => self::GROUP_EDITOR, //Fait
|
||||
@ -33,7 +33,7 @@ class course extends common
|
||||
'backup' => self::GROUP_EDITOR, // Fait
|
||||
'restore' => self::GROUP_EDITOR, //Fait
|
||||
'clone' => self::GROUP_ADMIN,
|
||||
'add' => self::GROUP_ADMIN,
|
||||
'add' => self::GROUP_ADMIN,
|
||||
'delete' => self::GROUP_ADMIN,
|
||||
'category' => self::GROUP_ADMIN,
|
||||
'categoryAdd' => self::GROUP_ADMIN,
|
||||
@ -1212,7 +1212,7 @@ class course extends common
|
||||
self::$userGraph[] = [
|
||||
helper::dateUTF8('%Y-%m-%d %H:%M:%S', $time),
|
||||
$diff,
|
||||
html_entity_decode($pages[$pageId]['title']) . ' ('. helper::dateUTF8('%M\'%S"', $diff) . ')'
|
||||
html_entity_decode($pages[$pageId]['title']) . ' (' . helper::dateUTF8('%M\'%S"', $diff) . ')'
|
||||
];
|
||||
}
|
||||
$lastView = $time;
|
||||
@ -1769,19 +1769,27 @@ class course extends common
|
||||
* Admin : tous les droits
|
||||
* Editor : Inscrits dans le cours ou propriétaire
|
||||
*/
|
||||
public function permissionControl($funtion, $courseId)
|
||||
public function permissionControl($function, $courseId)
|
||||
{
|
||||
switch ($this->getUser('group')) {
|
||||
case self::GROUP_ADMIN:
|
||||
return true;
|
||||
case self::GROUP_EDITOR:
|
||||
return (
|
||||
$this->getUser('group') === self::$actions[$funtion]
|
||||
$this->getUser('permission', __CLASS__, $function)
|
||||
&&
|
||||
($this->getData(['enrolment', $courseId]) && ($this->getUser('id') === $this->getData(['course', $courseId, 'author']))
|
||||
|| (// permission de gérer tous les espaces dans lesquels l'éditeur est inscrit.
|
||||
$this->getUser('permission', __CLASS__, 'index') === true &&
|
||||
array_key_exists($this->getUser('id'), $this->getData(['enrolment', $courseId]))) )
|
||||
$this->getUser('group') === self::$actions[$function]
|
||||
&&
|
||||
// Permission d'accèder aux espaces dans lesquels le membre auteur
|
||||
(
|
||||
$this->getData(['enrolment', $courseId]) && ($this->getUser('id') === $this->getData(['course', $courseId, 'author']))
|
||||
)
|
||||
||
|
||||
( // Permission d'accèder aux esapces dans lesquels le membre est inscrits avec les
|
||||
$this->getData(['enrolment', $courseId])
|
||||
&& $this->getUser('permission', __CLASS__, 'author') === true
|
||||
&& array_key_exists($this->getUser('id'), $this->getData(['enrolment', $courseId]))
|
||||
)
|
||||
);
|
||||
default:
|
||||
return false;
|
||||
|
@ -6,41 +6,38 @@
|
||||
'value' => template::ico('home')
|
||||
]); ?>
|
||||
</div>
|
||||
<?php if ($this->getUser('group') === self::GROUP_ADMIN): ?>
|
||||
<div class="col1 offset8">
|
||||
<?php echo template::button('courseUpload', [
|
||||
'href' => helper::baseUrl() . 'course/restore/',
|
||||
'value' => template::ico('upload-cloud'),
|
||||
'help' => 'Restaurer'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php echo template::button('courseCategory', [
|
||||
'href' => helper::baseUrl() . 'course/category',
|
||||
'value' => template::ico('table'),
|
||||
'help' => 'Catégories'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<div class="col1 offset8">
|
||||
<?php if ($this->getUser('permission', 'course', 'add') === true): ?>
|
||||
<?php echo template::button('courseAdd', [
|
||||
'class' => 'buttonGreen',
|
||||
'href' => helper::baseUrl() . 'course/add',
|
||||
'value' => template::ico('plus'),
|
||||
'help' => 'Ajouter un espace'
|
||||
]); ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="col1 offset10">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php if ($this->getUser('permission', 'course', 'category') === true): ?>
|
||||
<?php echo template::button('courseCategory', [
|
||||
'href' => helper::baseUrl() . 'course/category',
|
||||
'value' => template::ico('table'),
|
||||
'help' => 'Catégories des espaces'
|
||||
]); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php if ($this->getUser('permission', 'course', 'restore') === true): ?>
|
||||
<?php echo template::button('courseUpload', [
|
||||
'href' => helper::baseUrl() . 'course/restore/',
|
||||
'value' => template::ico('upload-cloud'),
|
||||
'help' => 'Restaurer depuis le dossier de l\'espace ' . self::$siteContent
|
||||
'help' => 'Restaurer un espace'
|
||||
]); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($module::$courses): ?>
|
||||
<?php echo template::table([4, 4, 3, 1 ], $module::$courses, ['Titre court', 'Description', 'Inscription', '',], ['id' => 'dataTables']); ?>
|
||||
<?php echo template::table([4, 4, 3, 1], $module::$courses, ['Titre court', 'Description', 'Inscription', '',], ['id' => 'dataTables']); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucun espace'); ?>
|
||||
<?php endif; ?>
|
@ -707,8 +707,15 @@ class user extends common
|
||||
'edit' => $this->getInput('profilEditUserEdit', helper::FILTER_BOOLEAN),
|
||||
],
|
||||
'course' => [
|
||||
'index' => $this->getInput('profilEditCourseIndex', helper::FILTER_BOOLEAN),
|
||||
'manage' => $this->getInput('profilEditCourseIndex', helper::FILTER_BOOLEAN), // Les deux fonctions sont groupées
|
||||
/**
|
||||
* author vaut false lorsque l'éditeur a les droits de modifier uniquement ses espaces.
|
||||
* author vaut true lorsque l'éditeur a les droits de modifier uniquement TOUS les espaces.
|
||||
*/
|
||||
'author' => $this->getInput('profilEditCourseAuthor', helper::FILTER_BOOLEAN),
|
||||
// On autorise l'accès à ces deux pages
|
||||
'index' => $this->getInput('profilEditCourseIndex', helper::FILTER_BOOLEAN) && $this->getInput('profilEditCourseAuthor', helper::FILTER_BOOLEAN),
|
||||
'manage' => $this->getInput('profilEditCourseIndex', helper::FILTER_BOOLEAN) && $this->getInput('profilEditCourseAuthor', helper::FILTER_BOOLEAN), // Les deux fonctions sont groupées
|
||||
// La suite
|
||||
'users' => $this->getInput('profilEditCourseUsers', helper::FILTER_BOOLEAN),
|
||||
'userHistory' => $this->getInput('profilEditCourseUserHistory', helper::FILTER_BOOLEAN),
|
||||
'userHistoryExport' => $this->getInput('profilEditCourseUserExport', helper::FILTER_BOOLEAN),
|
||||
|
@ -19,7 +19,7 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
// Désactive les éléments liés aux espaces
|
||||
if (!$("#profilEditCourseIndex").prop("checked")) {
|
||||
if (!$("#profilEditCourseIndex, #profilEditCourseAuthor").prop("checked")) {
|
||||
$("#courseContainer").slideUp();
|
||||
} else {
|
||||
$("#courseContainer").slideDown();
|
||||
@ -71,7 +71,7 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
// Gérer l'évènement sur les options des espaces
|
||||
$("#profilEditCourseIndex").change(function () {
|
||||
$("#profilEditCourseIndex, #profilEditCourseAuthor").change(function () {
|
||||
if (!$(this).is(':checked')) {
|
||||
$('.courseOptions input[type="checkbox"]').prop('checked', false);
|
||||
$("#courseContainer").slideUp();
|
||||
|
@ -79,76 +79,83 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo helper::translate('Gestion des espaces'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('profilEditCourseIndex', true, 'Gérer tous les espaces', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'index'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="courseContainer">
|
||||
<?php if ($this->getUrl(2) >= self::GROUP_EDITOR): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo helper::translate('Gestion des espaces'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseEdit', true, 'Éditer un espace', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'edit']),
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('profilEditCourseAuthor', true, 'Gérer ses espaces', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'author'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseBackup', true, 'Sauvegarder un espace', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'backup']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseRestore', true, 'Restaurer un espace', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'restore']),
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('profilEditCourseIndex', true, 'Gérer tous les espaces', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'index'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUsers', true, 'Lister participants', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'users']),
|
||||
]); ?>
|
||||
<div id="courseContainer">
|
||||
<div class="row">
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseEdit', true, 'Éditer un espace', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'edit']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseBackup', true, 'Sauvegarder un espace', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'backup']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseRestore', true, 'Restaurer un espace', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'restore']),
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUserHistory', true, 'Voir historique d\'un participant', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'userHistory']),
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUsers', true, 'Lister participants', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'users']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUserHistory', true, 'Voir historique d\'un participant', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'userHistory']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUserHistoryExport', true, 'Exporter historique d\'un participant', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'userHistoryExport']),
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUserHistoryExport', true, 'Exporter historique d\'un participant', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'userHistoryExport']),
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUserDelete', true, 'Désinscrire un participant', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'userDelete']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUsersAdd', true, 'Inscrire en masse', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'usersAdd']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUsersDelete', true, 'Désinscrire en masse', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'usersDelete']),
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUserDelete', true, 'Désinscrire un participant', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'userDelete']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUsersAdd', true, 'Inscrire en masse', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'usersAdd']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 courseOptions">
|
||||
<?php echo template::checkbox('profilEditCourseUsersDelete', true, 'Désinscrire en masse', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'usersDelete']),
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
|
Loading…
Reference in New Issue
Block a user