X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/56f1fd19f2c9c72878395b3275f03f192ccca082..bf300dab88607ee209b83f16a6915bb9d61787bb:/WEB-INF/lib/ttGroupExportHelper.class.php diff --git a/WEB-INF/lib/ttGroupExportHelper.class.php b/WEB-INF/lib/ttGroupExportHelper.class.php index fecfba8a..1b7e74a7 100644 --- a/WEB-INF/lib/ttGroupExportHelper.class.php +++ b/WEB-INF/lib/ttGroupExportHelper.class.php @@ -40,13 +40,15 @@ class ttGroupExportHelper { // The following arrays are maps between entity ids in the file versus the database. // We write to the file sequentially (1,2,3...) while in the database the entities have different ids. - var $userMap = array(); // User ids. - var $roleMap = array(); // Role ids. - var $taskMap = array(); // Task ids. - var $projectMap = array(); // Project ids. - var $clientMap = array(); // Client ids. - var $invoiceMap = array(); // Invoice ids. - var $logMap = array(); // Time log ids. + var $userMap = array(); + var $roleMap = array(); + var $taskMap = array(); + var $projectMap = array(); + var $clientMap = array(); + var $invoiceMap = array(); + var $logMap = array(); + var $customFieldMap = array(); + var $customFieldOptionMap = array(); // Constructor. function __construct($group_id, $file, $indentation) { @@ -231,6 +233,16 @@ class ttGroupExportHelper { foreach ($invoices as $key=>$invoice_item) $this->invoiceMap[$invoice_item['id']] = $key + 1; + // Prepare custom fields map. + $custom_fields = ttTeamHelper::getAllCustomFields($this->group_id); + foreach ($custom_fields as $key=>$custom_field) + $this->customFieldMap[$custom_field['id']] = $key + 1; + + // Prepare custom field options map. + $custom_field_options = ttTeamHelper::getAllCustomFieldOptions($this->group_id); + foreach ($custom_field_options as $key=>$option) + $this->customFieldOptionMap[$option['id']] = $key + 1; + // Write roles. fwrite($this->file, $this->indentation." \n"); foreach ($roles as $role) { @@ -373,6 +385,20 @@ class ttGroupExportHelper { fwrite($this->file, $this->indentation." \n"); unset($records); + // Write custom fields. + fwrite($this->file, $this->indentation." \n"); + foreach ($custom_fields as $custom_field) { + $custom_field_part = $this->indentation.' '."customFieldMap[$custom_field['id']]."\""; + $custom_field_part .= " type=\"".$custom_field['type']."\""; + $custom_field_part .= " label=\"".htmlentities($custom_field['label'])."\""; + $custom_field_part .= " required=\"".$custom_field['required']."\""; + $custom_field_part .= " status=\"".$custom_field['status']."\""; + $custom_field_part .= ">\n"; + fwrite($this->file, $custom_field_part); + } + fwrite($this->file, $this->indentation." \n"); + unset($custom_fields); + // Call self recursively for all subgroups. foreach ($this->subgroups as $subgroup) { $subgroup_helper = new ttGroupExportHelper($subgroup['id'], $this->file, $this->indentation.' ');