@@ -22,7 +22,11 @@ class Module extends FormToolsModule
22
22
protected $ version = "3.0.0 " ;
23
23
protected $ date = "2017-10-01 " ;
24
24
protected $ originLanguage = "en_us " ;
25
- protected $ jsFiles = array ();
25
+ protected $ jsFiles = array (
26
+ "{MODULEROOT}/scripts/admin.js " ,
27
+ "{FTROOT}/global/scripts/sortable.js " ,
28
+ "{FTROOT}/global/codemirror/js/codemirror.js "
29
+ );
26
30
protected $ cssFiles = array ("css/styles.css " );
27
31
28
32
protected $ nav = array (
@@ -57,7 +61,6 @@ public function install($module_id)
57
61
} catch (PDOException $ e ) {
58
62
$ db ->rollbackTransaction ();
59
63
$ success = false ;
60
- print_r ($ e );
61
64
$ message = $ L ["notify_installation_problem_c " ] . " <b> " . $ e ->getMessage () . "</b> " ;
62
65
}
63
66
@@ -84,6 +87,34 @@ public function uninstall($module_id)
84
87
}
85
88
86
89
90
+ public function resetData ()
91
+ {
92
+ $ db = Core::$ db ;
93
+ $ L = $ this ->getLangStrings ();
94
+
95
+ $ success = true ;
96
+ $ message = $ L ["notify_reset_to_default " ];
97
+
98
+ try {
99
+ $ db ->beginTransaction ();
100
+
101
+ General::clearTableData ();
102
+ $ this ->addHtmlExportGroup ();
103
+ $ this ->addExcelExportGroup ();
104
+ $ this ->addXmlExportGroup ();
105
+ $ this ->addCsvExportGroup ();
106
+ $ this ->addModuleSettings ();
107
+
108
+ $ db ->processTransaction ();
109
+ } catch (PDOException $ e ) {
110
+ $ db ->rollbackTransaction ();
111
+ $ success = false ;
112
+ $ message = $ L ["notify_installation_problem_c " ] . " <b> " . $ e ->getMessage () . "</b> " ;
113
+ }
114
+
115
+ return array ($ success , $ message );
116
+ }
117
+
87
118
/**
88
119
* This hook function is what actually outputs the Export options at the bottom of the Submission Listing page.
89
120
*
@@ -95,6 +126,7 @@ public function displayExportOptions($template_name, $params)
95
126
$ account_id = Sessions::get ("account.account_id " );
96
127
$ root_url = Core::getRootUrl ();
97
128
$ smarty = Core::$ smarty ;
129
+ $ L = $ this ->getLangStrings ();
98
130
99
131
$ form_id = $ params ["form_id " ];
100
132
$ view_id = $ params ["view_id " ];
@@ -118,12 +150,12 @@ public function displayExportOptions($template_name, $params)
118
150
"export_group_ {$ export_group_id }_export_type " , "export_group_ {$ export_group_id }_export_type " );
119
151
}
120
152
121
- $ params ["LANG " ]["export_manager " ] = ft_get_module_lang_file_contents ("export_manager " );
122
-
123
153
// now pass the information to the Smarty template to display
124
154
$ smarty ->assign ("export_groups " , $ export_groups );
125
155
$ smarty ->assign ("is_admin " , $ is_admin );
126
156
$ smarty ->assign ("page_vars " , $ page_vars );
157
+ $ smarty ->assign ("L " , $ L );
158
+ $ smarty ->assign ("SESSION " , Settings::get ("export_manager " ));
127
159
$ smarty ->assign ("LANG " , $ params ["LANG " ]);
128
160
$ smarty ->assign ("export_icon_folder " , "$ root_url/modules/export_manager/images/icons " );
129
161
@@ -228,7 +260,7 @@ private function addHtmlExportGroup()
228
260
229
261
ExportTypes::addExportType (array (
230
262
"export_type_name " => $ L ["phrase_table_format " ],
231
- "export_type_visibility " => "show " ,
263
+ "visibility " => "show " ,
232
264
"filename " => "submissions-{ \$M}.{ \$j}.html " ,
233
265
"export_group_id " => $ export_group_id ,
234
266
"smarty_template " => $ table_smarty_template
@@ -259,7 +291,7 @@ private function addHtmlExportGroup()
259
291
260
292
ExportTypes::addExportType (array (
261
293
"export_type_name " => $ L ["phrase_one_by_one " ],
262
- "export_type_visibility " => "show " ,
294
+ "visibility " => "show " ,
263
295
"filename " => "submissions-{ \$M}.{ \$j}.html " ,
264
296
"export_group_id " => $ export_group_id ,
265
297
"smarty_template " => $ one_by_one_smarty_template
@@ -292,7 +324,7 @@ private function addHtmlExportGroup()
292
324
293
325
ExportTypes::addExportType (array (
294
326
"export_type_name " => $ L ["phrase_one_submission_per_page " ],
295
- "export_type_visibility " => "show " ,
327
+ "visibility " => "show " ,
296
328
"filename " => "submissions-{ \$M}.{ \$j}.html " ,
297
329
"export_group_id " => $ export_group_id ,
298
330
"smarty_template " => $ one_submission_smarty_template
@@ -340,7 +372,7 @@ public function addExcelExportGroup()
340
372
341
373
ExportTypes::addExportType (array (
342
374
"export_type_name " => $ L ["phrase_table_format " ],
343
- "export_type_visibility " => "show " ,
375
+ "visibility " => "show " ,
344
376
"filename " => "submissions-{ \$M}.{ \$j}.html " ,
345
377
"export_group_id " => $ export_group_id ,
346
378
"smarty_template " => $ excel_smarty_template
@@ -392,7 +424,7 @@ private function addXmlExportGroup ()
392
424
393
425
ExportTypes::addExportType (array (
394
426
"export_type_name " => $ LANG ["phrase_all_submissions " ],
395
- "export_type_visibility " => "show " ,
427
+ "visibility " => "show " ,
396
428
"filename " => "form{ \$form_id}_{ \$datetime}.xml " ,
397
429
"export_group_id " => $ export_group_id ,
398
430
"smarty_template " => $ xml_smarty_template
@@ -419,7 +451,7 @@ private function addCsvExportGroup()
419
451
420
452
ExportTypes::addExportType (array (
421
453
"export_type_name " => $ LANG ["phrase_all_submissions " ],
422
- "export_type_visibility " => "show " ,
454
+ "visibility " => "show " ,
423
455
"filename " => "form{ \$form_id}_{ \$datetime}.csv " ,
424
456
"export_group_id " => $ export_group_id ,
425
457
"smarty_template " => $ csv_smarty_template
@@ -446,6 +478,7 @@ private function addModuleSettings()
446
478
), "export_manager " );
447
479
}
448
480
481
+
449
482
private function createTables ()
450
483
{
451
484
$ db = Core::$ db ;
0 commit comments