original_string: public function load_choices() {
          if (is_array($this->choices)) {
              return true;
          }
          $this->choices = array();
  
          global $CFG, $DB;
          $records = $DB->get_records('modules', array('visible'=>1), 'name');
          foreach ($records as $record) {
              // Exclude modules if the code doesn't exist
              if (file_exists("$CFG->dirroot/mod/$record->name/lib.php")) {
                  // Also exclude system modules (if specified)
                  if (!($this->excludesystem &&
                          plugin_supports('mod', $record->name, FEATURE_MOD_ARCHETYPE) ===
                          MOD_ARCHETYPE_SYSTEM)) {
                      $this->choices[$record->id] = $record->name;
                  }
              }
          }
          return true;
      }
code: public function load_choices() {
          if (is_array($this->choices)) {
              return true;
          }
          $this->choices = array();
  
          global $CFG, $DB;
          $records = $DB->get_records('modules', array('visible'=>1), 'name');
          foreach ($records as $record) {
              // Exclude modules if the code doesn't exist
              if (file_exists("$CFG->dirroot/mod/$record->name/lib.php")) {
                  // Also exclude system modules (if specified)
                  if (!($this->excludesystem &&
                          plugin_supports('mod', $record->name, FEATURE_MOD_ARCHETYPE) ===
                          MOD_ARCHETYPE_SYSTEM)) {
                      $this->choices[$record->id] = $record->name;
                  }
              }
          }
          return true;
      }
code_tokens: public function load_choices ( ) { if ( is_array ( $ this -> choices ) ) { return true ; } $ this -> choices = array ( ) ; global $ CFG , $ DB ; $ records = $ DB -> get_records ( 'modules' , array ( 'visible' => 1 ) , 'name' ) ; foreach ( $ records as $ record ) { // Exclude modules if the code doesn't exist if ( file_exists ( "$CFG->dirroot/mod/$record->name/lib.php" ) ) { // Also exclude system modules (if specified) if ( ! ( $ this -> excludesystem && plugin_supports ( 'mod' , $ record -> name , FEATURE_MOD_ARCHETYPE ) === MOD_ARCHETYPE_SYSTEM ) ) { $ this -> choices [ $ record -> id ] = $ record -> name ; } } } return true ; }
docstring: Loads an array of current module choices
  
  @return bool always return true
docstring_tokens: Loads an array of current module choices