Skip to content

Commit d87b4b5

Browse files
authored
Merge pull request #224 from catalyst/issue223
issue #223: Moodle 4.4 support
2 parents 9b2526f + 87d0125 commit d87b4b5

File tree

126 files changed

+302
-13875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+302
-13875
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ More Information on Moodle events can be found in the Moodle documentation at th
2424
## Branches ##
2525
The following maps the plugin version to use depending on your Moodle version.
2626

27-
| Moodle verion | Branch |
28-
| ------------------ | ------------------ |
29-
| Moodle 3.5 to 3.10 | MOODLE_35_STABLE |
30-
| Moodle 3.11+ | MOODLE_311_STABLE |
27+
| Moodle verion | Branch |
28+
|---------------------------|-------------------|
29+
| Moodle 3.5 to 3.10 | MOODLE_35_STABLE |
30+
| Moodle 3.11 to Moodle 4.1 | MOODLE_311_STABLE |
31+
| Moodle 4.4+ | MOODLE_404_STABLE |
32+
3133

3234
## Moodle Plugin Installation
3335
The following sections outline how to install the Moodle plugin.

classes/event_processor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private function process_realtime_workflow($workflow, $evententry) {
276276
* history and auditing.
277277
*
278278
* @param int $workflowid The workflow id to record.
279-
* @param stdClass $event the event that triggered this workflow.
279+
* @param \stdClass $event the event that triggered this workflow.
280280
* @param int $attemptnum The number of attempts for this event.
281281
* @return int|null the id of the recorded workflow record or null.
282282
*/
@@ -799,7 +799,7 @@ public static function rerun_all_error_runs($workflow, $historic = false) {
799799
* Records a cancelled workflow, used in debouncing.
800800
*
801801
* @param int $workflowid
802-
* @param stdClass $event
802+
* @param \stdClass $event
803803
* @param int $runid
804804
* @param boolean $deferred
805805
* @return void

classes/output/manageworkflows/renderable.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public function __construct($uniqueid, \moodle_url $url, $perpage = 100) {
9090
$this->pageable(true);
9191
$this->is_downloadable(false);
9292
$this->define_baseurl($url);
93-
$this->workflowid = 0;
9493
}
9594

9695
/**

classes/output/manageworkflows/renderer.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class renderer extends \plugin_renderer_base {
4141
* @return string to display on the mangerules page.
4242
*/
4343
protected function render_renderable(renderable $renderable) {
44-
$o = $this->render_add_button($renderable->workflowid);
44+
$o = $this->render_add_button();
4545
$o .= ' ';
4646
$o .= $this->render_import_button();
4747
$o .= $this->render_table($renderable);
@@ -69,14 +69,13 @@ protected function render_table(renderable $renderable) {
6969
/**
7070
* Html to add a button for adding a new workflow.
7171
*
72-
* @param int $workflowid The workflow the button applies too.
7372
* @return string html for the button.
7473
*/
75-
protected function render_add_button($workflowid) {
74+
protected function render_add_button() {
7675
global $CFG;
7776

7877
$button = \html_writer::tag('button', get_string('addworkflow', 'tool_trigger'), ['class' => 'btn btn-primary']);
79-
$addurl = new \moodle_url($CFG->wwwroot. '/admin/tool/trigger/edit.php', array('workflowid' => $workflowid));
78+
$addurl = new \moodle_url($CFG->wwwroot. '/admin/tool/trigger/edit.php', array('workflowid' => 0));
8079
return \html_writer::link($addurl, $button);
8180
}
8281

classes/output/workflowhistory/renderer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function render_workflowhistory_table($workflowid, $searchparams = [], $d
8484
$url = new \moodle_url('/admin/tool/trigger/history.php', $searchparams);
8585
$renderable = new \tool_trigger\output\workflowhistory\workflowhistory_renderable('triggerhistory', $url, $searchparams, $download, 100);
8686

87-
$namefields = get_all_user_name_fields(true, 'u');
87+
$namefields = implode(',', \core_user\fields::get_name_fields());
8888
$sqlfields = "tfh.*, {$namefields}";
8989
$sqlfrom = '{tool_trigger_workflow_hist} tfh LEFT JOIN {user} u ON tfh.userid = u.id';
9090
$sqlwhere = 'tfh.workflowid = :workflow';
@@ -274,7 +274,7 @@ public function run_actions_button($run, $statusonly = false, $searchparams = []
274274
private function rerun_all_historic_button($workflowid) {
275275
$url = new \moodle_url('/admin/tool/trigger/history.php',
276276
['action' => 'rerunallhist', 'sesskey' => sesskey(), 'id' => $workflowid, 'workflow' => $workflowid]);
277-
$btn = new \single_button($url, get_string('rerunallhist', 'tool_trigger'), 'get', true);
277+
$btn = new \single_button($url, get_string('rerunallhist', 'tool_trigger'), 'get', \single_button::BUTTON_PRIMARY);
278278
echo $this->render($btn);
279279
}
280280

@@ -286,7 +286,7 @@ private function rerun_all_historic_button($workflowid) {
286286
private function rerun_all_current_button($workflowid) {
287287
$url = new \moodle_url('/admin/tool/trigger/history.php',
288288
['action' => 'rerunallcurr', 'sesskey' => sesskey(), 'id' => $workflowid, 'workflow' => $workflowid]);
289-
$btn = new \single_button($url, get_string('rerunallcurr', 'tool_trigger'), 'get', true);
289+
$btn = new \single_button($url, get_string('rerunallcurr', 'tool_trigger'), 'get', \single_button::BUTTON_PRIMARY);
290290
echo $this->render($btn);
291291
}
292292
}

classes/steps/actions/assign_cohort_action_step.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,18 @@
2828
require_once($CFG->dirroot.'/cohort/lib.php');
2929

3030
class assign_cohort_action_step extends base_action_step {
31+
use \tool_trigger\helper\datafield_manager;
3132

33+
/** User field.
34+
* @var int
35+
*/
36+
protected $useridfield;
3237

33-
use \tool_trigger\helper\datafield_manager;
38+
/**
39+
* Cohort field.
40+
* @var int
41+
*/
42+
protected $cohortidfield;
3443

3544
/**
3645
* The fields supplied by this step.

classes/steps/actions/http_post_action_step.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
/**
2828
* HTTP action step class.
29-
*
3029
* @package tool_trigger
3130
* @copyright Matt Porritt <[email protected]>
3231
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -51,6 +50,8 @@ class http_post_action_step extends base_action_step {
5150
protected $headers;
5251
protected $params;
5352
private $httphandler = null;
53+
private $expectedresponse;
54+
private $jsonencode;
5455

5556
/**
5657
* The fields supplied by this step.
@@ -127,15 +128,11 @@ public function get_http_client() {
127128
* @return array if execution was succesful and the response from the execution.
128129
*/
129130
public function execute($step, $trigger, $event, $stepresults) {
130-
global $CFG;
131-
require_once($CFG->dirroot . '/admin/tool/trigger/guzzle/autoloader.php');
132-
133131
$this->update_datafields($event, $stepresults);
134132

135133
$headers = $this->render_datafields($this->headers);
136134
$headers = explode("\n", str_replace("\r\n", "\n", $headers));
137-
$headers = \GuzzleHttp\headers_from_lines($headers);
138-
135+
$headers = \GuzzleHttp\Utils::headersFromLines($headers);
139136
// ... urlencode the values of any substitutions being placed into the URL
140137
// or the POST params.
141138
$urlencodecallback = function($v) {

classes/steps/filters/numcompare_filter_step.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class numcompare_filter_step extends base_filter_step {
4444
const OPERATOR_GTE = '>=';
4545
const OPERATOR_GT = '>';
4646

47+
protected $field1;
48+
protected $field2;
49+
protected $operator;
4750

4851

4952
/**

classes/steps/filters/stringcompare_filter_step.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ class stringcompare_filter_step extends base_filter_step {
101101
*/
102102
protected $wantmatch = true;
103103

104+
/**
105+
* Error on fail.
106+
*
107+
* @var bool
108+
*/
109+
protected $erroronfail;
110+
104111
/**
105112
* {@inheritDoc}
106113
* @see \tool_trigger\steps\base\base_step::init()

classes/steps/lookups/cohort_lookup_step.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ class cohort_lookup_step extends base_lookup_step {
4343
*/
4444
private $outputprefix = null;
4545

46+
/**
47+
* User field.
48+
*
49+
* @var string
50+
*/
51+
private $useridfield;
52+
4653
/**
4754
* The fields supplied by this step.
4855
* A string containing all the cohorts a user is assigned to.

0 commit comments

Comments
 (0)