/
index.php
246 lines (205 loc) · 12.9 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?php
/* @var $this AdminController */
/* @var $dataProvider CActiveDataProvider */
/* @var bool $canImport */
/* @var string $importErrorMessage */
// TODO: rename to template_list.php and move to template controller
// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('templateOptions');
$this->renderPartial('super/fullpagebar_view', array(
'fullpagebar' => array(
'returnbutton'=>array(
'url'=>'index',
'text'=>gT('Close'),
),
)
));
?>
<div class="ls-space margin left-15 right-15 row list-themes">
<ul class="nav nav-tabs" id="themelist" role="tablist">
<li class="active"><a href="#surveythemes"><?php eT('Survey themes'); ?></a></li>
<li><a href="#adminthemes"><?php eT('Admin themes'); ?></a></li>
<li><a href="#questionthemes"><?php eT('Question themes'); ?></a></li>
</ul>
<div class="tab-content">
<div id="surveythemes" class="tab-pane active">
<div class="col-lg-12 list-surveys">
<?php echo '<h3>'.gT('Installed survey themes:').'</h3>'; ?>
<?php $this->renderPartial('themeoptions/surveythememenu',['canImport'=>$canImport,'importErrorMessage'=>$importErrorMessage]); ?>
<?php $this->renderPartial('themeoptions/surveythemelist', array( 'oSurveyTheme'=> $oSurveyTheme, 'pageSize'=>$pageSize )); ?>
<!-- Available Themes -->
<?php if (count($oSurveyTheme->templatesWithNoDb) > 0 ):?>
<h3><?php eT('Available survey themes:'); ?></h3>
<div class="row">
<div class="col-sm-12 content-right">
<div id="templates_no_db" class="grid-view">
<table class="items table">
<thead>
<tr>
<th><?php eT('Preview'); ?></th><th><?php eT('Folder'); ?></th><th><?php eT('Description'); ?></th><th><?php eT('Type'); ?></th><th><?php eT('Extends'); ?></th><th></th>
</tr>
</thead>
<tbody>
<?php foreach ($oSurveyTheme->templatesWithNoDb as $oTemplate):?>
<?php // echo $oTemplate; ?>
<tr class="odd">
<td class="col-md-1"><?php echo $oTemplate->preview; ?></td>
<td class="col-md-2"><?php echo $oTemplate->sTemplateName; ?></td>
<td class="col-md-3"><?php echo $oTemplate->config->metadata->description; ?></td>
<td class="col-md-2"><?php eT('XML themes');?></td>
<td class="col-md-2"><?php echo $oTemplate->config->metadata->extends; ?></td>
<td class="col-md-1"><?php echo $oTemplate->buttons; ?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<?php endif;?>
<!-- Broken Themes -->
<?php $aBrokenThemes = Template::getBrokenThemes(); if (count($aBrokenThemes) > 0 ):?>
<div class="alert alert-danger" role="alert">
<?php eT('Broken survey themes:'); ?>
</div>
<div class="row" >
<div class="col-sm-12 content-right">
<div id="thembes_broken" class="grid-view">
<table class="items table">
<thead>
<tr>
<th><?php eT('Name'); ?></th><th><?php eT('Error message'); ?></th><th></th>
</tr>
</thead>
<tbody>
<?php foreach ($aBrokenThemes as $sName => $oBrokenTheme):?>
<?php // echo $oTemplate; ?>
<tr class="odd">
<td class="col-md-1 text-danger"><?php echo $sName; ?></td>
<td class="col-md-10 "><blockquote><?php echo $oBrokenTheme->getMessage(); ?></blockquote></td>
<td class="col-md-1">
<!-- Export -->
<?php if(Permission::model()->hasGlobalPermission('templates','export') && function_exists("zip_open")):?>
<a class="btn btn-default btn-block" id="button-export" href="<?php echo $this->createUrl('admin/themes/sa/brokentemplatezip/templatename/' . $sName) ?>" role="button">
<span class="icon-export text-success"></span>
<?php eT("Export"); ?>
</a>
<?php endif;?>
<!-- Delete -->
<?php if(Permission::model()->hasGlobalPermission('templates','delete')):?>
<a
id="button-delete"
href="<?php echo Yii::app()->getController()->createUrl('admin/themes/sa/deleteBrokenTheme/'); ?>"
data-post='{ "templatename": "<?php echo $sName; ?>" }'
data-text="<?php eT('Are you sure you want to delete this theme?'); ?>"
title="<?php eT('Delete'); ?>"
class="btn btn-danger selector--ConfirmModal">
<span class="fa fa-trash "></span>
<?php eT('Delete'); ?>
</a>
<?php endif;?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<?php endif;?>
<!-- Broken Themes -->
<!-- Deprecated Themes -->
<?php $aDeprecatedThemes = Template::getDeprecatedTemplates(); ?>
<?php if (count( $aDeprecatedThemes ) > 0 ):?>
<h3><?php eT('Deprecated survey themes:'); ?></h3>
<div class="row">
<div class="col-sm-12 content-right">
<div id="deprecatedThemes" class="grid-view">
<table class="items table">
<thead>
<tr>
<th><?php eT('Name'); ?></th>
<th><?php eT('Export'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($aDeprecatedThemes as $aDeprecatedTheme):?>
<tr class="odd">
<td class="col-md-10"><?php echo $aDeprecatedTheme['name']; ?></td>
<td class="col-md-2">
<?php if(Permission::model()->hasGlobalPermission('templates','export') && function_exists("zip_open")):?>
<a class="btn btn-default" id="button-export" href="<?php echo $this->createUrl('admin/themes/sa/deprecatedtemplatezip/templatename/' . $aDeprecatedTheme['name']) ?>" role="button">
<span class="icon-export text-success"></span>
<?php eT("Export"); ?>
</a>
<?php endif;?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<?php endif;?>
</div>
</div>
<div id="adminthemes" class="tab-pane">
<div class="col-lg-12 list-surveys">
<h3><?php eT('Available admin themes:'); ?></h3>
<div class="row">
<div class="col-sm-12 content-right">
<div id="templates_no_db" class="grid-view">
<table class="items table">
<thead>
<tr>
<th><?php eT('Preview'); ?></th><th><?php eT('Folder'); ?></th><th><?php eT('Description'); ?></th><th><?php eT('Type'); ?></th><th></th>
</tr>
</thead>
<tbody>
<?php foreach ($oAdminTheme->adminThemeList as $oTheme ):?>
<tr class="odd">
<td class="col-md-1"><?php echo $oTheme->preview; ?></td>
<td class="col-md-2"><?php echo $oTheme->metadata->name; ?></td>
<td class="col-md-3"><?php echo $oTheme->metadata->description; ?></td>
<td class="col-md-2"><?php eT('Core admin theme');?></td>
<td class="col-md-1">
<?php if ($oTheme->path == getGlobalSetting('admintheme')):?>
<h3><strong class="text-info"><?php eT("Selected")?></strong></h3>
<?php else: ?>
<a href="<?php echo Yii::app()->getController()->createUrl("admin/themeoptions/sa/setAdminTheme/", ['sAdminThemeName'=>$oTheme->path]);?>" class="btn btn-default btn-lg ">
<?php eT("Select");?>
</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="questionthemes" class="tab-pane">
<div class="col-lg-12 list-surveys">
<?php echo '<h3>'.gT('Question themes:').'</h3>'; ?>
Soon, here, you'll have the list of all question types, and all customed question types. <br>
You'll be able to manage them like the Survey Themes (inheritance, theme editor, configuration at global/survey group/survey ; show/hide by survey group, etc)
<br>Engine is already working, the interface will come very soon.
</div>
</div>
</div>
</div>
<script>
$('#themelist a').click(function (e) {
window.location.hash = $(this).attr('href');
e.preventDefault();
$(this).tab('show');
});
$(document).on('ready pjax:scriptcomplete', function(){
if(window.location.hash){
$('#themelist').find('a[href='+window.location.hash+']').trigger('click');
}
})
</script>