File tree Expand file tree Collapse file tree 6 files changed +28
-1
lines changed Expand file tree Collapse file tree 6 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ public function render_completepage($page) {
54
54
*/
55
55
public function render_reportpage ($ page ) {
56
56
$ data = $ page ->export_for_template ($ this );
57
+ $ printparam = optional_param ('target ' , '' , PARAM_TEXT );
58
+
59
+ $ data ->printparam = $ printparam == 'print ' ;
60
+
57
61
return $ this ->render_from_template ('mod_questionnaire/reportpage ' , $ data );
58
62
}
59
63
Original file line number Diff line number Diff line change 421
421
$ string ['previous ' ] = 'Previous ' ;
422
422
$ string ['previouspage ' ] = 'Previous Page ' ;
423
423
$ string ['print ' ] = 'Print this Response ' ;
424
+ $ string ['printbutton ' ] = 'Print ' ;
424
425
$ string ['printblank ' ] = 'Print Blank ' ;
425
426
$ string ['printblanktooltip ' ] = 'Opens printer-friendly window with blank Questionnaire ' ;
426
427
$ string ['printstrictdateformatting ' ] = 'Enter the date ' ;
Original file line number Diff line number Diff line change @@ -268,6 +268,16 @@ M.mod_questionnaire.init_sendmessage = function(Y) {
268
268
} , '#checkstarted' ) ;
269
269
270
270
} ;
271
+
272
+ M . mod_questionnaire . init_printing = function ( Y ) {
273
+ var printbutton = Y . one ( '#print-button' ) ;
274
+ if ( printbutton ) {
275
+ printbutton . on ( 'click' , function ( e ) {
276
+ e . preventDefault ( ) ;
277
+ window . print ( ) ;
278
+ } ) ;
279
+ }
280
+ } ;
271
281
M . mod_questionnaire . init_slider = function ( ) {
272
282
const allRanges = document . querySelectorAll ( ".question-slider" ) ;
273
283
allRanges . forEach ( wrap => {
Original file line number Diff line number Diff line change 126
126
$ PAGE ->set_context ($ context );
127
127
if ($ outputtarget == 'print ' ) {
128
128
$ PAGE ->set_pagelayout ('popup ' );
129
+ $ PAGE ->requires ->js_init_call ('M.mod_questionnaire.init_printing ' );
129
130
}
130
131
131
132
// Tab setup.
Original file line number Diff line number Diff line change @@ -191,6 +191,12 @@ td.selected {
191
191
display : inline;
192
192
}
193
193
194
+ @media print {
195
+ # page-mod-questionnaire-report # print-button {
196
+ display : none;
197
+ }
198
+ }
199
+
194
200
# page-mod-questionnaire-complete .notice .buttons input {
195
201
margin-bottom : 10px ;
196
202
}
Original file line number Diff line number Diff line change 82
82
{ {#feedbacknotes} }{ {{.} }}{ {/feedbacknotes} }
83
83
{ {#responses} }{ {{.} }}{ {/responses} }
84
84
{ {#bottomnavigationbar} }<div class =" box respondentsnavbar" >{ {{.} }}</div >{ {/bottomnavigationbar} }
85
+ { {#printparam} }
86
+ <button id =" print-button" title =" { { #str} } print, mod_questionnaire{ { /str} } " >
87
+ { {#str} }printbutton, mod_questionnaire{ {/str} }
88
+ </button >
89
+ { {/printparam} }
85
90
</div >
86
91
</div >
87
92
{ {#js} }
90
95
TableSort.init();
91
96
} );
92
97
});
93
- { {/js} }
98
+ { {/js} }
You can’t perform that action at this time.
0 commit comments