X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/cfc33172165a50572d74d808c3c523484f60800f..191af95a641e560104be099de62ea45ac5cd6315:/WEB-INF/lib/ttGroupExportHelper.class.php 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);