1.6 Autorisation d'éditer les espaces

This commit is contained in:
Fred Tempez 2024-02-13 10:28:30 +01:00
parent c43ce394e4
commit 13227a5cd4
5 changed files with 38 additions and 14 deletions

View File

@ -929,10 +929,12 @@ class layout extends common
}
$leftItems .= '</select></li>';
}
$leftItems .= '<li>' . template::ico('cubes', [
'href' => helper::baseUrl() . 'course',
'help' => 'Espaces'
]) . '</li>';
if ($this->getUser('permission', 'course', 'index') === true) {
$leftItems .= '<li>' . template::ico('cubes', [
'href' => helper::baseUrl() . 'course',
'help' => 'Gérer les espaces'
]) . '</li>';
}
}
if ($this->getUser('group') >= self::GROUP_ADMIN) {
$leftItems .= '<li>' . template::ico('brush', [
@ -941,9 +943,10 @@ class layout extends common
]) . '</li>';
}
// Liste des pages et bouton de gestion interdit pour l'accueil sauf admin
if (($this->getUser('group') === self::GROUP_EDITOR && self::$siteContent != 'home')
|| $this->getUser('group') === self::GROUP_ADMIN
) {
if (
($this->getUser('group') === self::GROUP_EDITOR && self::$siteContent != 'home')
|| $this->getUser('group') === self::GROUP_ADMIN
) {
$leftItems .= '<li><select id="barSelectPage">';
$leftItems .= '<option value="">' . helper::translate('Pages du site') . '</option>';
$leftItems .= '<optgroup label="' . helper::translate('Pages orphelines') . '">';
@ -1102,7 +1105,7 @@ class layout extends common
$this->setData(['core', 'lastAutoUpdate', $today]);
if (
helper::checkNewVersion(common::ZWII_UPDATE_CHANNEL)
) {
) {
$this->setData(['core', 'updateAvailable', true]);
}
}

View File

@ -1419,7 +1419,7 @@ class common
* @param string $userId identifiant
* @param string $serStatus teacher ou student ou admin
*
* CETTE FONCTION N'EST PAS UTILISEE
* CETTE FONCTION EST UTILISEE PAR LAYOUT
*
*/
public function getCoursesByProfil()

View File

@ -82,14 +82,14 @@ class course extends common
public function index()
{
// Tableau à transmettre à la fvue
self::$courses = array();
if (
$this->getUser('id')
&& $this->getUser('group')
&& $this->getCoursesByProfil()
) {
foreach ($this->getCoursesByProfil() as $courseId => $courseValue) {
foreach ($this->getData(['course']) as $courseId => $courseValue) {
/**
* Filtres :
* Groupes acceptés :
@ -126,7 +126,7 @@ class course extends common
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Espaces disponibles'),
'title' => helper::translate('Gestionnaire d\'espaces'),
'view' => 'index',
'vendor' => [
'datatables'
@ -1779,7 +1779,9 @@ class course extends common
$this->getUser('group') === self::$actions[$funtion]
&&
($this->getData(['enrolment', $courseId]) && ($this->getUser('id') === $this->getData(['course', $courseId, 'author']))
|| array_key_exists($this->getUser('id'), $this->getData(['enrolment', $courseId])))
|| (// 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]))) )
);
default:
return false;

View File

@ -705,6 +705,9 @@ class user extends common
],
'user' => [
'edit' => $this->getInput('profilEditUserEdit', helper::FILTER_BOOLEAN),
],
'course' => [
'index' => $this->getInput('profilEditCourseIndex', helper::FILTER_BOOLEAN),
]
];

View File

@ -79,6 +79,22 @@
</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>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">