Merge branch 'MDL-73975-main' of https://github.com/sarjona/moodle

This commit is contained in:
Ilya Tregubov 2024-04-04 08:54:12 +08:00
commit 28e441aee1
9 changed files with 27 additions and 222 deletions

View File

@ -62,40 +62,16 @@ class core_course_management_renderer extends plugin_renderer_base {
}
/**
* Displays a heading for the management pages.
*
* @deprecated since Moodle 4.0. This is now handled/replaced with the tertiary navigation
* @todo Final deprecation MDL-73975
* @param string $heading The heading to display
* @param string|null $viewmode The current view mode if there are options.
* @param int|null $categoryid The currently selected category if there is one.
* @return string
*/
public function management_heading($heading, $viewmode = null, $categoryid = null) {
debugging('management_heading() is deprecated. Use the class manage_categories_action_bar instead.', DEBUG_DEVELOPER);
$html = html_writer::start_div('coursecat-management-header clearfix');
if (!empty($heading)) {
$html .= $this->heading($heading);
}
if ($viewmode !== null) {
$html .= html_writer::start_div();
$html .= $this->view_mode_selector(\core_course\management\helper::get_management_viewmodes(), $viewmode);
if ($viewmode === 'courses') {
$categories = core_course_category::make_categories_list(array('moodle/category:manage', 'moodle/course:create'));
$nothing = false;
if ($categoryid === null) {
$nothing = array('' => get_string('selectacategory'));
$categoryid = '';
}
$select = new single_select($this->page->url, 'categoryid', $categories, $categoryid, $nothing);
$select->attributes['aria-label'] = get_string('selectacategory');
$html .= $this->render($select);
}
$html .= html_writer::end_div();
}
$html .= html_writer::end_div();
return $html;
#[\core\attribute\deprecated(
replacement: 'manage_categories_action_bar',
since: '4.0',
mdl: 'MDL-73462',
final: true,
)]
public function management_heading() {
\core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]);
}
/**
@ -1301,24 +1277,16 @@ class core_course_management_renderer extends plugin_renderer_base {
}
/**
* Renders html to display a course search form
*
* @deprecated since Moodle 4.0. This is now handled within manage_categories_action_bar
* @todo Final deprecation MDL-73975
* @param string $value default value to populate the search field
* @return string
*/
public function course_search_form($value = '') {
debugging('course_search_form() is deprecated. Use the class manage_categories_action_bar instead.', DEBUG_DEVELOPER);
$data = [
'action' => new moodle_url('/course/management.php'),
'btnclass' => 'btn-primary',
'extraclasses' => 'my-3 d-flex justify-content-center',
'inputname' => 'search',
'searchstring' => get_string('searchcourses'),
'value' => $value
];
return $this->render_from_template('core/search_input', $data);
#[\core\attribute\deprecated(
replacement: 'manage_categories_action_bar',
since: '4.0',
mdl: 'MDL-73462',
final: true,
)]
public function course_search_form() {
\core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]);
}
/**

View File

@ -1,46 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_course/course_search_form
This template renders the form for course search.
Example context (json):
{
"searchurl": "https://moodlesite/course/search.php",
"id": "coursesearch",
"inputid": "coursesearchbox",
"inputsize": 30,
"value": "certificate",
"name" : "q",
"helpicon": [{
"heading": "Search courses",
"text": "You can search for multiple words at once and can refine your search as follows:"
}]
}
}}
<form action="{{searchurl}}" id="{{id}}" method="get" class="d-flex flex-wrap align-items-center">
<fieldset class="coursesearchbox invisiblefieldset">
<label for="{{inputid}}">{{#str}}searchcourses{{/str}}</label>
<input id="{{inputid}}" name="q" type="text" size="{{inputsize}}" value="{{value}}" class="form-control mb-1 mb-sm-0">
<input name="areaids" type="hidden" value="{{areaids}}">
<button class="btn btn-secondary" type="submit">{{#str}}go{{/str}}</button>
{{#helpicon}}
{{>core/help_icon}}
{{/helpicon}}
</fieldset>
</form>

View File

@ -19,6 +19,8 @@ information provided here is intended especially for developers.
- `course_purge_section_cache`
- `course_purge_module_cache`
- `get_array_of_activities`
- `core_course_management_renderer::management_heading`
- `core_course_management_renderer::course_search_form`
* New format actions classes. Those classes will eventually replace all course/lib.php content editing functions.
All new methods are distributed in three classes formats can extend. Method can be accessed using static
methods (see doc block of core_courseformat\formatactions for more information).
@ -36,6 +38,7 @@ The colors for all these purposes and the filters applied to outline them are de
* New behat step using the URL resolvers:
- When I am on the "Course > <section> "course > section" page logged in as "<username>". When utilizing 'Section x'
it first searches by section name (Section x). If it's not found, then it searches by the section number (x).
* The template core_course/course_search_form has been removed following its cessation of use upon MDL-69454 in version 3.11.
=== 4.3 ===
* The `core_course_renderer::course_section_cm_completion` method has been removed, and can no longer be used

View File

@ -125,3 +125,5 @@ from,core
aria-toggledropdown,core_grades
aria:dropdowngrades,core_grades
viewresults,core
coursesearch,core
coursesearch_help,core

View File

@ -430,12 +430,6 @@ $string['coursesectiontitleediting'] = 'Edit {$a->sectionname}: {$a->sectiontitl
$string['coursesettings'] = 'Course default settings';
$string['coursesmovedout'] = 'Courses moved out from {$a}';
$string['coursespending'] = 'Courses pending approval';
$string['coursesearch'] = 'Search courses';
$string['coursesearch_help'] = 'You can search for multiple words at once and can refine your search as follows:
* word - find any match of this word within the text
* +word - only exact matching words will be found
* -word - don\'t include results containing this word.';
$string['coursestart'] = 'Course start';
$string['coursesummary'] = 'Course summary';
$string['coursesummary_help'] = 'A short description of your course. The content you add here is searchable.';
@ -2504,3 +2498,9 @@ $string['summaryof'] = 'Summary of {$a}';
$string['from'] = 'From';
$string['to'] = 'To';
$string['viewresults'] = 'View results for {$a}';
$string['coursesearch'] = 'Search courses';
$string['coursesearch_help'] = 'You can search for multiple words at once and can refine your search as follows:
* word - find any match of this word within the text
* +word - only exact matching words will be found
* -word - don\'t include results containing this word.';

View File

@ -556,11 +556,6 @@ span.editinstructions {
vertical-align: text-bottom;
}
#coursesearch {
margin-top: 1em;
text-align: left;
}
#page-course-pending .pendingcourserequests {
margin-bottom: 1em;
}
@ -985,43 +980,6 @@ span.editinstructions {
}
/** Management header styling **/
.coursecat-management-header {
vertical-align: middle;
h2 {
display: inline-block;
text-align: left;
}
> div {
float: right;
> div {
margin: 10px 0 10px 1em;
display: inline-block;
}
}
select {
max-width: 300px;
cursor: pointer;
padding: 0.4em 0.5em 0.45em 1em;
vertical-align: baseline;
white-space: nowrap;
}
.view-mode-selector {
.moodle-actionmenu {
white-space: nowrap;
display: inline-block;
}
.moodle-actionmenu[data-enhanced].show .menu a {
padding-left: 1em;
}
}
}
.course-being-dragged-proxy {
border: 0;
color: $link-color;

View File

@ -197,10 +197,6 @@ div#dateselector-calendar-panel {
z-index: 3100; /* Set higher than the z-index of the filemanager - see MDL-39047. */
}
fieldset.coursesearchbox label {
display: inline;
}
/**
* Show the labels above text editors and file managers except on wide screens.
*/

