本文整理汇总了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);
}
}
示例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);
}
}
示例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 );
}
}
示例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);
}
}