MDL-61256 core_search: Coding style fixes

This commit is contained in:
Andrew Nicols 2018-04-03 14:36:15 +08:00
parent a9710e9d94
commit c464c08a52

View File

@ -54,8 +54,7 @@ class section extends \core_search\base {
public function get_document_recordset($modifiedfrom = 0, \context $context = null) { public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
global $DB; global $DB;
list ($contextjoin, $contextparams) = $this->get_course_level_context_restriction_sql( list ($contextjoin, $contextparams) = $this->get_course_level_context_restriction_sql($context, 'c');
$context, 'c');
if ($contextjoin === null) { if ($contextjoin === null) {
return null; return null;
} }
@ -63,7 +62,12 @@ class section extends \core_search\base {
$comparetext = $DB->sql_compare_text('cs.summary', 1); $comparetext = $DB->sql_compare_text('cs.summary', 1);
return $DB->get_recordset_sql(" return $DB->get_recordset_sql("
SELECT cs.id, cs.course, cs.section, cs.name, cs.summary, cs.summaryformat, SELECT cs.id,
cs.course,
cs.section,
cs.name,
cs.summary,
cs.summaryformat,
cs.timemodified cs.timemodified
FROM {course_sections} cs FROM {course_sections} cs
JOIN {course} c ON c.id = cs.course JOIN {course} c ON c.id = cs.course
@ -147,8 +151,7 @@ class section extends \core_search\base {
*/ */
public function get_doc_url(\core_search\document $doc) { public function get_doc_url(\core_search\document $doc) {
global $DB; global $DB;
$section = $DB->get_field('course_sections', 'section', $section = $DB->get_field('course_sections', 'section', ['id' => $doc->get('itemid')], MUST_EXIST);
['id' => $doc->get('itemid')], MUST_EXIST);
$format = course_get_format($doc->get('courseid')); $format = course_get_format($doc->get('courseid'));
return $format->get_view_url($section); return $format->get_view_url($section);
} }