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

Search area for course sections (title and summary). More...

Inheritance diagram for core_course\search\section:
core_search\base

Public Member Functions

 attach_files ($document)
 Files related to the current document are attached, to the document object ready for indexing by Global Search. More...
 
 check_access ($id)
 Whether the user can access the section or not. More...
 
 get_area_id ()
 Returns the area id. More...
 
 get_category_names ()
 Returns a list of category names associated with the area. More...
 
 get_component_name ()
 Returns the moodle component name, as used in the files table. More...
 
 get_component_type ()
 Returns the component type. More...
 
 get_config ()
 Returns all the search area configuration. More...
 
 get_config_var_name ()
 Returns the config var name. More...
 
 get_context_url (\core_search\document $doc)
 Gets a link to the section. More...
 
 get_context_url (\core_search\document $doc)
 Returns a url to the document context. More...
 
 get_contexts_to_reindex ()
 Gets a list of all contexts to reindex when reindexing this search area. More...
 
 get_doc_icon (\core_search\document $doc)
 Returns an icon instance for the document. More...
 
 get_doc_icon (document $doc)
 Returns an icon instance for the document. More...
 
 get_doc_url (\core_search\document $doc)
 Gets a link to the section. More...
 
 get_doc_url (\core_search\document $doc)
 Returns a url to the document, it might match self::get_context_url(). More...
 
 get_document ($record, $options=array())
 Returns the document associated with this section. More...
 
 get_document_display_title (\core_search\document $doc)
 Returns the document title to display. More...
 
 get_document_recordset ($modifiedfrom=0, context $context=null)
 Returns recordset containing required data for indexing course sections. More...
 
 get_last_indexing_duration ()
 Gets the length of time spent indexing this area (the last time it was indexed). More...
 
 get_recordset_by_timestamp ($modifiedfrom=0)
 Returns a recordset ordered by modification date ASC. More...
 
 get_search_fileareas ()
 Return the file area that is used for summary files. More...
 
 get_visible_name ($lazyload=false)
 Returns the area visible name. More...
 
 is_enabled ()
 Is the search component enabled by the system administrator? More...
 
 set_enabled ($isenabled)
 
 supports_get_document_recordset ()
 Checks if get_document_recordset is supported for this search area. More...
 
 uses_file_indexing ()
 Returns true to include summary files in the index. More...
 

Static Public Member Functions

static get_levels ()
 Returns context levels property. More...
 
static get_settingnames ()
 Return a list of all required setting names. More...
 

Protected Member Functions

 get_course_level_context_restriction_sql (\context $context=null, $coursetable, $paramtype=SQL_PARAMS_QM)
 Helper function that gets SQL useful for restricting a search query given a passed-in context, for data stored at course level. More...
 

Protected Attributes

string $areaname = null
 The area name as defined in the class name.
 
string $componentname = null
 The component frankenstyle name.
 
string $componenttype = null
 The component type (core or the plugin type).
 

Static Protected Attributes

static array $levels = [CONTEXT_COURSE]
 Sections are indexed at course context.
 

Detailed Description

Search area for course sections (title and summary).

Note this does not include the activities within the section, as these have their own search areas.

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

Member Function Documentation

◆ attach_files()

core_search\base::attach_files (   $document)
inherited

Files related to the current document are attached, to the document object ready for indexing by Global Search.

The default implementation retrieves all files for the file areas returned by get_search_fileareas(). If you need to filter files to specific items per file area, you will need to override this method and explicitly provide the items.

Parameters
document$documentThe current document
Return values
void

Reimplemented in core_search\base_activity, mod_forum\search\post, block_html\search\content, and mod_data\search\entry.

◆ check_access()

core_course\search\section::check_access (   $id)

Whether the user can access the section or not.

Parameters
int$idThe course section id.
Return values
intOne of the core_search\manager:ACCESS_xx constants

Reimplemented from core_search\base.

◆ get_area_id()

core_search\base::get_area_id ( )
inherited

Returns the area id.

Return values
string

◆ get_category_names()

core_course\search\section::get_category_names ( )

Returns a list of category names associated with the area.

Return values
array

Reimplemented from core_search\base.

◆ get_component_name()

core_course\search\section::get_component_name ( )

Returns the moodle component name, as used in the files table.

Return values
stringComponent name

Reimplemented from core_search\base.

◆ get_component_type()

core_search\base::get_component_type ( )
inherited

Returns the component type.

It might be a plugintype or 'core' for core subsystems.

Return values
string

◆ get_config()

core_search\base::get_config ( )
inherited

Returns all the search area configuration.

Return values
array

◆ get_config_var_name()

core_search\base::get_config_var_name ( )
inherited

Returns the config var name.

It depends on whether it is a moodle subsystem or a plugin as plugin-related config should remain in their own scope.

Return values
stringConfig var path including the plugin (or component) and the varname

◆ get_context_url() [1/2]

core_course\search\section::get_context_url ( \core_search\document  $doc)

Gets a link to the section.

Parameters
core_search\document$doc
Return values
moodle_url

◆ get_context_url() [2/2]

core_search\base::get_context_url ( \core_search\document  $doc)
abstractinherited

Returns a url to the document context.

Parameters
core_search\document$doc
Return values
moodle_url

Reimplemented in core_search\base_block, and core_search\base_activity.

◆ get_contexts_to_reindex()

core_search\base::get_contexts_to_reindex ( )
inherited

Gets a list of all contexts to reindex when reindexing this search area.

