Esempio n. 1
0
 // 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);
             }
         }
     }
Esempio n. 2
0
 public function getNumAccepted()
 {
     $accepted = Accepted::getByTaskID($this->getID());
     return count($accepted);
 }
Esempio n. 3
0
if ($project == null || $task == null) {
    header('Location: ' . Url::error());
    exit;
}
// if private project, limit access to invited users, members, and admins
// 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)) {