/**
  * (non-PHPdoc)
  * @see \intuitel\IntuitelAdaptor::getCoursesEnrolled()
  */
 public function getCoursesEnrolled(UserId $user_id)
 {
     $listCoursesEnrolled = array();
     $intuitelCourses = Intuitel::getIntuitelEnabledCourses();
     $ownedCourses = Intuitel::getAdaptorInstanceForCourse()->getCoursesOwnedByUser($user_id);
     $native_userid = $user = $this->getNativeUserFromUId($user_id)->id;
     foreach ($intuitelCourses as $intuitelCourse) {
         $nativeCourseId = Intuitel::getIDFactory()->getIdfromLoId($intuitelCourse->loId);
         // get_user_roles_in_course($user->id, $nativeCourseId) TODO decide between this and is_enrolled, with this we can know if the user is student but with is_enrolled we get true for students and teachers.
         if (is_enrolled(\context_course::instance($nativeCourseId), $native_userid)) {
             //do not include those courses in which the user is teacher
             if (array_search($intuitelCourse, $ownedCourses) === FALSE) {
                 $listCoursesEnrolled[] = $intuitelCourse;
             }
         }
     }
     return $listCoursesEnrolled;
 }
 /**
  * Get the list of INUITEL-enabled courses in the LMS
  * @return array(intuitel\CourseLO)
  */
 public static function getIntuitelEnabledCourses()
 {
     return Intuitel::getAdaptorInstanceForCourse(null)->getIntuitelEnabledCourses();
 }
 /**
  * Generate a new messageId based on LMSId and a local counter.
  * @deprecated
  * @return string
  */
 public function getNewMessageUUID_old()
 {
     $counter = get_config('intuitel', 'muid');
     if (!isset($counter)) {
         $counter = 0;
     }
     $counter++;
     set_config('muid', $counter, 'intuitel');
     return Intuitel::getAdaptorInstanceForCourse(null)->getLMSId() . "-MSG-" . $counter;
 }