Beispiel #1
0
 public function isLatestUpdate()
 {
     $accepted = Accepted::load($this->getAcceptedID());
     $latestUpdate = $accepted->getLatestUpdate();
     if ($latestUpdate->getID() == $this->id) {
         return true;
     } else {
         return false;
     }
 }
Beispiel #2
0
 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)));
 }
Beispiel #3
0
 $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
Beispiel #4
0
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 &ldquo;%s.&rdquo;", 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 &#8734;.", 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;
}
Beispiel #5
0
});

</script>

<?php 
}
?>

<?php 
if ($updates != null) {
    echo '<ul class="segmented-list updates">';
    foreach ($updates as $u) {
        echo '<li>';
        echo '<h6 class="primary"><a href="' . Url::update($u->getID()) . '">' . $u->getTitle() . '</a>';
        if ($u->isLatestUpdate()) {
            $accept = Accepted::load($u->getAcceptedID());
            $statusName = Accepted::getStatusName($accept->getStatus());
            echo ' <span class="status">' . $statusName . '</span>';
        }
        echo '</h6>';
        // .primary
        echo '<p class="secondary">';
        echo 'posted ' . formatTimeTag($u->getDateCreated());
        $comments = $u->getComments();
        echo ' <span class="slash">/</span> ' . formatCount(count($comments), 'comment', 'comments', 'no');
        echo '</p>';
        // .secondary
        echo '</li>';
    }
    echo '</ul>';
} else {
Beispiel #6
0
 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;
 }
Beispiel #7
0
    echo Url::updateNew($task->getID());
    ?>
';
	});
<?php 
}
?>

</script>
<?php 
if (!empty($contribs)) {
    ?>

<table class="contribs">
	<tr>
		<th style="padding-left: 22px;">Contribution</th>
		<th>Member</th>
		<th>Status</th>
		<th>Date</th>
	</tr>
<?php 
    foreach ($contribs as $c) {
        echo '<tr>';
        // title
        echo '<td class="name">';
        echo '<h6><a href="' . Url::update($c->getID()) . '">' . $c->getTitle() . '</a></h6>';
        echo '</td>';
        // creator
        echo '<td class="member">' . formatUserLink($c->getCreatorID(), $c->getProjectID()) . '</td>';
        // status
        if ($c->isLatestUpdate()) {