user enrol user filter okay
This commit is contained in:
parent
ba721c0bdb
commit
a99341aa82
@ -55,7 +55,7 @@ class course extends common
|
|||||||
public static $alphabet = [];
|
public static $alphabet = [];
|
||||||
|
|
||||||
public static $groups = [
|
public static $groups = [
|
||||||
self::GROUP_VISITOR => 'Aucun'
|
'all' => 'Tous'
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $courses = [];
|
public static $courses = [];
|
||||||
@ -400,6 +400,9 @@ class course extends common
|
|||||||
}
|
}
|
||||||
// Liste alphabétique
|
// Liste alphabétique
|
||||||
self::$alphabet = range('A', 'Z');
|
self::$alphabet = range('A', 'Z');
|
||||||
|
$alphabet = range('A', 'Z');
|
||||||
|
self::$alphabet = array_combine($alphabet, self::$alphabet);
|
||||||
|
self::$alphabet = array_merge(['all'=>'Toute'], self::$alphabet );
|
||||||
// Liste des inscrits dans le cours sélectionné.
|
// Liste des inscrits dans le cours sélectionné.
|
||||||
$courseId = $this->getUrl(2);
|
$courseId = $this->getUrl(2);
|
||||||
$users = $this->getData(['enrolment', $courseId]);
|
$users = $this->getData(['enrolment', $courseId]);
|
||||||
@ -408,6 +411,25 @@ class course extends common
|
|||||||
$history = $userValue['history'];
|
$history = $userValue['history'];
|
||||||
$maxTime = max($history);
|
$maxTime = max($history);
|
||||||
$pageId = array_search($maxTime, $history);
|
$pageId = array_search($maxTime, $history);
|
||||||
|
// Filtres
|
||||||
|
if ($this->isPost()) {
|
||||||
|
// Groupe et profils
|
||||||
|
$group = (string) $this->getData(['user', $userId, 'group']);
|
||||||
|
$profil = (string) $this->getData(['user', $userId, 'profil']);
|
||||||
|
$firstName = $this->getData(['user', $userId, 'firstname']);
|
||||||
|
$lastName = $this->getData(['user', $userId, 'lastname']);
|
||||||
|
if ( $this->getInput('courseFilterGroup', helper::FILTER_INT) > 0
|
||||||
|
&& $this->getInput('courseFilterGroup', helper::FILTER_STRING_SHORT) !== $group . $profil )
|
||||||
|
continue;
|
||||||
|
// Première lettre du prénom
|
||||||
|
if ($this->getInput('courseFilterFirstName', helper::FILTER_STRING_SHORT) !== 'all'
|
||||||
|
&& $this->getInput('courseFilterFirstName', helper::FILTER_STRING_SHORT) !== strtoupper(substr($firstName, 0, 1)))
|
||||||
|
continue;
|
||||||
|
// Première lettre du nom
|
||||||
|
if ($this->getInput('courseFilterLastName', helper::FILTER_STRING_SHORT) !== 'all'
|
||||||
|
&& $this->getInput('courseFilterLastName', helper::FILTER_STRING_SHORT) !== strtoupper(substr($lastName, 0, 1)))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
self::$courseUsers[] = [
|
self::$courseUsers[] = [
|
||||||
$userId,
|
$userId,
|
||||||
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||||
@ -422,6 +444,7 @@ class course extends common
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => sprintf(helper::translate('Inscrits dans le cours %s'), $this->getData(['course', $courseId, 'title'])),
|
'title' => sprintf(helper::translate('Inscrits dans le cours %s'), $this->getData(['course', $courseId, 'title'])),
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
'class' => 'userDeleteAll buttonRed',
|
'class' => 'userDeleteAll buttonRed',
|
||||||
'href' => helper::baseUrl() . 'course/userDeleteAll/' . $this->getUrl(2),
|
'href' => helper::baseUrl() . 'course/userDeleteAll/' . $this->getUrl(2),
|
||||||
'value' => helper::translate('Réinitialiser'),
|
'value' => helper::translate('Réinitialiser'),
|
||||||
'help' => 'Désinscrire tous les utilisateurs'
|
'help' => 'Désinscrire tous les utilisateurs',
|
||||||
|
'ico'=> 'minus'
|
||||||
])
|
])
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -27,23 +28,24 @@
|
|||||||
<div class="col2">
|
<div class="col2">
|
||||||
<?php echo template::select('courseFilterGroup', $module::$groups, [
|
<?php echo template::select('courseFilterGroup', $module::$groups, [
|
||||||
'label' => 'Groupes / Profils',
|
'label' => 'Groupes / Profils',
|
||||||
'selected' => isset($_POST['courseFilterGroup']) ? $_POST['courseFilterGroup'] : self::GROUP_VISITOR,
|
'selected' => isset($_POST['courseFilterGroup']) ? $_POST['courseFilterGroup'] : 'all',
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col2">
|
<div class="col2">
|
||||||
<?php echo template::select('courseFilterFirstName', $module::$alphabet, [
|
<?php echo template::select('courseFilterFirstName', $module::$alphabet, [
|
||||||
'label' => 'Prénom commence par',
|
'label' => 'Prénom commence par',
|
||||||
'selected' => isset($_POST['courseFilterFirstName']) ? $_POST['courseFilterFirstName'] : 'A',
|
'selected' => isset($_POST['courseFilterFirstName']) ? $_POST['courseFilterFirstName'] : 'all',
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col2">
|
<div class="col2">
|
||||||
<?php echo template::select('courseFilterLastName', $module::$alphabet, [
|
<?php echo template::select('courseFilterLastName', $module::$alphabet, [
|
||||||
'label' => 'Nom commence par',
|
'label' => 'Nom commence par',
|
||||||
'selected' => isset($_POST['courseFilterLastName']) ? $_POST['courseFilterLastName'] : 'A',
|
'selected' => isset($_POST['courseFilterLastName']) ? $_POST['courseFilterLastName'] : 'all',
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col2 offset4">
|
<div class="col2 offset4">
|
||||||
<?php echo template::submit('courseFilterSubmit', [
|
<?php echo template::submit('courseFilterSubmit', [
|
||||||
|
'value' => 'Filtrer',
|
||||||
'uniqueSubmission' => true
|
'uniqueSubmission' => true
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user