+
+ if ($name == 'PROJECTS') {
+ // If we get here, we have to recycle $currentGroupProjectMap.
+ unset($this->currentGroupProjectMap);
+ $this->currentGroupProjectMap = array();
+ // Project map is reconstructed after processing <project> elements in XML. See below.
+ }
+
+ if ($name == 'PROJECT') {
+ // We get here when processing <project> tags for the current group.
+
+ // Prepare a list of task ids.
+ $tasks = explode(',', $attrs['TASKS']);
+ foreach ($tasks as $id)
+ $mapped_tasks[] = $this->currentGroupTaskMap[$id];
+
+ $project_id = ttProjectHelper::insert(array(
+ 'group_id' => $this->current_group_id,
+ 'org_id' => $this->org_id,
+ 'name' => $attrs['NAME'],
+ 'description' => $attrs['DESCRIPTION'],
+ 'tasks' => $mapped_tasks,
+ 'status' => $attrs['STATUS']));
+ if ($project_id) {
+ // Add a mapping.
+ $this->currentGroupProjectMap[$attrs['ID']] = $project_id;
+ } else $this->errors->add($i18n->get('error.db'));
+ }