public static function task($taskID = null)
 {
     if ($taskID == null) {
         return null;
     }
     $task = Task::load($taskID);
     $title = $task->getTitle();
     $projectID = $task->getProjectID();
     return array_merge(self::tasks($projectID), self::oneCrumb($title, Url::task($taskID)));
 }
Exemple #2
0
			<p><?php 
echo Accepted::getStatusName($accepted->getStatus());
?>
</p>
		</div>
	</div>		

</div>

<div class="edit hidden">

	<div class="clear">
		<label>Task</label>
		<div class="task-info">
			<p><a href="<?php 
echo Url::task($task->getID());
?>
"><?php 
echo $task->getTitle();
?>
</a></p>
		</div>
	</div>
	
	<div class="clear">
		<label>Accepted By</label>
		<div class="task-info">
			<p><a class="picture small" href="<?php 
echo Url::user($task->getLeaderID());
?>
"><img src="<?php 
Exemple #3
0
		$(this).parent().parent().find('a.thumb.preview').click();
		return false;
	});
});
</script>
<div id="flowplayer" style="overflow: hidden;"></div>
<div id="imageviewer" style="overflow: hidden;"></div>
<div id="flashviewer"></div>
<?php 
function getUploadCssClass($ext)
{
    $className = '';
    switch ($ext) {
        case 'jpg':
        case 'jpeg':
        case 'png':
        case 'gif':
            $className = 'image';
            break;
        case 'mp3':
            $className = 'audio';
            break;
        case 'fla':
        case 'swf':
        case 'flv':
            $className = 'flash';
            break;
        case 'mpeg':
        case 'mp4':
        case '3gp':
        case 'mpg':
Exemple #4
0
 echo '<table class="tasks">';
 // table heading
 echo '<tr>';
 echo '	<th style="padding-left: 22px;">Task</th>';
 echo '	<th>Status</th>';
 echo '	<th>Deadline</th>';
 echo '	<th>Needed</th>';
 if (!is_null($user)) {
     echo '	<th>Role</th>';
 }
 echo '</tr>';
 foreach ($tasks as $t) {
     echo '<tr>';
     // title
     echo '<td class="name">';
     echo '<h6><a href="' . Url::task($t->getID()) . '">' . $t->getTitle() . '</a></h6>';
     if (is_null($project)) {
         // project
         $ptitle = Project::load($t->getProjectID())->getTitle();
         echo '<p>in <a href="' . Url::project($t->getProjectID()) . '">' . $ptitle . '</a></p>';
     } else {
         // description
         echo '<p>';
         $description = strip_tags(formatTaskDescription($t->getDescription()));
         echo substr($description, 0, 70);
         if (strlen($description) > 70) {
             echo '&hellip;';
         }
         echo '</p>';
     }
     echo '</td>';
Exemple #5
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;
}
Exemple #6
0
                $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);
                    }
                }
            }
        }
        // send us back
        Session::setMessage('You replied to a comment on this task.');
        $json = array('success' => '1');
        echo json_encode($json);
    }
} else {
    $json = array('error' => 'Invalid action.');