Skip to content
Snippets Groups Projects
Commit 3c84a233 authored by Justus Dieckmann's avatar Justus Dieckmann
Browse files

Save and display action, add method to interactionlib for action display name

parent ea84a097
No related branches found
No related tags found
No related merge requests found
...@@ -98,7 +98,7 @@ class interaction_manager { ...@@ -98,7 +98,7 @@ class interaction_manager {
$record->processid = $process->id; $record->processid = $process->id;
$record->workflowid = $process->workflowid; $record->workflowid = $process->workflowid;
$record->stepindex = $process->stepindex; $record->stepindex = $process->stepindex;
// TODO Save Action! $record->action = $action;
$DB->insert_record('tool_lifecycle_action_log', $record); $DB->insert_record('tool_lifecycle_action_log', $record);
} }
... ...
......
...@@ -40,7 +40,7 @@ class interaction_log_table extends \table_sql { ...@@ -40,7 +40,7 @@ class interaction_log_table extends \table_sql {
$fields = "l.id as processid, c.id as courseid, c.fullname as coursefullname, w.title as workflow, " . $fields = "l.id as processid, c.id as courseid, c.fullname as coursefullname, w.title as workflow, " .
"s.id as stepinstanceid, s.instancename as stepinstancename, s.subpluginname as subpluginname, " . "s.id as stepinstanceid, s.instancename as stepinstancename, s.subpluginname as subpluginname, " .
"u.id as userid, " . get_all_user_name_fields(true, 'u') . ", l.time as time"; "u.id as userid, " . get_all_user_name_fields(true, 'u') . ", l.time, l.action";
$from = '{tool_lifecycle_action_log} l join ' . $from = '{tool_lifecycle_action_log} l join ' .
'{course} c on l.courseid = c.id join ' . '{course} c on l.courseid = c.id join ' .
'{tool_lifecycle_workflow} w on l.workflowid = w.id join ' . '{tool_lifecycle_workflow} w on l.workflowid = w.id join ' .
...@@ -53,7 +53,6 @@ class interaction_log_table extends \table_sql { ...@@ -53,7 +53,6 @@ class interaction_log_table extends \table_sql {
$where = 'l.courseid IN (' . $ids . ')'; $where = 'l.courseid IN (' . $ids . ')';
} }
$this->column_nosort = array('category', 'status', 'tools');
$this->set_sql($fields, $from, $where, []); $this->set_sql($fields, $from, $where, []);
$this->define_baseurl($PAGE->url); $this->define_baseurl($PAGE->url);
$this->init(); $this->init();
...@@ -63,13 +62,14 @@ class interaction_log_table extends \table_sql { ...@@ -63,13 +62,14 @@ class interaction_log_table extends \table_sql {
* Initialises the columns of the table. * Initialises the columns of the table.
*/ */
public function init() { public function init() {
$this->define_columns(['courseid', 'coursefullname', 'workflow', 'time', 'user']); $this->define_columns(['courseid', 'coursefullname', 'workflow', 'time', 'user', 'action']);
$this->define_headers([ $this->define_headers([
get_string('course'), get_string('course'),
get_string('fullnamecourse'), get_string('fullnamecourse'),
get_string('workflow', 'tool_lifecycle'), get_string('workflow', 'tool_lifecycle'),
get_string('date'), get_string('date'),
get_string('user'), get_string('user'),
get_string('action', 'tool_lifecycle')
]); ]);
$this->setup(); $this->setup();
} }
...@@ -113,6 +113,8 @@ class interaction_log_table extends \table_sql { ...@@ -113,6 +113,8 @@ class interaction_log_table extends \table_sql {
return \html_writer::link(course_get_url($row->courseid), $row->coursefullname); return \html_writer::link(course_get_url($row->courseid), $row->coursefullname);
} }
public function print_nothing_to_display() { public function print_nothing_to_display() {
global $OUTPUT; global $OUTPUT;
... ...
......
...@@ -120,6 +120,7 @@ ...@@ -120,6 +120,7 @@
<FIELD NAME="stepindex" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="stepindex" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="action" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
</FIELDS> </FIELDS>
<KEYS> <KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/> <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
... ...
......
...@@ -340,6 +340,7 @@ function xmldb_tool_lifecycle_upgrade($oldversion) { ...@@ -340,6 +340,7 @@ function xmldb_tool_lifecycle_upgrade($oldversion) {
$table->add_field('stepindex', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); $table->add_field('stepindex', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('time', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); $table->add_field('time', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('action', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
// Adding keys to table tool_lifecycle_action_log. // Adding keys to table tool_lifecycle_action_log.
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
... ...
......
...@@ -148,6 +148,7 @@ $string['manual_trigger_success'] = 'Workflow started successfully.'; ...@@ -148,6 +148,7 @@ $string['manual_trigger_success'] = 'Workflow started successfully.';
$string['manual_trigger_process_existed'] = 'A workflow for this course already exists.'; $string['manual_trigger_process_existed'] = 'A workflow for this course already exists.';
$string['nopastactions'] = 'There are no past actions'; $string['nopastactions'] = 'There are no past actions';
$string['action'] = 'Action';
$string['workflow_started'] = 'Workflow started.'; $string['workflow_started'] = 'Workflow started.';
$string['workflow_is_running'] = 'Workflow is running.'; $string['workflow_is_running'] = 'Workflow is running.';
... ...
......
...@@ -105,4 +105,15 @@ class interactionemail extends interactionlibbase { ...@@ -105,4 +105,15 @@ class interactionemail extends interactionlibbase {
// TODO default format -- seconds -> not in this class ! // TODO default format -- seconds -> not in this class !
return date('d.m.Y', $date); return date('d.m.Y', $date);
} }
/**
* Returns the display name for the given action.
* Used for the past actions table in view.php.
*
* @param $action
* @return string action display name
*/
public function get_action_string($action) {
return get_string('email:preventdeletion', 'lifecyclestep_email');
}
} }
\ No newline at end of file
...@@ -65,6 +65,14 @@ abstract class interactionlibbase { ...@@ -65,6 +65,14 @@ abstract class interactionlibbase {
*/ */
public abstract function get_status_message($process); public abstract function get_status_message($process);
/**
* Returns the display name for the given action.
* Used for the past actions table in view.php.
* @param $action
* @return string action display name
*/
public abstract function get_action_string($action);
/** /**
* Called when a user triggered an action for a process instance. * Called when a user triggered an action for a process instance.
* @param process $process instance of the process the action was triggered upon. * @param process $process instance of the process the action was triggered upon.
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment