Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
restore_search_base Class Reference

A base class that can be used to build a specific search upon. More...

Inheritance diagram for restore_search_base:
renderable restore_category_search restore_course_search import_course_search

Public Member Functions

 __construct (array $config=array())
 Constructor. More...
 
 get_count ()
 The total number of results. More...
 
 get_results ()
 Returns an array of results from the search. More...
 
 get_search ()
 The current search string. More...
 
moodle_page get_url ()
 The URL for this search $PAGE. More...
 
 get_varsearch ()
 Gets the string used to transfer the search string for this compontents requests. More...
 
 has_more_results ()
 Returns true if there are more search results. More...
 
 invalidate_results ()
 Invalidates the results collected so far.
 
 require_capability ($capability, $user=null)
 Adds a required capability which all results will be checked against. More...
 
moodle_database search ()
 Executes the search. More...
 
 set_url (moodle_url $url)
 Sets the page URL. More...
 

Public Attributes

const DEFAULT_SEARCH = ''
 The default values for this components params.
 

Static Public Attributes

static string $VAR_SEARCH = 'search'
 The param used to convey the current search string.
 

Protected Member Functions

 format_results ()
 Formats the results.
 
 get_itemcontextlevel ()
 Gets the context level associated with this components items. More...
 
 get_searchsql ()
 Returns an array containing the SQL for the search and the params. More...
 

Detailed Description

A base class that can be used to build a specific search upon.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

restore_search_base::__construct ( array  $config = array())

Constructor.

Parameters
array$configConfig options

Reimplemented in restore_category_search.

Member Function Documentation

◆ get_count()

restore_search_base::get_count ( )
final

The total number of results.

Return values
int

◆ get_itemcontextlevel()

restore_search_base::get_itemcontextlevel ( )
abstractprotected

Gets the context level associated with this components items.

Return values
CONTEXT_*

Reimplemented in restore_category_search, and restore_course_search.

◆ get_results()

restore_search_base::get_results ( )
final

Returns an array of results from the search.

Return values
array

◆ get_search()

restore_search_base::get_search ( )
final

The current search string.

Return values
string

◆ get_searchsql()

restore_search_base::get_searchsql ( )
abstractprotected

Returns an array containing the SQL for the search and the params.

Return values
array

Reimplemented in restore_category_search, and restore_course_search.

◆ get_url()

moodle_page restore_search_base::get_url ( )
final

The URL for this search $PAGE.

Return values
moodle_urlThe URL for this page

◆ get_varsearch()

restore_search_base::get_varsearch ( )
abstract

Gets the string used to transfer the search string for this compontents requests.

Return values
string

Reimplemented in restore_category_search, and restore_course_search.

◆ has_more_results()

restore_search_base::has_more_results ( )
final

Returns true if there are more search results.

Return values
bool

◆ require_capability()

restore_search_base::require_capability (   $capability,
  $user = null 
)
final

Adds a required capability which all results will be checked against.

Parameters
string$capability
int | null$user

◆ search()

moodle_database restore_search_base::search ( )
final

Executes the search.

$DB

Return values
intThe number of results

◆ set_url()

restore_search_base::set_url ( moodle_url  $url)
final

Sets the page URL.

Parameters
moodle_url$url

The documentation for this class was generated from the following file: