private function initTrackerV3ModuleFromTemplate(Group $group, Group $template_group, $ugroup_mapping) { $group_id = $group->getID(); $tracker_mapping = array(); $report_mapping = array(); if (TrackerV3::instance()->available()) { $atf = new ArtifactTypeFactory($template_group); //$tracker_error = ""; // Add all trackers from template project (tracker templates) that need to be instanciated for new trackers. $res = $atf->getTrackerTemplatesForNewProjects(); while ($arr_template = db_fetch_array($res)) { $ath_temp = new ArtifactType($template_group, $arr_template['group_artifact_id']); $report_mapping_for_this_tracker = array(); $new_at_id = $atf->create($group_id, $template_group->getID(), $ath_temp->getID(), db_escape_string($ath_temp->getName()), db_escape_string($ath_temp->getDescription()), $ath_temp->getItemName(), $ugroup_mapping, $report_mapping_for_this_tracker); if (!$new_at_id) { $GLOBALS['Response']->addFeedback('error', $atf->getErrorMessage()); } else { $report_mapping = $report_mapping + $report_mapping_for_this_tracker; $tracker_mapping[$ath_temp->getID()] = $new_at_id; // Copy all the artifacts from the template tracker to the new tracker $ath_new = new ArtifactType($group, $new_at_id); // not now. perhaps one day //if (!$ath_new->copyArtifacts($ath_temp->getID()) ) { //$GLOBALS['Response']->addFeedback('info', $ath_new->getErrorMessage()); //} // Create corresponding reference $ref = new Reference(0, strtolower($ath_temp->getItemName()), $GLOBALS['Language']->getText('project_reference', 'reference_art_desc_key'), '/tracker/?func=detail&aid=$1&group_id=$group_id', 'P', 'tracker', ReferenceManager::REFERENCE_NATURE_ARTIFACT, '1', $group_id); $result = $this->reference_manager->createReference($ref, true); // Force reference creation because default trackers use reserved keywords } } } return array($tracker_mapping, $report_mapping); }
<?php include_once '../config/symbini.php'; include_once $serverRoot . '/classes/ReferenceManager.php'; $refId = array_key_exists('refid', $_REQUEST) ? $_REQUEST['refid'] : 0; $formSubmit = array_key_exists('formsubmit', $_POST) ? $_POST['formsubmit'] : ''; $refManager = new ReferenceManager(); $refArr = ''; $statusStr = ''; if ($formSubmit) { if ($formSubmit == 'Create Reference') { $statusStr = $refManager->createReference($_POST); $refId = $refManager->getRefId(); } elseif ($formSubmit == 'Edit Reference') { if ($_POST['refGroup'] == 1) { $statusStr = $refManager->editBookReference($_POST); } elseif ($_POST['refGroup'] == 2) { $statusStr = $refManager->editPerReference($_POST); } else { $statusStr = $refManager->editReference($_POST); } } } $refGroup = 0; $refRank = 0; $parentChild = 0; if ($refId) { $refArr = $refManager->getRefArr($refId); $childArr = $refManager->getChildArr($refId); $authArr = $refManager->getRefAuthArr($refId); $fieldArr = $refManager->getRefTypeFieldArr($refArr["ReferenceTypeId"]);