$string['addnewportfolio'] = 'Add a new portfolio';
$string['addtoportfolio'] = 'Add to portfolio';
$string['addalltoportfolio'] = 'Add all to portfolio';
-$string['alreadyexporting'] = 'You already have an active portfolio export in this session. Please complete that first, or <a href=\"$a\">click here</a> to cancel it.';
+$string['alreadyexporting'] = 'You already have an active portfolio export in this session. Please <a href=\"$a->finish\">complete that first</a>, or <a href=\"$a->cancel\">click here</a> to cancel it.';
$string['availableformats'] = 'Available export formats';
$string['callercouldnotpackage'] = 'Failed to package up your data for export';
$string['cannotsetvisible'] = 'Cannot set this to visible - the plugin has been completely disabled because of a misconfiguration';
}
if (isset($SESSION->portfolioexport)) {
- print_error('alreadyexporting', 'portfolio', null, $CFG->wwwroot . '/portfolio/add.php?cancel=1');
+ $a = new StdClass;
+ $a->cancel = $CFG->wwwroot . '/portfolio/add.php?cancel=1';
+ $a->finish = $CFG->wwwroot . '/portfolio/add.php?id=' . $SESSION->portfolioexport;
+ print_error('alreadyexporting', 'portfolio', null, $a);
}
if (empty($callbackfile)) {
public $instancefile;
public $callerfile;
+ private $stage;
+
/**
* id of this export
* matches record in portfolio_tempdata table
* @return boolean whether or not to process the next stage. this is important as the function is called recursively.
*/
public function process_stage($stage, $alreadystolen=false) {
+ $this->set('stage', $stage);
+ $this->save();
if (!$alreadystolen && $url = $this->instance->steal_control($stage)) {
- $this->set('stage', $stage);
- $this->save();
redirect($url);
break;
}
}
}
-$stage = optional_param('stage', PORTFOLIO_STAGE_CONFIG);
+if (!$stage = optional_param('stage', PORTFOLIO_STAGE_CONFIG)) {
+ $stage = $exporter->get('stage');
+}
+
$alreadystolen = false;
// for places returning control to pass (rather than PORTFOLIO_STAGE_PACKAGE
// which is unstable if they can't get to the constant (eg external system)
if ($postcontrol = optional_param('postcontrol', 0, PARAM_INT)) {
- $stage = $exporter->get('stage');
$exporter->instance()->post_control($stage, array_merge($_GET, $_POST));
$alreadystolen = true;
}
+
$exporter->process_stage($stage, $alreadystolen);
?>