original_string: protected static function validate_course_module($cmmixed, $throwexception = true) {
          $cm = $cmmixed;
          if (!is_object($cm)) {
              $cmrecord = get_coursemodule_from_id(null, $cmmixed);
              $modinfo = get_fast_modinfo($cmrecord->course);
              $cm = $modinfo->get_cm($cmmixed);
          } else if (!$cm instanceof cm_info) {
              // Assume we got a course module record.
              $modinfo = get_fast_modinfo($cm->course);
              $cm = $modinfo->get_cm($cm->id);
          }
  
          if (!$cm->uservisible) {
              if ($throwexception) {
                  throw new require_login_exception('Course module is hidden');
              } else {
                  return false;
              }
          }
  
          return true;
      }
code: protected static function validate_course_module($cmmixed, $throwexception = true) {
          $cm = $cmmixed;
          if (!is_object($cm)) {
              $cmrecord = get_coursemodule_from_id(null, $cmmixed);
              $modinfo = get_fast_modinfo($cmrecord->course);
              $cm = $modinfo->get_cm($cmmixed);
          } else if (!$cm instanceof cm_info) {
              // Assume we got a course module record.
              $modinfo = get_fast_modinfo($cm->course);
              $cm = $modinfo->get_cm($cm->id);
          }
  
          if (!$cm->uservisible) {
              if ($throwexception) {
                  throw new require_login_exception('Course module is hidden');
              } else {
                  return false;
              }
          }
  
          return true;
      }
code_tokens: protected static function validate_course_module ( $ cmmixed , $ throwexception = true ) { $ cm = $ cmmixed ; if ( ! is_object ( $ cm ) ) { $ cmrecord = get_coursemodule_from_id ( null , $ cmmixed ) ; $ modinfo = get_fast_modinfo ( $ cmrecord -> course ) ; $ cm = $ modinfo -> get_cm ( $ cmmixed ) ; } else if ( ! $ cm instanceof cm_info ) { // Assume we got a course module record. $ modinfo = get_fast_modinfo ( $ cm -> course ) ; $ cm = $ modinfo -> get_cm ( $ cm -> id ) ; } if ( ! $ cm -> uservisible ) { if ( $ throwexception ) { throw new require_login_exception ( 'Course module is hidden' ) ; } else { return false ; } } return true ; }
docstring: Validate if current user have acces to the course_module if hidden.
  
  @param mixed $cmmixed The cm_info class, course module record or its ID.
  @param bool $throwexception Throw an exception or not.
  @return bool
docstring_tokens: Validate if current user have acces to the course_module if hidden .