X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=WEB-INF%2Flib%2FttGroupExportHelper.class.php;h=c6e1d9a5d810acd9cc8589a3f3f2433073e78dd7;hb=191af95a641e560104be099de62ea45ac5cd6315;hp=cf64cede780ef01fe6912c058a1a6c239e999ac4;hpb=e8612865ad9644fad85cd0d6fef32ea07c8acdf9;p=timetracker.git 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);