function isWorkbookInstalledByUser($currentUser, $currentUserRole, $currentLessonID) { $userLessons = $currentUser->getLessons(false, $currentUserRole); $lessons = array(); unset($userLessons[$currentLessonID]); // do not use current lesson $lessons[-1] = array("id" => -1, "name" => _WORKBOOK_SWITCH_TO); $lessons[-2] = array("id" => -2, "name" => '-------------'); foreach ($userLessons as $key => $value) { $lesson = new EfrontLesson($key); $installed = $lesson->getOptions(array('module_workbook')); if (count($installed) != 0 && $installed['module_workbook'] == 1) { $lessons[$key] = array("id" => $key, "name" => $lesson->lesson['name']); } } return $lessons; }
function getProfessorJournalLessons($currentUser) { $userLessons = $currentUser->getLessons(false, 'professor'); $lessons = array(); foreach ($userLessons as $key => $value) { $lesson = new EfrontLesson($key); $installed = $lesson->getOptions(array('module_journal')); if (count($installed) != 0 && $installed['module_journal'] == 1) { array_push($lessons, $key); } } return $lessons; }