@@ -22,7 +22,11 @@ class Module extends FormToolsModule
2222 protected $ version = "3.0.0 " ;
2323 protected $ date = "2017-10-01 " ;
2424 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+ );
2630 protected $ cssFiles = array ("css/styles.css " );
2731
2832 protected $ nav = array (
@@ -57,7 +61,6 @@ public function install($module_id)
5761 } catch (PDOException $ e ) {
5862 $ db ->rollbackTransaction ();
5963 $ success = false ;
60- print_r ($ e );
6164 $ message = $ L ["notify_installation_problem_c " ] . " <b> " . $ e ->getMessage () . "</b> " ;
6265 }
6366
@@ -84,6 +87,34 @@ public function uninstall($module_id)
8487 }
8588
8689
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+
87118 /**
88119 * This hook function is what actually outputs the Export options at the bottom of the Submission Listing page.
89120 *
@@ -95,6 +126,7 @@ public function displayExportOptions($template_name, $params)
95126 $ account_id = Sessions::get ("account.account_id " );
96127 $ root_url = Core::getRootUrl ();
97128 $ smarty = Core::$ smarty ;
129+ $ L = $ this ->getLangStrings ();
98130
99131 $ form_id = $ params ["form_id " ];
100132 $ view_id = $ params ["view_id " ];
@@ -118,12 +150,12 @@ public function displayExportOptions($template_name, $params)
118150 "export_group_ {$ export_group_id }_export_type " , "export_group_ {$ export_group_id }_export_type " );
119151 }
120152
121- $ params ["LANG " ]["export_manager " ] = ft_get_module_lang_file_contents ("export_manager " );
122-
123153 // now pass the information to the Smarty template to display
124154 $ smarty ->assign ("export_groups " , $ export_groups );
125155 $ smarty ->assign ("is_admin " , $ is_admin );
126156 $ smarty ->assign ("page_vars " , $ page_vars );
157+ $ smarty ->assign ("L " , $ L );
158+ $ smarty ->assign ("SESSION " , Settings::get ("export_manager " ));
127159 $ smarty ->assign ("LANG " , $ params ["LANG " ]);
128160 $ smarty ->assign ("export_icon_folder " , "$ root_url/modules/export_manager/images/icons " );
129161
@@ -228,7 +260,7 @@ private function addHtmlExportGroup()
228260
229261 ExportTypes::addExportType (array (
230262 "export_type_name " => $ L ["phrase_table_format " ],
231- "export_type_visibility " => "show " ,
263+ "visibility " => "show " ,
232264 "filename " => "submissions-{ \$M}.{ \$j}.html " ,
233265 "export_group_id " => $ export_group_id ,
234266 "smarty_template " => $ table_smarty_template
@@ -259,7 +291,7 @@ private function addHtmlExportGroup()
259291
260292 ExportTypes::addExportType (array (
261293 "export_type_name " => $ L ["phrase_one_by_one " ],
262- "export_type_visibility " => "show " ,
294+ "visibility " => "show " ,
263295 "filename " => "submissions-{ \$M}.{ \$j}.html " ,
264296 "export_group_id " => $ export_group_id ,
265297 "smarty_template " => $ one_by_one_smarty_template
@@ -292,7 +324,7 @@ private function addHtmlExportGroup()
292324
293325 ExportTypes::addExportType (array (
294326 "export_type_name " => $ L ["phrase_one_submission_per_page " ],
295- "export_type_visibility " => "show " ,
327+ "visibility " => "show " ,
296328 "filename " => "submissions-{ \$M}.{ \$j}.html " ,
297329 "export_group_id " => $ export_group_id ,
298330 "smarty_template " => $ one_submission_smarty_template
@@ -340,7 +372,7 @@ public function addExcelExportGroup()
340372
341373 ExportTypes::addExportType (array (
342374 "export_type_name " => $ L ["phrase_table_format " ],
343- "export_type_visibility " => "show " ,
375+ "visibility " => "show " ,
344376 "filename " => "submissions-{ \$M}.{ \$j}.html " ,
345377 "export_group_id " => $ export_group_id ,
346378 "smarty_template " => $ excel_smarty_template
@@ -392,7 +424,7 @@ private function addXmlExportGroup ()
392424
393425 ExportTypes::addExportType (array (
394426 "export_type_name " => $ LANG ["phrase_all_submissions " ],
395- "export_type_visibility " => "show " ,
427+ "visibility " => "show " ,
396428 "filename " => "form{ \$form_id}_{ \$datetime}.xml " ,
397429 "export_group_id " => $ export_group_id ,
398430 "smarty_template " => $ xml_smarty_template
@@ -419,7 +451,7 @@ private function addCsvExportGroup()
419451
420452 ExportTypes::addExportType (array (
421453 "export_type_name " => $ LANG ["phrase_all_submissions " ],
422- "export_type_visibility " => "show " ,
454+ "visibility " => "show " ,
423455 "filename " => "form{ \$form_id}_{ \$datetime}.csv " ,
424456 "export_group_id " => $ export_group_id ,
425457 "smarty_template " => $ csv_smarty_template
@@ -446,6 +478,7 @@ private function addModuleSettings()
446478 ), "export_manager " );
447479 }
448480
481+
449482 private function createTables ()
450483 {
451484 $ db = Core::$ db ;
0 commit comments