当前位置: 首页>>代码示例>>PHP>>正文


PHP ProjectTasks::copySubTasks方法代码示例

本文整理汇总了PHP中ProjectTasks::copySubTasks方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectTasks::copySubTasks方法的具体用法?PHP ProjectTasks::copySubTasks怎么用?PHP ProjectTasks::copySubTasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectTasks的用法示例。


在下文中一共展示了ProjectTasks::copySubTasks方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addObject

 /**
  * 
  * @author Ignacio Vazquez - elpepe.uy@gmail.com
  * @param ProjectTask $object
  */
 function addObject($object)
 {
     if ($this->hasObject($object)) {
         return;
     }
     if (!$object->isTemplate() && $object->canBeTemplate()) {
         // the object isn't a template but can be, create a template copy
         $copy = $object->copy();
         $copy->setColumnValue('is_template', true);
         if ($copy instanceof ProjectTask) {
             // don't copy milestone and parent task
             $copy->setMilestoneId(0);
             $copy->setParentId(0);
         }
         $copy->save();
         //Also copy members..
         // 			$memberIds = json_decode(array_var($_POST, 'members'));
         // 			$controller  = new ObjectController() ;
         // 			$controller->add_to_members($copy, $memberIds);
         // copy subtasks
         if ($copy instanceof ProjectTask) {
             ProjectTasks::copySubTasks($object, $copy, true);
         } else {
             if ($copy instanceof ProjectMilestone) {
                 ProjectMilestones::copyTasks($object, $copy, true);
             }
         }
         // copy custom properties
         $copy->copyCustomPropertiesFrom($object);
         // copy linked objects
         $linked_objects = $object->getAllLinkedObjects();
         if (is_array($linked_objects)) {
             foreach ($linked_objects as $lo) {
                 $copy->linkObject($lo);
             }
         }
         // copy reminders
         $reminders = ObjectReminders::getByObject($object);
         foreach ($reminders as $reminder) {
             $copy_reminder = new ObjectReminder();
             $copy_reminder->setContext($reminder->getContext());
             $copy_reminder->setDate(EMPTY_DATETIME);
             $copy_reminder->setMinutesBefore($reminder->getMinutesBefore());
             $copy_reminder->setObject($copy);
             $copy_reminder->setType($reminder->getType());
             // $copy_reminder->setContactId($reminder->getContactId()); //TODO Feng 2 -  No  anda
             $copy_reminder->save();
         }
         $template = $copy;
     } else {
         // the object is already a template or can't be one, use it as it is
         $template = $object;
     }
     $to = new TemplateObject();
     $to->setObject($template);
     $to->setTemplate($this);
     $to->save();
     return $template->getObjectId();
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:64,代码来源:COTemplate.class.php

示例2: copyTasks

 /**
  * Copies tasks from milestoneFrom to milestoneTo.
  *
  * @param ProjectMilestone $milestoneFrom
  * @param ProjectMilestone $milestoneTo
  */
 function copyTasks(ProjectMilestone $milestoneFrom, ProjectMilestone $milestoneTo, $as_template = false)
 {
     //FIXME
     foreach ($milestoneFrom->getTasks($as_template) as $sub) {
         if ($sub->getParentId() != 0) {
             continue;
         }
         $new = ProjectTasks::createTaskCopy($sub);
         $new->setMilestoneId($milestoneTo->getId());
         $new->save();
         $object_controller = new ObjectController();
         $members = $milestoneFrom->getMemberIds();
         if (count($members)) {
             $object_controller->add_to_members($new, $members);
         }
         /*
         			foreach ($sub->getWorkspaces() as $workspace) {
         				if (ProjectTask::canAdd(logged_user(), $workspace)) {
         					$new->addToWorkspace($workspace);
         				}
         			}
         
         			if (!$as_template && active_project() instanceof Project && ProjectTask::canAdd(logged_user(), active_project())) {
         				$new->removeFromAllWorkspaces();
         				$new->addToWorkspace(active_project());
         			}
         */
         $new->copyCustomPropertiesFrom($sub);
         $new->copyLinkedObjectsFrom($sub);
         ProjectTasks::copySubTasks($sub, $new, $as_template);
     }
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:38,代码来源:ProjectMilestones.class.php

示例3: add_task


//.........这里部分代码省略.........
                 if ($parent->getIsTemplate()) {
                     $task->setIsTemplate(true);
                 }
             }
             if ($task->getParentId() > 0 && $task->hasChild($task->getParentId())) {
                 flash_error(lang('task child of child error'));
                 ajx_current("empty");
                 return;
             }
             DB::beginWork();
             $task->save();
             // dependencies
             if (config_option('use tasks dependencies')) {
                 $previous_tasks = array_var($task_data, 'previous');
                 if (is_array($previous_tasks)) {
                     foreach ($previous_tasks as $ptask) {
                         if ($ptask == $task->getId()) {
                             continue;
                         }
                         $dep = ProjectTaskDependencies::findById(array('previous_task_id' => $ptask, 'task_id' => $task->getId()));
                         if (!$dep instanceof ProjectTaskDependency) {
                             $dep = new ProjectTaskDependency();
                             $dep->setPreviousTaskId($ptask);
                             $dep->setTaskId($task->getId());
                             $dep->save();
                         }
                     }
                 }
             }
             if (array_var($_GET, 'copyId', 0) > 0) {
                 // copy remaining stuff from the task with id copyId
                 $toCopy = ProjectTasks::findById(array_var($_GET, 'copyId'));
                 if ($toCopy instanceof ProjectTask) {
                     ProjectTasks::copySubTasks($toCopy, $task, array_var($task_data, 'is_template', false));
                 }
             }
             // if task is added from task view -> add subscribers
             if (array_var($task_data, 'inputtype') == 'taskview') {
                 if (!isset($_POST['subscribers'])) {
                     $_POST['subscribers'] = array();
                 }
                 $_POST['subscribers']['user_' . logged_user()->getId()] = 'checked';
                 if ($task->getAssignedToContactId() > 0 && Contacts::instance()->findById($task->getAssignedToContactId())->getUserType()) {
                     $_POST['subscribers']['user_' . $task->getAssignedToContactId()] = 'checked';
                 }
             }
             // Add assigned user to the subscibers list
             if (isset($_POST['subscribers']) && $task->getAssignedToContactId() > 0 && Contacts::instance()->findById($task->getAssignedToContactId())) {
                 $_POST['subscribers']['user_' . $task->getAssignedToContactId()] = 'checked';
             }
             //Link objects
             $object_controller = new ObjectController();
             $object_controller->add_to_members($task, $member_ids);
             $object_controller->add_subscribers($task);
             $object_controller->link_to_new_object($task);
             $object_controller->add_custom_properties($task);
             $object_controller->add_reminders($task);
             ApplicationLogs::createLog($task, ApplicationLogs::ACTION_ADD);
             if (config_option('repeating_task') == 1) {
                 $opt_rep_day['saturday'] = false;
                 $opt_rep_day['sunday'] = false;
                 if (array_var($task_data, 'repeat_saturdays', false)) {
                     $opt_rep_day['saturday'] = true;
                 }
                 if (array_var($task_data, 'repeat_sundays', false)) {
                     $opt_rep_day['sunday'] = true;
开发者ID:rorteg,项目名称:fengoffice,代码行数:67,代码来源:TaskController.class.php

示例4: copySubTasks

	/**
	 * Copies subtasks from taskFrom to taskTo.
	 *
	 * @param ProjectTask $taskFrom
	 * @param ProjectTask $taskTo
	 */
	function copySubTasks(ProjectTask $taskFrom, ProjectTask $taskTo, $as_template = false) {
		foreach ( $taskFrom->getSubTasks () as $sub ) {
			if ($sub->getId() == $taskTo->getId()) continue;
			$new = ProjectTasks::createTaskCopy ( $sub );
			$new->setIsTemplate ( $as_template );
			$new->setParentId ( $taskTo->getId () );
			$new->setMilestoneId ( $taskTo->getMilestoneId () );
			$new->setOrder ( ProjectTasks::maxOrder ( $new->getParentId (), $new->getMilestoneId () ) );
			if ($sub->getIsTemplate ()) {
				$new->setFromTemplateId ( $sub->getId () );
			}
			$new->save ();
			
			$object_controller = new ObjectController();
			if (count($taskFrom->getMemberIds())) {
				$object_controller->add_to_members($new, $taskFrom->getMemberIds());
			}
			$new->copyCustomPropertiesFrom ( $sub );
			$new->copyLinkedObjectsFrom ( $sub );
			ProjectTasks::copySubTasks ( $sub, $new, $as_template );
		}
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:28,代码来源:ProjectTasks.class.php

示例5: instantiate

 function instantiate()
 {
     $selected_members = array();
     $id = get_id();
     $template = COTemplates::findById($id);
     if (!$template instanceof COTemplate) {
         flash_error(lang("template dnx"));
         ajx_current("empty");
         return;
     }
     $parameters = TemplateParameters::getParametersByTemplate($id);
     $parameterValues = array_var($_POST, 'parameterValues');
     if (count($parameters) > 0 && !isset($parameterValues)) {
         ajx_current("back");
         return;
     }
     if (array_var($_POST, 'members')) {
         $selected_members = json_decode(array_var($_POST, 'members'));
     } else {
         $context = active_context();
         foreach ($context as $selection) {
             if ($selection instanceof Member) {
                 $selected_members[] = $selection->getId();
             }
         }
     }
     $objects = $template->getObjects();
     $controller = new ObjectController();
     if (count($selected_members > 0)) {
         $selected_members_instances = Members::findAll(array('conditions' => 'id IN (' . implode($selected_members) . ')'));
     } else {
         $selected_members_instances = array();
     }
     DB::beginWork();
     $active_context = active_context();
     foreach ($objects as $object) {
         if (!$object instanceof ContentDataObject) {
             continue;
         }
         // copy object
         $copy = $object->copy();
         if ($copy->columnExists('is_template')) {
             $copy->setColumnValue('is_template', false);
         }
         if ($copy instanceof ProjectTask) {
             // don't copy parent task and milestone
             $copy->setMilestoneId(0);
             $copy->setParentId(0);
         }
         $copy->save();
         /*		if (!can_write(logged_user(), $selected_members_instances, $copy->getObjectTypeId()) ) {
         				flash_error(lang('no context permissions to add', $copy instanceof ProjectTask ? lang("tasks") : ($copy instanceof ProjectMilestone ? lang('milestones') : '')));
         				DB::rollback();
         				ajx_current("empty");
         				return;
         			}*/
         // Copy members from origial object, if it doesn't have then use active context members
         /*	$template_object_members = $object->getMemberIds();
         			if (count($template_object_members) == 0) {
         				$object_member_ids = active_context_members(false);
         				if (count($object_member_ids) > 0) {
         					$template_object_members = Members::findAll(array("id" => true, "conditions" => "id IN (".implode(",", $object_member_ids).")"));
         				}
         			}*/
         /* Set instantiated object members:
          * foreach dimension:
          * 		if no member is active then the instantiated object is put in the same members as the original for current dimension
          * 		if a member is selected in current dimension then the instantiated object will be put in that member  
          */
         $template_object_members = $object->getMembers();
         $object_members = array();
         foreach ($active_context as $selection) {
             if ($selection instanceof Member) {
                 // member selected
                 $object_members[] = $selection->getId();
             } else {
                 if ($selection instanceof Dimension) {
                     // no member selected
                     foreach ($template_object_members as $tom) {
                         if ($tom->getDimensionId() == $selection->getId()) {
                             $object_members[] = $tom->getId();
                         }
                     }
                 }
             }
         }
         $controller->add_to_members($copy, $object_members);
         // copy linked objects
         $copy->copyLinkedObjectsFrom($object);
         // copy subtasks if applicable
         if ($copy instanceof ProjectTask) {
             ProjectTasks::copySubTasks($object, $copy, false);
             foreach ($copy->getOpenSubTasks(false) as $m_task) {
                 $controller->add_to_members($m_task, $object_members);
             }
             $manager = $copy->manager();
         } else {
             if ($copy instanceof ProjectMilestone) {
                 ProjectMilestones::copyTasks($object, $copy, false);
                 foreach ($copy->getTasks(false) as $m_task) {
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:TemplateController.class.php

示例6: add_task


//.........这里部分代码省略.........
             $task->setIsPrivate(false);
             // Not used, but defined as not null.
             // Set assigned to
             $assigned_to = explode(':', array_var($task_data, 'assigned_to', ''));
             $company_id = array_var($assigned_to, 0, 0);
             $user_id = array_var($assigned_to, 1, 0);
             $can_assign = can_assign_task_to_company_user(logged_user(), $task, $company_id, $user_id);
             if ($can_assign !== true) {
                 flash_error($can_assign);
                 ajx_current("empty");
                 return;
             }
             $task->setAssignedToCompanyId($company_id);
             $task->setAssignedToUserId($user_id);
             $id = array_var($_GET, 'id', 0);
             $parent = ProjectTasks::findById($id);
             if ($parent instanceof ProjectTask) {
                 $task->setParentId($id);
                 if ($parent->getIsTemplate()) {
                     $task->setIsTemplate(true);
                 }
             }
             if ($task->getParentId() > 0 && $task->hasChild($task->getParentId())) {
                 flash_error(lang('task child of child error'));
                 ajx_current("empty");
                 return;
             }
             //Add handins
             $handins = array();
             for ($i = 0; $i < 4; $i++) {
                 if (isset($task_data["handin{$i}"]) && is_array($task_data["handin{$i}"]) && trim(array_var($task_data["handin{$i}"], 'title')) != '') {
                     $assigned_to = explode(':', array_var($task_data["handin{$i}"], 'assigned_to', ''));
                     $handins[] = array('title' => array_var($task_data["handin{$i}"], 'title'), 'responsible_company_id' => array_var($assigned_to, 0, 0), 'responsible_user_id' => array_var($assigned_to, 1, 0));
                     // array
                 }
                 // if
             }
             // for
             DB::beginWork();
             $task->save();
             //$task->setProject($project);
             //echo 'pepe'; DB::rollback(); die();
             $task->setTagsFromCSV(array_var($task_data, 'tags'));
             foreach ($handins as $handin_data) {
                 $handin = new ObjectHandin();
                 $handin->setFromAttributes($handin_data);
                 $handin->setObjectId($task->getId());
                 $handin->setObjectManager(get_class($task->manager()));
                 $handin->save();
             }
             // foreach*/
             if (array_var($_GET, 'copyId', 0) > 0) {
                 // copy remaining stuff from the task with id copyId
                 $toCopy = ProjectTasks::findById(array_var($_GET, 'copyId'));
                 if ($toCopy instanceof ProjectTask) {
                     ProjectTasks::copySubTasks($toCopy, $task, array_var($task_data, 'is_template', false));
                 }
             }
             //Link objects
             $object_controller = new ObjectController();
             if ($parent instanceof ProjectTask) {
                 // task is being added as subtask of another, so place in same workspace
                 $task->addToWorkspace($parent->getProject());
             } else {
                 $object_controller->add_to_workspaces($task);
             }
             $object_controller->link_to_new_object($task);
             $object_controller->add_subscribers($task);
             $object_controller->add_custom_properties($task);
             $object_controller->add_reminders($task);
             ApplicationLogs::createLog($task, $task->getWorkspaces(), ApplicationLogs::ACTION_ADD);
             DB::commit();
             // notify asignee
             if (array_var($task_data, 'send_notification') == 'checked') {
                 try {
                     Notifier::taskAssigned($task);
                 } catch (Exception $e) {
                     evt_add("debug", $e->getMessage());
                 }
                 // try
             }
             if ($task->getIsTemplate()) {
                 flash_success(lang('success add template', $task->getTitle()));
             } else {
                 flash_success(lang('success add task list', $task->getTitle()));
             }
             if (array_var($task_data, 'inputtype') != 'taskview') {
                 ajx_current("back");
             } else {
                 ajx_current("reload");
             }
         } catch (Exception $e) {
             DB::rollback();
             flash_error($e->getMessage());
             ajx_current("empty");
         }
         // try
     }
     // if
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:TaskController.class.php

示例7: add_task


//.........这里部分代码省略.........
             }
             if ($task->getParentId() > 0 && $task->hasChild($task->getParentId())) {
                 flash_error(lang('task child of child error'));
                 ajx_current("empty");
                 return;
             }
             if ($task instanceof TemplateTask) {
                 $task->setSessionId(logged_user()->getId());
             }
             DB::beginWork();
             $task->save();
             // dependencies
             if (config_option('use tasks dependencies')) {
                 $previous_tasks = array_var($task_data, 'previous');
                 if (is_array($previous_tasks)) {
                     foreach ($previous_tasks as $ptask) {
                         if ($ptask == $task->getId()) {
                             continue;
                         }
                         $dep = ProjectTaskDependencies::findById(array('previous_task_id' => $ptask, 'task_id' => $task->getId()));
                         if (!$dep instanceof ProjectTaskDependency) {
                             $dep = new ProjectTaskDependency();
                             $dep->setPreviousTaskId($ptask);
                             $dep->setTaskId($task->getId());
                             $dep->save();
                         }
                     }
                 }
             }
             if (array_var($_GET, 'copyId', 0) > 0) {
                 // copy remaining stuff from the task with id copyId
                 $toCopy = ProjectTasks::findById(array_var($_GET, 'copyId'));
                 if ($toCopy instanceof ProjectTask) {
                     ProjectTasks::copySubTasks($toCopy, $task, array_var($task_data, 'is_template', false));
                 }
             }
             // if task is added from task view -> add subscribers
             if (array_var($task_data, 'inputtype') == 'taskview') {
                 if (!isset($_POST['subscribers'])) {
                     $_POST['subscribers'] = array();
                 }
                 $_POST['subscribers']['user_' . logged_user()->getId()] = '1';
                 if ($task->getAssignedToContactId() > 0 && Contacts::instance()->findById($task->getAssignedToContactId())->getUserType()) {
                     $_POST['subscribers']['user_' . $task->getAssignedToContactId()] = '1';
                 }
             }
             // Add assigned user to the subscibers list
             if (isset($_POST['subscribers']) && $task->getAssignedToContactId() > 0 && Contacts::instance()->findById($task->getAssignedToContactId())) {
                 $_POST['subscribers']['user_' . $task->getAssignedToContactId()] = '1';
             }
             //Link objects
             $object_controller = new ObjectController();
             if ($task instanceof TemplateTask) {
                 //if(!empty($member_ids)){
                 $object_controller->add_to_members($task, $member_ids, null, false);
                 //}
             } else {
                 $object_controller->add_to_members($task, $member_ids);
             }
             $is_template = $task instanceof TemplateTask;
             $object_controller->add_subscribers($task, null, !$is_template);
             $object_controller->link_to_new_object($task);
             $object_controller->add_custom_properties($task);
             $object_controller->add_reminders($task);
             if (config_option('repeating_task') == 1) {
                 $opt_rep_day['saturday'] = false;
开发者ID:abhinay100,项目名称:feng_app,代码行数:67,代码来源:TaskController.class.php

示例8: instantiate

 function instantiate()
 {
     $id = get_id();
     $template = COTemplates::findById($id);
     if (!$template instanceof COTemplate) {
         flash_error(lang("template dnx"));
         ajx_current("empty");
         return;
     }
     $parameters = TemplateParameters::getParametersByTemplate($id);
     $parameterValues = array_var($_POST, 'parameterValues');
     if (count($parameters) > 0 && !isset($parameterValues)) {
         ajx_current("back");
         return;
     }
     $objects = $template->getObjects();
     foreach ($objects as $object) {
         if (!$object instanceof ProjectDataObject) {
             continue;
         }
         // copy object
         $copy = $object->copy();
         if ($copy->columnExists('is_template')) {
             $copy->setColumnValue('is_template', false);
         }
         if ($copy instanceof ProjectTask) {
             // don't copy parent task and milestone
             $copy->setMilestoneId(0);
             $copy->setParentId(0);
         }
         $copy->save();
         $wsId = array_var($_POST, 'project_id', active_or_personal_project()->getId());
         // if specified, set workspace
         $workspace = Projects::findById($wsId);
         if (!$workspace instanceof Project) {
             $workspace = active_or_personal_project();
         }
         $copy->addToWorkspace($workspace);
         // add object tags and specified tags
         $tags = implode(',', $object->getTagNames());
         $copy->setTagsFromCSV($tags . "," . array_var($_POST, 'tags'));
         // copy linked objects
         $copy->copyLinkedObjectsFrom($object);
         // copy subtasks if applicable
         if ($copy instanceof ProjectTask) {
             ProjectTasks::copySubTasks($object, $copy, false);
             $manager = new ProjectTask();
         } else {
             if ($copy instanceof ProjectMilestone) {
                 ProjectMilestones::copyTasks($object, $copy, false);
                 $manager = new ProjectMilestone();
             }
         }
         // copy custom properties
         $copy->copyCustomPropertiesFrom($object);
         // set property values as defined in template
         $objProp = TemplateObjectProperties::getPropertiesByTemplateObject($id, $object->getId());
         foreach ($objProp as $property) {
             $propName = $property->getProperty();
             $value = $property->getValue();
             if ($manager->getColumnType($propName) == DATA_TYPE_STRING) {
                 if (is_array($parameterValues)) {
                     foreach ($parameterValues as $param => $val) {
                         $value = str_replace('{' . $param . '}', $val, $value);
                     }
                 }
             } else {
                 if ($manager->getColumnType($propName) == DATA_TYPE_DATE || $manager->getColumnType($propName) == DATA_TYPE_DATETIME) {
                     $operator = '+';
                     if (strpos($value, '+') === false) {
                         $operator = '-';
                     }
                     $opPos = strpos($value, $operator);
                     if ($opPos !== false) {
                         $dateParam = substr($value, 1, strpos($value, '}') - 1);
                         $dateUnit = substr($value, strlen($value) - 1);
                         // d, w or m (for days, weeks or months)
                         if ($dateUnit == 'm') {
                             $dateUnit = 'M';
                             // make month unit uppercase to call DateTimeValue::add with correct parameter
                         }
                         $dateNum = (int) substr($value, strpos($value, $operator), strlen($value) - 2);
                         $date = $parameterValues[$dateParam];
                         $date = DateTimeValueLib::dateFromFormatAndString(user_config_option('date_format'), $date);
                         $value = $date->add($dateUnit, $dateNum);
                     }
                 } else {
                     if ($manager->getColumnType($propName) == DATA_TYPE_INTEGER) {
                         if (is_array($parameterValues)) {
                             foreach ($parameterValues as $param => $val) {
                                 $value = str_replace('{' . $param . '}', $val, $value);
                             }
                         }
                     }
                 }
             }
             if ($value != '') {
                 $copy->setColumnValue($propName, $value);
                 $copy->save();
             }
//.........这里部分代码省略.........
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:TemplateController.class.php

示例9: copyTasks

 /**
  * Copies tasks from milestoneFrom to milestoneTo.
  *
  * @param ProjectMilestone $milestoneFrom
  * @param ProjectMilestone $milestoneTo
  */
 function copyTasks(ProjectMilestone $milestoneFrom, ProjectMilestone $milestoneTo, $as_template = false)
 {
     foreach ($milestoneFrom->getTasks() as $sub) {
         if ($sub->getParentId() != 0) {
             continue;
         }
         $new = ProjectTasks::createTaskCopy($sub);
         $new->setIsTemplate($as_template);
         $new->setMilestoneId($milestoneTo->getId());
         if ($sub->getIsTemplate()) {
             $new->setFromTemplateId($sub->getId());
         }
         $new->save();
         foreach ($sub->getWorkspaces() as $workspace) {
             if (ProjectTask::canAdd(logged_user(), $workspace)) {
                 $new->addToWorkspace($workspace);
             }
         }
         if (!$as_template && active_project() instanceof Project && ProjectTask::canAdd(logged_user(), active_project())) {
             $new->removeFromAllWorkspaces();
             $new->addToWorkspace(active_project());
         }
         $new->copyCustomPropertiesFrom($sub);
         $new->copyLinkedObjectsFrom($sub);
         $new->setTagsFromCSV(implode(",", $sub->getTagNames()));
         ProjectTasks::copySubTasks($sub, $new, $as_template);
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:34,代码来源:ProjectMilestones.class.php

示例10: copySubTasks

 /**
  * Copies subtasks from taskFrom to taskTo.
  *
  * @param ProjectTask $taskFrom
  * @param ProjectTask $taskTo
  */
 function copySubTasks(ProjectTask $taskFrom, ProjectTask $taskTo, $as_template = false)
 {
     foreach ($taskFrom->getSubTasks() as $sub) {
         $new = ProjectTasks::createTaskCopy($sub);
         $new->setIsTemplate($as_template);
         $new->setParentId($taskTo->getId());
         $new->setMilestoneId($taskTo->getMilestoneId());
         $new->setOrder(ProjectTasks::maxOrder($new->getParentId(), $new->getMilestoneId()));
         if ($sub->getIsTemplate()) {
             $new->setFromTemplateId($sub->getId());
         }
         $new->save();
         foreach ($taskTo->getWorkspaces() as $workspace) {
             if (ProjectTask::canAdd(logged_user(), $workspace)) {
                 $new->addToWorkspace($workspace);
             }
         }
         $new->copyCustomPropertiesFrom($sub);
         $new->copyLinkedObjectsFrom($sub);
         $new->setTagsFromCSV(implode(",", $sub->getTagNames()));
         ProjectTasks::copySubTasks($sub, $new, $as_template);
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:29,代码来源:ProjectTasks.class.php


注:本文中的ProjectTasks::copySubTasks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。