From 191af95a641e560104be099de62ea45ac5cd6315 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 19 Nov 2018 20:46:11 +0000 Subject: [PATCH] Added user config params to export. --- WEB-INF/lib/ttGroupExportHelper.class.php | 36 +++++++++++++++++++++-- WEB-INF/templates/footer.tpl | 2 +- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/WEB-INF/lib/ttGroupExportHelper.class.php b/WEB-INF/lib/ttGroupExportHelper.class.php index cf64cede..c6e1d9a5 100644 --- a/WEB-INF/lib/ttGroupExportHelper.class.php +++ b/WEB-INF/lib/ttGroupExportHelper.class.php @@ -72,7 +72,7 @@ class ttGroupExportHelper { } // getGroupData obtains group attributes for export. - function getGroupData() { + private function getGroupData() { global $user; $mdb2 = getConnection(); @@ -86,7 +86,7 @@ class ttGroupExportHelper { } // The getUsers obtains all users in group for the purpose of export. - function getUsers() { + private function getUsers() { global $user; $mdb2 = getConnection(); @@ -232,6 +232,24 @@ class ttGroupExportHelper { return false; } + // getRecordsFromTable - obtains all fields from a given table for a group. + function getRecordsFromTable($table_name) { + global $user; + $mdb2 = getConnection(); + + $result = array(); + $sql = "select * from $table_name where group_id = $this->group_id and org_id = $user->org_id"; + $res = $mdb2->query($sql); + $result = array(); + if (!is_a($res, 'PEAR_Error')) { + while ($val = $res->fetchRow()) { + $result[] = $val; + } + return $result; + } + return false; + } + // writeData writes group data into file. function writeData() { @@ -626,6 +644,20 @@ class ttGroupExportHelper { unset($notifications); unset($notification_part); + // Write user config parameters. + $user_params = $this->getRecordsFromTable('tt_config'); + fwrite($this->file, $this->indentation." \n"); + foreach ($user_params as $user_param) { + $user_param_part = $this->indentation.' '."userMap[$user_param['user_id']]."\""; + $user_param_part .= " param_name=\"".htmlspecialchars($user_param['param_name'])."\""; + $user_param_part .= " param_value=\"".htmlspecialchars($user_param['param_value'])."\""; + $user_param_part .= ">\n"; + fwrite($this->file, $user_param_part); + } + fwrite($this->file, $this->indentation." \n"); + unset($user_params); + unset($user_param_part); + // We are mostly done with writing this group data, destroy all maps. unset($this->roleMap); unset($this->userMap); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 92095cf0..23cc0edb 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.22.4465 | Copyright © Anuko | +  Anuko Time Tracker 1.18.22.4466 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1