Droit aux éditeurs sur les cours
This commit is contained in:
parent
42a228a689
commit
d23148bd6c
@ -896,8 +896,7 @@ class layout extends common
|
||||
// Sélecteur de contenu
|
||||
/**
|
||||
* Les admins voient tousles contenus
|
||||
* Les enseignantsles contenus dont ils sont auteurs
|
||||
* Les étudiantsles contenus dans lesquels ils sont inscrits
|
||||
* Les enseignants les contenus dont ils sont auteurs
|
||||
*/
|
||||
if ($this->getUser('group') >= self::GROUP_EDITOR) {
|
||||
if ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group'))) {
|
||||
@ -908,9 +907,6 @@ class layout extends common
|
||||
}
|
||||
$leftItems .= '</select></li>';
|
||||
}
|
||||
}
|
||||
// Bouton Gérerles contenus
|
||||
if ($this->getUser('group') >= self::GROUP_ADMIN) {
|
||||
$leftItems .= '<li>' . template::ico('cubes', [
|
||||
'href' => helper::baseUrl() . 'course',
|
||||
'help' => 'Contenu'
|
||||
|
@ -1416,7 +1416,7 @@ class common
|
||||
// Fonctions pour la gestion des contenus
|
||||
|
||||
/**
|
||||
* Retourneles contenus d'un utilisateur
|
||||
* Retourne les contenus d'un utilisateur
|
||||
* @param string $userId identifiant
|
||||
* @param string $serStatus teacher ou student ou admin
|
||||
*/
|
||||
@ -1428,7 +1428,7 @@ class common
|
||||
return $c;
|
||||
case self::GROUP_EDITOR:
|
||||
foreach ($c as $courseId => $value) {
|
||||
if ($this->getData(['enrolment', $courseId]) !== $userId) {
|
||||
if ($this->getData(['course', $courseId, 'author']) !== $userId) {
|
||||
unset($c[$courseId]);
|
||||
}
|
||||
}
|
||||
|
@ -20,21 +20,21 @@ class course extends common
|
||||
'swap' => self::GROUP_VISITOR,
|
||||
'suscribe' => self::GROUP_VISITOR,
|
||||
'unsuscribe' => self::GROUP_MEMBER,
|
||||
'index' => self::GROUP_ADMIN,
|
||||
'edit' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_EDITOR,
|
||||
'edit' => self::GROUP_EDITOR,
|
||||
'add' => self::GROUP_ADMIN,
|
||||
'delete' => self::GROUP_ADMIN,
|
||||
'category' => self::GROUP_ADMIN,
|
||||
'categoryAdd' => self::GROUP_ADMIN,
|
||||
'categoryEdit' => self::GROUP_ADMIN,
|
||||
'categoryDelete' => self::GROUP_ADMIN,
|
||||
'user' => self::GROUP_ADMIN,
|
||||
'userAdd' => self::GROUP_ADMIN,
|
||||
'userDelete' => self::GROUP_ADMIN,
|
||||
'userDeleteAll' => self::GROUP_ADMIN,
|
||||
'userHistory' => self::GROUP_ADMIN,
|
||||
'usersHistoryExport' => self::GROUP_ADMIN,
|
||||
'userHistoryExport' => self::GROUP_ADMIN,
|
||||
'user' => self::GROUP_EDITOR,
|
||||
'userAdd' => self::GROUP_EDITOR,
|
||||
'userDelete' => self::GROUP_EDITOR,
|
||||
'userDeleteAll' => self::GROUP_EDITOR,
|
||||
'userHistory' => self::GROUP_EDITOR,
|
||||
'usersHistoryExport' => self::GROUP_EDITOR,
|
||||
'userHistoryExport' => self::GROUP_EDITOR,
|
||||
];
|
||||
|
||||
public static $courseAccess = [
|
||||
@ -74,38 +74,40 @@ class course extends common
|
||||
|
||||
public function index()
|
||||
{
|
||||
$courseIdShortTitle = helper::arrayColumn($this->getData(['course']), 'title');
|
||||
ksort($courseIdShortTitle);
|
||||
foreach ($courseIdShortTitle as $courseId => $courseTitle) {
|
||||
$categorieUrl = helper::baseUrl() . 'course/suscribe/' . $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[] = [
|
||||
$courseTitle,
|
||||
$author,
|
||||
$description,
|
||||
'<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, [
|
||||
'href' => helper::baseUrl() . 'course/edit/' . $courseId,
|
||||
'value' => template::ico('pencil'),
|
||||
'help' => 'Éditer'
|
||||
]),
|
||||
template::button('courseDelete' . $courseId, [
|
||||
'class' => 'courseDelete buttonRed',
|
||||
'href' => helper::baseUrl() . 'course/delete/' . $courseId,
|
||||
'value' => template::ico('trash'),
|
||||
'help' => 'Supprimer'
|
||||
])
|
||||
if ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group'))) {
|
||||
foreach ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group')) as $courseId => $courseValue) {
|
||||
$categorieUrl = helper::baseUrl() . 'course/suscribe/' . $courseId;
|
||||
$authorId = $this->getData(['course', $courseId, 'author']);
|
||||
$author = isset($authorId)
|
||||
? sprintf('%s %s', $this->getData(['user', $authorId, 'firstname']), $this->getData(['user', $authorId, 'lastname']))
|
||||
: '';
|
||||
$access = self::$courseAccess[$courseValue ['access']];
|
||||
$enrolment = self::$courseEnrolment[$courseValue ['enrolment']];
|
||||
$description = sprintf('%s<br />%s<br />%s<br />', $courseValue ['description'], $access, $enrolment);
|
||||
self::$courses[] = [
|
||||
$courseValue['title'],
|
||||
$author,
|
||||
$description,
|
||||
'<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, [
|
||||
'href' => helper::baseUrl() . 'course/edit/' . $courseId,
|
||||
'value' => template::ico('pencil'),
|
||||
'help' => 'Éditer'
|
||||
]),
|
||||
template::button('courseDelete' . $courseId, [
|
||||
'class' => 'courseDelete buttonRed',
|
||||
'href' => helper::baseUrl() . 'course/delete/' . $courseId,
|
||||
'value' => template::ico('trash'),
|
||||
'help' => 'Supprimer'
|
||||
])
|
||||
|
||||
];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
|
Loading…
Reference in New Issue
Block a user