Removed 'File' column when downloading report
This commit is contained in:
parent
4af6f68e48
commit
cb3f98a3b9
2 changed files with 24 additions and 12 deletions
|
@ -60,22 +60,34 @@ class report_table extends \table_sql {
|
||||||
* @param int $customcertid
|
* @param int $customcertid
|
||||||
* @param \stdClass $cm the course module
|
* @param \stdClass $cm the course module
|
||||||
* @param bool $groupmode are we in group mode?
|
* @param bool $groupmode are we in group mode?
|
||||||
|
* @param string|null $download The file type, null if we are not downloading
|
||||||
*/
|
*/
|
||||||
public function __construct($customcertid, $cm, $groupmode) {
|
public function __construct($customcertid, $cm, $groupmode, $download = null) {
|
||||||
parent::__construct('mod_customcert_report_table');
|
parent::__construct('mod_customcert_report_table');
|
||||||
|
|
||||||
$this->define_columns(array(
|
$columns = array(
|
||||||
'fullname',
|
'fullname',
|
||||||
'timecreated',
|
'timecreated',
|
||||||
'code',
|
'code'
|
||||||
'download'
|
);
|
||||||
));
|
$headers = array(
|
||||||
$this->define_headers(array(
|
|
||||||
get_string('fullname'),
|
get_string('fullname'),
|
||||||
get_string('receiveddate', 'customcert'),
|
get_string('receiveddate', 'customcert'),
|
||||||
get_string('code', 'customcert'),
|
get_string('code', 'customcert')
|
||||||
get_string('file')
|
);
|
||||||
));
|
|
||||||
|
// Check if we were passed a filename, which means we want to download it.
|
||||||
|
if ($download) {
|
||||||
|
$this->is_downloading($download, 'customcert-report');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->is_downloading()) {
|
||||||
|
$columns[] = 'download';
|
||||||
|
$headers[] = get_string('file');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->define_columns($columns);
|
||||||
|
$this->define_headers($headers);
|
||||||
$this->collapsible(false);
|
$this->collapsible(false);
|
||||||
$this->sortable(true);
|
$this->sortable(true);
|
||||||
$this->no_sorting('code');
|
$this->no_sorting('code');
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
require_once('../../config.php');
|
require_once('../../config.php');
|
||||||
|
|
||||||
$id = required_param('id', PARAM_INT);
|
$id = required_param('id', PARAM_INT);
|
||||||
$download = optional_param('download', '', PARAM_ALPHA);
|
$download = optional_param('download', null, PARAM_ALPHA);
|
||||||
$downloadcert = optional_param('downloadcert', '', PARAM_BOOL);
|
$downloadcert = optional_param('downloadcert', '', PARAM_BOOL);
|
||||||
if ($downloadcert) {
|
if ($downloadcert) {
|
||||||
$userid = required_param('userid', PARAM_INT);
|
$userid = required_param('userid', PARAM_INT);
|
||||||
|
@ -59,10 +59,10 @@ if ($groupmode = groups_get_activity_groupmode($cm)) {
|
||||||
groups_get_activity_group($cm, true);
|
groups_get_activity_group($cm, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new \mod_customcert\report_table($customcert->id, $cm, $groupmode);
|
$table = new \mod_customcert\report_table($customcert->id, $cm, $groupmode, $download);
|
||||||
$table->define_baseurl($pageurl);
|
$table->define_baseurl($pageurl);
|
||||||
|
|
||||||
if ($table->is_downloading($download, 'customcert-report')) {
|
if ($table->is_downloading()) {
|
||||||
$table->download();
|
$table->download();
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue