From 60c61508f8586f489fc8795c93d9bd45e41467c1 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 5 Nov 2018 16:53:55 +0000 Subject: [PATCH] Another small iteration for new export. --- WEB-INF/lib/ttGroupExportHelper.class.php | 31 +++++++++++++++++++---- WEB-INF/templates/footer.tpl | 2 +- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/WEB-INF/lib/ttGroupExportHelper.class.php b/WEB-INF/lib/ttGroupExportHelper.class.php index 59a19be2..364f984d 100644 --- a/WEB-INF/lib/ttGroupExportHelper.class.php +++ b/WEB-INF/lib/ttGroupExportHelper.class.php @@ -49,7 +49,7 @@ class ttGroupExportHelper { // Build a list of subgroups. $mdb2 = getConnection(); $sql = "select id from tt_groups". - " where status = 1 and parent_id = $this->group_id and org_id = $user->org_id order by id desc"; + " where status = 1 and parent_id = $this->group_id and org_id = $user->org_id"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { while ($val = $res->fetchRow()) { @@ -58,14 +58,35 @@ class ttGroupExportHelper { } } + // getGroupData obtains group attributes for export. + function getGroupData() { + global $user; + + $mdb2 = getConnection(); + $sql = "select name, currency, lang from tt_groups". + " where status = 1 and id = $this->group_id and org_id = $user->org_id"; + $res = $mdb2->query($sql); + if (!is_a($res, 'PEAR_Error')) { + $val = $res->fetchRow(); + } + return $val; + } + // writeData writes group data into file. function writeData() { - // TODO: write code here. - // Write group info. Something dummy for now to test... - fwrite($this->file, $this->indentation."\n"); + // Write group info. + $group = $this->getGroupData(); + $group_part = "file, $this->indentation.$group_part); - // Call itself recursively for all subgroups. + // Call self recursively for all subgroups. foreach ($this->subgroups as $subgroup) { $subgroup_helper = new ttGroupExportHelper($subgroup['id'], $this->file, $this->indentation.' '); $subgroup_helper->writeData(); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 5b275168..058c96fe 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.07.4367 | Copyright © Anuko | +  Anuko Time Tracker 1.18.07.4368 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1