1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
<template>
<studip-dialog
:title="$gettext('Seite exportieren')"
:confirmText="$gettext('Erstellen')"
confirmClass="accept"
:closeText="$gettext('Abbrechen')"
closeClass="cancel"
height="350"
@close="showElementPdfExportDialog(false)"
@confirm="pdfExportCurrentElement"
>
<template v-slot:dialogContent>
{{
$gettext(
'Hiermit exportieren Sie die Seite "%{ pageTitle }" als PDF-Datei.',
{ pageTitle: structuralElement.attributes.title }
)
}}
<div class="cw-element-export">
<label>
<input type="checkbox" v-model="pdfExportChildren">
{{ $gettext('Unterseiten exportieren') }}
</label>
</div>
</template>
</studip-dialog>
</template>
<script>
import { mapActions, mapGetters } from 'vuex';
export default {
name: 'courseware-structural-element-dialog-export-pdf',
props: {
structuralElement: Object,
},
data() {
return {
pdfExportChildren: false,
};
},
computed: {
...mapGetters({
context: 'context',
}),
},
methods: {
...mapActions({
showElementPdfExportDialog: 'showElementPdfExportDialog',
}),
pdfExportCurrentElement() {
this.showElementPdfExportDialog(false);
let url = '';
let withChildren = this.pdfExportChildren ? '/1' : '/0';
if (this.context.type === 'users') {
url = STUDIP.URLHelper.getURL(
'dispatch.php/contents/courseware/pdf_export/' + this.structuralElement.id + withChildren
);
}
if (this.context.type === 'courses') {
url = STUDIP.URLHelper.getURL(
'dispatch.php/course/courseware/pdf_export/' + this.structuralElement.id + withChildren
);
}
if (url) {
window.open(url, '_blank').focus();
}
},
},
};
</script>
|