Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'MDL-35603_24' of git://github.com/rlorenzo/moodle into …

…MOODLE_24_STABLE
  • Loading branch information...
commit ecfa79b801a5371a81f71c0ac11c58603fb1c3e5 2 parents 0c61dbe + 1936dbe
@danpoltawski danpoltawski authored
View
25 backup/util/ui/renderer.php
@@ -521,6 +521,15 @@ public function render_restore_course_search(restore_course_search $component) {
$url = $component->get_url();
$output = html_writer::start_tag('div', array('class' => 'restore-course-search'));
+
+ $count_str = '';
+ if ($component->has_more_results()) {
+ $count_str = get_string('morecoursesearchresults', 'backup', $component->get_count());
+ } else {
+ $count_str = get_string('totalcoursesearchresults', 'backup', $component->get_count());
+ }
+
+ $output .= html_writer::tag('div', $count_str, array('class'=>'rcs-totalresults'));
$output .= html_writer::start_tag('div', array('class' => 'rcs-results'));
$table = new html_table();
@@ -590,8 +599,14 @@ public function render_import_course_search(import_course_search $component) {
return $output;
}
- $output .= html_writer::tag('div', get_string('totalcoursesearchresults', 'backup', $component->get_count()), array('class'=>'ics-totalresults'));
+ $count_str = '';
+ if ($component->has_more_results()) {
+ $count_str = get_string('morecoursesearchresults', 'backup', $component->get_count());
+ } else {
+ $count_str = get_string('totalcoursesearchresults', 'backup', $component->get_count());
+ }
+ $output .= html_writer::tag('div', $count_str, array('class'=>'ics-totalresults'));
$output .= html_writer::start_tag('div', array('class' => 'ics-results'));
$table = new html_table();
@@ -610,6 +625,14 @@ public function render_import_course_search(import_course_search $component) {
);
$table->data[] = $row;
}
+ if ($component->has_more_results()) {
+ $cell = new html_table_cell(get_string('moreresults', 'backup'));
+ $cell->colspan = 3;
+ $cell->attributes['class'] = 'notifyproblem';
+ $row = new html_table_row(array($cell));
+ $row->attributes['class'] = 'rcs-course';
+ $table->data[] = $row;
+ }
$output .= html_writer::table($table);
$output .= html_writer::end_tag('div');
View
21 backup/util/ui/restore_ui_components.php
@@ -65,6 +65,11 @@
* @var array
*/
private $requiredcapabilities = array();
+ /**
+ * Indicates if we have more than maxresults found.
+ * @var boolean
+ */
+ private $has_more_results = false;
/**
* Constructor
@@ -177,7 +182,7 @@ public function __construct(array $config=array()) {
foreach ($this->requiredcapabilities as $cap) {
$requiredcaps[] = $cap['capability'];
}
- // Iterate while we have records and haven't reached MAXRESULTS
+ // Iterate while we have records and haven't reached $this->maxresults.
while ($totalcourses > $offs and $this->totalcount < self::$MAXRESULTS) {
$resultset = $DB->get_records_sql($sql, $params, $offs, $blocksz);
foreach ($resultset as $result) {
@@ -189,11 +194,14 @@ public function __construct(array $config=array()) {
continue;
}
}
- $this->results[$result->id] = $result;
- $this->totalcount++;
- if ($this->totalcount >= self::$MAXRESULTS) {
+ // Check if we are over the limit.
+ if ($this->totalcount+1 > self::$MAXRESULTS) {
+ $this->has_more_results = true;
break;
}
+ // If not, then continue.
+ $this->totalcount++;
+ $this->results[$result->id] = $result;
}
$offs += $blocksz;
}
@@ -202,7 +210,10 @@ public function __construct(array $config=array()) {
}
final public function has_more_results() {
- return $this->get_count() >= self::$MAXRESULTS;
+ if ($this->results === null) {
+ $this->search();
+ }
+ return $this->has_more_results;
}
/**
View
1  lang/en/backup.php
@@ -247,3 +247,4 @@
$string['skipmodifprevhelp'] = 'Choose whether or not to skip courses that have not been modified since previous backup';
$string['totalcategorysearchresults'] = 'Total categories: {$a}';
$string['totalcoursesearchresults'] = 'Total courses: {$a}';
+$string['morecoursesearchresults'] = 'More than {$a} courses found, showing first {$a} results';
Please sign in to comment.
Something went wrong with that request. Please try again.