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


PHP ProjectTasks::createTaskCopy方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

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