Skip to content

Commit 42eaed1

Browse files
committed
starting on FT3 support
1 parent a82c55d commit 42eaed1

13 files changed

+968
-639
lines changed

code/ExportGroups.class.php

+41-24
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,21 @@
66
use FormTools\Core;
77
use PDO;
88

9+
910
class ExportGroups
1011
{
1112
/**
1213
* Returns all information about an export type group.
1314
*
1415
* @param integer $export_group_id
1516
*/
16-
public function getExportGroup($export_group_id)
17+
public static function getExportGroup($export_group_id)
1718
{
1819
$db = Core::$db;
1920

2021
$db->query("
2122
SELECT *
22-
FROM {PREFUX}module_export_groups
23+
FROM {PREFIX}module_export_groups
2324
WHERE export_group_id = :export_group_id
2425
");
2526
$db->bind("export_group_id", $export_group_id);
@@ -61,7 +62,7 @@ public static function getExportGroups()
6162

6263
$infohash = array();
6364
foreach ($results as $field) {
64-
$field["num_export_types"] = ExportGroups::getNumExportTypes($field["export_group_id"]);
65+
$field["num_export_types"] = ExportTypes::getNumExportTypes($field["export_group_id"]);
6566
$infohash[] = $field;
6667
}
6768

@@ -74,34 +75,51 @@ public static function getExportGroups()
7475
*
7576
* @param array $info
7677
*/
77-
public function addExportGroup($info)
78+
public static function addExportGroup($info, $L)
7879
{
7980
$db = Core::$db;
80-
// $L;
81+
82+
$info = array_merge(array(
83+
"access_type" => "public",
84+
"form_view_mapping" => "all",
85+
"forms_and_views" => null,
86+
"visibility" => "show",
87+
"popup_height" => null,
88+
"popup_width" => null,
89+
"action" => "new_window",
90+
"headers" => ""
91+
), $info);
8192

8293
// get the next highest order count
8394
$db->query("SELECT count(*) FROM {PREFIX}module_export_groups");
8495
$db->execute();
8596
$order = $db->fetch(PDO::FETCH_COLUMN) + 1;
8697

8798
// define the default options
88-
8999
$db->query("
90-
INSERT INTO {PREFIX}module_export_groups (group_name, access_type, visibility, icon, action, action_button_text, list_order)
91-
VALUES (:group_name, :access_type, :visibility, :icon, :action, :action_button_text, :order)
100+
INSERT INTO {PREFIX}module_export_groups (group_name, access_type, form_view_mapping, forms_and_views,
101+
visibility, icon, action, action_button_text, popup_height, popup_width, headers, smarty_template, list_order)
102+
VALUES (:group_name, :access_type, :form_view_mapping, :forms_and_views, :visibility,
103+
:icon, :action, :action_button_text, :popup_height, :popup_width, :headers, :smarty_template, :list_order)
92104
");
93105
$db->bindAll(array(
94106
"group_name" => $info["group_name"],
95-
"access_type" => "admin",
107+
"access_type" => $info["access_type"],
108+
"form_view_mapping" => $info["form_view_mapping"],
109+
"forms_and_views" => $info["forms_and_views"],
96110
"visibility" => $info["visibility"],
97111
"icon" => $info["icon"],
98-
"action" => "new_window",
99-
"action_button_text" => "{\$LANG.word_display}",
100-
"order" => $order
112+
"action" => $info["action"],
113+
"action_button_text" => $info["action_button_text"],
114+
"popup_height" => $info["popup_height"],
115+
"popup_width" => $info["popup_width"],
116+
"headers" => $info["headers"],
117+
"smarty_template" => $info["smarty_template"],
118+
"list_order" => $order
101119
));
102120
$db->execute();
103121

104-
return array(true, $L["notify_export_group_added"]);
122+
return array(true, $L["notify_export_group_added"], $db->getInsertId());
105123
}
106124

107125

@@ -111,7 +129,7 @@ public function addExportGroup($info)
111129
* @param array $info
112130
* @return array
113131
*/
114-
public function updateExportGroup($info)
132+
public static function updateExportGroup($info)
115133
{
116134
$db = Core::$db;
117135

@@ -146,7 +164,7 @@ public function updateExportGroup($info)
146164
}
147165

148166

149-
public function exp_update_export_group_permissions($info)
167+
public static function updateExportGroupPermissions($info)
150168
{
151169
$db = Core::$db;
152170

@@ -205,9 +223,9 @@ public function exp_update_export_group_permissions($info)
205223
*
206224
* @param integer $export_group_id
207225
*/
208-
public function deleteExportGroup($export_group_id)
226+
public static function deleteExportGroup($export_group_id, $L)
209227
{
210-
// $L
228+
$db = Core::$db;
211229

212230
$db->query("DELETE FROM {PREFIX}module_export_groups WHERE export_group_id = :export_group_id");
213231
$db->bind("export_group_id", $export_group_id);
@@ -232,7 +250,7 @@ public function deleteExportGroup($export_group_id)
232250
* This can be called after deleting an export group, or whenever is needed to ensure that the
233251
* order of the export groups are consistent, accurate & don't have any gaps.
234252
*/
235-
public function checkExportGroupOrder()
253+
public static function checkExportGroupOrder()
236254
{
237255
$db = Core::$db;
238256

@@ -255,6 +273,7 @@ public function checkExportGroupOrder()
255273
"list_order" => $order,
256274
"export_group_id" => $export_group_id
257275
));
276+
$db->execute();
258277
$order++;
259278
}
260279
}
@@ -266,20 +285,18 @@ public function checkExportGroupOrder()
266285
*
267286
* @param array $info
268287
*/
269-
public function reorderExportGroups($info)
288+
public static function reorderExportGroups($info, $L)
270289
{
271290
$db = Core::$db;
272291

273-
// $L
274-
275292
$sortable_id = $info["sortable_id"];
276293
$export_group_ids = explode(",", $info["{$sortable_id}_sortable__rows"]);
277294

278295
$order = 1;
279296
foreach ($export_group_ids as $export_group_id) {
280297
$db->query("
281298
UPDATE {PREFIX}module_export_groups
282-
SET list_order = :order
299+
SET list_order = :list_order
283300
WHERE export_group_id = :export_group_id
284301
");
285302
$db->bindAll(array(
@@ -302,7 +319,7 @@ public function reorderExportGroups($info)
302319
* @return array prev_id => the previous export group ID (or empty string)
303320
* next_id => the next export group ID (or empty string)
304321
*/
305-
public function getExportGroupPrevNextLinks($export_group_id)
322+
public static function getExportGroupPrevNextLinks($export_group_id)
306323
{
307324
$db = Core::$db;
308325

@@ -333,7 +350,7 @@ public function getExportGroupPrevNextLinks($export_group_id)
333350
}
334351

335352

336-
public function deserializedExportGroupMapping($str)
353+
public static function deserializedExportGroupMapping($str)
337354
{
338355
$form_ids = array();
339356
$view_ids = array();

0 commit comments

Comments
 (0)