group_id = $group_id; $this->file = $file; $this->indentation = $indentation; // 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"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { while ($val = $res->fetchRow()) { $this->subgroups[] = $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"); // Call itself recursively for all subgroups. foreach ($this->subgroups as $subgroup) { $subgroup_helper = new ttGroupExportHelper($subgroup['id'], $this->file, $this->indentation.' '); $subgroup_helper->writeData(); } fwrite($this->file, $this->indentation."\n"); } }