Skip to content
Snippets Groups Projects
Unverified Commit 8e9e995c authored by Tobias Reischmann's avatar Tobias Reischmann Committed by GitHub
Browse files

Merge pull request #80 from learnweb/feature/mailduedate

Feature/mailduedate
parents 5cdf79ea c170f7a9
No related branches found
No related tags found
No related merge requests found
......@@ -175,7 +175,6 @@ class step_manager extends subplugin_manager {
* @return array of step instances.
*/
public static function get_step_instances($workflowid) {
// TODO: Alter calls to include workflow id.
global $DB;
$records = $DB->get_records('tool_lifecycle_step', array(
'workflowid' => $workflowid
......
......@@ -100,9 +100,21 @@ class interactionemail extends interactionlibbase {
* @return null
*/
public function get_due_date($processid, $stepid) {
$settings = settings_manager::get_settings($stepid, settings_type::STEP);
$process = process_manager::get_process_by_id($processid);
$date = $settings['responsetimeout'] + $process->timestepchanged;
$steps = step_manager::get_step_instances($process->workflowid);
// Necessary to access steps through counting variable.
$steps = array_values($steps);
// Keep track of the delays for future email steps and sum them up.
$date = $process->timestepchanged;
for ($i = $process->stepindex; $i <= count($steps); $i++) {
// The variable $i represents the stepindex. The index of $steps starts at 0.
/* @var $step step_subplugin class entry of the subplugin step */
$step = $steps[$i - 1];
if ($step->subpluginname == 'email') {
$settings = settings_manager::get_settings($step->id, settings_type::STEP);
$date += $settings['responsetimeout'];
}
}
// TODO default format -- seconds -> not in this class !
return date('d.m.Y', $date);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment