1410 Espaces profils
This commit is contained in:
parent
b297584fbe
commit
c3c5909ea6
@ -499,10 +499,10 @@ class layout extends common
|
|||||||
$this->getUser('group') <= self::GROUP_MEMBER
|
$this->getUser('group') <= self::GROUP_MEMBER
|
||||||
&& $this->getData(['theme', 'menu', 'selectSpace']) === true
|
&& $this->getData(['theme', 'menu', 'selectSpace']) === true
|
||||||
) {
|
) {
|
||||||
if ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group'))) {
|
if ($this->getCoursesByUser()) {
|
||||||
$itemsRight .= '<li><select id="menuSelectCourse" >';
|
$itemsRight .= '<li><select id="menuSelectCourse" >';
|
||||||
$itemsRight .= '<option name="' . helper::translate('Accueil') . '" value="' . helper::baseUrl(true) . 'course/swap/home" ' . ('home' === self::$siteContent ? 'selected' : '') . '>' . helper::translate('Accueil') . '</option>';
|
$itemsRight .= '<option name="' . helper::translate('Accueil') . '" value="' . helper::baseUrl(true) . 'course/swap/home" ' . ('home' === self::$siteContent ? 'selected' : '') . '>' . helper::translate('Accueil') . '</option>';
|
||||||
foreach ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group')) as $courseId => $value) {
|
foreach ($this->getCoursesByUser() as $courseId => $value) {
|
||||||
$itemsRight .= '<option name="' . $this->getData(['course', $courseId, 'title']) . '" value="' . helper::baseUrl(true) . 'course/swap/' . $courseId . '" ' . ($courseId === self::$siteContent ? 'selected' : '') . '>' . $this->getData(['course', $courseId, 'title']) . '</option>';
|
$itemsRight .= '<option name="' . $this->getData(['course', $courseId, 'title']) . '" value="' . helper::baseUrl(true) . 'course/swap/' . $courseId . '" ' . ($courseId === self::$siteContent ? 'selected' : '') . '>' . $this->getData(['course', $courseId, 'title']) . '</option>';
|
||||||
}
|
}
|
||||||
$itemsRight .= '</select></li>';
|
$itemsRight .= '</select></li>';
|
||||||
@ -922,10 +922,10 @@ class layout extends common
|
|||||||
* Les enseignants les contenus dont ils sont auteurs
|
* Les enseignants les contenus dont ils sont auteurs
|
||||||
*/
|
*/
|
||||||
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()) {
|
||||||
$leftItems .= '<li><select id="barSelectCourse" >';
|
$leftItems .= '<li><select id="barSelectCourse" >';
|
||||||
$leftItems .= '<option name="' . helper::translate('Accueil') . '" value="' . helper::baseUrl(true) . 'course/swap/home" ' . ('home' === self::$siteContent ? 'selected' : '') . '>' . helper::translate('Accueil') . '</option>';
|
$leftItems .= '<option name="' . helper::translate('Accueil') . '" value="' . helper::baseUrl(true) . 'course/swap/home" ' . ('home' === self::$siteContent ? 'selected' : '') . '>' . helper::translate('Accueil') . '</option>';
|
||||||
foreach ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group')) as $courseId => $value) {
|
foreach ($this->getCoursesByUser() as $courseId => $value) {
|
||||||
$leftItems .= '<option name="' . $this->getData(['course', $courseId, 'title']) . '" value="' . helper::baseUrl(true) . 'course/swap/' . $courseId . '" ' . ($courseId === self::$siteContent ? 'selected' : '') . '>' . $this->getData(['course', $courseId, 'title']) . '</option>';
|
$leftItems .= '<option name="' . $this->getData(['course', $courseId, 'title']) . '" value="' . helper::baseUrl(true) . 'course/swap/' . $courseId . '" ' . ($courseId === self::$siteContent ? 'selected' : '') . '>' . $this->getData(['course', $courseId, 'title']) . '</option>';
|
||||||
}
|
}
|
||||||
$leftItems .= '</select></li>';
|
$leftItems .= '</select></li>';
|
||||||
|
@ -1424,50 +1424,50 @@ class common
|
|||||||
* CETTE FONCTION N'EST PAS UTILISEE
|
* CETTE FONCTION N'EST PAS UTILISEE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function getCoursesByUser($userId, $userStatus)
|
public function getCoursesByUser()
|
||||||
{
|
{
|
||||||
$c = $this->getData([('course')]);
|
$courses = $this->getData([('course')]);
|
||||||
$c = helper::arraycolumn($c, 'title', 'SORT_ASC');
|
$courses = helper::arraycolumn($courses, 'title', 'SORT_ASC');
|
||||||
switch ($userStatus) {
|
$filter = array();
|
||||||
|
$userId = $this->getUser('id');
|
||||||
|
switch ($this->getUser('group')) {
|
||||||
case self::GROUP_ADMIN:
|
case self::GROUP_ADMIN:
|
||||||
// Affiche tout
|
// Affiche tout
|
||||||
return $c;
|
return $courses;
|
||||||
case self::GROUP_EDITOR:
|
case self::GROUP_EDITOR:
|
||||||
/*
|
foreach ($courses as $courseId => $value) {
|
||||||
foreach ($c as $courseId => $value) {
|
|
||||||
$students = $this->getData(['enrolment', $courseId]);
|
$students = $this->getData(['enrolment', $courseId]);
|
||||||
// Affiche les espaces gérés par l'éditeur, les espaces où il participe et les espaces ouverts
|
// Affiche les espaces gérés par l'éditeur, les espaces où il participe et les espaces ouverts
|
||||||
if (
|
if (
|
||||||
isset($students[$userId]) === false ||
|
isset($students[$userId]) === true ||
|
||||||
$this->getData(['course', $courseId, 'author']) !== $userId ||
|
$this->getData(['course', $courseId, 'author']) === $userId ||
|
||||||
$this->getData(['course', $courseId, 'access']) !== self::COURSE_ENROLMENT_GUEST
|
$this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST
|
||||||
) {
|
) {
|
||||||
unset($c[$courseId]);
|
$filter[$courseId] = $courses[$courseId];
|
||||||
}
|
}
|
||||||
} */
|
}
|
||||||
return $c;
|
return $courses;
|
||||||
case self::GROUP_MEMBER:
|
case self::GROUP_MEMBER:
|
||||||
/*
|
foreach ($courses as $courseId => $value) {
|
||||||
foreach ($c as $courseId => $value) {
|
// Affiche les espaces du participant et les espaces anonymes
|
||||||
// Affiche les espaces où le membre participe et les espaces ouverts
|
|
||||||
$students = $this->getData(['enrolment', $courseId]);
|
$students = $this->getData(['enrolment', $courseId]);
|
||||||
if (
|
if (
|
||||||
isset($students[$userId]) === false ||
|
isset($students[$userId]) === true ||
|
||||||
$this->getData(['course', $courseId, 'access']) !== self::COURSE_ENROLMENT_GUEST
|
$this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST
|
||||||
) {
|
) {
|
||||||
unset($c[$courseId]);
|
$filter[$courseId] = $courses[$courseId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
return $filter;
|
||||||
return $c;
|
|
||||||
case self::GROUP_VISITOR:
|
case self::GROUP_VISITOR:
|
||||||
foreach ($c as $courseId => $value) {
|
foreach ($courses as $courseId => $value) {
|
||||||
// Affiche les espaces ouverts
|
// Affiche les espaces anonymes
|
||||||
if ($this->getData(['course', $courseId, 'access']) !== self::COURSE_ENROLMENT_GUEST) {
|
if ($this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST) {
|
||||||
unset($c[$courseId]);
|
echo $this->getData(['course', $courseId, 'access']) ;
|
||||||
|
$filter[$courseId] = $courses[$courseId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $c;
|
return $filter;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,21 @@ class course extends common
|
|||||||
&& $this->getCoursesByUser()
|
&& $this->getCoursesByUser()
|
||||||
) {
|
) {
|
||||||
foreach ($this->getCoursesByUser() as $courseId => $courseValue) {
|
foreach ($this->getCoursesByUser() as $courseId => $courseValue) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filtres :
|
||||||
|
* Groupes acceptés :
|
||||||
|
* admin : tous les espaces
|
||||||
|
* editor : gère son espace
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (
|
||||||
|
$this->getUser('group') === self::GROUP_EDITOR
|
||||||
|
&& $this->getUser('id') != $this->getData(['course', $courseId, 'author'])
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$author = $this->getData(['course', $courseId, 'author'])
|
$author = $this->getData(['course', $courseId, 'author'])
|
||||||
? sprintf('%s %s', $this->getData(['user', $this->getData(['course', $courseId, 'author']), 'firstname']), $this->getData(['user', $this->getData(['course', $courseId, 'author']), 'lastname']))
|
? sprintf('%s %s', $this->getData(['user', $this->getData(['course', $courseId, 'author']), 'firstname']), $this->getData(['user', $this->getData(['course', $courseId, 'author']), 'lastname']))
|
||||||
: '';
|
: '';
|
||||||
@ -215,6 +230,17 @@ class course extends common
|
|||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Profil limité au propriétaire ou admis
|
||||||
|
if (
|
||||||
|
$this->getUser('group') === self::GROUP_EDITOR
|
||||||
|
&& $this->getUser('id') != $this->getData(['course', $this->getUrl(2), 'author'])
|
||||||
|
) {
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'access' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if (
|
if (
|
||||||
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
|
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
|
||||||
@ -284,6 +310,18 @@ class course extends common
|
|||||||
public function manage()
|
public function manage()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Profil limité au propriétaire ou admis
|
||||||
|
if (
|
||||||
|
$this->getUser('group') === self::GROUP_EDITOR
|
||||||
|
&& $this->getUser('id') != $this->getData(['course', $this->getUrl(2), 'author'])
|
||||||
|
|| $this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||||
|
) {
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'access' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Liste des enseignants pour le sélecteur d'auteurs
|
// Liste des enseignants pour le sélecteur d'auteurs
|
||||||
$teachers = $this->getData(['user']);
|
$teachers = $this->getData(['user']);
|
||||||
foreach ($teachers as $teacherId => $teacherInfo) {
|
foreach ($teachers as $teacherId => $teacherInfo) {
|
||||||
@ -319,6 +357,19 @@ class course extends common
|
|||||||
*/
|
*/
|
||||||
public function clone ()
|
public function clone ()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Profil limité au propriétaire ou admis
|
||||||
|
if (
|
||||||
|
$this->getUser('group') === self::GROUP_EDITOR
|
||||||
|
&& $this->getUser('id') != $this->getData(['course', $this->getUrl(2), 'author'])
|
||||||
|
|| $this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||||
|
) {
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'access' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Cours à dupliquer
|
// Cours à dupliquer
|
||||||
$courseId = $this->getUrl(2);
|
$courseId = $this->getUrl(2);
|
||||||
|
|
||||||
@ -503,6 +554,18 @@ class course extends common
|
|||||||
public function users()
|
public function users()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Profil limité au propriétaire ou admis
|
||||||
|
if (
|
||||||
|
$this->getUser('group') === self::GROUP_EDITOR
|
||||||
|
&& $this->getUser('id') != $this->getData(['course', $this->getUrl(2), 'author'])
|
||||||
|
|| $this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||||
|
) {
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'access' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Contenu sélectionné
|
// Contenu sélectionné
|
||||||
$courseId = $this->getUrl(2);
|
$courseId = $this->getUrl(2);
|
||||||
|
|
||||||
@ -652,6 +715,18 @@ class course extends common
|
|||||||
public function usersAdd()
|
public function usersAdd()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Profil limité au propriétaire ou admis
|
||||||
|
if (
|
||||||
|
$this->getUser('group') === self::GROUP_EDITOR
|
||||||
|
&& $this->getUser('id') != $this->getData(['course', $this->getUrl(2), 'author'])
|
||||||
|
|| $this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||||
|
) {
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'access' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Contenu sélectionné
|
// Contenu sélectionné
|
||||||
$courseId = $this->getUrl(2);
|
$courseId = $this->getUrl(2);
|
||||||
|
|
||||||
@ -783,9 +858,12 @@ class course extends common
|
|||||||
*/
|
*/
|
||||||
public function userDelete()
|
public function userDelete()
|
||||||
{
|
{
|
||||||
// Accès refusé
|
|
||||||
|
// Profil limité au propriétaire ou admis
|
||||||
if (
|
if (
|
||||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
$this->getUser('group') === self::GROUP_EDITOR
|
||||||
|
&& $this->getUser('id') != $this->getData(['course', $this->getUrl(2), 'author'])
|
||||||
|
|| $this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||||
) {
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
@ -802,7 +880,7 @@ class course extends common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Désinscription de tous les utilisateurs
|
* Désinscription de tous les utilisateurs
|
||||||
*/
|
*/
|
||||||
public function usersDelete()
|
public function usersDelete()
|
||||||
@ -1300,8 +1378,7 @@ class course extends common
|
|||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
case self::COURSE_ENROLMENT_SELF_KEY:
|
case self::COURSE_ENROLMENT_SELF_KEY:
|
||||||
if ($this->getInput('courseSwapEnrolmentKey', helper::FILTER_STRING_SHORT, true) === $this->getData(['course', $courseId, 'enrolmentKey']))
|
if ($this->getInput('courseSwapEnrolmentKey', helper::FILTER_STRING_SHORT, true) === $this->getData(['course', $courseId, 'enrolmentKey'])) {
|
||||||
{
|
|
||||||
$this->courseEnrolUser($courseId, $userId);
|
$this->courseEnrolUser($courseId, $userId);
|
||||||
// Stocker la sélection
|
// Stocker la sélection
|
||||||
$_SESSION['ZWII_SITE_CONTENT'] = $courseId;
|
$_SESSION['ZWII_SITE_CONTENT'] = $courseId;
|
||||||
@ -1388,9 +1465,11 @@ class course extends common
|
|||||||
public function backup()
|
public function backup()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Accès refusé
|
// Profil limité au propriétaire ou admis
|
||||||
if (
|
if (
|
||||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
$this->getUser('group') === self::GROUP_EDITOR
|
||||||
|
&& $this->getUser('id') != $this->getData(['course', $this->getUrl(2), 'author'])
|
||||||
|
|| $this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||||
) {
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
|
Loading…
Reference in New Issue
Block a user