View File

@ -28461,11 +28461,6 @@ span.editinstructions .alert-link {
vertical-align: text-bottom;
}
#coursesearch {
margin-top: 1em;
text-align: left;
}
#page-course-pending .pendingcourserequests {
margin-bottom: 1em;
}
@ -28860,35 +28855,6 @@ span.editinstructions .alert-link {
}
/** Management header styling **/
.coursecat-management-header {
vertical-align: middle;
}
.coursecat-management-header h2 {
display: inline-block;
text-align: left;
}
.coursecat-management-header > div {
float: right;
}
.coursecat-management-header > div > div {
margin: 10px 0 10px 1em;
display: inline-block;
}
.coursecat-management-header select {
max-width: 300px;
cursor: pointer;
padding: 0.4em 0.5em 0.45em 1em;
vertical-align: baseline;
white-space: nowrap;
}
.coursecat-management-header .view-mode-selector .moodle-actionmenu {
white-space: nowrap;
display: inline-block;
}
.coursecat-management-header .view-mode-selector .moodle-actionmenu[data-enhanced].show .menu a {
padding-left: 1em;
}
.course-being-dragged-proxy {
border: 0;
color: #0f6cbf;
@ -33087,10 +33053,6 @@ div#dateselector-calendar-panel {
z-index: 3100; /* Set higher than the z-index of the filemanager - see MDL-39047. */
}
fieldset.coursesearchbox label {
display: inline;
}
/**
* Show the labels above text editors and file managers except on wide screens.
*/

View File

@ -28461,11 +28461,6 @@ span.editinstructions .alert-link {
vertical-align: text-bottom;
}
#coursesearch {
margin-top: 1em;
text-align: left;
}
#page-course-pending .pendingcourserequests {
margin-bottom: 1em;
}
@ -28860,35 +28855,6 @@ span.editinstructions .alert-link {
}
/** Management header styling **/
.coursecat-management-header {
vertical-align: middle;
}
.coursecat-management-header h2 {
display: inline-block;
text-align: left;
}
.coursecat-management-header > div {
float: right;
}
.coursecat-management-header > div > div {
margin: 10px 0 10px 1em;
display: inline-block;
}
.coursecat-management-header select {
max-width: 300px;
cursor: pointer;
padding: 0.4em 0.5em 0.45em 1em;
vertical-align: baseline;
white-space: nowrap;
}
.coursecat-management-header .view-mode-selector .moodle-actionmenu {
white-space: nowrap;
display: inline-block;
}
.coursecat-management-header .view-mode-selector .moodle-actionmenu[data-enhanced].show .menu a {
padding-left: 1em;
}
.course-being-dragged-proxy {
border: 0;
color: #0f6cbf;
@ -33087,10 +33053,6 @@ div#dateselector-calendar-panel {
z-index: 3100; /* Set higher than the z-index of the filemanager - see MDL-39047. */
}
fieldset.coursesearchbox label {
display: inline;
}
/**
* Show the labels above text editors and file managers except on wide screens.
*/