|
10 | 10 |
|
11 | 11 | class General |
12 | 12 | { |
13 | | - /** |
14 | | - * Returns a list of all export icons, found in the /modules/export_manager/images/icons/ folder. |
15 | | - * |
16 | | - * return array an array of image filenames. |
17 | | - */ |
18 | | - public static function getExportIcons() |
19 | | - { |
20 | | - $root_dir = Core::getRootDir(); |
21 | | - $icon_folder = "$root_dir/modules/export_manager/images/icons/"; |
22 | | - |
23 | | - // store all the icon filenames in an array |
24 | | - $filenames = array(); |
25 | | - if ($handle = opendir($icon_folder)) { |
26 | | - while (false !== ($file = readdir($handle))) { |
27 | | - $extension = Files::getFilenameExtension($file, true); |
28 | | - if ($extension == "jpg" || $extension == "gif" || $extension == "bmp" || $extension == "png") { |
29 | | - $filenames[] = $file; |
30 | | - } |
31 | | - } |
32 | | - } |
33 | | - |
34 | | - return $filenames; |
35 | | - } |
36 | | - |
37 | | - |
38 | | - /** |
39 | | - * Called on the Settings page. Updates the generated file folder information. |
40 | | - * |
41 | | - * @param array $info |
42 | | - * @return array [0] T/F [1] Error / notification message |
43 | | - */ |
44 | | - public static function updateSettings($info, $L) |
45 | | - { |
46 | | - $settings = array( |
47 | | - "file_upload_dir" => $info["file_upload_dir"], |
48 | | - "file_upload_url" => $info["file_upload_url"] |
49 | | - ); |
50 | | - |
51 | | - //$settings["cache_multi_select_fields"] = (isset($info["cache_multi_select_fields"]) && !empty($info["cache_multi_select_fields"])) ? |
52 | | - // $info["cache_multi_select_fields"] : "no"; |
53 | | - |
54 | | - Modules::setModuleSettings($settings); |
55 | | - |
56 | | -// $_SESSION["ft"]["export_manager"]["cache_multi_select_fields"] = $settings["cache_multi_select_fields"]; |
57 | | - |
58 | | - return array(true, $L["notify_settings_updated"]); |
59 | | - } |
60 | | - |
61 | | - |
62 | | - /** |
63 | | - * Used in generating the filenames; this builds most of the placeholder values (the date-oriented ones) |
64 | | - * to which the form and export-specific placeholders are added. |
65 | | - * |
66 | | - * @return array the placeholder array |
67 | | - */ |
68 | | - public static function getExportFilenamePlaceholderHash() |
69 | | - { |
70 | | - $offset = CoreGeneral::getCurrentTimezoneOffset(); |
71 | | - $date_str = CoreGeneral::getDate($offset, CoreGeneral::getCurrentDatetime(), "Y|y|F|M|m|n|d|D|j|g|h|H|s|U|a|G|i"); |
72 | | - list($Y, $y, $F, $M, $m, $n, $d, $D, $j, $g, $h, $H, $s, $U, $a, $G, $i) = explode("|", $date_str); |
73 | | - |
74 | | - $placeholders = array( |
75 | | - "datetime" => "$Y-$m-$d.$H-$i-$s", |
76 | | - "date" => "$Y-$m-$d", |
77 | | - "time" => "$H-$i-$s", |
78 | | - "Y" => $Y, |
79 | | - "y" => $y, |
80 | | - "F" => $F, |
81 | | - "M" => $M, |
82 | | - "m" => $m, |
83 | | - "G" => $G, |
84 | | - "i" => $i, |
85 | | - "n" => $n, |
86 | | - "d" => $d, |
87 | | - "D" => $D, |
88 | | - "j" => $j, |
89 | | - "g" => $g, |
90 | | - "h" => $h, |
91 | | - "H" => $H, |
92 | | - "s" => $s, |
93 | | - "U" => $U, |
94 | | - "a" => $a |
95 | | - ); |
96 | | - |
97 | | - return $placeholders; |
98 | | - } |
99 | | - |
100 | | - |
101 | | - public static function removeTables() |
102 | | - { |
103 | | - $db = Core::$db; |
104 | | - |
105 | | - $db->query("DROP TABLE {PREFIX}module_export_groups"); |
106 | | - $db->execute(); |
107 | | - |
108 | | - $db->query("DROP TABLE {PREFIX}module_export_group_clients"); |
109 | | - $db->execute(); |
110 | | - |
111 | | - $db->query("DROP TABLE {PREFIX}module_export_types"); |
112 | | - $db->execute(); |
113 | | - } |
114 | | - |
115 | | - |
116 | | - public static function clearTableData() |
117 | | - { |
118 | | - $db = Core::$db; |
119 | | - |
120 | | - $db->query("TRUNCATE {PREFIX}module_export_group_clients"); |
121 | | - $db->execute(); |
122 | | - |
123 | | - $db->query("TRUNCATE {PREFIX}module_export_groups"); |
124 | | - $db->execute(); |
125 | | - |
126 | | - $db->query("TRUNCATE {PREFIX}module_export_types"); |
127 | | - $db->execute(); |
128 | | - |
129 | | - $db->query("DELETE FROM {PREFIX}settings WHERE module = 'export_manager'"); |
130 | | - $db->execute(); |
131 | | - } |
| 13 | + /** |
| 14 | + * Returns a list of all export icons, found in the /modules/export_manager/images/icons/ folder. |
| 15 | + * |
| 16 | + * return array an array of image filenames. |
| 17 | + */ |
| 18 | + public static function getExportIcons() |
| 19 | + { |
| 20 | + $root_dir = Core::getRootDir(); |
| 21 | + $icon_folder = "$root_dir/modules/export_manager/images/icons/"; |
| 22 | + |
| 23 | + // store all the icon filenames in an array |
| 24 | + $filenames = array(); |
| 25 | + if ($handle = opendir($icon_folder)) { |
| 26 | + while (false !== ($file = readdir($handle))) { |
| 27 | + $extension = Files::getFilenameExtension($file, true); |
| 28 | + if ($extension == "jpg" || $extension == "gif" || $extension == "bmp" || $extension == "png") { |
| 29 | + $filenames[] = $file; |
| 30 | + } |
| 31 | + } |
| 32 | + } |
| 33 | + |
| 34 | + return $filenames; |
| 35 | + } |
| 36 | + |
| 37 | + |
| 38 | + /** |
| 39 | + * Called on the Settings page. Updates the generated file folder information. |
| 40 | + * |
| 41 | + * @param array $info |
| 42 | + * @return array [0] T/F [1] Error / notification message |
| 43 | + */ |
| 44 | + public static function updateSettings($info, $L) |
| 45 | + { |
| 46 | + $settings = array( |
| 47 | + "file_upload_dir" => $info["file_upload_dir"], |
| 48 | + "file_upload_url" => $info["file_upload_url"], |
| 49 | + "export_timeout" => $info["export_timeout"] |
| 50 | + ); |
| 51 | + |
| 52 | + Modules::setModuleSettings($settings); |
| 53 | + return array(true, $L["notify_settings_updated"]); |
| 54 | + } |
| 55 | + |
| 56 | + |
| 57 | + /** |
| 58 | + * Used in generating the filenames; this builds most of the placeholder values (the date-oriented ones) |
| 59 | + * to which the form and export-specific placeholders are added. |
| 60 | + * |
| 61 | + * @return array the placeholder array |
| 62 | + */ |
| 63 | + public static function getExportFilenamePlaceholderHash() |
| 64 | + { |
| 65 | + $offset = CoreGeneral::getCurrentTimezoneOffset(); |
| 66 | + $date_str = CoreGeneral::getDate($offset, CoreGeneral::getCurrentDatetime(), "Y|y|F|M|m|n|d|D|j|g|h|H|s|U|a|G|i"); |
| 67 | + list($Y, $y, $F, $M, $m, $n, $d, $D, $j, $g, $h, $H, $s, $U, $a, $G, $i) = explode("|", $date_str); |
| 68 | + |
| 69 | + $placeholders = array( |
| 70 | + "datetime" => "$Y-$m-$d.$H-$i-$s", |
| 71 | + "date" => "$Y-$m-$d", |
| 72 | + "time" => "$H-$i-$s", |
| 73 | + "Y" => $Y, |
| 74 | + "y" => $y, |
| 75 | + "F" => $F, |
| 76 | + "M" => $M, |
| 77 | + "m" => $m, |
| 78 | + "G" => $G, |
| 79 | + "i" => $i, |
| 80 | + "n" => $n, |
| 81 | + "d" => $d, |
| 82 | + "D" => $D, |
| 83 | + "j" => $j, |
| 84 | + "g" => $g, |
| 85 | + "h" => $h, |
| 86 | + "H" => $H, |
| 87 | + "s" => $s, |
| 88 | + "U" => $U, |
| 89 | + "a" => $a |
| 90 | + ); |
| 91 | + |
| 92 | + return $placeholders; |
| 93 | + } |
| 94 | + |
| 95 | + |
| 96 | + public static function removeTables() |
| 97 | + { |
| 98 | + $db = Core::$db; |
| 99 | + |
| 100 | + $db->query("DROP TABLE {PREFIX}module_export_groups"); |
| 101 | + $db->execute(); |
| 102 | + |
| 103 | + $db->query("DROP TABLE {PREFIX}module_export_group_clients"); |
| 104 | + $db->execute(); |
| 105 | + |
| 106 | + $db->query("DROP TABLE {PREFIX}module_export_types"); |
| 107 | + $db->execute(); |
| 108 | + } |
| 109 | + |
| 110 | + |
| 111 | + public static function clearTableData() |
| 112 | + { |
| 113 | + $db = Core::$db; |
| 114 | + |
| 115 | + $db->query("TRUNCATE {PREFIX}module_export_group_clients"); |
| 116 | + $db->execute(); |
| 117 | + |
| 118 | + $db->query("TRUNCATE {PREFIX}module_export_groups"); |
| 119 | + $db->execute(); |
| 120 | + |
| 121 | + $db->query("TRUNCATE {PREFIX}module_export_types"); |
| 122 | + $db->execute(); |
| 123 | + |
| 124 | + $db->query("DELETE FROM {PREFIX}settings WHERE module = 'export_manager'"); |
| 125 | + $db->execute(); |
| 126 | + } |
132 | 127 | } |
0 commit comments