original_string: public static function get_current_versions_ids($audience = null) {
          global $DB;
          $sql = "SELECT v.policyid, v.id
               FROM {tool_policy} d
               LEFT JOIN {tool_policy_versions} v ON v.policyid = d.id
               WHERE d.currentversionid = v.id";
          $params = [];
          if ($audience) {
              $sql .= " AND v.audience IN (?, ?)";
              $params = [$audience, policy_version::AUDIENCE_ALL];
          }
          return $DB->get_records_sql_menu($sql . " ORDER BY d.sortorder", $params);
      }
code: public static function get_current_versions_ids($audience = null) {
          global $DB;
          $sql = "SELECT v.policyid, v.id
               FROM {tool_policy} d
               LEFT JOIN {tool_policy_versions} v ON v.policyid = d.id
               WHERE d.currentversionid = v.id";
          $params = [];
          if ($audience) {
              $sql .= " AND v.audience IN (?, ?)";
              $params = [$audience, policy_version::AUDIENCE_ALL];
          }
          return $DB->get_records_sql_menu($sql . " ORDER BY d.sortorder", $params);
      }
code_tokens: public static function get_current_versions_ids ( $ audience = null ) { global $ DB ; $ sql = "SELECT v.policyid, v.id
               FROM {tool_policy} d
               LEFT JOIN {tool_policy_versions} v ON v.policyid = d.id
               WHERE d.currentversionid = v.id" ; $ params = [ ] ; if ( $ audience ) { $ sql .= " AND v.audience IN (?, ?)" ; $ params = [ $ audience , policy_version :: AUDIENCE_ALL ] ; } return $ DB -> get_records_sql_menu ( $ sql . " ORDER BY d.sortorder" , $ params ) ; }
docstring: Checks if there are any current policies defined and returns their ids only
  
  @param array $audience If defined, filter against the given audience (AUDIENCE_ALL always included)
  @return array of version ids indexed by policies ids
docstring_tokens: Checks if there are any current policies defined and returns their ids only