Merge branch 'MDL-46902_master' of git://github.com/markn86/moodle

This commit is contained in:
Damyon Wiese 2014-09-01 15:53:44 +08:00
commit 49025fdda7
3 changed files with 13 additions and 5 deletions

View File

@ -1050,9 +1050,11 @@ class core_course_management_renderer extends plugin_renderer_base {
* @param course_in_list $course The currently selected course if there is one.
* @param int $page The current page, starting at 0.
* @param int $perpage The number of courses to display per page.
* @param string $search The string we are searching for.
* @return string
*/
public function search_listing(array $courses, $totalcourses, course_in_list $course = null, $page = 0, $perpage = 20) {
public function search_listing(array $courses, $totalcourses, course_in_list $course = null, $page = 0, $perpage = 20,
$search = '') {
$page = max($page, 0);
$perpage = max($perpage, 2);
$totalpages = ceil($totalcourses / $perpage);
@ -1082,7 +1084,7 @@ class core_course_management_renderer extends plugin_renderer_base {
$first = false;
}
$html .= html_writer::end_tag('ul');
$html .= $this->search_pagination($totalcourses, $page, $perpage, true);
$html .= $this->search_pagination($totalcourses, $page, $perpage, true, $search);
$html .= html_writer::end_div();
return $html;
}
@ -1094,13 +1096,16 @@ class core_course_management_renderer extends plugin_renderer_base {
* @param int $page The current page.
* @param int $perpage The number of courses being displayed.
* @param bool $showtotals Whether or not to print total information.
* @param string $search The string we are searching for.
* @return string
*/
protected function search_pagination($totalcourses, $page, $perpage, $showtotals = false) {
protected function search_pagination($totalcourses, $page, $perpage, $showtotals = false, $search = '') {
$html = '';
$totalpages = ceil($totalcourses / $perpage);
if ($showtotals) {
if ($totalpages == 1) {
if ($totalpages == 0) {
$str = get_string('nocoursesfound', 'moodle', $search);
} else if ($totalpages == 1) {
$str = get_string('showingacourses', 'moodle', $totalcourses);
} else {
$a = new stdClass;

View File

@ -499,7 +499,7 @@ if ($displaycourselisting) {
} else {
list($courses, $coursescount, $coursestotal) =
\core_course\management\helper::search_courses($search, $blocklist, $modulelist, $page, $perpage);
echo $renderer->search_listing($courses, $coursestotal, $course, $page, $perpage);
echo $renderer->search_listing($courses, $coursestotal, $course, $page, $perpage, $search);
}
echo $renderer->grid_column_end();
if ($displaycoursedetail) {

View File

@ -9,6 +9,9 @@ information provided here is intended especially for theme designer.
- report_log_renderer::render_report_log_renderable => report_log_renderer::render_report_log
- report_loglive_renderer::render_report_loglive_renderable => report_loglive_renderer::render_report_log
* On calendar view screen the course selector and new event button have been swapped, custom CSS for .path-calendar might be affected.
* The functions search_listing() and search_pagination() in the core_course_management_renderer class take the searched string
as an extra parameter - see MDL-46902.
=== 2.7 ===