|
33 | 33 | $removedirective = optional_param('removedirective', false, PARAM_TEXT);
|
34 | 34 | $removedomain = optional_param('removedomain', false, PARAM_TEXT);
|
35 | 35 | $removerecordwithid = optional_param('removerecordwithid', false, PARAM_TEXT);
|
| 36 | +$download = optional_param('download', '', PARAM_ALPHA); |
36 | 37 |
|
37 | 38 | admin_externalpage_setup('local_csp_report', '', null, '', array('pagelayout' => 'report'));
|
38 | 39 |
|
|
58 | 59 | redirect($PAGE->url);
|
59 | 60 | }
|
60 | 61 |
|
| 62 | +$PAGE->set_url('/local/csp/csp_report.php', [ |
| 63 | + 'blockeddomain' => $viewblockeddomain, |
| 64 | + 'blockeddirective' => $viewdirective ?? '', |
| 65 | + 'removedirective' => $removedirective, |
| 66 | + 'removedomain' => $removedomain, |
| 67 | + 'removerecordwithid' => $removerecordwithid, |
| 68 | +]); |
| 69 | + |
61 | 70 | $resetallcspstatistics = optional_param('resetallcspstatistics', 0, PARAM_INT);
|
62 | 71 | if ($resetallcspstatistics == 1 && confirm_sesskey()) {
|
63 | 72 | $DB->delete_records('local_csp');
|
|
69 | 78 | $PAGE->set_heading($title);
|
70 | 79 | $PAGE->set_pagelayout('admin');
|
71 | 80 |
|
72 |
| -global $OUTPUT, $DB; |
73 |
| - |
74 |
| -echo $OUTPUT->header(); |
75 |
| -echo $OUTPUT->heading($title); |
| 81 | +$table = new \local_csp\table\csp_report('cspreportstable'); |
| 82 | +$table->is_downloading($download, 'csp_report', 'csp_report'); |
76 | 83 |
|
77 |
| -$action = new \confirm_action(get_string('areyousuretodeleteallrecords', 'local_csp')); |
78 |
| -$urlresetallcspstatistics = new moodle_url($PAGE->url, array( |
79 |
| - 'resetallcspstatistics' => 1, |
80 |
| - 'sesskey' => sesskey(), |
81 |
| -)); |
82 |
| -echo $OUTPUT->single_button($urlresetallcspstatistics, |
83 |
| - get_string('resetallcspstatistics', 'local_csp'), 'post', array('actions' => array($action))); |
| 84 | +global $OUTPUT, $DB; |
84 | 85 |
|
85 | 86 | $blockeduri = get_string('blockeduri', 'local_csp');
|
86 | 87 | $blockeddomain = get_string('blockeddomain', 'local_csp');
|
|
93 | 94 | $timeupdated = get_string('timeupdated', 'local_csp');
|
94 | 95 | $action = get_string('action', 'local_csp');
|
95 | 96 |
|
96 |
| -$table = new \local_csp\table\csp_report('cspreportstable'); |
97 | 97 | $table->define_baseurl($PAGE->url);
|
98 | 98 | $table->sortable(true, 'failcounter', SORT_DESC);
|
99 | 99 | $table->set_attribute('class', 'generaltable generalbox table-sm');
|
|
159 | 159 | $where = '1 = 1';
|
160 | 160 | $params = array();
|
161 | 161 | }
|
162 |
| -$table->set_sql($fields, $from, $where, $params); |
163 | 162 |
|
| 163 | +if(!$table->is_downloading()) { |
| 164 | + echo $OUTPUT->header(); |
| 165 | + echo $OUTPUT->heading($title); |
| 166 | + |
| 167 | + $action = new \confirm_action(get_string('areyousuretodeleteallrecords', 'local_csp')); |
| 168 | + $urlresetallcspstatistics = new moodle_url($PAGE->url, array( |
| 169 | + 'resetallcspstatistics' => 1, |
| 170 | + 'sesskey' => sesskey(), |
| 171 | + )); |
| 172 | + echo $OUTPUT->single_button($urlresetallcspstatistics, |
| 173 | + get_string('resetallcspstatistics', 'local_csp'), 'post', array('actions' => array($action))); |
| 174 | +} |
| 175 | + |
| 176 | +$table->set_sql($fields, $from, $where, $params); |
164 | 177 | $table->out(30, true);
|
165 | 178 |
|
166 | 179 | echo $OUTPUT->footer();
|
0 commit comments