The list should be returned in an order that is likely to be suitable when reindexing, for example with newer contexts first.

The default implementation simply returns the system context, which will result in reindexing everything in normal date order (oldest first).

Return values
IteratorIterator of contexts to reindex

Reimplemented in core_search\base_mod, and core_search\base_block.

◆ get_course_level_context_restriction_sql()

core_search\base::get_course_level_context_restriction_sql ( \context  $context = null,
  $coursetable,
  $paramtype = SQL_PARAMS_QM 
)
protectedinherited

Helper function that gets SQL useful for restricting a search query given a passed-in context, for data stored at course level.

The SQL returned will be zero or more JOIN statements, surrounded by whitespace, which act as restrictions on the query based on the rows in a module table.

You can pass in a null or system context, which will both return an empty string and no params.

Returns an array with two nulls if there can be no results for a course within this context.

If named parameters are used, these will be named gclcrs0, gclcrs1, etc. The table aliases used in SQL also all begin with gclcrs, to avoid conflicts.

Parameters
context | null$contextContext to restrict the query
string$coursetableName of alias for course table e.g. 'c'
int$paramtypeType of SQL parameters to use (default question mark)
Return values
arrayArray with SQL and parameters; both null if no need to query
Exceptions
coding_exceptionIf called with invalid params

◆ get_doc_icon() [1/2]

core_course\search\section::get_doc_icon ( \core_search\document  $doc)

Returns an icon instance for the document.

Parameters
core_search\document$doc
Return values
core_search

◆ get_doc_icon() [2/2]

core_search\base::get_doc_icon ( document  $doc)
inherited

Returns an icon instance for the document.

Parameters
core_search\document$doc
Return values
core_search

Reimplemented in core_search\base_mod, and core_search\base_block.

◆ get_doc_url() [1/2]

core_course\search\section::get_doc_url ( \core_search\document  $doc)

Gets a link to the section.

Parameters
core_search\document$doc
Return values
moodle_url

◆ get_doc_url() [2/2]

core_search\base::get_doc_url ( \core_search\document  $doc)
abstractinherited

Returns a url to the document, it might match self::get_context_url().

Parameters
core_search\document$doc
Return values
moodle_url

Reimplemented in core_search\base_block, and core_search\base_activity.

◆ get_document()

core_course\search\section::get_document (   $record,
  $options = array() 
)

Returns the document associated with this section.

Parameters
stdClass$record
array$options
Return values
core_search

Reimplemented from core_search\base.

◆ get_document_display_title()

core_search\base::get_document_display_title ( \core_search\document  $doc)
inherited

Returns the document title to display.

Allow to customize the document title string to display.

Parameters
core_search\document$doc
Return values
stringDocument title to display in the search results page

◆ get_document_recordset()

core_course\search\section::get_document_recordset (   $modifiedfrom = 0,
context  $context = null 
)

Returns recordset containing required data for indexing course sections.

Parameters
int$modifiedfromtimestamp
context | null$contextRestriction context
Return values
moodle_recordset|nullRecordset or null if no change possible

Reimplemented from core_search\base.

◆ get_last_indexing_duration()

core_search\base::get_last_indexing_duration ( )
inherited

Gets the length of time spent indexing this area (the last time it was indexed).

Return values
int|boolTime in seconds spent indexing this area last time, false if never indexed

◆ get_levels()

static core_search\base::get_levels ( )
staticinherited

Returns context levels property.

Return values
int

◆ get_recordset_by_timestamp()

core_search\base::get_recordset_by_timestamp (   $modifiedfrom = 0)
inherited

Returns a recordset ordered by modification date ASC.

Each record can include any data self::get_document might need but it must:

  • Include an 'id' field: Unique identifier (in this area's scope) of a document to index in the search engine If the indexed content field can contain embedded files, the 'id' value should match the filearea itemid.
  • Only return data modified since $modifiedfrom, including $modifiedform to prevent some records from not being indexed (e.g. your-timemodified-fieldname >= $modifiedfrom)
  • Order the returned data by time modified in ascending order, as core_search::manager will need to store the modified time of the last indexed document.

Since Moodle 3.4, subclasses should instead implement get_document_recordset, which has an additional context parameter. This function continues to work for implementations which haven't been updated, or where the context parameter is not required.

Parameters
int$modifiedfrom
Return values
moodle_recordset

◆ get_search_fileareas()

core_course\search\section::get_search_fileareas ( )

Return the file area that is used for summary files.

Return values
arrayFile area name

Reimplemented from core_search\base.

◆ get_settingnames()

static core_search\base::get_settingnames ( )
staticinherited

Return a list of all required setting names.

Return values
array

◆ get_visible_name()

core_search\base::get_visible_name (   $lazyload = false)
inherited

Returns the area visible name.

Parameters
bool$lazyloadUsually false, unless when in admin settings.
Return values
string

◆ is_enabled()

core_search\base::is_enabled ( )
inherited

Is the search component enabled by the system administrator?

Return values
bool

◆ supports_get_document_recordset()

core_search\base::supports_get_document_recordset ( )
inherited

Checks if get_document_recordset is supported for this search area.

For many uses you can simply call get_document_recordset and see if it returns false, but this function is useful when you don't want to actually call the function right away.

◆ uses_file_indexing()

core_course\search\section::uses_file_indexing ( )

Returns true to include summary files in the index.

Return values
boolTrue

Reimplemented from core_search\base.


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