private function task_item(ProjectTask $task) { return array( "id" => $task->getId(), "title" => clean($task->getObjectName()), "parent" => $task->getParentId(), "milestone" => $task->getMilestoneId(), "assignedTo" => $task->getAssignedTo()? $task->getAssignedToName():'', "completed" => $task->isCompleted(), "completedBy" => $task->getCompletedByName(), "isLate" => $task->isLate(), "daysLate" => $task->getLateInDays(), "priority" => $task->getPriority(), "percentCompleted" => $task->getPercentCompleted(), "duedate" => ($task->getDueDate() ? $task->getDueDate()->getTimestamp() : '0'), "order" => $task->getOrder() ); }
/** * Returns an unsaved copy of the task. Copies everything except open/closed state, * anything that needs the task to have an id (like tags, properties, subtask), * administrative info like who created the task and when, etc. * * @param ProjectTask $task * @return ProjectTask */ function createTaskCopy(ProjectTask $task) { $new = new ProjectTask (); $new->setMilestoneId ( $task->getMilestoneId () ); $new->setParentId ( $task->getParentId () ); $new->setObjectName($task->getObjectName()) ; $new->setAssignedToContactId ( $task->getAssignedToContactId () ); $new->setPriority ( $task->getPriority () ); $new->setTimeEstimate ( $task->getTimeEstimate () ); $new->setText ( $task->getText () ); $new->setOrder ( ProjectTasks::maxOrder ( $new->getParentId (), $new->getMilestoneId () ) ); $new->setStartDate ( $task->getStartDate () ); $new->setDueDate ( $task->getDueDate () ); return $new; }
private function task_item(ProjectTask $task) { $isCurrentProject = active_project() instanceof Project && $task->getProjectId() == active_project()->getId(); return array("id" => $task->getId(), "title" => clean($task->getObjectName()), "parent" => $task->getParentId(), "milestone" => $task->getMilestoneId(), "assignedTo" => $task->getAssignedTo() ? $task->getAssignedToName() : '', "workspaces" => $isCurrentProject ? '' : $task->getWorkspacesNamesCSV(logged_user()->getWorkspacesQuery()), "workspaceids" => $isCurrentProject ? '' : $task->getWorkspacesIdsCSV(logged_user()->getWorkspacesQuery()), "workspacecolors" => $isCurrentProject ? '' : $task->getWorkspaceColorsCSV(logged_user()->getWorkspacesQuery()), "completed" => $task->isCompleted(), "completedBy" => $task->getCompletedByName(), "isLate" => $task->isLate(), "daysLate" => $task->getLateInDays(), "priority" => $task->getPriority(), "duedate" => $task->getDueDate() ? $task->getDueDate()->getTimestamp() : '0', "order" => $task->getOrder()); }
/** * Detach subtask from this task * * @param ProjectTask $task * @param ProjectTaskList $attach_to If you wish you can detach and attach task to * other list with one save query * @return null */ function detachTask(ProjectTask $task, $attach_to = null) { if($task->getParentId() <> $this->getId()) return; if($attach_to instanceof ProjectTask) { $attach_to->attachTask($task); } else { $task->setParentId(0); $task->save(); } } // detachTask
/** * Detach subtask from this task * * @param ProjectTask $task * @param ProjectTaskList $attach_to If you wish you can detach and attach task to * other list with one save query * @return null */ function detachTask(ProjectTask $task, $attach_to = null) { if ($task->getParentId() != $this->getId()) { return; } if ($attach_to instanceof ProjectTask) { $attach_to->attachTask($task); } else { $task->setParentId(0); $task->save(); } // if $close = true; $open_tasks = $this->getOpenSubTasks(); if (is_array($open_tasks)) { foreach ($open_tasks as $open_task) { if ($open_task->getId() != $task->getId()) { $close = false; } } // if } // if if ($close) { $this->complete(DateTimeValueLib::now(), logged_user()); } }