public function isLatestUpdate() { $accepted = Accepted::load($this->getAcceptedID()); $latestUpdate = $accepted->getLatestUpdate(); if ($latestUpdate->getID() == $this->id) { return true; } else { return false; } }
public static function update($updateID = null) { if ($updateID == null) { return null; } $update = Update::load($updateID); // $user = User::load($update->getCreatorID()); // $username = $user->getUsername(); $title = $update->getTitle(); $accepted = Accepted::load($update->getAcceptedID()); return array_merge(self::task($accepted->getTaskID()), self::oneCrumb($title, Url::update($updateID))); }
<input type="hidden" name="action" value="edit-update" /> <div class="clear"> <label for="txtTitle">Title<span class="required">*</span></label> <div class="input"> <input type="text" id="txtTitle" name="txtTitle" maxlength="255" value="<?php echo $update->getTitle(); ?> " /> <p>Short title for the contribution</p> </div> </div> <div class="clear"> <label for="txtMessage">Message<span class="required">*</span></label> <div class="input"> <textarea id="txtMessage" name="txtMessage"><?php echo $update->getMessage(); ?> </textarea> <p>Write your contribution here, <a class="help-link" href="<?php echo Url::help(); ?> #help-html-allowed">some HTML allowed</a></p> </div> </div> <?php if ($update->isLatestUpdate()) { ?> <div class="clear"> <label for="selStatus">Status<span class="required">*</span></label> <div class="input">
$added = $_POST['file']; // added files // title can't be empty if ($title == '') { $json = array('error' => 'Your update title cannot be empty.'); exit(json_encode($json)); } // message can't be empty if ($message == '') { $json = array('error' => 'Your update message cannot be empty.'); exit(json_encode($json)); } // flag default is false; assume nothing is modified to start $modified = false; // get acceptedID $accepted = Accepted::load($update->getAcceptedID()); // is title modified? if ($title != $update->getTitle()) { // save changes $oldTitle = $update->getTitle(); $update->setTitle($title); $update->save(); // log it $logEvent = new Event(array('event_type_id' => 'edit_update_title', 'user_1_id' => Session::getUserID(), 'project_id' => $project->getID(), 'item_1_id' => $update->getID(), 'item_2_id' => $accepted->getID(), 'item_3_id' => $task->getID(), 'data_1' => $oldTitle, 'data_2' => $title)); $logEvent->save(); // set flag $modified = true; } // is message modified? if ($message != $update->getMessage()) { // save changes
"><?php echo Accepted::getStatusName(Accepted::STATUS_ACCEPTED); ?> </option> <option value="<?php echo Accepted::STATUS_FEEDBACK; ?> "><?php echo Accepted::getStatusName(Accepted::STATUS_FEEDBACK); ?> </option> <option value="<?php echo Accepted::STATUS_COMPLETED; ?> "><?php echo Accepted::getStatusName(Accepted::STATUS_COMPLETED); ?> </option> </select> </div> </div> <div class="clear"> <div class="input"> <input id="btnEditStatus" type="button" value="Save" /> <input id="btnCancelStatus" class="right" type="button" value="Cancel" /> </div> </div> </div>
$numAccepted = $t->getNumAccepted(); if (empty($numNeeded)) { $stillNeeded = '∞'; } elseif ($numNeeded > $numAccepted) { $stillNeeded = $numNeeded - $numAccepted; } else { $stillNeeded = 0; } echo '<td class="needed">' . $stillNeeded . '</td>'; // role if (!is_null($user)) { // relationship to task if ($user->getID() == $t->getLeaderID()) { echo '<td class="role">leader</td>'; } else { $accepted = Accepted::getByUserID($user->getID(), $t->getID()); if (!empty($accepted)) { $role = Accepted::getStatusName($accepted->getStatus()); echo '<td class="role">' . $role . '</td>'; } } } echo '</tr>'; } echo '</table>'; } } else { echo "<p>(none)</p>"; } $fork->endBlockSet(); $fork->render('site/partial/panel');
public function getAcceptedBy() { $acceptedBy = Accepted::getAcceptedBy($this->getID()); return $acceptedBy; }
function formatEvent($event, $showProject = false) { switch ($event->getEventTypeID()) { case 'create_user': $formatted = sprintf("%s registered for %s.", formatUserLink($event->getUser1ID()), '<a href="' . Url::base() . '">' . PIPELINE_NAME . '</a>'); break; case 'send_message': $formatted = sprintf("%s sent a message to %s.", formatUserLink($event->getUser1ID()), formatUserLink($event->getUser2ID())); break; case 'accept_member_invitation': $predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : "this project"; $formatted = sprintf("%s accepted %s's invitation to join %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate); break; case 'trust_member': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s trusted %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate); break; case 'untrust_member': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s untrusted %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate); break; case 'join_project': $predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s joined the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate); break; case 'leave_project': $predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s left the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate); break; case 'follow_project': $predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s followed the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate); break; case 'unfollow_project': $predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s unfollowed the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate); break; case 'ban_user': $predicate = $showProject ? ' from the project ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s banned %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate); break; case 'unban_user': $predicate = $showProject ? ' from the project ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s unbanned %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate); break; case 'create_project': $predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project'; $formatted = sprintf("%s created %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatProjectLink($event->getProjectID())); break; case 'edit_pitch': $predicate = $showProject ? ' for the project ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s edited the %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::pitch($event->getProjectID()) . '">pitch</a>', $predicate); break; case 'edit_specs': $predicate = $showProject ? ' for the project ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s edited the %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::specs($event->getProjectID()) . '">specs</a>', $predicate); break; case 'edit_rules': $predicate = $showProject ? ' for the project ' . formatProjectLink($event->getProjectID()) : ''; $formatted = sprintf("%s edited the %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::rules($event->getProjectID()) . '">rules</a>', $predicate); break; case 'edit_project_status': $predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project'; $status = $event->getData2(); $formatted = sprintf("%s changed the %s of %s to “%s.”", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::status($event->getProjectID()) . '">status</a>', $predicate, formatProjectStatus($status)); break; case 'edit_project_deadline': $deadline = $event->getData2(); if ($deadline != null) { $predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project'; $formatted = sprintf("%s changed the %s of %s to %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::deadline($event->getProjectID()) . '">deadline</a>', $predicate, strftime("%a, %b %d, %Y", strtotime($deadline))); } else { $predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project'; $formatted = sprintf("%s removed the %s for %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::deadline($event->getProjectID()) . '">deadline</a>', $predicate); } break; case 'create_discussion': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $discussion = Discussion::load($event->getItem1ID()); $title = $discussion->getTitle(); $url = Url::discussion($discussion->getID()); $formatted = sprintf("%s posted the discussion %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'lock_discussion': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $discussion = Discussion::load($event->getItem1ID()); $title = $discussion->getTitle(); $url = Url::discussion($discussion->getID()); $formatted = sprintf("%s locked the discussion %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'unlock_discussion': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $discussion = Discussion::load($event->getItem1ID()); $title = $discussion->getTitle(); $url = Url::discussion($discussion->getID()); $formatted = sprintf("%s unlocked the discussion %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'create_discussion_reply': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $discussion = Discussion::load($event->getItem2ID()); $title = $discussion->getTitle(); $url = Url::discussion($discussion->getID()); $formatted = sprintf("%s replied to the discussion %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'create_task': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $task = Task::load($event->getItem1ID()); $title = $task->getTitle(); $url = Url::task($task->getID()); $formatted = sprintf("%s created the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'edit_task_title': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $task = Task::load($event->getItem1ID()); $title = $task->getTitle(); $url = Url::task($task->getID()); $formatted = sprintf("%s edited the name of the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'edit_task_status': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $task = Task::load($event->getItem1ID()); $title = $task->getTitle(); $url = Url::task($task->getID()); $status = $event->getData2(); if ($status == Task::STATUS_CLOSED) { $formatted = sprintf("%s closed the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); } else { $formatted = sprintf("%s opened the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); } break; case 'edit_task_num_needed': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $task = Task::load($event->getItem1ID()); $title = $task->getTitle(); $url = Url::task($task->getID()); $numNeeded = $event->getData2(); if ($numNeeded != '') { $formatted = sprintf("%s changed the # people needed for the task %s%s to %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate, $numNeeded); } else { $formatted = sprintf("%s changed the # people needed for the task %s%s to ∞.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate, $numNeeded); } break; case 'edit_task_leader': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $task = Task::load($event->getItem1ID()); $title = $task->getTitle(); $url = Url::task($task->getID()); $formatted = sprintf("%s changed the leader of the task %s%s to %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate, formatUserLink($event->getUser2ID(), $event->getProjectID())); break; case 'edit_task_description': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $task = Task::load($event->getItem1ID()); $title = $task->getTitle(); $url = Url::task($task->getID()); $formatted = sprintf("%s edited the instructions for the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'edit_task_uploads': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $task = Task::load($event->getItem1ID()); $title = $task->getTitle(); $url = Url::task($task->getID()); $formatted = sprintf("%s edited the attached files for the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'edit_task_deadline': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $task = Task::load($event->getItem1ID()); $title = $task->getTitle(); $url = Url::task($task->getID()); $deadline = $event->getData2(); if ($deadline != '') { $formatted = sprintf("%s changed the deadline for the task %s%s to %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate, strftime("%a, %b %d, %Y", strtotime($deadline))); } else { $formatted = sprintf("%s removed the deadline for the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); } break; case 'accept_task': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $accepted = Accepted::load($event->getItem1ID()); //$acceptedUrl = Url::updates($accepted->getID()); $task = Task::load($event->getItem2ID()); $taskTitle = $task->getTitle(); $taskUrl = Url::task($task->getID()); $formatted = sprintf("%s joined the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $taskUrl . '">' . $taskTitle . '</a>', $predicate); break; case 'release_task': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $accepted = Accepted::load($event->getItem1ID()); //$acceptedUrl = Url::updates($accepted->getID()); $task = Task::load($event->getItem2ID()); $taskTitle = $task->getTitle(); $taskUrl = Url::task($task->getID()); $formatted = sprintf("%s left the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $taskUrl . '">' . $taskTitle . '</a>', $predicate); break; case 'edit_accepted_status': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $update = Update::load($event->getItem1ID()); $updateTitle = $update->getTitle(); $updateUrl = Url::update($update->getID()); $accepted = Accepted::load($event->getItem2ID()); $task = Task::load($event->getItem3ID()); $taskTitle = $task->getTitle(); $taskUrl = Url::task($task->getID()); $status = $event->getData2(); if ($status == Accepted::STATUS_FEEDBACK) { $formatted = sprintf("%s is seeking feedback on his/her work on the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $taskUrl . '">' . $taskTitle . '</a>', $predicate); } elseif ($status == Accepted::STATUS_COMPLETED) { $formatted = sprintf("%s is finished working on the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $taskUrl . '">' . $taskTitle . '</a>', $predicate); } elseif ($status == Accepted::STATUS_PROGRESS) { $formatted = sprintf("%s is working on the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $taskUrl . '">' . $taskTitle . '</a>', $predicate); } break; case 'create_task_comment': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $task = Task::load($event->getItem2ID()); $title = $task->getTitle(); $url = Url::task($task->getID()); $formatted = sprintf("%s commented on the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'create_task_comment_reply': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $task = Task::load($event->getItem3ID()); $title = $task->getTitle(); $url = Url::task($task->getID()); $formatted = sprintf("%s replied to a comment on the task %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'create_update_comment': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $update = Update::load($event->getItem2ID()); $title = $update->getTitle(); $url = Url::update($update->getID()); $formatted = sprintf("%s commented on the contribution %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'create_update_comment_reply': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $update = Update::load($event->getItem3ID()); $title = $update->getTitle(); $url = Url::update($update->getID()); $formatted = sprintf("%s replied to a comment on the contribution %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate); break; case 'create_update': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $update = Update::load($event->getItem1ID()); $updateTitle = $update->getTitle(); $updateUrl = Url::update($update->getID()); $formatted = sprintf("%s created the contribution %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $updateUrl . '">' . $updateTitle . '</a>', $predicate); break; case 'edit_update_title': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $update = Update::load($event->getItem1ID()); $updateTitle = $update->getTitle(); $updateUrl = Url::update($update->getID()); $formatted = sprintf("%s edited the title of the contribution %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $updateUrl . '">' . $updateTitle . '</a>', $predicate); break; case 'edit_update_message': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $update = Update::load($event->getItem1ID()); $updateTitle = $update->getTitle(); $updateUrl = Url::update($update->getID()); $formatted = sprintf("%s edited the contents of the contribution %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $updateUrl . '">' . $updateTitle . '</a>', $predicate); break; case 'edit_update_uploads': $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : ''; $update = Update::load($event->getItem1ID()); $updateTitle = $update->getTitle(); $updateUrl = Url::update($update->getID()); $formatted = sprintf("%s edited the attached files for the contribution %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $updateUrl . '">' . $updateTitle . '</a>', $predicate); break; default: $formatted = 'Event type "' . $event->getEventTypeID() . '" not found.'; } return $formatted; }
// send email notifications, if applicable // to task leader $leader = User::load($task->getLeaderID()); if ($leader->getID() != Session::getUserID()) { // don't email yourself if ($leader->getNotifyCommentTaskLeading()) { // compose email $body = "<p>" . formatUserLink(Session::getUserID()) . ' replied to a comment on the task <a href="' . Url::task($taskID) . '">' . $task->getTitle() . '</a> in the project ' . formatProjectLink($project->getID()) . '. The reply was:</p>'; $body .= "<blockquote>" . formatComment($message) . "</blockquote>"; $email = array('to' => $leader->getEmail(), 'subject' => '[' . PIPELINE_NAME . '] New comment reply on a task you are leading in ' . $project->getTitle(), 'message' => $body); // send email Email::send($email); } } // to task crew $crew = Accepted::getByTaskID($taskID); if ($crew != null) { foreach ($crew as $c) { $user = User::load($c->getCreatorID()); if ($user->getID() != Session::getUserID()) { // don't email yourself if ($user->getNotifyCommentTaskAccepted()) { // compose email $body = "<p>" . formatUserLink(Session::getUserID()) . ' replied to a comment on the task <a href="' . Url::task($taskID) . '">' . $task->getTitle() . '</a> in the project ' . formatProjectLink($project->getID()) . '. The reply was:</p>'; $body .= "<blockquote>" . formatComment($message) . "</blockquote>"; $email = array('to' => $user->getEmail(), 'subject' => '[' . PIPELINE_NAME . '] New comment reply on a task you joined in ' . $project->getTitle(), 'message' => $body); // send email Email::send($email); } } }
if (!Session::isAdmin() && !$project->isCreator(Session::getUserID())) { if (!$project->isInvited(Session::getUserID()) && !$project->isMember(Session::getUserID()) && !$project->isTrusted(Session::getUserID()) || ProjectUser::isBanned(Session::getUserID(), $project->getID())) { header('Location: ' . Url::error()); exit; } } } // // validate username // $username = Filter::text($_GET['u']); // $user = User::loadByUsername($username); // // check if user has accepted task //$accepted = Accepted::getByUserID(Session::getUserID(), $taskID); // if($accepted == null) { // header('Location: '.Url::error()); // exit(); // } //$updates = Update::getByAcceptedID($accepted->getID()); // get existing updates $accepted = Accepted::getByUserID(Session::getUserID(), $taskID); if ($accepted == null) { header('Location: ' . Url::error()); exit; } $updates = Update::getByAcceptedID($accepted->getID()); $soup = new Soup(); $soup->set('project', $project); $soup->set('task', $task); $soup->set('updates', $updates); //$soup->set('user', $user); //$soup->set('accepted', $accepted); $soup->render('project/page/updateNew');
public static function update($updateID = null) { if ($updateID == null) { return null; } $update = Update::load($updateID); $accepted = Accepted::load($update->getAcceptedID()); return self::task($accepted->getTaskID()) . '/updates/' . $updateID; }
public function getNumAccepted() { $accepted = Accepted::getByTaskID($this->getID()); return count($accepted); }
// and exclude banned members if ($project->getPrivate()) { if (!Session::isAdmin() && !$project->isCreator(Session::getUserID())) { if (!$project->isInvited(Session::getUserID()) && !$project->isMember(Session::getUserID()) && !$project->isTrusted(Session::getUserID()) || ProjectUser::isBanned(Session::getUserID(), $project->getID())) { header('Location: ' . Url::error()); exit; } } } // get accepted for this task $accepted = Accepted::getByTaskID($taskID); //$contributorInvites = Invitation::getByTaskID($taskID); // has current user joined this task? $hasJoinedTask = false; if (Session::isLoggedIn()) { $joined = Accepted::getByUserID(Session::getUserID(), $task->getID()); if (!empty($joined)) { $hasJoinedTask = true; } } // get latest updates for this task $latestUpdates = array(); if ($accepted != null) { foreach ($accepted as $a) { $updates = Update::getByAcceptedID($a->getID()); if (!empty($updates)) { $latestUpdate = reset($updates); array_push($latestUpdates, $latestUpdate); } } }