Skip to content

Commit 9221edf

Browse files
committed
continued work
1 parent 42eaed1 commit 9221edf

19 files changed

+357
-287
lines changed

code/ExportGroups.class.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public static function addExportGroup($info, $L)
129129
* @param array $info
130130
* @return array
131131
*/
132-
public static function updateExportGroup($info)
132+
public static function updateExportGroup($info, $L)
133133
{
134134
$db = Core::$db;
135135

@@ -164,7 +164,7 @@ public static function updateExportGroup($info)
164164
}
165165

166166

167-
public static function updateExportGroupPermissions($info)
167+
public static function updateExportGroupPermissions($info, $L)
168168
{
169169
$db = Core::$db;
170170

code/ExportTypes.class.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ExportTypes
1212
*
1313
* @param integer $export_type_id
1414
*/
15-
public static function deleteExportType($export_type_id)
15+
public static function deleteExportType($export_type_id, $L)
1616
{
1717
$db = Core::$db;
1818

@@ -132,7 +132,7 @@ public static function addExportType($info, $L)
132132
");
133133
$db->bindAll(array(
134134
"export_type_name" => $info["export_type_name"],
135-
"export_type_visibility" => $info["export_type_visibility"],
135+
"export_type_visibility" => $info["visibility"],
136136
"filename" => $info["filename"],
137137
"export_group_id" => $info["export_group_id"],
138138
"smarty_template" => $info["smarty_template"],
@@ -150,7 +150,7 @@ public static function addExportType($info, $L)
150150
* @param integer $export_type_id
151151
* @param array
152152
*/
153-
public static function updateExportType($info)
153+
public static function updateExportType($info, $L)
154154
{
155155
$db = Core::$db;
156156

@@ -167,9 +167,9 @@ public static function updateExportType($info)
167167
"export_type_name" => $info["export_type_name"],
168168
"visibility" => $info["visibility"],
169169
"filename" => $info["filename"],
170-
"export_group_id" => $info["export_type_id"],
170+
"export_group_id" => $info["export_group_id"],
171171
"smarty_template" => $info["smarty_template"],
172-
"export_type_id" => $info["export_group_id"]
172+
"export_type_id" => $info["export_type_id"]
173173
));
174174
$db->execute();
175175

@@ -223,7 +223,7 @@ public static function checkExportTypeOrder($export_group_id)
223223
*
224224
* @param array $info
225225
*/
226-
public static function reorderExportTypes($info)
226+
public static function reorderExportTypes($info, $L)
227227
{
228228
$db = Core::$db;
229229

@@ -241,10 +241,11 @@ public static function reorderExportTypes($info)
241241
");
242242
$db->bindAll(array(
243243
"list_order" => $order,
244-
"export_type_id" > $export_type_id,
244+
"export_type_id" => $export_type_id,
245245
"export_group_id" => $export_group_id
246246
));
247247
$db->execute();
248+
248249
$order++;
249250
}
250251

code/General.class.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,8 @@ public static function getExportIcons()
4242
* @param array $info
4343
* @return array [0] T/F [1] Error / notification message
4444
*/
45-
public static function updateSettings($info)
45+
public static function updateSettings($info, $L)
4646
{
47-
// $L
48-
49-
$old_settings = ft_get_module_settings();
50-
5147
$settings = array(
5248
"file_upload_dir" => $info["file_upload_dir"],
5349
"file_upload_url" => $info["file_upload_url"]

code/Module.class.php

+43-10
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)