original_string: public function get_cm_sql() {
          $joins = array();
          $params = array();
  
          if ($this->filterparams->logreader instanceof logstore_legacy\log\store) {
              // The legacy store doesn't support context level.
              $joins[] = "cmid = :cmid";
              $params['cmid'] = $this->filterparams->modid;
          } else {
              $joins[] = "contextinstanceid = :contextinstanceid";
              $joins[] = "contextlevel = :contextmodule";
              $params['contextinstanceid'] = $this->filterparams->modid;
              $params['contextmodule'] = CONTEXT_MODULE;
          }
  
          $sql = implode(' AND ', $joins);
          return array($sql, $params);
      }
code: public function get_cm_sql() {
          $joins = array();
          $params = array();
  
          if ($this->filterparams->logreader instanceof logstore_legacy\log\store) {
              // The legacy store doesn't support context level.
              $joins[] = "cmid = :cmid";
              $params['cmid'] = $this->filterparams->modid;
          } else {
              $joins[] = "contextinstanceid = :contextinstanceid";
              $joins[] = "contextlevel = :contextmodule";
              $params['contextinstanceid'] = $this->filterparams->modid;
              $params['contextmodule'] = CONTEXT_MODULE;
          }
  
          $sql = implode(' AND ', $joins);
          return array($sql, $params);
      }
code_tokens: public function get_cm_sql ( ) { $ joins = array ( ) ; $ params = array ( ) ; if ( $ this -> filterparams -> logreader instanceof logstore_legacy \ log \ store ) { // The legacy store doesn't support context level. $ joins [ ] = "cmid = :cmid" ; $ params [ 'cmid' ] = $ this -> filterparams -> modid ; } else { $ joins [ ] = "contextinstanceid = :contextinstanceid" ; $ joins [ ] = "contextlevel = :contextmodule" ; $ params [ 'contextinstanceid' ] = $ this -> filterparams -> modid ; $ params [ 'contextmodule' ] = CONTEXT_MODULE ; } $ sql = implode ( ' AND ' , $ joins ) ; return array ( $ sql , $ params ) ; }
docstring: Helper function which is used by build logs to get course module sql and param.
  
  @return array sql and param for action.
docstring_tokens: Helper function which is used by build logs to get course module sql and param .