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