original_string: private function obtain_dynamic_data() {
          global $CFG;
          $userid = $this->modinfo->get_user_id();
          if ($this->state >= self::STATE_BUILDING_DYNAMIC || $userid == -1) {
              return;
          }
          $this->state = self::STATE_BUILDING_DYNAMIC;
  
          if (!empty($CFG->enableavailability)) {
              // Get availability information.
              $ci = new \core_availability\info_module($this);
  
              // Note that the modinfo currently available only includes minimal details (basic data)
              // but we know that this function does not need anything more than basic data.
              $this->available = $ci->is_available($this->availableinfo, true,
                      $userid, $this->modinfo);
          } else {
              $this->available = true;
          }
  
          // Check parent section.
          if ($this->available) {
              $parentsection = $this->modinfo->get_section_info($this->sectionnum);
              if (!$parentsection->available) {
                  // Do not store info from section here, as that is already
                  // presented from the section (if appropriate) - just change
                  // the flag
                  $this->available = false;
              }
          }
  
          // Update visible state for current user.
          $this->update_user_visible();
  
          // Let module make dynamic changes at this point
          $this->call_mod_function('cm_info_dynamic');
          $this->state = self::STATE_DYNAMIC;
      }
code: private function obtain_dynamic_data() {
          global $CFG;
          $userid = $this->modinfo->get_user_id();
          if ($this->state >= self::STATE_BUILDING_DYNAMIC || $userid == -1) {
              return;
          }
          $this->state = self::STATE_BUILDING_DYNAMIC;
  
          if (!empty($CFG->enableavailability)) {
              // Get availability information.
              $ci = new \core_availability\info_module($this);
  
              // Note that the modinfo currently available only includes minimal details (basic data)
              // but we know that this function does not need anything more than basic data.
              $this->available = $ci->is_available($this->availableinfo, true,
                      $userid, $this->modinfo);
          } else {
              $this->available = true;
          }
  
          // Check parent section.
          if ($this->available) {
              $parentsection = $this->modinfo->get_section_info($this->sectionnum);
              if (!$parentsection->available) {
                  // Do not store info from section here, as that is already
                  // presented from the section (if appropriate) - just change
                  // the flag
                  $this->available = false;
              }
          }
  
          // Update visible state for current user.
          $this->update_user_visible();
  
          // Let module make dynamic changes at this point
          $this->call_mod_function('cm_info_dynamic');
          $this->state = self::STATE_DYNAMIC;
      }
code_tokens: private function obtain_dynamic_data ( ) { global $ CFG ; $ userid = $ this -> modinfo -> get_user_id ( ) ; if ( $ this -> state >= self :: STATE_BUILDING_DYNAMIC || $ userid == - 1 ) { return ; } $ this -> state = self :: STATE_BUILDING_DYNAMIC ; if ( ! empty ( $ CFG -> enableavailability ) ) { // Get availability information. $ ci = new \ core_availability \ info_module ( $ this ) ; // Note that the modinfo currently available only includes minimal details (basic data) // but we know that this function does not need anything more than basic data. $ this -> available = $ ci -> is_available ( $ this -> availableinfo , true , $ userid , $ this -> modinfo ) ; } else { $ this -> available = true ; } // Check parent section. if ( $ this -> available ) { $ parentsection = $ this -> modinfo -> get_section_info ( $ this -> sectionnum ) ; if ( ! $ parentsection -> available ) { // Do not store info from section here, as that is already // presented from the section (if appropriate) - just change // the flag $ this -> available = false ; } } // Update visible state for current user. $ this -> update_user_visible ( ) ; // Let module make dynamic changes at this point $ this -> call_mod_function ( 'cm_info_dynamic' ) ; $ this -> state = self :: STATE_DYNAMIC ; }
docstring: If dynamic data for this course-module is not yet available, gets it.
  
  This function is automatically called when requesting any course_modinfo property
  that can be modified by modules (have a set_xxx method).
  
  Dynamic data is data which does not come directly from the cache but is calculated at
  runtime based on the current user. Primarily this concerns whether the user can access
  the module or not.
  
  As part of this function, the module's _cm_info_dynamic function from its lib.php will
  be called (if it exists).
  @return void
docstring_tokens: If dynamic data for this course - module is not yet available gets it .