Started work on ttGroupExportHelper class for exporting single groups.
[timetracker.git] / WEB-INF / lib / ttGroupExportHelper.class.php
1 <?php
2 // +----------------------------------------------------------------------+
3 // | Anuko Time Tracker
4 // +----------------------------------------------------------------------+
5 // | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
6 // +----------------------------------------------------------------------+
7 // | LIBERAL FREEWARE LICENSE: This source code document may be used
8 // | by anyone for any purpose, and freely redistributed alone or in
9 // | combination with other software, provided that the license is obeyed.
10 // |
11 // | There are only two ways to violate the license:
12 // |
13 // | 1. To redistribute this code in source form, with the copyright
14 // |    notice or license removed or altered. (Distributing in compiled
15 // |    forms without embedded copyright notices is permitted).
16 // |
17 // | 2. To redistribute modified versions of this code in *any* form
18 // |    that bears insufficient indications that the modifications are
19 // |    not the work of the original author(s).
20 // |
21 // | This license applies to this document only, not any other software
22 // | that it may be combined with.
23 // |
24 // +----------------------------------------------------------------------+
25 // | Contributors:
26 // | https://www.anuko.com/time_tracker/credits.htm
27 // +----------------------------------------------------------------------+
28
29 // ttGroupExportHelper - this class is used to write data for a single group
30 // to a file. When group contains other groups, it reuses itself recursively.
31 //
32 // Currently, it is work in progress.
33 // When done, it should handle export of organizations containing multiple groups.
34 class ttGroupExportHelper {
35
36   var $group_id = null;    // Group we are exporting.
37   var $file     = null;    // File to write to.
38   var $indentation = null; // A string consisting of a number of spaces.
39
40   // Constructor.
41   function __construct($group_id, $file, $indentation) {
42
43     $this->group_id = $group_id;
44     $this->file = $file;
45     $this->indentation = $indentation;
46
47     // TODO: Build a list of subgroups here.
48   }
49
50   // writeData writes group data into file.
51   function writeData() {
52     // TODO: write code here.
53     //
54     // Call itself recursively for all subgroups.
55   }
56 }