protected function get_filters_sql_and_params() {
        global $DB;

        $coursecontext = $this->context;
        $filter = 'gi.courseid = :courseid';
        $params = array(
            'courseid' => $coursecontext->instanceid,
        );

        if (!empty($this->filters->itemid)) {
            $filter .= ' AND ggh.itemid = :itemid';
            $params['itemid'] = $this->filters->itemid;
        }
        if (!empty($this->filters->userids)) {
            $list = explode(',', $this->filters->userids);
            list($insql, $plist) = $DB->get_in_or_equal($list, SQL_PARAMS_NAMED);
            $filter .= " AND ggh.userid $insql";
            $params += $plist;
        }
        if (!empty($this->filters->datefrom)) {
            $filter .= " AND ggh.timemodified >= :datefrom";
            $params += array('datefrom' => $this->filters->datefrom);
        }
        if (!empty($this->filters->datetill)) {
            $filter .= " AND ggh.timemodified <= :datetill";
            $params += array('datetill' => $this->filters->datetill);
        }
        if (!empty($this->filters->grader)) {
            $filter .= " AND ggh.usermodified = :grader";
            $params += array('grader' => $this->filters->grader);
        }

        return array($filter, $params);
    }
protected function get_filters_sql_and_params() {
        global $DB;

        $coursecontext = $this->context;
        $filter = 'gi.courseid = :courseid';
        $params = array(
            'courseid' => $coursecontext->instanceid,
        );

        if (!empty($this->filters->itemid)) {
            $filter .= ' AND ggh.itemid = :itemid';
            $params['itemid'] = $this->filters->itemid;
        }
        if (!empty($this->filters->userids)) {
            $list = explode(',', $this->filters->userids);
            list($insql, $plist) = $DB->get_in_or_equal($list, SQL_PARAMS_NAMED);
            $filter .= " AND ggh.userid $insql";
            $params += $plist;
        }
        if (!empty($this->filters->datefrom)) {
            $filter .= " AND ggh.timemodified >= :datefrom";
            $params += array('datefrom' => $this->filters->datefrom);
        }
        if (!empty($this->filters->datetill)) {
            $filter .= " AND ggh.timemodified <= :datetill";
            $params += array('datetill' => $this->filters->datetill);
        }
        if (!empty($this->filters->grader)) {
            $filter .= " AND ggh.usermodified = :grader";
            $params += array('grader' => $this->filters->grader);
        }

        return array($filter, $params);
    }
protected function get_filters_sql_and_params ( ) { global $ DB ; $ coursecontext = $ this -> context ; $ filter = 'gi.courseid = :courseid' ; $ params = array ( 'courseid' => $ coursecontext -> instanceid , ) ; if ( ! empty ( $ this -> filters -> itemid ) ) { $ filter .= ' AND ggh.itemid = :itemid' ; $ params [ 'itemid' ] = $ this -> filters -> itemid ; } if ( ! empty ( $ this -> filters -> userids ) ) { $ list = explode ( ',' , $ this -> filters -> userids ) ; list ( $ insql , $ plist ) = $ DB -> get_in_or_equal ( $ list , SQL_PARAMS_NAMED ) ; $ filter .= " AND ggh.userid $insql" ; $ params += $ plist ; } if ( ! empty ( $ this -> filters -> datefrom ) ) { $ filter .= " AND ggh.timemodified >= :datefrom" ; $ params += array ( 'datefrom' => $ this -> filters -> datefrom ) ; } if ( ! empty ( $ this -> filters -> datetill ) ) { $ filter .= " AND ggh.timemodified <= :datetill" ; $ params += array ( 'datetill' => $ this -> filters -> datetill ) ; } if ( ! empty ( $ this -> filters -> grader ) ) { $ filter .= " AND ggh.usermodified = :grader" ; $ params += array ( 'grader' => $ this -> filters -> grader ) ; } return array ( $ filter , $ params ) ; }
Builds the sql and param list needed, based on the user selected filters.

@return array containing sql to use and an array of params.
Builds the sql and param list needed based on the user selected filters .