Skip to content

Commit 8495b6c

Browse files
committed
provide search field when more than one page
1 parent da7545d commit 8495b6c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

workflowoverview.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,22 +313,22 @@
313313

314314
// Popup courses list.
315315
$out = null;
316-
$ncourses = 0;
317-
$courseids = [];
316+
$tablecoursesamount = 0;
318317
$hiddenfieldssearch = [];
319318
$hiddenfieldssearch[] = ['name' => 'wf', 'value' => $workflowid];
320319
$hiddenfieldssearch[] = ['name' => 'showdetails', 'value' => $showdetails];
321320
if ($stepid) { // Display courses table with courses of this step.
322321
$step = step_manager::get_step_instance($stepid);
323-
$ncourses = $DB->count_records('tool_lifecycle_process',
322+
$courseids = $DB->count_records('tool_lifecycle_process',
324323
['stepindex' => $step->sortindex, 'workflowid' => $workflowid]);
325324
$table = new courses_in_step_table($step,
326-
optional_param('courseid', null, PARAM_INT), $ncourses, $search);
325+
optional_param('courseid', null, PARAM_INT), $courseids, $search);
327326
ob_start();
328327
$table->out(PAGESIZE, false);
329328
$out = ob_get_contents();
330329
ob_end_clean();
331330
$hiddenfieldssearch[] = ['name' => 'step', 'value' => $stepid];
331+
$tablecoursesamount = count($courseids);
332332
} else if ($triggerid) { // Display courses table with triggered courses of this trigger.
333333
$trigger = trigger_manager::get_instance($triggerid);
334334
if ($courseids = (new processor())->get_triggercourses($trigger, $workflow)) {
@@ -339,6 +339,7 @@
339339
$out = ob_get_contents();
340340
ob_end_clean();
341341
$hiddenfieldssearch[] = ['name' => 'trigger', 'value' => $triggerid];
342+
$tablecoursesamount = count($courseids);
342343
}
343344
} else if ($triggered) { // Display courses table with triggered courses of this workflow.
344345
$table = new triggered_courses_table($coursestriggered, 'triggeredworkflow', null,
@@ -348,6 +349,7 @@
348349
$out = ob_get_contents();
349350
ob_end_clean();
350351
$hiddenfieldssearch[] = ['name' => 'triggered', 'value' => $triggered];
352+
$tablecoursesamount = count($coursestriggered);
351353
} else if ($excluded) { // Display courses table with excluded courses of this trigger.
352354
$trigger = trigger_manager::get_instance($excluded);
353355
if ($courseids = (new processor())->get_triggercourses($trigger, $workflow)) {
@@ -357,6 +359,7 @@
357359
$out = ob_get_contents();
358360
ob_end_clean();
359361
$hiddenfieldssearch[] = ['name' => 'excluded', 'value' => $excluded];
362+
$tablecoursesamount = count($courseids);
360363
}
361364
} else if ($delayed) { // Display courses table with courses delayed for this workflow.
362365
$table = new triggered_courses_table( $coursesdelayed, 'delayed',
@@ -366,6 +369,7 @@
366369
$out = ob_get_contents();
367370
ob_end_clean();
368371
$hiddenfieldssearch[] = ['name' => 'delayed', 'value' => $delayed];
372+
$tablecoursesamount = count($coursesdelayed);
369373
} else if ($used) { // Display courses triggered by this workflow but involved in other processes already.
370374
if ($courseids = $amounts['all']->used ?? null) {
371375
$table = new triggered_courses_table( $courseids, 'used',
@@ -375,11 +379,12 @@
375379
$out = ob_get_contents();
376380
ob_end_clean();
377381
$hiddenfieldssearch[] = ['name' => 'used', 'value' => $used];
382+
$tablecoursesamount = count($courseids);
378383
}
379384
}
380385
// Search box for courses list.
381386
$searchhtml = '';
382-
if ((intval($courseids) + intval($ncourses)) > PAGESIZE ) {
387+
if ($tablecoursesamount > PAGESIZE ) {
383388
$searchhtml = $renderer->render_from_template('tool_lifecycle/search_input', [
384389
'action' => (new moodle_url(urls::WORKFLOW_DETAILS))->out(false),
385390
'uniqid' => 'tool_lifecycle-search-courses',

0 commit comments

Comments
 (0)