-
Notifications
You must be signed in to change notification settings - Fork 988
/
index.php
141 lines (129 loc) · 4.11 KB
/
index.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
130
131
132
133
134
135
136
137
138
139
140
141
<?php
/**
* Index view for plugin manager
* @var $this AdminController
*
* @since 2015-10-02
* @author LimeSurvey GmbH
*/
// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('pluginManager');
$pageSize = intval(Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']));
?>
<div class="row mb-3 mt-1">
<div class="float-end">
<?php /* Disabled for prototype 1.
<a
href=''
class='btn btn-outline-secondary '
data-bs-toggle='tooltip'
title='<?php eT('Install plugins from the extension shop'); ?>'
>
<i class='ri-shopping-cart-fill'></i>
<?php eT('Browse the shop'); ?>
</a>
*/ ?>
<?php foreach ($extraMenus as $menu) : ?>
<a href='<?php echo $menu->getHref(); ?>' <?php if ($menu->getOnClick()) : ?> onclick='<?php echo $menu->getOnClick(); ?>' <?php endif; ?> <?php if ($menu->getTooltip()) : ?> data-bs-toggle='tooltip' data-title='<?php echo $menu->getTooltip(); ?>' <?php endif; ?> class='btn btn-outline-secondary'>
<?php if ($menu->getIconClass()) : ?>
<i class='<?php echo $menu->getIconClass(); ?>'></i>
<?php endif; ?>
<?php echo $menu->getLabel(); ?>
</a>
<?php endforeach; ?>
</div>
</div>
<?php
$sort = new CSort();
$sort->attributes = [
'name' => [
'asc' => 'name',
'desc' => 'name desc',
],
'description' => [
'asc' => 'description',
'desc' => 'description desc',
],
'status' => [
'asc' => 'active',
'desc' => 'active desc',
'default' => 'desc',
],
];
$sort->defaultOrder = [
'name' => CSort::SORT_ASC,
];
$providerOptions = [
'pagination' => [
'pageSize' => $pageSize,
],
'sort' => $sort,
'caseSensitiveSort' => false,
];
$dataProvider = new CArrayDataProvider($plugins, $providerOptions);
$gridColumns = [
[
'header' => gT('Plugin'),
'name' => 'name',
'type' => 'html',
'value' => '$data->getName()'
],
[
'header' => gT('Description'),
'name' => 'description',
'type' => 'html',
'value' => '$data->getPossibleDescription()'
],
[
'header' => gT('Status'),
'type' => 'html',
'name' => 'status',
'value' => '$data->getStatus()'
],
[
'header' => gT('Action'),
'name' => 'actions',
'value' => '$data->buttons',
'type' => 'raw',
'headerHtmlOptions' => ['class' => 'ls-sticky-column'],
'htmlOptions' => ['class' => 'text-center ls-sticky-column'],
]
];
$this->widget(
'application.extensions.admin.grid.CLSGridView',
[
'id' => 'plugins-grid',
'dataProvider' => $dataProvider,
'summaryText' => gT('Displaying {start}-{end} of {count} result(s).') . ' '
. sprintf(
gT('%s rows per page'),
CHtml::dropDownList(
'pageSize',
$pageSize,
Yii::app()->params['pageSizeOptions'],
[
'class' => 'changePageSize form-select',
'style' => 'display: inline; width: auto'
]
)
),
'columns' => $gridColumns,
'rowHtmlOptionsExpression' => 'array("data-id" => $data["id"])',
'ajaxUpdate' => 'plugins-grid',
'lsAfterAjaxUpdate' => []
]
);
$this->renderPartial('./pluginmanager/uploadModal', []);
?>
<script type="text/javascript">
jQuery(function($) {
// To update rows per page via ajax
$(document).on("change", '#pageSize', function() {
$.fn.yiiGridView.update('plugins-grid', {
data: {
pageSize: $(this).val()
}
});
});
});
</script>