예제 #1
0
 /**
  * createProject
  *
  * Create a new project
  *
  * Insert in group table
  * Insert group_desc_value, trove_group_link
  * Create filemodule in DB
  * Assign an admin user
  * Copy from template:
  * - activate the same services (using the ame server id and options)
  * - send message to the project requested (pepend on template values)
  * - create forums with the same name and public status
  * - copy CVS properties
  * - copy SVN settings and start .SVNAccessFile hisr=tiry
  * - add system references withut services
  * - copy ugroups and save mapping for further import
  * - copy FRS packages with permissions
  * - copy trackers
  * - copy wiki
  * - copy layout summary page
  * - Add the template as a project reference
  * - Copy Truncated email option
  * - Raise an event for plugin configuration
  *
  * @param  data ProjectCreationData
  */
 protected function createProject(ProjectCreationData $data)
 {
     $admin_user = UserManager::instance()->getCurrentUser();
     $group_id = $this->createGroupEntry($data);
     if ($group_id === false) {
         return;
     }
     $this->setCategories($data, $group_id);
     $this->initFileModule($group_id);
     $this->setProjectAdmin($group_id, $admin_user);
     // Instanciate all services from the project template that are 'active'
     $group = $this->projectManager->getProject($group_id);
     if (!$group || !is_object($group)) {
         exit_no_group();
     }
     $this->fakeGroupIdIntoHTTPParams($group_id);
     $template_id = $group->getTemplate();
     $template_group = $this->projectManager->getProject($template_id);
     if (!$template_group || !is_object($template_group) || $template_group->isError()) {
         exit_no_group();
     }
     $this->activateServicesFromTemplate($group_id, $template_group, $data);
     $this->setMessageToRequesterFromTemplate($group_id, $template_id);
     $this->initForumModuleFromTemplate($group_id, $template_id);
     $this->initCVSModuleFromTemplate($group_id, $template_id);
     $this->initSVNModuleFromTemplate($group_id, $template_id);
     // Activate other system references not associated with any service
     $this->reference_manager->addSystemReferencesWithoutService($template_id, $group_id);
     //Copy ugroups
     $ugroup_mapping = array();
     ugroup_copy_ugroups($template_id, $group_id, $ugroup_mapping);
     $this->initFRSModuleFromTemplate($group_id, $template_id, $ugroup_mapping);
     list($tracker_mapping, $report_mapping) = $this->initTrackerV3ModuleFromTemplate($group, $template_group, $ugroup_mapping);
     $this->initWikiModuleFromTemplate($group_id, $template_id);
     $this->initLayoutFromTemplate($group_id, $template_id);
     //Create project specific references if template is not default site template
     if (!$template_group->isSystem()) {
         $this->reference_manager->addProjectReferences($template_id, $group_id);
     }
     $this->copyEmailOptionsFromTemplate($group_id, $template_id);
     // Raise an event for plugin configuration
     $em = EventManager::instance();
     $em->processEvent('register_project_creation', array('reportMapping' => $report_mapping, 'trackerMapping' => $tracker_mapping, 'ugroupsMapping' => $ugroup_mapping, 'group_id' => $group_id, 'template_id' => $template_id));
     $this->autoActivateProject($group);
     return $group_id;
 }