forked from ZwiiCMS-Team/ZwiiCampus
Droit aux éditeurs sur les cours
This commit is contained in:
parent
42a228a689
commit
d23148bd6c
@ -897,7 +897,6 @@ class layout extends common
|
||||
/**
|
||||
* Les admins voient tousles contenus
|
||||
* 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->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'
|
||||
|
@ -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,17 +74,18 @@ class course extends common
|
||||
|
||||
public function index()
|
||||
{
|
||||
$courseIdShortTitle = helper::arrayColumn($this->getData(['course']), 'title');
|
||||
ksort($courseIdShortTitle);
|
||||
foreach ($courseIdShortTitle as $courseId => $courseTitle) {
|
||||
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 = 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);
|
||||
$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[] = [
|
||||
$courseTitle,
|
||||
$courseValue['title'],
|
||||
$author,
|
||||
$description,
|
||||
'<a href="' . $categorieUrl . '" target="_blank">' . $categorieUrl . '</a>',
|
||||
@ -107,6 +108,7 @@ class course extends common
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
|
Loading…
Reference in New Issue
Block a user