本文整理汇总了PHP中ProjectTasks::findByTaskAndRelated方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectTasks::findByTaskAndRelated方法的具体用法?PHP ProjectTasks::findByTaskAndRelated怎么用?PHP ProjectTasks::findByTaskAndRelated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectTasks
的用法示例。
在下文中一共展示了ProjectTasks::findByTaskAndRelated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: repetitive_tasks_related
function repetitive_tasks_related($task, $action, $type_related = "", $task_data = array())
{
//I find all those related to the task to find out if the original
$task_related = ProjectTasks::findByRelated($task->getObjectId());
if (!$task_related) {
//is not the original as the original look plus other related
if ($task->getOriginalTaskId() != "0") {
$task_related = ProjectTasks::findByTaskAndRelated($task->getObjectId(), $task->getOriginalTaskId());
}
}
if ($task_related) {
switch ($action) {
case "edit":
foreach ($task_related as $t_rel) {
if ($type_related == "news") {
if ($task->getStartDate() <= $t_rel->getStartDate() && $task->getDueDate() <= $t_rel->getDueDate()) {
$this->repetitive_task_related_edit($t_rel, $task_data);
}
} else {
$this->repetitive_task_related_edit($t_rel, $task_data);
}
}
break;
case "delete":
$delete_task = array();
foreach ($task_related as $t_rel) {
$task_rel = Objects::findObject($t_rel->getId());
if ($type_related == "news") {
if ($task->getStartDate() <= $t_rel->getStartDate() && $task->getDueDate() <= $t_rel->getDueDate()) {
$delete_task[] = $t_rel->getId();
$task_rel->trash();
}
} else {
$delete_task[] = $t_rel->getId();
$task_rel->trash();
}
}
return $delete_task;
break;
case "archive":
$archive_task = array();
foreach ($task_related as $t_rel) {
$task_rel = Objects::findObject($t_rel->getId());
if ($type_related == "news") {
if ($task->getStartDate() <= $t_rel->getStartDate() && $task->getDueDate() <= $t_rel->getDueDate()) {
$archive_task[] = $t_rel->getId();
$t_rel->archive();
}
} else {
$archive_task[] = $t_rel->getId();
$t_rel->archive();
}
}
return $archive_task;
break;
}
}
}
示例2: getArrayInfo
/**
* End task templates
*/
function getArrayInfo($full = false)
{
if (config_option("wysiwyg_tasks")) {
if ($this->getTypeContent() == "text") {
$desc = nl2br(htmlspecialchars($this->getText()));
} else {
$desc = purify_html(nl2br($this->getText()));
}
} else {
if ($this->getTypeContent() == "text") {
$desc = htmlspecialchars($this->getText());
} else {
$desc = html_to_text(html_entity_decode(nl2br($this->getText()), null, "UTF-8"));
}
}
$result = array('id' => $this->getId(), 't' => $this->getObjectName(), 'desc' => $desc, 'members' => $this->getMemberIds(), 'c' => $this->getCreatedOn() instanceof DateTimeValue ? $this->getCreatedOn()->getTimestamp() : 0, 'cid' => $this->getCreatedById(), 'otype' => $this->getObjectSubtype(), 'percentCompleted' => $this->getPercentCompleted(), 'memPath' => str_replace('"', "'", str_replace("'", "\\'", json_encode($this->getMembersToDisplayPath()))));
if ($full) {
$result['description'] = $this->getText();
}
$result['multiAssignment'] = $this->getColumnValue('multi_assignment', 0);
if ($this->isCompleted()) {
$result['s'] = 1;
}
if ($this->getParentId() > 0) {
$result['pid'] = $this->getParentId();
}
//if ($this->getPriority() != 200)
$result['pr'] = $this->getPriority();
if ($this->getMilestoneId() > 0) {
$result['mid'] = $this->getMilestoneId();
}
if ($this->getAssignedToContactId() > 0) {
$result['atid'] = $this->getAssignedToContactId();
}
$result['atName'] = $this->getAssignedToName();
if ($this->getCompletedById() > 0) {
$result['cbid'] = $this->getCompletedById();
$result['con'] = $this->getCompletedOn()->getTimestamp();
}
if ($this->getDueDate() instanceof DateTimeValue) {
$result['dd'] = $this->getDueDate()->getTimestamp() + logged_user()->getTimezone() * 3600;
$result['udt'] = $this->getUseDueTime() ? 1 : 0;
}
if ($this->getStartDate() instanceof DateTimeValue) {
$result['sd'] = $this->getStartDate()->getTimestamp() + logged_user()->getTimezone() * 3600;
$result['ust'] = $this->getUseStartTime() ? 1 : 0;
}
$time_estimate = $this->getTimeEstimate();
$result['TimeEstimate'] = $this->getTimeEstimate();
if ($time_estimate > 0) {
$result['estimatedTime'] = DateTimeValue::FormatTimeDiff(new DateTimeValue(0), new DateTimeValue($time_estimate * 60), 'hm', 60);
}
$result['tz'] = logged_user()->getTimezone() * 3600;
$ot = $this->getOpenTimeslots();
if ($ot) {
$users = array();
$time = array();
$paused = array();
foreach ($ot as $t) {
$time[] = $t->getSeconds();
$users[] = $t->getContactId();
$paused[] = $t->isPaused() ? 1 : 0;
if ($t->isPaused() && $t->getContactId() == logged_user()->getId()) {
$result['wpt'] = $t->getPausedOn()->getTimestamp();
}
}
$result['wt'] = $time;
$result['wid'] = $users;
$result['wp'] = $paused;
}
if ($this->isRepetitive()) {
$result['rep'] = 1;
} else {
//I find all those related to the task to find out if the original
$task_related = ProjectTasks::findByRelated($this->getObjectId());
if (!$task_related) {
//is not the original as the original look plus other related
if ($this->getOriginalTaskId() != "0") {
$task_related = ProjectTasks::findByTaskAndRelated($this->getObjectId(), $this->getOriginalTaskId());
}
}
if ($task_related) {
$result['rep'] = 1;
}
}
return $result;
}