protected function get_searchsql() {
        global $DB;

        $ctxselect = ', ' . context_helper::get_preload_record_columns_sql('ctx');
        $ctxjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)";
        $params = array(
            'contextlevel' => CONTEXT_COURSECAT,
            'namesearch' => '%'.$this->get_search().'%',
        );

        $select     = " SELECT c.id, c.name, c.visible, c.sortorder, c.description, c.descriptionformat ";
        $from       = " FROM {course_categories} c ";
        $where      = " WHERE ".$DB->sql_like('c.name', ':namesearch', false);
        $orderby    = " ORDER BY c.sortorder";

        return array($select.$ctxselect.$from.$ctxjoin.$where.$orderby, $params);
    }
protected function get_searchsql() {
        global $DB;

        $ctxselect = ', ' . context_helper::get_preload_record_columns_sql('ctx');
        $ctxjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)";
        $params = array(
            'contextlevel' => CONTEXT_COURSECAT,
            'namesearch' => '%'.$this->get_search().'%',
        );

        $select     = " SELECT c.id, c.name, c.visible, c.sortorder, c.description, c.descriptionformat ";
        $from       = " FROM {course_categories} c ";
        $where      = " WHERE ".$DB->sql_like('c.name', ':namesearch', false);
        $orderby    = " ORDER BY c.sortorder";

        return array($select.$ctxselect.$from.$ctxjoin.$where.$orderby, $params);
    }
protected function get_searchsql ( ) { global $ DB ; $ ctxselect = ', ' . context_helper :: get_preload_record_columns_sql ( 'ctx' ) ; $ ctxjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)" ; $ params = array ( 'contextlevel' => CONTEXT_COURSECAT , 'namesearch' => '%' . $ this -> get_search ( ) . '%' , ) ; $ select = " SELECT c.id, c.name, c.visible, c.sortorder, c.description, c.descriptionformat " ; $ from = " FROM {course_categories} c " ; $ where = " WHERE " . $ DB -> sql_like ( 'c.name' , ':namesearch' , false ) ; $ orderby = " ORDER BY c.sortorder" ; return array ( $ select . $ ctxselect . $ from . $ ctxjoin . $ where . $ orderby , $ params ) ; }
Returns the search SQL.
@global moodle_database $DB
@return array
Returns the search SQL .