-
Notifications
You must be signed in to change notification settings - Fork 991
/
installedthemelist.php
130 lines (120 loc) · 5.14 KB
/
installedthemelist.php
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/**
* List of all installed question themes
* @var QuestionTheme $oQuestionTheme
*/
?>
<?php
$massiveAction = App()->getController()->renderPartial(
'./_selector',
[
'oQuestionTheme' => $oQuestionTheme,
'gridID' => 'questionthemes-grid',
'dropupID' => 'questionsthemes-dropup',
'pk' => 'questionId'
],
true,
false
);
$this->widget('application.extensions.admin.grid.CLSGridView', [
'dataProvider' => $oQuestionTheme->search(),
'filter' => $oQuestionTheme,
'id' => 'questionthemes-grid',
'massiveActionTemplate' => $massiveAction,
'summaryText' => gT('Displaying {start}-{end} of {count} result(s).') . ' ' . sprintf(
gT('%s rows per page'),
CHtml::dropDownList(
'pageSize',
$pageSize,
App()->params['pageSizeOptions'],
['class' => 'changePageSize form-select', 'style' => 'display: inline; width: auto']
)
),
'columns' => [
[
'id' => 'questionId',
'class' => 'CCheckBoxColumn',
'selectableRows' => '100',
],
[
'header' => gT('Name'),
'name' => 'name',
'value' => '$data->name',
'htmlOptions' => ['class' => 'col-lg-2'],
],
[
'header' => gT('Description'),
'name' => 'description',
'value' => '$data->description',
'htmlOptions' => ['class' => 'col-lg-3'],
'type' => 'raw',
],
[
'header' => gT('Type'),
'name' => 'core_theme',
'value' => '($data->core_theme == 1) ? gT("Core Theme") : gT("User Theme")',
'type' => 'raw',
'htmlOptions' => ['class' => 'col-lg-2'],
"filter" => [1 => gT("Core Theme"), 0 => gT('User Theme')]
],
[
'header' => gT('Extends'),
'name' => 'extends',
'value' => '$data->extends',
'htmlOptions' => ['class' => 'col-lg-2'],
],
[
'header' => gT('Visibility'),
'headerHtmlOptions' => ['title' => gT('Visible inside the Question Selector')],
'name' => 'visible',
'value' => '$data->getVisibilityButton()',
'type' => 'raw',
'htmlOptions' => ['class' => 'col-lg-1'],
"filter" => ['N' => gT("Off"), 'Y' => gT('On')],
]
],
'ajaxUpdate' => 'questionthemes-grid',
'ajaxType' => 'POST',
// @todo create a new javascript file and call function from here, related: 1573120573738
'afterAjaxUpdate' => '
function(id, data){
window.LS.doToolTip();
bindListItemclick();
let togglequestionthemes = document.getElementsByClassName("toggle_question_theme");
for (let togglequestiontheme of togglequestionthemes) {
togglequestiontheme.addEventListener("change", () => {
let $url = togglequestiontheme.getAttribute("data-url");
let data = new FormData();
let xhttp = new XMLHttpRequest();
data.append(LS.data.csrfTokenName, LS.data.csrfToken);
xhttp.open("POST", $url, true);
xhttp.send(data);
});
}
}',
]);
?>
<?php
// todo create a new javascript file and call function from here, related: 1573120573738
$script = '
jQuery(document).on("change", "#pageSize", function () {
$.fn.yiiGridView.update("questionthemes-grid", {
data: {
pageSize: $(this).val()
}
});
});
let togglequestionthemes = document.getElementsByClassName("toggle_question_theme");
for (let togglequestiontheme of togglequestionthemes) {
togglequestiontheme.addEventListener("change", () => {
let $url = togglequestiontheme.getAttribute("data-url");
let data = new FormData();
let xhttp = new XMLHttpRequest();
data.append(LS.data.csrfTokenName, LS.data.csrfToken);
xhttp.open("POST", $url, true);
xhttp.send(data);
});
}
';
App()->getClientScript()->registerScript('questionthemes-grid', $script, LSYii_ClientScript::POS_POSTSCRIPT);
?>