original_string: protected function get_participants_sql($musthavesubmission=false, $groupid=0) {
  
          list($sql1, $params1) = $this->get_users_with_capability_sql('mod/workshop:submit', $musthavesubmission, $groupid);
          list($sql2, $params2) = $this->get_users_with_capability_sql('mod/workshop:peerassess', $musthavesubmission, $groupid);
  
          if (empty($sql1) or empty($sql2)) {
              if (empty($sql1) and empty($sql2)) {
                  return array('', array());
              } else if (empty($sql1)) {
                  $sql = $sql2;
                  $params = $params2;
              } else {
                  $sql = $sql1;
                  $params = $params1;
              }
          } else {
              $sql = $sql1.PHP_EOL." UNION ".PHP_EOL.$sql2;
              $params = array_merge($params1, $params2);
          }
  
          return array($sql, $params);
      }
code: protected function get_participants_sql($musthavesubmission=false, $groupid=0) {
  
          list($sql1, $params1) = $this->get_users_with_capability_sql('mod/workshop:submit', $musthavesubmission, $groupid);
          list($sql2, $params2) = $this->get_users_with_capability_sql('mod/workshop:peerassess', $musthavesubmission, $groupid);
  
          if (empty($sql1) or empty($sql2)) {
              if (empty($sql1) and empty($sql2)) {
                  return array('', array());
              } else if (empty($sql1)) {
                  $sql = $sql2;
                  $params = $params2;
              } else {
                  $sql = $sql1;
                  $params = $params1;
              }
          } else {
              $sql = $sql1.PHP_EOL." UNION ".PHP_EOL.$sql2;
              $params = array_merge($params1, $params2);
          }
  
          return array($sql, $params);
      }
code_tokens: protected function get_participants_sql ( $ musthavesubmission = false , $ groupid = 0 ) { list ( $ sql1 , $ params1 ) = $ this -> get_users_with_capability_sql ( 'mod/workshop:submit' , $ musthavesubmission , $ groupid ) ; list ( $ sql2 , $ params2 ) = $ this -> get_users_with_capability_sql ( 'mod/workshop:peerassess' , $ musthavesubmission , $ groupid ) ; if ( empty ( $ sql1 ) or empty ( $ sql2 ) ) { if ( empty ( $ sql1 ) and empty ( $ sql2 ) ) { return array ( '' , array ( ) ) ; } else if ( empty ( $ sql1 ) ) { $ sql = $ sql2 ; $ params = $ params2 ; } else { $ sql = $ sql1 ; $ params = $ params1 ; } } else { $ sql = $ sql1 . PHP_EOL . " UNION " . PHP_EOL . $ sql2 ; $ params = array_merge ( $ params1 , $ params2 ) ; } return array ( $ sql , $ params ) ; }
docstring: Returns SQL statement that can be used to fetch all actively enrolled participants in the workshop
  
  @param bool $musthavesubmission if true, return only users who have already submitted
  @param int $groupid 0 means ignore groups, any other value limits the result by group id
  @return array of (string)sql, (array)params
docstring_tokens: Returns SQL statement that can be used to fetch all actively enrolled participants in the workshop