Skip to content
Snippets Groups Projects
Unverified Commit 935144f0 authored by Tobias Reischmann's avatar Tobias Reischmann
Browse files

Added first trivial version of interaction handling through actions

parent acea0d65
No related branches found
No related tags found
No related merge requests found
...@@ -42,10 +42,14 @@ class interaction_manager { ...@@ -42,10 +42,14 @@ class interaction_manager {
/** /**
* Called by the view.php for redirecting the interactions to the respective subplugin. * Called by the view.php for redirecting the interactions to the respective subplugin.
* @param int $subpluginid id of the step instance * @param int $subpluginid id of the step instance
* @param int $processid id of the process, the triggered action belongs to.
* @param string $action action string * @param string $action action string
*/ */
public static function handle_interaction($subpluginid, $action) { public static function handle_interaction($subpluginid, $processid, $action) {
$step = step_manager::get_step_instance($subpluginid);
$process = process_manager::get_process_by_id($processid);
$interactionlib = lib_manager::get_step_interactionlib($step->subpluginname);
return $interactionlib->handle_interaction($process, $action);
} }
/** /**
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
*/ */
namespace tool_cleanupcourses\step; namespace tool_cleanupcourses\step;
use tool_cleanupcourses\entity\process;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../interactionlib.php'); require_once(__DIR__ . '/../interactionlib.php');
...@@ -55,4 +57,13 @@ class interactionemail extends interactionlibbase { ...@@ -55,4 +57,13 @@ class interactionemail extends interactionlibbase {
), ),
); );
} }
/**
* Called when a user triggered an action for a process instance.
* @param process $process instance of the process the action was triggered upon.
* @param string $action action string
*/
public function handle_interaction($process, $action){
echo 'Test';
}
} }
\ No newline at end of file
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
*/ */
namespace tool_cleanupcourses\step; namespace tool_cleanupcourses\step;
use tool_cleanupcourses\entity\process;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
abstract class interactionlibbase { abstract class interactionlibbase {
...@@ -52,4 +54,11 @@ abstract class interactionlibbase { ...@@ -52,4 +54,11 @@ abstract class interactionlibbase {
* @return array of action tools * @return array of action tools
*/ */
public abstract function get_action_tools(); public abstract function get_action_tools();
/**
* Called when a user triggered an action for a process instance.
* @param process $process instance of the process the action was triggered upon.
* @param string $action action string
*/
public abstract function handle_interaction($process, $action);
} }
\ No newline at end of file
...@@ -47,7 +47,7 @@ echo $renderer->header(); ...@@ -47,7 +47,7 @@ echo $renderer->header();
if (interaction_manager::interaction_available($stepinstance->subpluginname)) { if (interaction_manager::interaction_available($stepinstance->subpluginname)) {
if ($action && $processid) { if ($action && $processid) {
interaction_manager::handle_interaction($action, $processid); interaction_manager::handle_interaction($stepinstance->id, $processid, $action);
} }
$table = new interaction_table('tool_cleanupcourses_interaction', $stepinstance->id); $table = new interaction_table('tool_cleanupcourses_interaction', $stepinstance->id);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment