Ok, so I got this to work by cacheing the form data.
Same issue here. How did you cache the form data?
Sorry Andres, I am out of the office, I will post my code Tuesday or Wednesday
Ok, so in my report index.php file I call my options form, then I have this code:
// Define variables.
if ($id) {
$report = $DB->get_record('local_customreports', array('id' => $id));
$toform = new StdClass();
$queryparams = unserialize($report->queryparams);
foreach ($queryparams as $param => $value) {
$toform->{$param} = $value;
}
$courseids = $queryparams['course'];
$requestedcohort = $queryparams['cohort'];
$completionstatus = $queryparams['completionstatus'];
$datefrom = $queryparams['datefrom'];
$dateto = $queryparams['dateto'];
if (!empty($queryparams['coloptions'])) {
$profieldids = array_keys($queryparams['coloptions']);
}
$cachedata = '';
$mform->set_data($toform);
} else {
$cache = cache::make_from_params(cache_store::MODE_SESSION, 'report_trainingsummary', 'search');
if ($cachedata = $cache->get('data')) {
// Cache form submission so that it is preserved while paging through the report.
$mform->set_data($cachedata);
}
}
// Form has been submitted or we have cached data.
$data = ($mform->is_submitted() ? $mform->get_data() : fullclone($cachedata));
if ($data) {
if (!empty($data->course)) {
$courseids = $data->course;
}
if (!empty($data->cohort)) {
$requestedcohort = $data->cohort;
}
if (!empty($data->completionstatus)) {
$completionstatus = $data->completionstatus;
}
if (!empty($data->datefrom)) {
$datefrom = $data->datefrom;
}
if (!empty($data->dateto)) {
$dateto = $data->dateto;
}
if (!empty($data->coloptions)) {
$profieldids = array_keys($data->coloptions);
}
unset($data->submitbutton);
$cache->set('data', $data);
}