|
| 1 | +<?php |
| 2 | +// This file is part of Moodle - http://moodle.org/ |
| 3 | +// |
| 4 | +// Moodle is free software: you can redistribute it and/or modify |
| 5 | +// it under the terms of the GNU General Public License as published by |
| 6 | +// the Free Software Foundation, either version 3 of the License, or |
| 7 | +// (at your option) any later version. |
| 8 | +// |
| 9 | +// Moodle is distributed in the hope that it will be useful, |
| 10 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +// GNU General Public License for more details. |
| 13 | +// |
| 14 | +// You should have received a copy of the GNU General Public License |
| 15 | +// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + |
| 17 | +namespace trigger_testplugin\steps\lookups; |
| 18 | +use tool_trigger\steps\lookups\base_lookup_step; |
| 19 | + |
| 20 | +/** |
| 21 | + * A lookup step for testing purposes. |
| 22 | + * |
| 23 | + * @package trigger_testplugin |
| 24 | + * @copyright 2025 Moodle US |
| 25 | + * @author Oscar Nadjar <oscar.nadjar@moodle.com> |
| 26 | + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
| 27 | + */ |
| 28 | +class subplugin_lookup_test_step extends base_lookup_step { |
| 29 | + |
| 30 | + /** |
| 31 | + * The fields supplied by this step. |
| 32 | + * A string containing all the cohorts a user is assigned to. |
| 33 | + * |
| 34 | + * @var array |
| 35 | + */ |
| 36 | + private static $stepfields = array( |
| 37 | + 'testlookupresult' |
| 38 | + ); |
| 39 | + |
| 40 | + protected function init() { |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * {@inheritDoc} |
| 45 | + * @see \tool_trigger\steps\base\base_step::execute() |
| 46 | + */ |
| 47 | + public function execute($step, $trigger, $event, $stepresults) { |
| 48 | + global $DB; |
| 49 | + $stepresults = [ 'testlookupresult' => 'test' ]; |
| 50 | + return [true, $stepresults]; |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * {@inheritDoc} |
| 55 | + * @see \tool_trigger\steps\base\base_step::form_definition_extra() |
| 56 | + */ |
| 57 | + public function form_definition_extra($form, $mform, $customdata) { |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * {@inheritDoc} |
| 62 | + * @see \tool_trigger\steps\base\base_step::get_step_desc() |
| 63 | + */ |
| 64 | + public static function get_step_desc() { |
| 65 | + return get_string('subplugin_lookup_test_step_desc', 'trigger_testplugin'); |
| 66 | + } |
| 67 | + |
| 68 | + /** |
| 69 | + * {@inheritDoc} |
| 70 | + * @see \tool_trigger\steps\base\base_step::get_step_name() |
| 71 | + */ |
| 72 | + public static function get_step_name() { |
| 73 | + return get_string('subplugin_lookup_test_step_name', 'trigger_testplugin'); |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * {@inheritDoc} |
| 78 | + * @see \tool_trigger\steps\base\base_step::get_privacyfields() |
| 79 | + */ |
| 80 | + public static function get_privacyfields() { |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * Get a list of fields this step provides. |
| 85 | + * |
| 86 | + * @return array $stepfields The fields this step provides. |
| 87 | + */ |
| 88 | + public static function get_fields() { |
| 89 | + return self::$stepfields; |
| 90 | + } |
| 91 | +} |
0 commit comments