forked from ZwiiCMS-Team/ZwiiCampus
debogage filtrage du swap
This commit is contained in:
parent
3422f581d8
commit
1552e29942
@ -900,7 +900,6 @@ class layout extends common
|
||||
* Les étudiants les cours dans lesquels ils sont inscrits
|
||||
*/
|
||||
if ($this->getUser('group') >= self::GROUP_TEACHER) {
|
||||
var_dump($this->getCoursesByUser($this->getUser('id'), $this->getUser('group')));
|
||||
if ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group'))) {
|
||||
$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>';
|
||||
|
@ -1427,7 +1427,6 @@ class common
|
||||
return $c;
|
||||
case self::GROUP_TEACHER:
|
||||
foreach ($c as $courseId => $value) {
|
||||
var_dump( $this->getData(['enrolment', $courseId, 'teacher']));
|
||||
if ($this->getData(['enrolment', $courseId, 'teacher']) !== $userId) {
|
||||
unset($c[$courseId]);
|
||||
}
|
||||
|
@ -41,6 +41,10 @@ class course extends common
|
||||
|
||||
public static $courses = [];
|
||||
|
||||
const COURSE_ACCESS_OPEN = 0;
|
||||
const COURSE_ACCESS_DATE = 0;
|
||||
const COURSE_ACCESS_CLOSE = 0;
|
||||
|
||||
public function index()
|
||||
{
|
||||
$courseIdShortTitle = helper::arrayColumn($this->getData(['course']), 'shortTitle');
|
||||
@ -199,7 +203,7 @@ class course extends common
|
||||
]);
|
||||
|
||||
// BDD des inscrits
|
||||
$students = is_null($this->getData(['enrolment', $courseId, 'students'])) ? [] : $this->getData([ 'enrolment', $courseId, 'students']);
|
||||
$students = is_null($this->getData(['enrolment', $courseId, 'students'])) ? [] : $this->getData(['enrolment', $courseId, 'students']);
|
||||
$this->setData([
|
||||
'enrolment',
|
||||
$courseId,
|
||||
@ -240,9 +244,28 @@ class course extends common
|
||||
{
|
||||
// Cours sélectionnée
|
||||
$courseId = $this->getUrl(2);
|
||||
|
||||
// Modalité d'ouverture du cours
|
||||
// L'utilisateur n'est pas admin
|
||||
if ($this->getUser('group') < self::GROUP_ADMIN) {
|
||||
if (
|
||||
// le cours est fermé
|
||||
$this->getData(['course', $courseId, 'access']) === self::COURSE_ACCESS_CLOSE
|
||||
||
|
||||
// Le cours ets ouvert entre deux dates
|
||||
($this->getData(['course', $courseId, 'access']) &&
|
||||
($this->getData(['course', $courseId, 'openingDate']) >= time() ||
|
||||
$this->getData(['course', $courseId, 'clodingDate']) <= time())
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
// home n'est pas présent dans la base de donénes des cours
|
||||
$courseId === 'home' ||
|
||||
// Contrôle la validité du cours demandé
|
||||
(is_dir(self::DATA_DIR . $courseId) &&
|
||||
$this->getData(['course', $courseId]))
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user