Skip to content

Commit 2d0a518

Browse files
committed
keep search string with initials links
1 parent bf95f5a commit 2d0a518

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

classes/local/table/courses_in_step_table.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class courses_in_step_table extends \table_sql {
4242
/** @var int|null if set, it is the courseid to focus on. */
4343
private $courseid;
4444

45+
/** @var string search string to filter courses list */
46+
private $search = "";
47+
4548
/**
4649
* Constructor for courses_in_step_table.
4750
* @param step_subplugin $step step to show courses of
@@ -87,6 +90,7 @@ public function __construct($step, $courseid, $ncourses = 0, $filterdata = '') {
8790
} else {
8891
$where = $where . " AND ( c.fullname LIKE '%$filterdata%' OR c.shortname LIKE '%$filterdata%')";
8992
}
93+
$this->search = $filterdata;
9094
}
9195

9296
$this->column_nosort = ['status', 'tools'];
@@ -172,12 +176,12 @@ public function col_tools($row) {
172176
global $OUTPUT, $PAGE;
173177
$output = '';
174178
$output .= $OUTPUT->single_button(new \moodle_url($PAGE->url,
175-
['action' => 'rollback', 'processid' => $row->processid, 'sesskey' => sesskey()]),
176-
get_string('rollback', 'tool_lifecycle')
179+
['action' => 'rollback', 'processid' => $row->processid, 'sesskey' => sesskey(), 'search' => $this->search]),
180+
get_string('rollback', 'tool_lifecycle'), 'post', 'secondary', ['class' => 'mr-1']
177181
);
178182
$output .= $OUTPUT->single_button(new \moodle_url($PAGE->url,
179-
['action' => 'proceed', 'processid' => $row->processid, 'sesskey' => sesskey()]),
180-
get_string('proceed', 'tool_lifecycle')
183+
['action' => 'proceed', 'processid' => $row->processid, 'sesskey' => sesskey(), 'search' => $this->search]),
184+
get_string('proceed', 'tool_lifecycle'), 'post', 'secondary', ['class' => 'mt-1']
181185
);
182186
return $output;
183187
}

workflowoverview.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@
8888
} else if ($excluded) {
8989
$params['excluded'] = $excluded;
9090
}
91+
if ($search) {
92+
$params['search'] = $search;
93+
}
9194

9295
$syscontext = context_system::instance();
9396
$PAGE->set_url(new \moodle_url(urls::WORKFLOW_DETAILS, $params));
@@ -177,7 +180,7 @@
177180
'move_down' => get_string('move_down', 'tool_lifecycle'),
178181
];
179182

180-
$nextrun = 0;
183+
$nextrun = false;
181184
$coursestriggered = [];
182185
$coursesdelayed = [];
183186
$displaytotaltriggered = false;
@@ -190,7 +193,7 @@
190193
$amounts = (new processor())->get_count_of_courses_to_trigger_for_workflow($workflow);
191194
$coursestriggered = $amounts['all']->coursestriggered;
192195
$coursesdelayed = $amounts['all']->delayedcourses;
193-
$nextrun = $amounts['all']->nextrun;
196+
$nextrun = $amounts['all']->nextrun == 0 ? false : $amounts['all']->nextrun;
194197
$displaytotaltriggered = !empty($triggers);
195198
}
196199

@@ -204,9 +207,9 @@
204207
} else if ($nextrunt < time()) {
205208
$nextrunt = get_string('asap', 'tool_task');
206209
}
207-
if (is_int($nextrunt) && $nextrun ?? false) { // Task nextrun and trigger nextrun are valid times: take the minimum.
210+
if (is_int($nextrunt) && is_int($nextrun)) { // Task nextrun and trigger nextrun are valid times: take the minimum.
208211
$nextrun = userdate(min($nextrunt, $nextrun), get_string('strftimedatetimeshort', 'langconfig'));
209-
} else if (!is_int($nextrunt) && $nextrun ?? false) { // Only trigger nextrun is valid time.
212+
} else if (!is_int($nextrunt) && is_int($nextrun)) { // Only trigger nextrun is valid time.
210213
$nextrun = userdate($nextrun, get_string('strftimedatetimeshort', 'langconfig'));
211214
} else if (is_int($nextrunt)) { // Only task next run is valid time.
212215
$nextrun = userdate($nextrunt, get_string('strftimedatetimeshort', 'langconfig'));
@@ -480,7 +483,6 @@
480483
['type' => settings_type::TRIGGER, 'wf' => $workflow->id]),
481484
'subplugin', $selectabletriggers, '', ['' => get_string('add_new_trigger_instance', 'tool_lifecycle')],
482485
null, ['id' => 'tool_lifecycle-choose-trigger']);
483-
484486
// Add step selection field.
485487
if (!$newworkflow) { // At first select a course selection trigger, than you can select the first step.
486488
if ($steptypes = step_manager::get_step_types()) {

0 commit comments

Comments
 (0)